Simon game at FreeCodeCamp.com

planning my pseudo code for Simon.

https://www.freecodecamp.com/challenges/build-a-simon-game

I’ll start with forking the HTML & CSS from the sample… just to have a sandbox to start in then delete their javascript so I can start practicing my own. I think the first step is just to get it to play back a random array of lights and sounds… then accumulate the player’s response in an array for comparison before repeating with a new random addition to the initial array.

My question to this forum is,
if I’m on the right track with my planning?
I figure it’s like the calculator… a rather know science many of you may have already had experience with. I’m sure I’ll have more specific questions as the project progresses.

// Simon, Turtle Wolfe
//front end developer, free code camp .com
function start() {
    var sequence = [];  //random array
    sequence++          //add new random number 0-3
    
    for (var i = 0; i < sequence.length; i++) { //play sight & sound
        play.sequence[i].sight;
        play.sequence[i].sound;              
    }
    console.log(sequence);
}

function reply(buttonPushed) {
    var reply = [];  //accumulated response
    for (var reply = buttonPushed; reply === sequence[i]; i++) { //play sight & sound
        play.sequence[i].sight;
        play.sequence[i].sound;              
    }
    if (buttonPushed = sequence[i]){
        push.buttonPushed;
        start();
    }

    else {
        loose();
    }
}

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.