f- for forward,
l- for left turn, and
r- for right turn. As the light-cycles move, they leave a trail behind them, and a light-cycle dies when it crosses its own or its opponent's trail. What makes the game interesting, is that each player gets more moves at each turn. (Multiple moves in the sample game must be space separated.) You can play the game by giving the following command at the command-line:
~/wcbrown/bin/tryLab3Note: Please resize your terminal window to have at least 42 lines.
chars or something. You define such a beast in Java like this
int board = new int;or this
char board = new char;Of course, you still need to initialize the entries in the 2D array! How you use this array to represent the board state is, of course, up to you!
in.next().charAt(0);Hopefully you see why this works! Also, so you don't get caught up with this, Dr. Crabbe reads in the y/n character after asking whether you're ready to move, but goes on and asks for the move no matter what you say! You can do the same.