Alice Community  

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

Reply
 
Thread Tools Display Modes
Memory game
Old
Anques
Guest
 
Status:
Posts: n/a
Unhappy Memory game - 04-06-2012, 02:38 PM

I have decided to do some sort of memory game for my final project but I am having an issue with play back. I want the user to be able to replay the sequence again if they need to see it. But I would assume that the program has to record the circles that light up but the cirlces flash at random. IDK I'm really stuck at the moment -_____-
   
Reply With Quote
Old
sfunk
Senior Member
 
sfunk's Avatar
 
Status: Offline
Posts: 1,112
Join Date: Mar 2011
Location: I don't know
Default 04-06-2012, 05:17 PM

well you could use variables, so lets say you have a pattern thats done by random, each step of the pattern would set the the first_step_var to it's unique assignment, example... lets say you are doing a game were it will show colored blocks in order, the user is to remember the colored blocks. well lets say for green, you have the var set to 1, blue=2 and red=3. okay now lets determine the length of the pattern, lets make it a pattern of 5. so that means we need 5 variables(lets make them number variables shall we. Okay, so you want your normal code to determine the pattern, which you are having it do randomly. so use a do in order statement, and have a block change color randomly, then the next part of the method would determine what the color of the block is using an if else statement. so lets say the random method made the block red, well it will set the first variable you made to the number 3. now just have the rest of the code do that with the rest of the pattern all setting the correct variable(determined by which step it is in), then now you just need a method to repeat the colors back which you just need if/else statements checking the varibles that were assigned a number in each step, and based off the variable, reflecting the color that was picked by random. hope this helps and you understand it, pretty much learn how variables work and you will have no problem.


If you are stuck on a project, check out the tutorials I made here at this link:

http://alice.org/community/showthread.php?p=36778#post36778

There are lots of tutorials on it so far, including some youtube videos, check it out

Or..

Go to my youtube channel to check out my alice 2.2 tutorials I have there..

http://www.youtube.com/user/sfunk1992?feature=mhsn
   
Reply With Quote
Old
GameKid
Senior Member
 
GameKid's Avatar
 
Status: Offline
Posts: 467
Join Date: May 2011
Location: My magnificent castle
Default 04-06-2012, 05:19 PM

You can fix this with number variables. Just make however many number variables as the sequence's flashes. Then, when the random number is decided, use the number variable. For example, if, for the first time, circle number two flashes, number variable 1 will set value to two. I trust you can figure it out from there.
EDIT: Oops. Sfunk posted that while I was writing this. Just refer to this if sfunk is too complicated, I guess.....


[COLOR=e4eaf2]Your text here[/COLOR]
Come on, you know you want to try it.
   
Reply With Quote
Old
Anques
Guest
 
Status:
Posts: n/a
Default 04-06-2012, 05:57 PM

That's so funny that's exactly how I did it, except with circles But now how would I somehow, record it? Maybe so that it can be played back to the person if they missed the pattern. Also so that the program can check and make sure the right patterns were clicked by the user?

I'm new to this so bare with me.... I have alot of ideas but it's super complicating to execute things in my head.... when in actuality it's super simple....

And Thanks!
   
Reply With Quote
Old
sfunk
Senior Member
 
sfunk's Avatar
 
Status: Offline
Posts: 1,112
Join Date: Mar 2011
Location: I don't know
Default 04-06-2012, 08:36 PM

Quote:
Originally Posted by Anques View Post
That's so funny that's exactly how I did it, except with circles But now how would I somehow, record it? Maybe so that it can be played back to the person if they missed the pattern. Also so that the program can check and make sure the right patterns were clicked by the user?

I'm new to this so bare with me.... I have alot of ideas but it's super complicating to execute things in my head.... when in actuality it's super simple....

And Thanks!
Refer to the first post I made on this thread, but I am assuming you are new programming in general? if you are, lets get you familiar with some key pieces of information that will help you become successful using Alice, Variables are are found in properties of either the world class (look at the object list on the left hand side of your Alice browser) or the properties of individual objects, it is best to use world variables when dealing with general things such as the program you are trying to make.

Okay, now since you know where the variables are located, how do you create one? The answer is click create variable, a menu will pop up, you have to name the variable(name it something appropriate to what it is doing, such as place_holder_1) Now you may be asking yourself what does number,boolean,object,and other mean, well a number variable deals with data that is only numbers, boolean variables are variables that say whether something is true or false, and we won't get to the other stuff for now.

You may still be confused as to what a variable is, so here is a short definition of what it is, a variable is a empty piece of data that can altered or changed while code is being executed(while the world is running)

Now you should have a good grasp of what a variable is, now lets use this information to put it to use in your game, I would create as many number variables as there are changes in the pattern you have.

so whenever the change in the pattern is being made, it can assign the appropriate ordered number variable what ever the change in the pattern was.

Now that the variables have something assigned to it, you can use these varibles to play the pattern back using if/else statements.

so if first_place_holder==1
set box color to green

if second_place_holder==2
set box color to blue

if third_place_holder==1
set box color to green

of course this is just an example, but apply this logic and knowledge to your game and you should be set to go


If you are stuck on a project, check out the tutorials I made here at this link:

http://alice.org/community/showthread.php?p=36778#post36778

There are lots of tutorials on it so far, including some youtube videos, check it out

Or..

Go to my youtube channel to check out my alice 2.2 tutorials I have there..

http://www.youtube.com/user/sfunk1992?feature=mhsn
   
Reply With Quote
Old
4rianna
Guest
 
Status:
Posts: n/a
Default 05-02-2012, 11:53 AM

How does the user input and comparing work?

I've tried making two lists, one with the values randomly assigned which make up the 'sequence' the other the user's input.

Is there a way to compare lists at all? I tried using If (list 1) contains (list2) but am not sure that's the correct way to go about it.

Thanks!
   
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 ©2024, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.