Open krystian1201 opened 9 years ago
First move - easiest case
Random location on board, random orientation, random word length and, finally, random word
Move 2nd and above - next case
AI player needs tiles rack
AI and human needs to share tiles bag
There is some problem with randomly choosing word's orientation - the Random.Next() method always returns the same number. Replaced Next(0,2) with Next(0,10) - a little better
For move 2 and above we need not only the state of tiles rack, but also the state of board and the "anchor" tile
Tiles in tiles rack need to be refilled from tiles bag after each move - seems to work
To add - checking if the new tiles don't form invalid words in any direction
The AI "hangs" when the tiles rack is partially empty
The tiles put by AI player on board needs to be put inside Board array. Assigning them position on board is not enough
If the tiles form some invalid words, they should be taken away from board.
I can add checking for repetitions in random words
Method checking for invalid words can also collect the words formed by tiles in different directions. It can be used later for scoring
The simplest case - just choose any random word that satisfies the constraints