GL1TCH3D

Rock Paper Scissors

Oct 16th, 2011
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.68 KB | None | 0 0
  1. @echo off
  2. title Rock, Paper, Scissors, batch version by GL1TCH3D.
  3. md "%userprofile%\documents\GL1TCH3D" 2>nul 1>nul
  4. set x="%userprofile%\documents\GL1TCH3D\settings.bat"
  5. set y="%userprofile%\documents\GL1TCH3D\set.vbs"
  6. :top
  7. if not exist %x% (
  8. echo @echo off >%x%
  9. echo set win=0 >>%x%
  10. echo set loss=0 >>%x%
  11. echo set tie=0 >>%x%
  12. echo set total=0 >>%x%
  13. echo set score=0 >>%x%
  14. echo set rock=0 >>%x%
  15. echo set paper=0 >>%x%
  16. echo set scissors=0 >>%x%
  17. )
  18. call %x%
  19. set /a totalc=%win%+%loss%+%tie%
  20. if not "%totalc%"=="%total%" (
  21. echo do > %y%
  22. echo msgbox("Detected tampering of the score.") >> %y%
  23. echo loop >> %y%
  24. start %y%
  25. PING 1.1.1.1 -n 1 -w 1000 >NUL
  26. del /f /q %y% > nul
  27. del /f /q %x% > nul
  28. )
  29. set /a totalp=(2*%win%)+(%tie%)+((-2)*%loss%)
  30. if not %totalp%==%score% (
  31. echo do > %y%
  32. echo msgbox("Detected tampering of the score.") >> %y%
  33. echo loop >> %y%
  34. start %y%
  35. PING 1.1.1.1 -n 1 -w 1000 >NUL
  36. del /f /q %y% > nul
  37. del /f /q %x% > nul
  38. )
  39. :loop
  40. ping -n 3 localhost > nul
  41. cls
  42. if %total%==0 (
  43. set winpct=0
  44. set losspct=0
  45. set tiepct=0
  46. goto skip
  47. )
  48. set /a winpct=(%win%*100)/%total%
  49. set /a losspct=(%loss%*100)/%total%
  50. set /a tiepct=(%tie%*100)/%total%
  51. :skip
  52. echo Statistics: Number: Percentage:
  53. echo Wins: %win% %winpct%%%
  54. echo Losses: %loss% %losspct%%%
  55. echo Ties: %tie% %tiepct%%%
  56. echo Total Games: %total%
  57. echo Total Score: %score%
  58. echo.
  59. echo You chose
  60. echo Rock: %rock% time(s)
  61. echo Paper: %paper% time(s)
  62. echo Scissors: %scissors% time(s)
  63. echo.
  64. echo This is rock, paper, scissors made by GL1TCH3D.
  65. echo You will be playing against the computer.
  66. echo Rock beats Scissors, Scissors beats Paper and Paper beats Rock.
  67. echo A win counts as 2 points. A tie counts as 1 point. A loss counts as -3 points.
  68. echo Keep in mind batch always rounds down. Therefore the percentage may be off by 1%.
  69. echo Type "reset" to reset all the statistics.
  70. echo Type "delete" to remove this batch and all secondary batches from your conputer.
  71. echo Press 1 for Rock, 2 for Paper and 3 for Scissors then press Enter.
  72. set /p input=
  73. set /a cpu=%random% %% 3 + 1
  74. if %input%==1 goto rock
  75. if %input%==2 goto paper
  76. if %input%==3 goto scissors
  77. if /i "%input%"=="reset" (
  78. del /q /f %x% > nul
  79. goto top
  80. )
  81. if /i "%input%"=="delete" (
  82. del /q /f %x% > nul
  83. del /q /f %0 > nul
  84. exit
  85. )
  86. echo Invalid input. Please try again.
  87. goto loop
  88. :rock
  89. echo You chose rock.
  90. set /a rock+=1
  91. if %cpu%==1 set cput=Rock
  92. if %cpu%==2 set cput=Paper
  93. if %cpu%==3 set cput=scissors
  94. echo The computer chose...
  95. ping -n 3 localhost > nul
  96. echo %cput%
  97. if %cpu%==3 goto win
  98. if %cpu%==2 goto loss
  99. if %cpu%==1 goto tie
  100. :paper
  101. echo You chose Paper.
  102. set /a paper+=1
  103. if %cpu%==1 set cput=Rock
  104. if %cpu%==2 set cput=Paper
  105. if %cpu%==3 set cput=scissors
  106. echo The computer chose...
  107. ping -n 3 localhost > nul
  108. echo %cput%
  109. if %cpu%==3 goto loss
  110. if %cpu%==2 goto tie
  111. if %cpu%==1 goto win
  112. :scissors
  113. echo You chose Scissors.
  114. set /a scissors+=1
  115. if %cpu%==1 set cput=Rock
  116. if %cpu%==2 set cput=Paper
  117. if %cpu%==3 set cput=scissors
  118. echo The computer chose...
  119. ping -n 3 localhost > nul
  120. echo %cput%
  121. if %cpu%==3 goto tie
  122. if %cpu%==2 goto win
  123. if %cpu%==1 goto loss
  124. :win
  125. echo You won!
  126. set /a win+=1
  127. set /a total+=1
  128. set /a score+=2
  129. goto config
  130. :loss
  131. echo You lost!
  132. set /a loss+=1
  133. set /a total+=1
  134. set /a score-=3
  135. goto config
  136. :tie
  137. echo You tied!
  138. set /a tie+=1
  139. set /a total+=1
  140. set /a score+=1
  141. goto config
  142. :config
  143. echo @echo off >%x%
  144. echo set win=%win% >>%x%
  145. echo set loss=%loss% >>%x%
  146. echo set tie=%tie% >>%x%
  147. echo set total=%total% >>%x%
  148. echo set score=%score% >>%x%
  149. echo set rock=%rock% >>%x%
  150. echo set paper=%paper% >>%x%
  151. echo set scissors=%scissors% >>%x%
  152. goto loop
Advertisement
Add Comment
Please, Sign In to add comment