Lab 2: Connect 4 Look Ahead
- Today we're going to do connect-4. In particular, we're going
to try to get some look-ahead running in the opponent.
- Grab the java code,
or the java code for Net
Beans.
- Compile it and run it. You should probably use your favourite
IDE. I did it in Eclipse.
- If you run it (as an applet) and hit the newgame button, you
get the agents playing each other.
- Change the agentPlaysX variable to false, and the user (you)
now plays X.
- Notice at the bottom the embedded connectFourAgent class.
You need to modify this.
- Can you get the game to look ahead one move. That is,
if it has a winning move, it always picks it?
- Two moves (blocking the opponents win).
- N moves? Here you might want to take advantage of a stack, and
most easily the run time stack.