<div>Wrote this from the lesson:</div><div><br></div><div>;; this is the definitive exercise 32 from the 2htdp</div><div>;; car moves across the empty-screen. Yay. 12/2/2010</div><div><br></div><div><br></div><div>;; this creates the empty window</div>
<div><br></div><div>(define WIDTH 1000)</div><div>(define HEIGHT 40)</div><div>(define MTSCN (empty-scene WIDTH HEIGHT))</div><div><br></div><div>;; this draws the vehicle shape</div><div><br></div><div>(define WHEEL-RADIUS 5)</div>
<div> (define WHEEL-DISTANCE (* WHEEL-RADIUS 5))</div><div> (define BODY-LENGTH (+ WHEEL-DISTANCE (* 6 WHEEL-RADIUS)))</div><div> (define BODY-HEIGHT (* WHEEL-RADIUS 2)) </div><div> (define WHL (circle WHEEL-RADIUS "solid" "black"))</div>
<div> (define BDY</div><div> (above</div><div> (rectangle (/ BODY-LENGTH 2) (/ BODY-HEIGHT 2)</div><div> "solid" "blue")</div><div> (rectangle BODY-LENGTH BODY-HEIGHT "solid" "red")))</div>
<div> (define SPC (rectangle WHEEL-DISTANCE 1 "solid" "white"))</div><div> (define WH* (beside WHL SPC WHL))</div><div> (define CAR (underlay/xy BDY WHEEL-RADIUS BODY-HEIGHT WH*))</div><div> </div>
<div> ;; As Ramin A. my old classmate once said, "I drew a tree"</div><div> ;; Well, this is a tree I was instructed to place in the empty screen</div><div> ;; as a constant shape throughout the running fo the program</div>
<div> </div><div> (define tree</div><div> (underlay/xy (circle 10 'solid 'green)</div><div> 9 15</div><div> (rectangle 2 20 'solid 'brown)))</div><div>;; this one actually places the tree!</div>
<div> </div><div> (define BACKGROUND</div><div> (place-image tree 500 25 MTSCN)</div><div> )</div><div> </div><div>;; this sets the y-axis (vertical) for the car and</div><div>;; defines the "tock" where the trigger is the clock (not keystroke or mouse)</div>
<div>;; increments of 3</div><div> </div><div> (define Y-CAR 30)</div><div> (define (tock ws) (+ ws 3))</div><div> </div><div>;; Here we are placing the car into the scene, according to the given world state</div><div>
<br></div><div> (define (render ws) (place-image CAR ws Y-CAR BACKGROUND))</div><div> </div><div> </div><div> </div><div>;; here is the big-bang, or main program, that is the actual instruction </div><div>;; to use all the above-definitions</div>
<div> </div><div> (define (main ws)</div><div> (big-bang ws (on-tick tock) (to-draw render) <b>(stop-when (> ws 500) )</b>))</div><div><br></div><div>;; that's it! </div><div>;; next step is a condition that will stop the program when </div>
<div>;; the vehicle reaches a certain point</div><div><br></div><div>****************************</div><div>Ok, I bold-faced the attempt to have the car stop at x-axis of 500, which I believe is ws 500. When I put in "(main 1)" in the execution line, I get a false boolean, if I put in "(main 501)" I get a true boolean. Both cases, it doesn't work the "procedure expects an argument", not a true/false. </div>
<div><br></div><div>How the heck can I get the stop-when function to work, or can I be pointed to a section of the tutor or other reference that explains to me what should be a simple (not to me) additional command in the big-bang. Thank you in advance,</div>
<div><br></div><div>dt</div><br>-- <br><br>CONFIDENTIAL EMAIL: This email may contain - Attorney-Client Privileged - Attorney Work Product - This email is only for use by the intended recipient. If received in error any use, disclosure or copying is prohibited. Any inadvertent receipt shall not be a waiver of any privilege or work product protection. If you have received this communication in error, please notify sender immediately. Thank you.<br>