SA-12, due Nov 15
Assignment
This assignment will help you learn about game tree search.
In class we drew the game tree for a version of chips called "last wins". The first player can take between 1 and n-1 of the chips, and on subsequent moves the play can take between 1 and twice the number of chips that his opponent took on the previous move. The winner is the player who takes the last chip.
The Chips program that we saw in class played a different version, "even wins". I said that the even-wins Chips program could be changed to last wins by changing a few things in theGame
class. Specifically:
- Change the initial value of
maxMove
fromchips/2
tochips-1
in the constructor - Change the method
getWinner
to use the new rule for deciding the winner - Change the
inputInitChips
method to not require the number of chips to be odd.
Everything else is unchanged!
Make these changes to the code inGames.java
in the Chips program, which can be
downloaded here: Chips.zip.
Extra Credit - Invent other variations
Invent and implement other interesting variations on Chips. The variations "last looses" and "even looses" (or odd wins) are not different enough to be interesting.
Blackboard submission
Submit via Blackboard a folder that contains your version of Game.java
and a run to demonstrate that it works correctly.