Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java code for the linear lights out game: completes the following stages: Linear Lights Out -- the user is presented with an array of buttons

Java code for the linear lights out game: completes the following stages:

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, if they exist. Buttons on the end just change their own symbol and their one neighbors symbol; the buttons dont wrap around. The object of the game is to reach a state where the buttons all show the same symbol, whether Xs or Os, it doesnt matter.

Stage 0: Examine the main method in the LinearMain class in the linearLightsOut package in the LinearLightsOut project that you checked out in class. This is all the code that we supply for the project the rest is your responsibility.

Stage 1: Display a frame with the right title.

Stage 2: Display the right number of buttons in the frame (see the nButtons variable in LinearMain.main) without worrying about event handling or the symbols on the buttons. For full credit, your final solution must work with any nButtons greater than 2.

Stage 3: Make sure the buttons are initialized to random symbols (Xs and Os, 50% probability each).

Stage 4: Implement a working Quit button (This involves implementing an event handler for the Quit button).

Stage 5: Implement a working New Game button. When the button it pressed, the game should reset the symbol buttons to a new set of random symbols.

Stage 6: Set up event handlers for the symbol buttons that correctly toggle the symbols as described above.

Stage 7: Check for a win and notify the player in some way through the GUI (not simply by System.out.println). Changing the window title would suffice. (If you do that, be sure to change it back when the player clicks New Game.)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advanced Database Systems For Integration Of Media And User Environments 98

Authors: Yahiko Kambayashi, Akifumi Makinouchi, Shunsuke Uemura, Katsumi Tanaka, Yoshifumi Masunaga

1st Edition

9810234368, 978-9810234362

More Books

Students also viewed these Databases questions

Question

=+ To develop the system equations of motion in Lagrange form.

Answered: 1 week ago