how to do a game that is simulated by a loop

186 views Asked by At

how to do program a game that is simulated by a loop in which people has to repeat goes for as long as it takes to get out that it reach or pass square 80? I am doing a snake & ladder game and need to write a code that will allow this to happen

1

There are 1 answers

0
Gordon Gustafson On

You need to use a loop with an exit condition that checks if a player has reached square 80 or otherwise won.

while ( !hasPlayerWon() ) {

    //continue game

}

loops in javascript, loops in C++ :D