Alice Community  

Go Back   Alice Community > Alice 2 > How do I...?

Reply
 
Thread Tools Display Modes
Another Simon Says Question
Old
bluntedwhat
Junior Member
 
Status: Offline
Posts: 6
Join Date: Sep 2011
Default Another Simon Says Question - 12-04-2011, 05:07 PM

So, I'm trying to create a simon says game and I'm stuck a little bit.
I added the four squares and made them all different colors and added the 4 to a object list.
I want to randomly display a pattern of 3 and if they get the correct order than it will increment to 4, then 5. up to ten.
I'm having a bit of trouble actually get the sqaures to randomly display the patterns.
Any sort of guidance would be very much appreciated. thanks
   
Reply With Quote
Old
x2495iiii
Super Moderator
 
x2495iiii's Avatar
 
Status: Offline
Posts: 3,508
Join Date: Dec 2008
Location: Somewhere in the Continental U.S.
Default 12-04-2011, 06:17 PM

Post your best shot at making the method yourself, and we'll guide you from there.


(')>
   
Reply With Quote
hey
Old
bluntedwhat
Junior Member
 
Status: Offline
Posts: 6
Join Date: Sep 2011
Default hey - 12-04-2011, 07:53 PM

hey here is where i am so far. i know its early but maybe just need some direction. I created a method that flashes the square and another that calls it with a loop that flashes a number of times. I created a list that includes the 4 squares and a second list that is empty that i want to transfer the order the squares after they flash randomly. am i on the right track? is there a better way of doing this maybe? thanks for any help, i never want anyone to do it for me just some guidance and suggestions would be greatly appreciated. thanks again
Attached Files
File Type: a2w simonsays.a2w (179.0 KB, 7 views)
   
Reply With Quote
hey
Old
bluntedwhat
Junior Member
 
Status: Offline
Posts: 6
Join Date: Sep 2011
Default hey - 12-04-2011, 07:58 PM

i attached the wrong file. The second empty list is now populated with the random flashed squares. how would i mold a method that ask the user for the order flashed? does that make sense my question?
Attached Files
File Type: a2w simonsays.a2w (182.7 KB, 6 views)
   
Reply With Quote
Old
x2495iiii
Super Moderator
 
x2495iiii's Avatar
 
Status: Offline
Posts: 3,508
Join Date: Dec 2008
Location: Somewhere in the Continental U.S.
Default 12-04-2011, 08:42 PM

Here's your start.

You have to finish it.

If you need me to explain anything, let me know.
Attached Files
File Type: a2w simonsaysFix.a2w (181.3 KB, 32 views)


(')>
   
Reply With Quote
hmm
Old
bluntedwhat
Junior Member
 
Status: Offline
Posts: 6
Join Date: Sep 2011
Default hmm - 12-04-2011, 09:46 PM

I played around with it for a while now and came up with the attached. It works for the most part but I feel as though I'm missing an easier way to do it. Can the 'guess method' method be constructed with a for all in order or for all together statement? And is there any hints you can give for me to be able to increase the size of the pattern being asked after the user gets the previous correct? Sorry if I'm over stepping my bounds by asking too much but my high school teacher is still new at this program too. Thanks again.
   
Reply With Quote
Re: Simon says...
Old
todd0312
Member
 
todd0312's Avatar
 
Status: Offline
Posts: 35
Join Date: Sep 2011
Default Re: Simon says... - 12-05-2011, 04:33 PM

Hello Blunted What (?):

I'm actually doing a similar project. I opened up your program, but when I clicked the squares in the correct order, I got a message to start over (?). Anyhow...

Regarding your getting the squares to display randomly, it might be easier to assign numbers to your squares, and then make your "newwwwlist" a number list, rather than an object list. If you do this, then you can use the "random number" function so the program can generate the sequence.

Second, you are going to need a way to compare the newwwwlist sequence that the program displays with the sequence in which the player clicks the squares after they have been displayed. If you look at the properties panel when you are playing the game, it will display the squares that have flashed (ex. newwwwlist (green, yellow, yellow)). You need another blank list (let's call it "user_List") that will display the squares they click in the Properties panel - in the same way - as they are clicked. However, I'm not sure how to do this with object lists.

As you have it now in your "world.guessMethod" at the moment, your condition: "If squareClicked (object) = item guessNum (a number) from world.newwwwlist, you are trying to - compare apples to oranges (objects to numbers). And... unless there is some weird work-around, I don't think you can. There might be some way to index the object numbers (0,1,2,3) and compare in that way, but I'm not sure.

Anyway, I'll get back with you on this tonight when I have a better chance to look at your program.

Kind of hard to explain.

Don't let what I wrote confuse you. I'm pretty noob, but I think I might be able to help. Maybe some other people will contribute to your post - and help us both out.

I'll get back with you soon.

Take care,

Todd

Last edited by todd0312; 12-05-2011 at 04:46 PM.
   
Reply With Quote
Old
x2495iiii
Super Moderator
 
x2495iiii's Avatar
 
Status: Offline
Posts: 3,508
Join Date: Dec 2008
Location: Somewhere in the Continental U.S.
Default 12-05-2011, 05:35 PM

Quote:
Originally Posted by todd0312 View Post
Hello Blunted What (?):

I'm actually doing a similar project. I opened up your program, but when I clicked the squares in the correct order, I got a message to start over (?). Anyhow...

Regarding your getting the squares to display randomly, it might be easier to assign numbers to your squares, and then make your "newwwwlist" a number list, rather than an object list. If you do this, then you can use the "random number" function so the program can generate the sequence.

Second, you are going to need a way to compare the newwwwlist sequence that the program displays with the sequence in which the player clicks the squares after they have been displayed. If you look at the properties panel when you are playing the game, it will display the squares that have flashed (ex. newwwwlist (green, yellow, yellow)). You need another blank list (let's call it "user_List") that will display the squares they click in the Properties panel - in the same way - as they are clicked. However, I'm not sure how to do this with object lists.

As you have it now in your "world.guessMethod" at the moment, your condition: "If squareClicked (object) = item guessNum (a number) from world.newwwwlist, you are trying to - compare apples to oranges (objects to numbers). And... unless there is some weird work-around, I don't think you can. There might be some way to index the object numbers (0,1,2,3) and compare in that way, but I'm not sure.

Anyway, I'll get back with you on this tonight when I have a better chance to look at your program.

Kind of hard to explain.

Don't let what I wrote confuse you. I'm pretty noob, but I think I might be able to help. Maybe some other people will contribute to your post - and help us both out.

I'll get back with you soon.

Take care,

Todd
He can still get random items from an object list. In fact, it's an option when you drag it over most conditionals, if I recall (the options are first item, last item, ith item, and random item).

Furthermore, he really doesn't need to populate a list with user guesses. Just comparing each sequential guess with the corresponding value in the object list containing the right answers will do fine.

Finally, item x from a list of objects is going to return an object value, not a number value. It simply requires a number value to specify which object in the list should be compared, which is why guessNum is there.


(')>
   
Reply With Quote
hey
Old
bluntedwhat
Junior Member
 
Status: Offline
Posts: 6
Join Date: Sep 2011
Default hey - 12-05-2011, 05:56 PM

i feel like i am making progress. perhaps you could check out the latest from today? I'm looking for a way to compare one list against another list to check if they're the same. Could you maybe give me a hint if able? thanks again
Attached Files
File Type: a2w 12.05 simons say.a2w (181.4 KB, 39 views)
   
Reply With Quote
Re: Simon
Old
todd0312
Member
 
todd0312's Avatar
 
Status: Offline
Posts: 35
Join Date: Sep 2011
Default Re: Simon - 12-08-2011, 06:23 AM

Hey Blunted_what:

This is what I did to compare the lists, though I don't know if it's the best way. I'm a beginner muddling my way through.

Create a global function that contains 2 empty lists as the parameters. Create an if-else statement comparing the size of the 2 parameter lists, and have it return 1 if they are not equal. Then add a loop to the function containing another if-else statement comparing the list parameters for inequality, looping the size of one of the lists and using the same conditions you did in the first if-else statement except using "item" instead of "size", and returning 1 if they are not equal. After the loop block, return 2 if they are equal (the inequality conditions in the upper blocks are not true.

Next, create a method that calls the function you created to compare the lists. You will also need a boolean variable that you will use as a condition in the case that the player has selected the wrong sequence of squares - set to false in global properties.

In this method, create an if-else statement, and drag the function you created after if, using the logic statement "= 1" (the 2 lists are unequal and have returned "1", as stated in your function). If this is the case, set your variable for wrong selection = true, and call the method you created for what happens if the player made the wrong selection.

If the condition is not true, have the program go back to the beginning method so Simon can continue with the game.

Does that make sense?

Hope it helps. If you have any questions, post again - I'll be checking your post.

Take care,

Todd

Last edited by todd0312; 12-08-2011 at 06:30 AM.
   
Reply With Quote
Reply

Thread Tools
Display Modes

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 Jump



Copyright ©2023, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.