Pair Programming, organizing an algorithm and its data for efficient computation.
HardysTaxi
project inside Check out this project from your Hardy
pair repository, then switch back to the
Java
perspective.
Optional GUI practice programming. This problem (starting code is in the Inheritance project in your individual repository) was assigned
during the Fall, 2008 term. You have had considerably more GUI practice by now than last term's students have. so I am not going to require it or give extra credit for it. But you might reinforce (or initially learn) a few things by doing it.
Linear Lights Out: Implement the game Linear Lights Out. In Linear Lights Out, the user is presented with an array of buttons that are randomly initialized to either Xs or Os, 50% probability each. Clicking on a button changes the symbol of the button
and both its left and right neighbors. Buttons on the end just change their own symbol and their one neighbor’s symbol; the buttons don’t “wrap around”. The object of the game is to reach a state where the buttons all show the same symbol, whether Xs or Os doesn’t matter.
We’re providing a lot less “scaffolding” for this problem than most of the previous ones. Everything you need to solve the problem has either appeared in previous homeworks or examples, or is in the Java API documentation for
JButton
. Remember to ask for help if you get stuck. Here’s a suggested plan of attack:
LinearMain.BUTTON_COUNT
) without worrying about event handling or the symbols on the buttons. For full credit, you final solution must work with any
BUTTON_COUNT
greater than 2.
Hints:
setText()
and
getText()
methods of
JButton
are your friends.
Here’s a screen shot of the game in progress:
We will grade your reading quiz using ANGEL. Turn-in your programming work by committing it to your SVN repository.