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

Username:   Password: 
 RegisterRegister   
 Rock Paper Scissors Game
Index -> Programming, Turing -> Turing Help
Goto page 1, 2  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
amirsonali




PostPosted: Thu Jan 12, 2006 8:34 pm   Post subject: Rock Paper Scissors Game

Hey I am a new Comp Science student and i have a small task which is almost impossible

I was wondering if anyone can help me with a creation of a rock paper scissors game. The assignment is more for a game based on rock paper sccisors except it has three diffrent objects. And the assingnor would like me to have mouse clicks to choose the objects and animation of one object beating the other ( for example rock crushing scissor)

if you can help me please reply or send email to amirsonali@hotmail.com
thks a bunch

Martin says:Please make more descriptive titles in the future. Carry on.
Sponsor
Sponsor
Sponsor
sponsor
Delos




PostPosted: Thu Jan 12, 2006 8:40 pm   Post subject: (No subject)

Hello. Welcome.

This post is classified as "Turing Help" since you're asking for help. If you were posting up Source Code, you'd post it there. I've moved it to the appropriate place. You'll get used to this rather simple organisational structure in due time.

Your assignment is by no means impossible. However, you are not going to very much help unless you show us first that you've put some effort into it. Post up some snippets of the code you have, or at least the ideas you have (the pseudocode).
Please bear in mind that if you do post code to:
a) use [code] or [syntax] tags.
b) ensure that the code runs when we press F1
c) indent (F2).
d) attach a file instead if it is long (more than about a page)
e) use meaningful variable names so that we don't have to decypher too much
f) comment where possible

Doing this will greatly increase your chances of having useful help bestowed up you. Don't worry about the emailing, all posts will be put here so as to benefit others as well who may be in similar situations.
Cervantes




PostPosted: Thu Jan 12, 2006 8:57 pm   Post subject: (No subject)

Cervantes, in the other thread wrote:

What specific problems are you having? If you don't know where to begin, try taking a look at the Turing Walkthrough to get you started.

Know that we don't do assignments for people. We'll help, but you have to have tried yourself to deserve that help. What algorithms/code have you got?


person, in the other thread wrote:

please delete this thread, u already have another one asking for the same thing

person, I'm fairly sure he can't delete his own thread. If you're talking to the staff: I don't mean to be rude, but we can think for ourselves. Replying to these threads to say things like that just makes it harder to clean up the mess.
person




PostPosted: Thu Jan 12, 2006 9:01 pm   Post subject: (No subject)

Quote:
person, I'm fairly sure he can't delete his own thread


srry, i didnt know that
Albrecd




PostPosted: Fri Jan 13, 2006 9:38 am   Post subject: (No subject)

Anyway... back to the topic of Rock, Paper, Scissors...

You could use randint to determine what the computer will choose:

code:
var CompSelection : int

randint (CompSelection, 1, 3)
if CompSelection = 1 then
    %Draw Rock
elsif CompSelection = 2 then
    %Draw Paper
else  %(if CompSelection = 3)
    %Draw Scissors
end if
amirsonali




PostPosted: Mon Jan 16, 2006 6:34 pm   Post subject: (No subject)

Hey heres the game playing part of the code, this is just mostly type and select, i am still struggling with using mouse clicks and MOuse.Wait stuff

If some one could just put the code in a loop where by the text doesn't repeat that would be nice, i just can't figure it out. Like where the user enters 3 games, and the comp or user have to win atleast 2 games. the program only plays one game, and if its a tie it just stops. I want it to loop or start another game.

Please Help



game loop.t
 Description:
snm=snowman like supposedly an object

snb=snowball, another object

man=man=another object (all three are like rock paper and scissors cept a diffrent name for them)

cpuw, userw=comp wins, user wins

pley=best of that many games

calc=how many

Download
 Filename:  game loop.t
 Filesize:  1.27 KB
 Downloaded:  147 Time(s)

iker




PostPosted: Mon Jan 16, 2006 6:49 pm   Post subject: (No subject)

LOOPS

try something like (not copy and paste, because this is an example)
code:

var games,wins, losses, computerchoice, playerchoice : int

put "how many games..."
get games

loop
    put "chose 1,2,3
    get playerchoice
    randint (computerchoice,1,3)
    if playerchoice = 3 and computer choice = 1 then
    wins +=1
    elsif playerchoice = 1 and computer choice = 3 the
    losses +=1
    ..
    ..
    ..
    if wins / games >= .5 or losses / games >= .5 then
        exit
    end if
end loop
put "you won ", wins, " out of ", games, "games"


try putting your code into this 'template' and it should work, if not, just ask and someone or I will see whats wrong
amirsonali




PostPosted: Mon Jan 16, 2006 7:52 pm   Post subject: (No subject)

Hey Thks a bunch, but how do make a the computer choose a random option every game, like right now the user picks 1 and the cpu picks 1 its a tie, and if the user picks 1 again its still a tie, the thing continues

attached-please help



game loop1.t
 Description:
snm=snowman like supposedly an object

snb=snowball, another object

man=man=another object (all three are like rock paper and scissors cept a diffrent name for them)

cpuw, userw=comp wins, user wins

pley=best of that many games

calc=how many

Download
 Filename:  game loop1.t
 Filesize:  1.44 KB
 Downloaded:  114 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
Rasta Fella




PostPosted: Mon Jan 16, 2006 8:37 pm   Post subject: (No subject)

amirsonali, if you correctly use Iker's template and post the attachment it will help us figure the syntax error(if you are) getting. In Iker's template is says var "computerchoice" use that as a variable and make a randint.
amirsonali




PostPosted: Mon Jan 16, 2006 8:47 pm   Post subject: (No subject)

Rasta Fella wrote:
amirsonali, if you correctly use Iker's template and post the attachment it will help us figure the syntax error(if you are) getting. In Iker's template is says var "computerchoice" use that as a variable and make a randint.


he said use it as a guidline (example) so i did, but all i want is for the loop too change the random integer everytime the program runs the loop
amirsonali




PostPosted: Mon Jan 16, 2006 8:49 pm   Post subject: (No subject)

amirsonali wrote:
Rasta Fella wrote:
amirsonali, if you correctly use Iker's template and post the attachment it will help us figure the syntax error(if you are) getting. In Iker's template is says var "computerchoice" use that as a variable and make a randint.


he said use it as a guidline (example) so i did, but all i want is for the loop too change the random integer everytime the program runs the loop


nvm

how do u unsend?
chrispminis




PostPosted: Mon Jan 16, 2006 10:40 pm   Post subject: (No subject)

unsend... as in delete your previous posts? no can do, not in the help section. We keep these topics alive so that others may search the forum for topics related to their questions. So what you may consider useless, might be the same mistakes someone else is trying to correct.
Albrecd




PostPosted: Tue Jan 17, 2006 8:43 am   Post subject: (No subject)

If you want the computer to pick at random, use:

code:
randint (computerChoice, 1, 3)
if computerChoice = 1 then
%Computer chooses paper
elsif computerChoice = 2 then
%Computer chooses rock
elsif computerChoice = 3 then
%Computer chooses scissors
end if
Cervantes




PostPosted: Tue Jan 17, 2006 1:59 pm   Post subject: (No subject)

Albrecd wrote:
If you want the computer to pick at random, use:

code:
randint (computerChoice, 1, 3)
...


wtd wrote:

Someday the world will realize the evils of procedures and learn to embrace functions. Mutable state is something that should be avoided when possible.


code:

computerChoice := Rand.Int (1, 3)
iker




PostPosted: Tue Jan 17, 2006 5:51 pm   Post subject: (No subject)

I actualy went along and made a rock paper scissers game in like 3 minutes, directly from my template, and it does exactly what you want it to do.. It randomizes the computers choice every time..
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 2  [ 19 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: