Coding project: Bingo. Part 1

April 12th, 2019

While cleaning up after losing to my daughter in a game of Bingo, I stopped and studied the pieces:

  • A control board with numbers from 1 - 75

  • A player board with 25 random numbers from 1 - 75,

  • 75 numbered pieces that are drawn at random

  • Indicator pieces to cover the number on the player board if it matches the number drawn.

I got intrigued because I believed that I could make this Bingo game with JavaScript. My brain immediately started to work, so I rushed to grab a pen and paper.

I set up a short description of how the program would work:

  • It needs a control card with numbers from 1 - 75

  • Numbers on the control board matching the number drawn is highlighted and stay highlighted throughout the game.

  • There will be one player card.

  • The player card will be empty before selecting “New game”.

  • When pressing “New Game”, the player card fills with random numbers. The “B” column has numbers from 1 - 15, “I” from 16 - 30 and so on. The numbers in each column don’t need to be in descending order.

  • The middle of the player card is a “free” area, meaning it will not have a number but it will be treated as “covered” or “checked”.

  • Press a “Draw” button to draw a number.

  • If a number on the player card matches the number drawn, it will be highlighted and stay highlighted throughout the game.

  • If a player card has five numbers covered in a row, either horizontally, vertically or diagonally, “Bingo” will be displayed, and the game ends.

  • The score is also displayed which is the total of the five numbers that make up the Bingo on the player card.

  • Press “New Game” to start over.

I’m not sure how to solve all these challenges yet, but I am going to start with the numbers from 1 - 75, the drawing function and the highlighting of the control card.

Then I will look at how to populate the player card with random numbers.