Help with memory game were you have to select a number and add a new one

Hi all!

I’m trying to find some code reference to create a very simple 2 players game in which you have to choose a number (between 0 and 9), the other player has to select 1 Player’s number and add a new one. Then Player 1 has to repeat de previous sequence and add a new number, and so on… If one player makes a mistake they have to start again.

Thanks in advance!!

Well … there is a lot of information missing.

  1. What language?

  2. More specifics on the game. Does player 1 type in the number? Select it with a click? Are later rounds based on the running total (i.e., 9, 7, 8, -> next entry should be “24” + a number) or just the last number (same example now next entry is 8 +

3 Basically you are talking about (1) managing input (UI/UX and variable storage) and (2) comparing that input to the game’s intended outcome (algorithm). These are two very different things.

If, for whatever language you want, you look at basic tutorials in UI/UX/input management and algorithms you should be able to build it.

1 Like

Thank you very much for your reply! I was thinking on java script, and yes… the players would have to select the numbers with a click.

I’m thinking in the image of a telephone keypad, so the players most select a numbre with a click.

The example would be:

  • Player 1: press number 4
  • Player 2: should press number 4 + a new one (e.g. 9)
  • Player 1: should press 4; 9; and a new one (e.g. 1) and so on…

Tha game consist on remember the sequence of numbers in the right order.

Well, you could do this as a React (or probably vanilla JS or other framework) app. It needs to have a max # of turns but that max can probably be pretty darn high. If you look at the sample calculator app (front end projects) that already has a bunch of inputs and a display. You’d need to make modifications to the logic and display (obviously) but then also probably something visual to say whose turn it was.

1 Like

You already have the core user workflow down,
you can start coding now.

You don’t need “some code reference”, because this mostly leads to copying other peoples’ stuff.

So your first steps could look like this:

  • create number grid
  • player1 clicks number(s), number(s) get(s) saved
  • player2 clicks number(s), check if they are correct, number(s) get(s) saved
  • player1 clicks number(s), check if they are correct, number(s) get(s) saved

I think you are able to start now!

1 Like

Thanks! I’m already doing some research around your ideas, I wasn’t clear about where to begin. Thank you again!!

This is great, as I’m starting to learn about coding is very helpful and easier to see it as a workflow, I’ll begin playing around today so thank you for your time, suggestions and the motivational!! :pray: