Alice Community Chapter 5 Game project PP 5.10

 Chapter 5 Game project PP 5.10
 Sharris Member   Status: Offline Posts: 15 Join Date: Jan 2014 Chapter 5 Game project PP 5.10 - 05-07-2014, 10:32 AM In this assignment I had to create a memory game where a sequence of buttons light up and the user has to press the buttons in that order. The only problem I am having with this project is how to have the level start over when the user selects the incorrect button and have the timer stop when they follow the sequence correctly. Here is what I have so far can anyone help me? Thanks. Last edited by Sharris; 05-08-2014 at 02:27 PM.
 Here
 jrrTolkien Senior Member     Status: Offline Posts: 166 Join Date: Feb 2014 Location: Middle-Earth (Merrimack, NH) Here - 05-07-2014, 01:46 PM This is possible with careful use of integers. Have the integers change after the button is clicked, then have an if/then so if all the integers are at a set value, then you win. For the timer, Have it an if/else where if the "win" integer == 1, do nothing, else if the timer is above zero, minus 1 and display the count. For the if you lose, have all the integers reset. Put if/elses in each so that they only change if you click them in the proper order, (Use nested loops) button2's config: if button1 == 0 and button3 == 0 and button4 == 0 then button2 == 1 button1: if button2 == 1 and button 3 == 0 and button4 == 0 then button1 == 1 button3: if button1 == 1 and button2 == 1 and button4 == 0 then button3 == 1 Then have when the world starts, infinitely loop: if button3 == 1 and button2 == 1 and button1 == 1 then win == 1 After you win, set all the integers to 0 and do the whole thing over again! Hope this helped! -Jrr
chickentree
Super Moderator

Status: Offline
Posts: 250
Join Date: Dec 2012
Location: Frosno, Ca
05-08-2014, 01:23 PM

Quote:
 Originally Posted by Sharris In this assignment I had to create a memory game where a sequence of buttons light up and the user has to press the buttons in that order. The only problem I am having with this project is how to have the level start over when the user selects the incorrect button and have the timer stop when they follow the sequence correctly. Here is what I have so far can anyone help me? Thanks.
I'm sorry but your project is not working as you think it is. I don't want to spend a lot of time on a detailed explanation but is important you understand what is there.
You have one method and five events, one of which calls the method.
In my first method you do the following
1. Set all the button.button (the center of the button) to be invisible
2. wait 5 seconds - This is a LONG time for a user to wait with nothing going on.
3. Flash the buttons presumably in the order you want the user to copy.
4. Start the timer
5. Set all the button.buttons back to invisible - even though the step above turned off all the buttons it turned on.
6. Cause each button to blink in order
7. call Countdown on the timer again, even though it is not clear the last countdown has expired.
After "my first method" does all this, it never runs again.
Meanwhile, as long as the movie is running the other 4 events cause the button.button on the corresponding button to become visible. Whether it stays visible depends on the timing. If "my first method" is still running, the button.button will become invisible in steps 1,4,5 and possibly 2.

There is no logic to check if the user turns on a particular light and nothing to indicate the order in which the lights are turned on.

I know that the email medium can cause peoples comments to seem harsher than they are and so I want to stress I am trying to be constructive and hope you will take the above in that light.
As to what to do I would write separate methods for:
1. Initialization of every thing.
2. Initializing all the things needed for a round.
3. Starting the play
4. Checking the users input - this is called from an event when the user clicks on a button.
5. Check for time-outs while the game is running.
6. handle restarting or ending the game.

If you want to use the time but be able to randomly start and stop it you will have to modify the countdown method to allow for this. You could add a Boolean variable to the timer maybe called "active" to indicate whether the counter should be counting.

Hope all this helps,
Mark

Mark Henwood
mhenwood@ieee.org

 simon game
 levimrj Junior Member   Status: Offline Posts: 11 Join Date: Jan 2014 Location: Dallas, TX simon game - 05-09-2014, 06:47 PM I am also tryin to make this game and for the life of me I can't even figger out how to start it! I've been doin fairly well with Alice but I can't rationalize out this game not one bit. Are there any tutorials or help I can find that would help explain it to me?
chickentree
Super Moderator

Status: Offline
Posts: 250
Join Date: Dec 2012
Location: Frosno, Ca
05-09-2014, 10:08 PM

Quote:
 Originally Posted by levimrj I am also tryin to make this game and for the life of me I can't even figger out how to start it! I've been doin fairly well with Alice but I can't rationalize out this game not one bit. Are there any tutorials or help I can find that would help explain it to me?
Can you post the requirements for the project? Without them it is difficult to provide the right advice.

Also, where are you at in the course?
Can you
1. Create Methods?
2. Create functions?
3. Use events?
4. Use lists?

It would also help if you could provide an outline showing the pieces you need to get the project to work. I am just looking for a level of understanding so I know where to start helping you. If you have trouble with the outline, don't stress out just post what you can.

Mark

Mark Henwood
mhenwood@ieee.org

Last edited by chickentree; 05-09-2014 at 10:18 PM. Reason: expanded request

 Ditto
MrMoke
Senior Member

Status: Offline
Posts: 501
Join Date: Sep 2007
Location: Austin, Texas
Ditto - 05-09-2014, 10:32 PM

Mark is Right- I just had to guess without direct knowledge regarding specifics of where you are, and minimum requirements.
I sort of assumed a few things, got on the PC, and created something like it. It's a little different because you can pick anything from 1 upto 10 switches for the REAL Memory Nerds.

Lists are essential to make this work efficiently.

Attached is zipped WMF file, so you have to click and open it to view.
Attached Files
 MemoryGame.zip (2.40 MB, 18 views)

Last edited by MrMoke; 05-11-2014 at 09:50 PM. Reason: Upgrade

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home Announcements     Community News and Announcements Alice 3     How Do I?     Works In Progress     Share Your World     Share Custom Classes     Bugs and Trouble Shooting     Suggestion Box Alice 2     How do I...?     Works-In-Progress     Share Worlds     Share Objects     Bugs and Troubleshooting     Suggestion Box Educators     Teaching with Alice     Teaching Using Alice 3     Teaching Using Alice 2     CS Principles and Alice     AP CSA and Intro to Java and Alice     Workshops General Discussion     Questions and Comments     The Lounge