Computer Science Canada Having a problem with The "brownianMotion" program. Thanks |
Author: | SpadeZAceZ [ Mon Jan 18, 2010 4:23 pm ] | ||
Post subject: | Having a problem with The "brownianMotion" program. Thanks | ||
What is it you are trying to achieve? What i am currently trying to achieve is, modifying the BrownianMotion program, arrange that a picture of a funny face is moved randomly around the window. What is the problem you are having? I am not sure on how to create a picture of a funny face and having no idea how to move it around the window. Describe what you have tried to solve this problem I attempted to create a funny face and failed very bad. Post any relevant code (You may choose to attach the file instead of posting the code if it is too long) <Answer Here>
Please specify what version of Turing you are using <Answer Here> |
Author: | SpadeZAceZ [ Mon Jan 18, 2010 4:39 pm ] |
Post subject: | RE:Having a problem with The "brownianMotion" program. Thanks |
It can either be a funny face or a star moving around the window |
Author: | SpadeZAceZ [ Mon Jan 18, 2010 7:34 pm ] |
Post subject: | RE:Having a problem with The "brownianMotion" program. Thanks |
% The "BrownianMotion" program % Moves an asterisk around on % the window like a smoke particle % This is known as Brownian motion % Color window green colorback (gray) for row : 1 .. 25 put repeat (" ", 80) .. end for % Set character color to magenta color (magenta) setscreen ("nocursor") % Hide cursor loop % Start at center var row := 13 var column := 40 loop % Start over when asterisk goes off the window exit when column < 1 or column > 80 or row < 1 or row > 25 locate (row, column) put " XD " .. delay (100) % Erase asterisk in old location by % outputting a blank there locate (row, column) put " " .. % Compute new value for row randint (row, row - 1, row + 1) % Compute new value for column randint (column, column - 1, column + 1) end loop play (">C<") % Sound a note % This is explained in the Music chapter end loop I got the program to show the star now but now im not sure how to move it around the window randomly |