Question 4: (back)
Using only five FOR loops, four calls to stdout.putcSize, and two calls to stdout.newln, write a program that draws a checkerboard pattern. Your checkerboard should look like the following:
******** ******** ******** ********
******** ******** ******** ********
******** ******** ******** ********
******** ******** ******** ********
******** ******** ******** ********
******** ******** ******** ********
******** ******** ******** ********
******** ******** ******** ********
******** ******** ******** ********
******** ******** ******** ********
******** ******** ******** ********
******** ******** ******** ********
******** ******** ******** ********
******** ******** ******** ********
******** ******** ******** ********
******** ******** ******** ********
******** ******** ******** ********
******** ******** ******** ********
******** ******** ******** ********
******** ******** ******** ********
******** ******** ******** ********
******** ******** ******** ********
******** ******** ******** ********
******** ******** ******** ********
******** ******** ******** ********
******** ******** ******** ********
******** ******** ******** ********
******** ******** ******** ********
******** ******** ******** ********
******** ******** ******** ********
******** ******** ******** ********
******** ******** ******** ********
program Question4;
#include( "stdlib.hhf" );
static
xCoord: int8;
yCoord: int8;
ColCntr: int8;
c1: char := '*';
c2: char := ' ';
begin Question4;
for( mov( 0, yCoord ); yCoord < 4; add( 1, yCoord )) do
for( mov( 4, ColCntr ); ColCntr >= 0; sub( 1, ColCntr )) do
for( mov( 0, xCoord ); xCoord < 4; add( 1, xCoord )) do
stdout.putcSize( c1, 8, '*' );
stdout.putcSize( c2, 8, ' ' );
endfor;
stdout.newln();
endfor;
for( mov( 4, ColCntr ); ColCntr >= 0; sub( 1, ColCntr )) do
for( mov( 0, xCoord ); xCoord < 4; add( 1, xCoord )) do
stdout.putcSize( c2, 8, ' ' );
stdout.putcSize( c1, 8, '*' );
endfor;
stdout.newln();
endfor;
endfor;
end Question4;