标题: [游戏娱乐] 批处理游戏10点半(2008-04-26更新) [打印本页]
作者: yslyxqysl 时间: 2009-4-19 12:31 标题: 批处理游戏10点半(2008-04-26更新)
最新更新日期:09-4-26- @echo off
- if "%1"=="/?" call :help
- mode con lines=16 cols=40
- title 10点半 by yslyxqysl&color 0e
- setlocal ENABLEDELAYEDEXPANSION
- set f=&set "poker= "&set /a pw=0,cw=0
- set "c=(call :give p&if ^!begin^!a==oa set begin=&goto shuffle)"
- set "g=!c:p=c!&if ^!ca^! geq 11 (goto show) else if ^!ca^!^!cs^!==10.5 (goto show) else goto cpu"
- :shuffle
- cls&echo 洗牌中...
- :shuffle2
- set /a tp=%random%%%52+4
- if "!poker: %tp% = !"=="!poker!" set "poker=!poker!%tp% "&set /a num+=1
- if "%num%"=="52" (set num=0) else goto shuffle2
- :reset
- for %%i in (p c) do set /a %%in=0,%%in=0,%%ia=0&set %%is=
- %c%&%c:p=c%
- :player
- cls&echo 电脑:%cw%盘
- echo ┏┳┓
- echo ┣╋┫
- echo ┣╋┫
- echo ┗┻┛
- echo 和:*&for /l %%i in (1 1 20) do set /p =─<nul
- echo 玩家:%pw%盘
- for /l %%a in (1 1 %pn%) do set /p =┏━┓<nul
- echo.&for /l %%b in (1 1 %pn%) do set /p =┃!p%%bf! ┃<nul
- echo.&for /l %%c in (1 1 %pn%) do ^
- set /p =┃!p%%cn!<nul&(if "!p%%cn:~1,1!"=="" set /p = <nul)&set /p =┃<nul
- echo.&for /l %%d in (1 1 %pn%) do set /p =┗━┛<nul
- echo.&echo 和:%pa%!ps!&echo.&set do=&set /p "do=要吗?:"
- if "!do!"=="" %c%
- if /i "!do!"=="c" set /a pw=0,cw=0&goto player
- if /i "!do!"=="r" set "poker= "&goto shuffle
- if /i "!do!"=="e" exit
- if /i "!do!"=="h" call :help&goto player
- if "!do!"==" " goto cpu
- if %pn% equ 5 if %pa% lss 11 goto cpu
- if %pa% geq 11 (goto show) else if %pn% equ 5 (goto cpu) else ^
- if "%pa%%ps%"=="10.5" (goto cpu) else goto player
- :cpu
- if %cn% equ 5 (goto show) else if %pn% equ 5 %g%
- if %ca% equ %pa% if not %ps%a%cs%==.5a (goto show) else %g%
- if %ca% gtr %pa% (goto show) else %g%
- :show
- if %pa% gtr %ca% set winner=p
- if %pa% lss %ca% set winner=c
- if %pa% equ %ca% (if %ps%a%cs%==.5a set winner=p)&if %ps%a%cs%==a.5 set winner=c
- if %cn% equ 5 set winner=c
- if %pn% equ 5 if %cn% equ 5 (if %pa% gtr %ca% (set winner=p) else ^
- if %pa% lss %ca% (set winner=c) else set winner=) else set winner=p
- if %pa% geq 11 set winner=c
- if %ca% geq 11 set winner=p
- if "%winner%"=="p" set /a pw+=1
- if "%winner%"=="c" set /a cw+=1
- cls&echo 电脑:%cw%盘
- for /l %%a in (1 1 %cn%) do set /p =┏━┓<nul
- echo.&for /l %%b in (1 1 %cn%) do ^
- set /p =┃!c%%bf!<nul&if "!c%%bf:~1,1!"=="" (set /p = ┃<nul) else set /p =┃<nul
- echo.&for /l %%c in (1 1 %cn%) do ^
- set /p =┃!c%%cn!<nul&if "!c%%cn:~1,1!"=="" (set /p = ┃<nul) else set /p =┃<nul
- echo.&for /l %%d in (1 1 %cn%) do set /p =┗━┛<nul
- echo.&echo 和:%ca%%cs%&(for /l %%i in (1 1 20) do set /p =─<nul)&echo 用户:%pw%盘
- for /l %%a in (1 1 %pn%) do set /p =┏━┓<nul
- echo.&for /l %%b in (1 1 %pn%) do ^
- set /p =┃!p%%bf!<nul&if "!p%%bf:~1,1!"=="" (set /p = ┃<nul) else set /p =┃<nul
- echo.&for /l %%c in (1 1 %pn%) do ^
- set /p =┃!p%%cn!<nul&if "!p%%cn:~1,1!"=="" (set /p = ┃<nul) else set /p =┃<nul
- echo.&(for /l %%d in (1 1 %pn%) do set /p =┗━┛<nul)&echo.&echo 和:%pa%%ps%&echo.
- if "%winner%"=="p" (set /p =玩家胜^^!<nul) else ^
- if "%winner%"=="c" (set /p =电脑胜^^!<nul) else set /p =平^^!<nul
- set winner=&ping /n 4 127.^1>nul&cls&goto reset
- :give
- if "!poker!"==" " set begin=o&goto :eof
- set /a %1n+=1
- if "!%1s!"=="" (set %1s=0) else set %1s=5
- if "%poker:~2,1%"==" " (set "tp=%poker:~1,1%"&set "poker=!poker:~2!") else ^
- set tp=%poker:~1,2%&set "poker=!poker:~3!"
- set /a %1!%1n!n=%tp%/4
- set /a tp=%tp%%%4
- set %1!%1n!f=!f:~%tp%,1!
- call set tp=%%%1!%1n!n%%
- if %tp%==11 (set /a %1s+=5&set %1!%1n!n=J) else (
- if %tp%==12 (set /a %1s+=5&set %1!%1n!n=Q) else (
- if %tp%==13 (set /a %1s+=5&set %1!%1n!n=K) else (
- set /a %1a+=%tp%
- )))
- set /a %1a+=!%1s!/10,%1s=!%1s!%%10
- if !%1s!==0 (set %1s=) else set %1s=.5
- goto :eof
- :help
- cls
- echo Page 1/2
- echo 游戏规则:
- echo ^
- 游戏开始,玩家和庄家每人得到一张牌,选择^
- 要牌与否使牌的点数和接近10点半又不超过10^
- 点半。当点数和大于或等于10点半时自动停止^
- 要牌。如果拿到五张牌仍没有超过10点半就比^
- 任何点数都要大。当双方都拿到“五小”时就^
- 按正常规则计算胜负。双方要完牌后,谁的点^
- 数和最接近10点半又不超过10点半就获胜。
- echo 请注意,庄家看得到玩家要牌的全过程。
- echo.
- echo 牌的点数:
- echo 1-10 1-10
- echo J Q K 0.5
- pause>nul&cls
- echo Page 2/2
- echo 操作方法:
- echo 回车 要牌
- echo 空格+回车 不要牌
- echo C 成绩清零
- echo R 洗牌
- echo E 退出
- echo H 帮助
- echo.
- echo 声明:电脑绝对不会作弊。
- pause>nul&goto :eof
复制代码
作者: Bluezhao 时间: 2010-5-12 20:50
有点算法说明就更完美了
作者: garyng 时间: 2011-9-1 20:46
这句很好笑~
欢迎光临 批处理之家 (http://bathome.net./) |
Powered by Discuz! 7.2 |