Write a procedure, board, which takes a integer number as input and produces a list as an
Question:
Write a procedure, board, which takes a integer number as input and produces a list as an output, each element of which is a list of 0s and 1s.
When board is called with a nonnegative integer, n, it returns a list containing n lists, each of which has n elements. These lists form the shape of a square board. Each of the inner lists contain only numbers 0 and 1, and they alternate across lists. The result always has 0 as the first element of the first inner list, if any.
The following examples show a formatted output of the boards, but your output does not need look the same regarding spaces. For your output, it is sufficient to produce the list. Spaces in the lists are just for illustrative purposes here; you are not required to print them:
Step by Step Answer:
An Experiential Introduction To Principles Of Programming Languages
ISBN: 9780262045452
1st Edition
Authors: Hridesh Rajan