The Memory Master app is a simple game, based on the “Simon” electronic memory games. The computer generates a pattern of sounds/lights, and the user must repeat the pattern. The pattern grows longer each time the user repeats it successfully, and the game gets faster as your score increases.
The UI consists of a button for starting the game, rows which display the current, high, and overall high score (cloud-based), and the gameplay field, comprised of four buttons.
Blocks
The general idea is:
User presses new button and the computer begins play
Computer randomly adds an integer between 1 and 4 to a string of text
The numbers (1-4) represent each of the four color buttons, which are “lit up” and play sounds to the user during the computer’s turn
On the player’s turn, the player must push the buttons in the same order they were displayed by the computer
The program iterates through each of the string’s characters to make sure they match, and generates a score based on how many match
The player’s score is determined by the length of the successfully matched string of text (for example, a high score of 7 might be represented in the blocks by a string such as “31442314”
The player’s score is compared to the stored high score and, if larger, replaces the stored high score. It is also compared against the “cloud” high score and, if player’s score is higher, that score is replaced with the player’s high score.
The best way to figure out how it works is to start messing with the blocks, so please remix it! I would love to see your results if you mess with it, so please share here.
This is great. Is it only me or are the blocks not visible? The app copies onto my Thunkable fine and I can play the game on my phone, but I can’t see any of the blocks used when I click on the blocks tab. I’m not sure if this was done intentionally or not, but I’m just trying to see what you did with the “AI”.
I’m going to try and give it a shot (recreating it just based on his design and how it works, I think my students would love to work on something like this). So far I can get the computer to assign a random value of 1 to 4 to each button and then light up that button, but only once or a specified # of times, not incrementally. I’m assuming he used a for loop with a list to do that? I have to figure that out as well as how the app will recognize that I’ve tapped the same sequence the computer ran.
Yes I’ve looked through those, the problem is that many of the app links are very old so I have to rely on screenshots that were posted, which don’t always show the entire picture. I’ll take another look though since it seems like the memory type apps are very close to what the simon app does.
Thanks I’ll check it out! I always like seeing how others do what I’m doing (or trying). Interesting how you set yours up to always run a sequence of 4 as opposed to 1, then 2, then 3, then 4, then 5, etc…
Here’s what I did (screen 1 and game test copy screen) yesterday just to see if I could get the thing to sequence. It’s set up with a test pattern that was used just to test how I was going to light up the buttons and then play the sound. It’s not set up to run once, then twice, then three times, etc…I hadn’t gotten that far. It’s set up to recognize when I’ve clicked a the first button that lit up, but not multiple. Since I have a limited account and ran out of projects to add I had to try mine on the original and just add a screen.
It would be easy enough to adjust this. I’m already using a variable for # of turns and looping from 1 to that value. So just change # of turns by 1 each time a guess is made.
That makes sense. I was wondering why that variable was created at first since the # of turns will never be fixed, but it makes sense now that you put it that way. It’s been a long couple of weeks with testing and new quarters here at school so I’m fried. lol
Because I didn’t build a fully-working demo, I chose to automate the sequence with delays instead of just showing 1 color, then 2, then 3, etc. which would require more coding. So I needed a set number of turns. You won’t.
Right. Well it certainly jostled my block I had going on in my head where I couldn’t just think through that simple process. Now I’ll work on getting the app to test what the player taps against what the computer ran.
I’ve been working on it over the course of the week and I’ve progressed but unfortunately, it still isn’t right. Here are a few observations not being able to see the original apps code but assuming how it works…
I doubt he used a “when any button is clicked” event handler like many, if not all, of the Memory apps did, since the start button has a very specific purpose for starting the game with the computers first sequence, while the other 4 buttons add a specific integer to a list when pressed. Of course I could be wrong, but it’s just a thought.
Since the start button is only pressed one time, to start the game, there must be a procedure or something in there that keeps track of whose turn it is, since repeatedly hitting the start button to allow the next player to go would reset the lists as well as the previous sequence (at least in my setup). In the working app the start button is only hit one time. After that the computer goes, then the player, then the computer again, then the player again, etc…So something must be tracking those turns.
Ultimately, what I have been able to get working (screen 1) is both the computer and the player sequences working correctly in terms of lighting up the respective buttons with sound, as well as creating both lists so that the sequence is right (via separate button click event handlers). What I haven’t gotten working correctly is the checking of the two lists so that it can be determined if the player sequence matches the computers.
I’d be willing to adjust how the game works, by clicking the start button after every sequence, but for some reason I can’t get the two lists to check correctly. My code is admittedly a mess with multiple screens, each containing different versions of what I’ve done, but if anybody wants to see where I may be going wrong it would be great. If not, I understand.
Any Component blocks can be tricky. It’s possible to avoid other buttons such as the Start button when using them but I think you’re wise to avoid them for now.
I was able to open your project link but when I click on mainScreen, I can see the Design tab but the Blocks tab is blank. This isn’t because of anything you did but if you could share another link, perhaps it will work.
Yes, I’ve used any component blocks before with success but I don’t see how it would work well. with this specific app. I created a tic tac toe game a few months ago and it (any button click) was perfect for that.
Strange you can’t see the blocks. That’s what was happening with the original app. The “mainscreen” screen won’t open for me either. I’ll send a new link and if it doesn’t work I can just post screens. Screen 1 should open blocks fine though.