• Writing the GUI
• Switching turns and the referee • Checking for valid moves and flipping
• The MINIMAX(!!!) algorithm
• Copy constructor
Othello Help Session
1 of 17
Nov 21, 2013
Writing the GUI
• Think Tetris! 2D Game Board
- array of squares where each square represents a space on the board
- Could use two arrays – one for pieces and one for squares.
• Separates the graphics from the logic
• These two arrays might be contained in different classes
- board needs to react when you click on it … think of which components should be “smart”
- Important question to answer early on: how will you represent and store your Othello pieces?
• Player Menus
- clicking a radio button sets a player as human or computer - should be able to switch between human and computer players, and two computers of different intelligence levels, at any point during a game
(play with the demo to see how this works)
- have a default player configuration for when the game begins (otherwise you may have
NullPointers!)
Othello Help Session
2 of 17
Nov 21, 2013
Switching Turns and the
Referee
• How boring would a game be if we couldn’t switch whose turn it is?!?!?!
• Need some way of figuring out when one player’s turn is over to switch to next player
• We can use a Referee class!
- keep a reference to both players, keep track of which one is the current player
- tells a player to move when it is his/her turn
• Referee handles checking for illegal moves
- keeps players from moving out of turn
- keeps players from moving when the game has ended
- makes sure that a human doesn’t try to move during computer player’s turn (and vice versa)
- Etc…
• Referee should contain a …. Timer! But why?
- computer player’s moves should update on screen with each timer tick
- so how do we do that??? The first line of actionPerformed() should call stop() on the Timer.
Should we