Advertisement
SmartGenius

Pairs (aka Memory) Batch Game

May 18th, 2012
754
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 2.27 KB | None | 0 0
  1. @Echo Off
  2. @Title The Pair Game
  3. @Mode Con Cols=30 Lines=12
  4.  
  5. Setlocal Enabledelayedexpansion
  6. Color 0a
  7. Colous Cursoroff
  8.  
  9. ::Batch Game - The Pair Game
  10. ::Coded by SmartGenius
  11. ::Using COLOUS command from Bolivianito
  12. ::SmartGenius, Corp. 2010
  13.  
  14. :Load
  15. Call :GenSymbols
  16. Call :InitVars
  17.  
  18. :Init
  19. Cls
  20. Echo.
  21. Echo. ÚÄÂÄÂÄÂÄÂÄÂÄ¿
  22. Echo. ³°³°³°³°³°³°³ Puntaje:%Points%
  23. Echo. ÃÄÅÄÅÄÅÄÅÄÅÄ´
  24. Echo. ³°³°³°³°³°³°³
  25. Echo. ÃÄÅÄÅÄÅÄÅÄÅÄ´
  26. Echo. ³°³°³°³°³°³°³
  27. Echo. ÃÄÅÄÅÄÅÄÅÄÅÄ´
  28. Echo. ³°³°³°³°³°³°³
  29. Echo. ÀÄÁÄÁÄÁÄÁÄÁÄÙ
  30. Echo.
  31.  
  32. :Coord
  33. Set /a "R+=1"
  34. For /f "tokens=*" %%a in ('Colous Mouse') do (Call :Check %%a)
  35. Colous 14 8 24,3 "!Points!  "
  36. If "%Pairs%"=="12" (
  37. Colous 14 8 16,6 "You Win, press"
  38. Colous 14 8 16,7 "  any key to"
  39. Colous 14 8 16,8 " restart game"
  40. Pause >nul
  41. Goto :Load
  42. )
  43. Goto :Coord
  44.  
  45. :Check
  46. For /l %%X in (3,2,13) do (
  47. For /l %%Y in (3,2,9) do (
  48. If Defined O_%~2_%~3 (Goto :Eof)
  49. If "%~2 %~3"=="%%X %%Y" (
  50. Colous 12 8 %2,%3 !V_%~2_%~3!
  51. If Not Defined Sel_1 (
  52. Set "Sel_1=!V_%~2_%~3!"
  53. Set "Pos_1=%~2,%~3"
  54. Goto :Eof
  55. )
  56. If Not Defined Sel_2 (
  57. Set "Sel_2=!V_%~2_%~3!"
  58. Set "Pos_2=%~2,%~3"
  59. )
  60. If Not "!Sel_1!"=="!Sel_2!" (
  61. Set /a "Points-=5"
  62. Ping -n 2 localhost >nul
  63. Colous 10 8 !Pos_1! $176
  64. Colous 10 8 !Pos_2! $176
  65. Set "Sel_1="
  66. Set "Sel_2="
  67. Goto :Eof
  68. ) else (
  69. Set /a "Points+=10"
  70. Set /a "Pairs+=1"
  71. Ping -n 2 localhost >nul
  72. Colous 0 8 !Pos_1! $219
  73. Colous 0 8 !Pos_2! $219
  74. Set "Sel_1="
  75. Set "Sel_2="
  76. Call :Def !Pos_1! !Pos_2!
  77. Goto :Eof
  78. ))))
  79. Goto :Eof
  80.  
  81. :Def
  82. If "%~1"=="" Goto :Eof
  83. Set "O_%~1_%~2=Nul"
  84. Shift&Shift
  85. Goto :Def
  86.  
  87. :GenSymbols
  88. Set "Symbols=$001,$002,$003,$004,$005,$006,$011,$012,$014,$015,$020,$021"
  89. For %%S in (%Symbols%) do (
  90. Set /a "S+=1"
  91. Set "Symbol_!S!=%%S"
  92. )
  93. Goto :Eof
  94.  
  95. :InitVars
  96. For /l %%X in (3,2,13) do (
  97. For /l %%Y in (3,2,9) do (
  98. Call :Generate "%%X" "%%Y"
  99. Set "O_%%X_%%Y="
  100. ))
  101. Set /a "Points=0","Pairs=0"
  102. Goto :Eof
  103.  
  104. :Generate
  105. Set /a "RX=(!Random! %% 12)+1"
  106. If Defined Sym_%RX% (Goto :Generate)
  107. If Not Defined S1_%RX% (
  108. Set "V_%~1_%~2=!Symbol_%RX%!"
  109. Set "S1_%RX%=Nul"
  110. Goto :Eof
  111. )
  112. If Not Defined S2_%RX% (
  113. Set "V_%~1_%~2=!Symbol_%RX%!"
  114. Set "S2_%RX%=Nul"
  115. Goto :Eof
  116. )
  117. Set "Sym_%RX%=Nul"
  118. Goto :Generate
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement