9.1.6 Checkerboard V1 Codehs < 2K • FHD >

board = []

Here's the code for the exercise on CodeHS:

Once you've mastered "Checkerboard, v1," you can challenge yourself further: 9.1.6 checkerboard v1 codehs

// Fill the current row starting with beeper presence based on row parity function fillRow() // Determine if first cell should have a beeper // For row 1: have beeper, row 2: no beeper, etc. // We check if we are on a beeper to decide pattern var startWithBeeper = beepersPresent();

Defining NUM_ROWS and NUM_COLS at the top of your script is a programming best practice. If you later want to change your checkerboard into a board = [] Here's the code for the

Use an if statement to check if the row index i is less than 3 or greater than 4.

Tell me what you would like to explore next to ! Tell me what you would like to explore next to

function start(): turn off beeper auto-placement var row = 1 while (front is clear or left is clear): placeRow(row) if (front is clear): moveToNextRow() row++

Solving this exercise teaches you several fundamental programming concepts:

×
Create a new article
Write your page title here:
We currently have 93,500 articles on Fallout Wiki. Type your article name above or click on one of the titles below and start writing!



board = []

Here's the code for the exercise on CodeHS:

Once you've mastered "Checkerboard, v1," you can challenge yourself further:

// Fill the current row starting with beeper presence based on row parity function fillRow() // Determine if first cell should have a beeper // For row 1: have beeper, row 2: no beeper, etc. // We check if we are on a beeper to decide pattern var startWithBeeper = beepersPresent();

Defining NUM_ROWS and NUM_COLS at the top of your script is a programming best practice. If you later want to change your checkerboard into a

Use an if statement to check if the row index i is less than 3 or greater than 4.

Tell me what you would like to explore next to !

function start(): turn off beeper auto-placement var row = 1 while (front is clear or left is clear): placeRow(row) if (front is clear): moveToNextRow() row++

Solving this exercise teaches you several fundamental programming concepts: