GonZor Posted December 1, 2007 Share Posted December 1, 2007 Ever wondered if you could make a Rock, Paper, Scissors game in Batch? Well, its possible... Ok, After a suggestion by my girl I made this, it isn't the best code. It's five minutes of work but I thought I'd share my pointless exercise with the community. Enjoy I hope you have hours of fun playing!@ECHO off set wins=0 set loss=0 set draws=0 :start CLS ECHO. ECHO. ECHO ------------------------------------------------------------------------------- ECHO. ECHO Rock, Paper, Scissors ECHO By GonZor ECHO ------------------------------------------------------------------------------- ECHO Wins: %wins% Losses: %loss% Draws: %draws% ECHO ------------------------------------------------------------------------------- ECHO. SET choice= SET RndNum=%time:~10,1% IF '%RndNum%' == '0' SET comp=1 IF '%RndNum%' == '1' SET comp=2 IF '%RndNum%' == '2' SET comp=3 IF '%RndNum%' == '3' SET comp=1 IF '%RndNum%' == '4' SET comp=2 IF '%RndNum%' == '5' SET comp=3 IF '%RndNum%' == '6' SET comp=1 IF '%RndNum%' == '7' SET comp=2 IF '%RndNum%' == '8' SET comp=3 IF '%RndNum%' == '9' SET comp=1 ECHO 1. Rock ECHO 2. Paper ECHO 3. Scissors ECHO. SET /p choice="startect Rock, Paper or Scissors: " IF '%choice%' == '1' GOTO rock IF '%choice%' == '2' GOTO paper IF '%choice%' == '3' GOTO scissors IF '%choice%' == '666' ( GOTO cool ) ELSE ( GOTO start ) :rock IF '%comp%' == '1' GOTO draw IF '%comp%' == '2' GOTO lose GOTO win :paper IF '%comp%' == '2' GOTO draw IF '%comp%' == '3' GOTO lose GOTO win :scissors IF '%comp%' == '3' GOTO draw IF '%comp%' == '1' GOTO lose GOTO win :lose SET /a loss=%loss% + 1 CLS ECHO. ECHO. ECHO ------------------------------------------------------------------------------- ECHO. ECHO YOU LOSE! ECHO. ECHO ------------------------------------------------------------------------------- PAUSE GOTO start :win SET /a wins=%wins% + 1 CLS ECHO. ECHO. ECHO ------------------------------------------------------------------------------- ECHO. ECHO YOU WIN! ECHO. ECHO ------------------------------------------------------------------------------- PAUSE GOTO start :draw SET /a draws=%draws% + 1 CLS ECHO. ECHO. ECHO ------------------------------------------------------------------------------- ECHO. ECHO DRAW! ECHO. ECHO ------------------------------------------------------------------------------- PAUSE GOTO start :cool SET /a wins=%wins% + 666 CLS ECHO. ECHO. ECHO ------------------------------------------------------------------------------- ECHO. ECHO YOU'RE AWESOME!! ECHO. ECHO ------------------------------------------------------------------------------- PAUSE GOTO start [me=GonZor]got bored :-([/me] And about the '666', she wanted a cheat :PEDIT - Just added a wins/losses/draws summary. Thanks to Marcs request. Quote Link to comment Share on other sites More sharing options...
DLSS Posted December 1, 2007 Share Posted December 1, 2007 lol ^^ nice :-P Quote Link to comment Share on other sites More sharing options...
digip Posted December 1, 2007 Share Posted December 1, 2007 Decided to give it a try in VB6: http://www.twistedpairrecords.com/digip/Ro...er_Scissors.rar All soucrce code to VB6 project plus exe in rar file. Edit: Fixed bug. Gave a loss when it was actually a win. Quote Link to comment Share on other sites More sharing options...
trustme Posted December 1, 2007 Share Posted December 1, 2007 If anyone is wondering, this is why he hasn't released anything in a while... we've been developing this amazing rock paper scissors game for months now. :-P Quote Link to comment Share on other sites More sharing options...
digip Posted December 1, 2007 Share Posted December 1, 2007 If anyone is wondering, this is why he hasn't released anything in a while... we've been developing this amazing rock paper scissors game for months now. :-P lol Quote Link to comment Share on other sites More sharing options...
GonZor Posted December 2, 2007 Author Share Posted December 2, 2007 Decided to give it a try in VB6: http://www.twistedpairrecords.com/digip/Ro...er_Scissors.rar All soucrce code to VB6 project plus exe in rar file. Edit: Fixed bug. Gave a loss when it was actually a win. Dam, its much prettier! Nice work! One question, where's the cheat? :P Quote Link to comment Share on other sites More sharing options...
digip Posted December 2, 2007 Share Posted December 2, 2007 Decided to give it a try in VB6: http://www.twistedpairrecords.com/digip/Ro...er_Scissors.rar All soucrce code to VB6 project plus exe in rar file. Edit: Fixed bug. Gave a loss when it was actually a win. Dam, its much prettier! Nice work! One question, where's the cheat? :P Well, I didn't want some user key combo, etc, type cheat. There are a few lines in there commented out that when in place, will allow you the pc to guess a 0 or 4 which = forfeit for the game. In otherwords, it ups your chances of winning, but you can add something, like a key combo of "ctrl+alt+whatever" = a win, or if you enabled a little text box and button that appeard on certain key combo and type god and submit it gives you 777 wins, etc, but I personally didn't add an easy cheat methods. Quote Link to comment Share on other sites More sharing options...
digip Posted December 2, 2007 Share Posted December 2, 2007 Ok. Added a cheat code. When in game play, hit the 0 (zero) key and get the "GOD" button. 777 points will be added if you decide to cheat. http://www.twistedpairrecords.com/digip/Ro...er_Scissors.rar Quote Link to comment Share on other sites More sharing options...
Mark Manching Posted December 2, 2007 Share Posted December 2, 2007 Decided to give it a try in VB6: http://www.twistedpairrecords.com/digip/Ro...er_Scissors.rar All soucrce code to VB6 project plus exe in rar file. Edit: Fixed bug. Gave a loss when it was actually a win. Dam, its much prettier! Nice work! One question, where's the cheat? :P Well, I didn't want some user key combo, etc, type cheat. There are a few lines in there commented out that when in place, will allow you the pc to guess a 0 or 4 which = forfeit for the game. In otherwords, it ups your chances of winning, but you can add something, like a key combo of "ctrl+alt+whatever" = a win, or if you enabled a little text box and button that appeard on ceartain key combo and type god and submit it gives you 777 wins, etc, but I personally didn't add an easy cheat methods. in the command version type 666 Quote Link to comment Share on other sites More sharing options...
digip Posted December 2, 2007 Share Posted December 2, 2007 I chose 777 in light of the "GOD" button, but you could set it to anything. Quote Link to comment Share on other sites More sharing options...
Mark Manching Posted December 3, 2007 Share Posted December 3, 2007 like this? http://i151.photobucket.com/albums/s140/MarkManching/Cheater.jpg[/img] Quote Link to comment Share on other sites More sharing options...
digip Posted December 3, 2007 Share Posted December 3, 2007 like this? http://i151.photobucket.com/albums/s140/MarkManching/Cheater.jpg[/img] Yeah, I added that yesterday. :) Quote Link to comment Share on other sites More sharing options...
sablefoxx Posted December 6, 2007 Share Posted December 6, 2007 That is some of the finest batch script i have ever seen! :D Bravo Quote Link to comment Share on other sites More sharing options...
GonZor Posted December 6, 2007 Author Share Posted December 6, 2007 That is some of the finest batch script i have ever seen! :D Bravo Cheers, most people hate the way I write my code... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.