Snakes and Ladders Game



Snakes and Ladders games is a popular board game for young children. This game usually involves two or more players and they take turns to move by rolling a dice. On the way to the finishing point, the players will meet with some hurdles in the form of snakes and some opportunities in the form of ladders. Whenever the player encounters a snake (or more accurately, the snake’s head), he or she will be thrown back to an earlier box (which is at the snake’s tail). On the other hand, whenever the player encounters a ladder, he or she can climb up the ladder to a higher box. The player who reaches the finishing point first wins the game

To design the program, it took me one day to think out the mathematical logics and wrote out the routines on paper (not in front of the computer). Since the board comprises 10 rows and 10 columns, each box thus represents a cell with the coordinate  (column, row). Therefore, I figured out that I need to define the coordinate of every cell by declaring two arrays row(10) and col(10) at the beginning of the procedure. To move the chess piece, I employed the method object.move  col(i), row(j), where I initiate the values of col(i) and row(j) in a For....Next loop. As the motion is in a zigzag manner, I need to control the motion using reverse order and by imposing some conditions.

In addition, I added the roll dice procedure (designed earlier) into this program. After a few trials and alterations with the help of my 10 years son, the program  works, and it works great. I am not attaching the codes here yet as I think it is good for you to figure out the logics and try to program it like myself. If you really cannot get it running, you can download the source codes by donating $2.00, click the button below to proceed

Back to the Main Page