I'm developing word game similar to word mole. I'm having a hard time determining how to store temporary selected character (and in turn will changed into word).
Here's the situations. Say, I have the following character:
0 1 2 3 ----------- 0|o b o s 1|s f r h 2|t n e z 3|r b d i
I store all this information in arrayed char named
playCharacter and I also created another arrayed char named
markedCharacter with default value for each array item is
In my opinion, every time I select each cell, say
cell[1,0], I set
markedCharacter[1,0] = 'b' an so on, until I'm done with current word.
My question is, how do I store the step information? for example, if I choose to play
bored, I'll be marking:
markedCharacter[1,0] = 'b' markedCharacter[2,0] = 'o' markedCharacter[2,1] = 'r' markedCharacter[2,2] = 'e' markedCharacter[2,3] = 'd'
Do I need another array? if so, what data should I store in it?
In turn, I'll want to use this
markedCharacter as a way to check:
- if certain move are valid (eg, do they marked within an already marked neighbor cell?)
- if stored word are valid or not (this part is already covered)
- I don't need to do undo operation