[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖

[游戏娱乐] 批处理游戏10点半(2008-04-26更新)

最新更新日期:09-4-26
  1. @echo off
  2. if "%1"=="/?" call :help
  3. mode con lines=16 cols=40
  4. title 10点半  by yslyxqysl&color 0e
  5. setlocal ENABLEDELAYEDEXPANSION
  6. set f=&set "poker= "&set /a pw=0,cw=0
  7. set "c=(call :give p&if ^!begin^!a==oa set begin=&goto shuffle)"
  8. set "g=!c:p=c!&if ^!ca^! geq 11 (goto show) else if ^!ca^!^!cs^!==10.5 (goto show) else goto cpu"
  9. :shuffle
  10. cls&echo 洗牌中...
  11. :shuffle2
  12. set /a tp=%random%%%52+4
  13. if "!poker: %tp% = !"=="!poker!" set "poker=!poker!%tp% "&set /a num+=1
  14. if "%num%"=="52" (set num=0) else goto shuffle2
  15. :reset
  16. for %%i in (p c) do set /a %%in=0,%%in=0,%%ia=0&set %%is=
  17. %c%&%c:p=c%
  18. :player
  19. cls&echo 电脑:%cw%盘
  20. echo ┏┳┓
  21. echo ┣╋┫
  22. echo ┣╋┫
  23. echo ┗┻┛
  24. echo 和:*&for /l %%i in (1 1 20) do set /p =─<nul
  25. echo 玩家:%pw%盘
  26. for /l %%a in (1 1 %pn%) do set /p =┏━┓<nul
  27. echo.&for /l %%b in (1 1 %pn%) do set /p =┃!p%%bf! ┃<nul
  28. echo.&for /l %%c in (1 1 %pn%) do ^
  29. set /p =┃!p%%cn!<nul&(if "!p%%cn:~1,1!"=="" set /p = <nul)&set /p =┃<nul
  30. echo.&for /l %%d in (1 1 %pn%) do set /p =┗━┛<nul
  31. echo.&echo 和:%pa%!ps!&echo.&set do=&set /p "do=要吗?:"
  32. if "!do!"=="" %c%
  33. if /i "!do!"=="c" set /a pw=0,cw=0&goto player
  34. if /i "!do!"=="r" set "poker= "&goto shuffle
  35. if /i "!do!"=="e" exit
  36. if /i "!do!"=="h" call :help&goto player
  37. if "!do!"==" " goto cpu
  38. if %pn% equ 5 if %pa% lss 11 goto cpu
  39. if %pa% geq 11 (goto show) else if %pn% equ 5 (goto cpu) else ^
  40. if "%pa%%ps%"=="10.5" (goto cpu) else goto player
  41. :cpu
  42. if %cn% equ 5 (goto show) else if %pn% equ 5 %g%
  43. if %ca% equ %pa% if not %ps%a%cs%==.5a (goto show) else %g%
  44. if %ca% gtr %pa% (goto show) else %g%
  45. :show
  46. if %pa% gtr %ca% set winner=p
  47. if %pa% lss %ca% set winner=c
  48. if %pa% equ %ca% (if %ps%a%cs%==.5a set winner=p)&if %ps%a%cs%==a.5 set winner=c
  49. if %cn% equ 5 set winner=c
  50. if %pn% equ 5 if %cn% equ 5 (if %pa% gtr %ca% (set winner=p) else ^
  51. if %pa% lss %ca% (set winner=c) else set winner=) else set winner=p
  52. if %pa% geq 11 set winner=c
  53. if %ca% geq 11 set winner=p
  54. if "%winner%"=="p" set /a pw+=1
  55. if "%winner%"=="c" set /a cw+=1
  56. cls&echo 电脑:%cw%盘
  57. for /l %%a in (1 1 %cn%) do set /p =┏━┓<nul
  58. echo.&for /l %%b in (1 1 %cn%) do ^
  59. set /p =┃!c%%bf!<nul&if "!c%%bf:~1,1!"=="" (set /p = ┃<nul) else set /p =┃<nul
  60. echo.&for /l %%c in (1 1 %cn%) do ^
  61. set /p =┃!c%%cn!<nul&if "!c%%cn:~1,1!"=="" (set /p = ┃<nul) else set /p =┃<nul
  62. echo.&for /l %%d in (1 1 %cn%) do set /p =┗━┛<nul
  63. echo.&echo 和:%ca%%cs%&(for /l %%i in (1 1 20) do set /p =─<nul)&echo 用户:%pw%盘
  64. for /l %%a in (1 1 %pn%) do set /p =┏━┓<nul
  65. echo.&for /l %%b in (1 1 %pn%) do ^
  66. set /p =┃!p%%bf!<nul&if "!p%%bf:~1,1!"=="" (set /p = ┃<nul) else set /p =┃<nul
  67. echo.&for /l %%c in (1 1 %pn%) do ^
  68. set /p =┃!p%%cn!<nul&if "!p%%cn:~1,1!"=="" (set /p = ┃<nul) else set /p =┃<nul
  69. echo.&(for /l %%d in (1 1 %pn%) do set /p =┗━┛<nul)&echo.&echo 和:%pa%%ps%&echo.
  70. if "%winner%"=="p" (set /p =玩家胜^^!<nul) else ^
  71. if "%winner%"=="c" (set /p =电脑胜^^!<nul) else set /p =平^^!<nul
  72. set winner=&ping /n 4 127.^1>nul&cls&goto reset
  73. :give
  74. if "!poker!"==" " set begin=o&goto :eof
  75. set /a %1n+=1
  76. if "!%1s!"=="" (set %1s=0) else set %1s=5
  77. if "%poker:~2,1%"==" " (set "tp=%poker:~1,1%"&set "poker=!poker:~2!") else ^
  78. set tp=%poker:~1,2%&set "poker=!poker:~3!"
  79. set /a %1!%1n!n=%tp%/4
  80. set /a tp=%tp%%%4
  81. set %1!%1n!f=!f:~%tp%,1!
  82. call set tp=%%%1!%1n!n%%
  83. if %tp%==11 (set /a %1s+=5&set %1!%1n!n=J) else (
  84. if %tp%==12 (set /a %1s+=5&set %1!%1n!n=Q) else (
  85.   if %tp%==13 (set /a %1s+=5&set %1!%1n!n=K) else (
  86.   set /a %1a+=%tp%
  87. )))
  88. set /a %1a+=!%1s!/10,%1s=!%1s!%%10
  89. if !%1s!==0 (set %1s=) else set %1s=.5
  90. goto :eof
  91. :help
  92. cls
  93. echo Page 1/2
  94. echo 游戏规则:
  95. echo ^
  96. 游戏开始,玩家和庄家每人得到一张牌,选择^
  97. 要牌与否使牌的点数和接近10点半又不超过10^
  98. 点半。当点数和大于或等于10点半时自动停止^
  99. 要牌。如果拿到五张牌仍没有超过10点半就比^
  100. 任何点数都要大。当双方都拿到“五小”时就^
  101. 按正常规则计算胜负。双方要完牌后,谁的点^
  102. 数和最接近10点半又不超过10点半就获胜。
  103. echo 请注意,庄家看得到玩家要牌的全过程。
  104. echo.
  105. echo 牌的点数:
  106. echo 1-10  1-10
  107. echo J Q K  0.5
  108. pause>nul&cls
  109. echo Page 2/2
  110. echo 操作方法:
  111. echo 回车  要牌
  112. echo 空格+回车 不要牌
  113. echo C  成绩清零
  114. echo R  洗牌
  115. echo E  退出
  116. echo H  帮助
  117. echo.
  118. echo 声明:电脑绝对不会作弊。
  119. pause>nul&goto :eof
复制代码

有点算法说明就更完美了

TOP

声明:电脑绝对不会作弊。


这句很好笑~

TOP

返回列表