//=======================================
// Martin Voshell
// tasks 1-2
// Q-Bert luv
//=======================================


//setup global canvas
setBackgroundColor(0,0,0);


//program is set up to repeatedly call a function that draws a single faux perspective square



//setup two while loops to make a "mirrored" board... nested loops would be correct


//while loop 1... takes care of left and center
var o=0.5; //o is the origin of the new cube
var y=0.0; //the y start offset of each cube
var incr=0; // counter increment
while (incr<4){ //defines the # of rows

qube(o,y); //draws center cube
qube(o+0.1, y+0.2); //draw to the left and down
qube(o-0.1, y+0.2); //draw to the right and down

o=(o+0.1); //the trouble line, defines traversal, need it nested to go + and -
y=(y+0.2);

incr=incr+1;
}


//while loop 2... takes care of right and center a hack and redundant in the big endian sense
var o2=0.5;
var y2=0.0;
var incr2=0;
while (incr2<4){ //defines the # of rows


qube(o2+0.1, y2+0.2); //draw to the left and down
qube(o2-0.1, y2+0.2); //draw to the right and down

o2=(o2-0.1);
y2=(y2+0.2);

incr2=incr2+1;
}



//cheating to make it look good...
qube(0.5,0.8);


//adding character

setPenWeight(.06);
setPenColor(1.0, .5, .1);
drawLine(0.13, .23, .14, .4);

//head/body
setPenWeight(.5);
setPenColor(.9, .5, .1);
drawLine(.06, .02, .08, .09);

//eyes
setPenWeight(.1);
setPenColor(1, 1, 1);
drawLine(.07, .02, .05, .04);

setPenWeight(.1);
setPenColor(1, 1, 1);
drawLine(.12, .02, .12, .04);

setPenWeight(.05);
setPenColor(0, 0, 0);
drawLine(.07, .03, .07, .04);

setPenWeight(.05);
setPenColor(0, 0, 0);
drawLine(.12, .03, .12, .04);

//nose
setPenWeight(.15);
setPenColor(1, .4, .1);
drawLine(.1, .1, .19, .12);
setPenColor(0, 0, 0);
setPenWeight(.12);
drawLine(.19, .12, .19, .121);

//feet
setPenWeight(.06);
setPenColor(.9, .5, .1);
drawLine(.06, .23, .07, .4);


stop();









//the allegorical cube
// all coords are relative from the input allowing "Easy" placement


function qube(origin, ystart){
//top of fake cube

setPenColor(.9, .5, .1);
setPenWeight(0.01);

drawLine(origin, ystart, origin-0.1,ystart+0.1); // center -> left
drawLine(origin, ystart, origin+0.1, ystart+0.1); // center -> right
drawline(origin-0.1, ystart+0.1, origin, ystart+2*0.1); // bottom left -> center
drawline(origin+0.1, ystart+0.1, origin, ystart+2*0.1); // bottom right -> center

//lowers of fake cube

setPenColor(.6, .5, .1);
setPenWeight(0.01);

drawline(origin-0.1, (ystart+0.1)+0.1, origin, (ystart+0.1)+2*0.1); // left -> center
drawline(origin+0.1, (ystart+0.1)+0.1, origin, (ystart+0.1)+2*0.1); // right -> center

//drop 3 legs

setPenColor(.6, .5, .1);
setPenWeight(0.01);

drawLine(origin-0.1, ystart+0.1, origin-0.1, (ystart+0.1)+0.1); // left
drawLine(origin, (ystart+0.1)+0.1, origin, (ystart+0.1)+2*0.1); // middle
drawLine(origin+0.1, ystart+0.1, origin+0.1, (ystart+0.1)+0.1); // right
}