Assignment for Tue 9/22: ----------------------- (1) LabB is due on Tuesday (2) Complete Part A (written questions) from the sample lab (on your own): http://www.mathcs.emory.edu/~cs190000/share/labs/SampLab.pdf ----------------------- -We discussed in detail constructing a flowchart to draw a pattern like flower.png from the homework -We introduced the idea of using a variable to keep count of the number of times we looped: Y -->[i <- 0]-+->[Fd 10]-->[Rt 90]-->[is i >= 4?]---> ^ | | | N +--------[i <- i+1]---------+ Here i keeps track of the number of times we've repeated Fd 10, Rt 90 (e.g. drawing a side of a square). The flowchart will stop looping after 4 sides have been drawn. Think of i as a piece of paper on which we write a number. The [i <- 0] block writes a 0 on that paper. Then [i <- i+1] reads the value of the paper, adds 1 to it and writes it back. We can stuff the entire flowchart above into a single new block and call it DoSquare. Then we can use the new block to draw a pattern: Y -->[j <- 0]-+->[DoSquare]-->[Rt 45]-->[is j >= 8?]---> ^ | | | N +-------[j <- j+1]--------------+ Note we had to use a different variable because the DoSquare block will be using the piece of "paper" called i. We broke up into groups to see what would happen if we didn't use j and used i again above. Note that the flowchart above is executing the i loop 32 times (4 times for each of the 8 times we go through the DoSquare block). -We pointed out that DoSquare is really DoSquare10 (draws a side length of 10 units), and for e.g. 100, we'd need a DoSquare100. It's better to create a version that uses another varible, maybe l, to read the value of the side length. -We talked about Logo and the HW assignment -Logo programming language -Logo is interpreted -Target is a "turtle" -We went over the sample lab at: http://www.mathcs.emory.edu/~cs190000/share/labs/SampLab.pdf -Goal: design robot to move forward but handle different events, e.g. bumper hit or object nearby -We don't know if we'll be hit first or the ultrasonic will find an object first, so we can't just use a wait block like last time -We need to keep looping and using switch statements to sequentially check if each event has ocurred, and if so handle it properly (see the program in the sample lab) -Finally we talked about Turing tests -We take them all the time: captchas -Contests: e.g. design a bot in FPS games to convince other players the bot is really a human