Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Having a problem with The "brownianMotion" program. Thanks
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
SpadeZAceZ




PostPosted: 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>

Turing:


% The "BrownianMotion" program
% Moves an asterisk around on
% the window like a smoke particle
% This is known as Brownian motion
% Color window green
colorback (green)
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 "*" ..
        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



Please specify what version of Turing you are using
<Answer Here>
Sponsor
Sponsor
Sponsor
sponsor
SpadeZAceZ




PostPosted: 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
SpadeZAceZ




PostPosted: 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
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: