{ Compile it, run it, figure out how it works and how to stop it. Complain about the flickering. Try to get it to bounce from side to side instead of up and down. Can you get the colors to change gradually from red to blue instead of abruptly? } program bounce(Input, Output); import graphics; const radius = 40; windowWidth = 400; windowHeight = 400; bottom = 100; left = 100; var x, y : integer; red, blue, green : real; goingUp : boolean; procedure StartGraphics; begin { open a window } initializegraphics; createwindow(left,bottom,left+windowWidth,bottom+windowHeight); { flood the window with a black background } setrgbcolor(0,0,0); flood; flushgraphics end; procedure NewCenter( var horiz, vert : integer ); begin if goingUp then vert := vert + 1 else vert := vert - 1; if vert >= windowHeight - radius then begin goingUp := false; red := 1.0; blue := 0 end else if vert <= radius then begin goingUp := true; red := 0; blue := 1.0 end end; begin StartGraphics; x := windowWidth div 2; y := radius; goingUp := true; red := 0.0; blue := 1.0; green := 0.0; while true do begin setrgbcolor( red, green, blue ); circle( x, y, radius ); flushgraphics; setrgbcolor( 0, 0, 0 ); circle( x, y, radius ); flushgraphics; NewCenter( x, y ) end; readln; end.