High Level Design |
---|
. |
ISREVER displays an initial menu on the television where users can chose the level of difficulty they want by pressing either B or C on their sega controller. Once they have chosen an option, the microcontroller AI either plays using the easy algorithm or the hard algorithm. Both take into account the number of pieces of the other players' to be flipped, but the hard algorithm also assigns weights to squares on the board which are more desirable. For example, the corners have a very high weight because they are key places and can never be recaptured by the opponent. The boxes right next to the corner have a negative weight because placing a piece there could give the opponent the possibility of capturing a corner. The edge spots have also higher weights because they are harder to recapture by the opponent. After the user choses their level, the playing board is drawn and they get a message saying what color they are and which button to use to select. At the bottom of the screen there is a count that keeps track of the number of white and black pieces, and at the top of the screen there is also a display that tells the user whether they are playing at the hard or easy level. The user can move around the board by using a + cross, which is controlled by the direction pad on the controller. To allow the user to follow the moves of the virtual player, we are displaying an X cursor where the microcontroller will move and we are using a small delay after to allow the player to notice the pieces that the computer took. In case one of the players does not have a move, it is the other player's turn until a possible move becomes available. Every time a player moves, we are checking if there is a winner by checking the number of pieces each player has. Once a player wins, we are stopping the game and displaying the winner, and we prompt the user to press B to restart, at which point we display the menu again.
|
. |