您好,今天帅帅来为大家解答以上的问题。简单的病毒编程代码,bat小游戏代码大全相信很多小伙伴还不知道,现在让我们一起来看看吧!
1、效果图:核心代码:复制代码 代码如下: @echo off&setlocal enabledelayedexpansionset li0=┌───────────────────┐set li1=│┌┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┐│1for /l %%a in (2,1,18) do (set li%%a=│├┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤│%%a)set li19=│└┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┘│19set li20=└───────────────────┘set li21= A B C D E F G H I J K L M N O P Q R Sfor %%a in (%li21%) do (set/a .+=1,%%a=.&set z!.!=%%a)set z0= &set z20= &set "z21= "set li5=!li5! 五 棋 子 人 机 对 战set li7=!li7! 批 处 理set li9=!li9! 电 脑 水 平 中 等set li12=!li12! 由 netbenton 编写完成set li14=!li14! 棋盘设计参照了 batmantitle 批处理五子棋set str=###################set .=0for /l %%a in (1,1,19) do ( set he%%a=!str!&set sh%%a=!str! for /l %%b in (1,1,19) do set [%%a.%%b=0)set .=33for /l %%a in (5,1,19) do ( set pi%%a=!str:~,%%a!&set ni%%a=!str:~,%%a! set pi!.!=!str:~,%%a!&set ni!.!=!str:~,%%a! set/a .-=1)set ●=○&set a●=电脑set ○=●&set a○=玩家::设置电脑IQset idea=@@@@#1 #@@@@5 @#@@@4 @@@#@2 @@#@@3 $#$$$4 $$#$$3 $$$#$2 $$$$#1 #$$$$5 #$$#$#3 #$#$$#4 #@@@##2 ##@@@#5 #@@#@#3 #@#@@#4 #@@@#1set idea=!idea! ##@@@4 @@@##2 ##$$$#5 #$$$##2 #$$$#1 ##@@#4 #@@##2 ##$$#4 #$$##2 #$#$#3 @@###3 ###@@3set idea=!idea! ##@##2 ###@#3 #@###3 @####4 ####@2 ##############7 ###########6 ########4 #####3 ####2set ttr=!idea:@=●!&set ttr=!ttr:$=○!for %%a in (!ttr!) do (set var=%%a&set !var:~,-1!=!var:~-1!&set idea=!idea! !var:~,-1!)set ttr=::设置电脑IQ:restartfor /l %%a in (0,1,21) do (echo !z%%a!!li%%a!)setlocal enabledelayedexpansionset li21=!li21! reboot重新开始,exit退出。
2、set /p var=选择谁先下[ W,玩家 D,电脑 Q,退出 ]:if /i "!var!" equ "Q" goto :eofif /i "!var!" equ "W" (set zhi=●) else (set zhi=○)echo.:loopif %zhi% equ ● goto :menset .=&set put1=for %%a in (!idea!) do ( for %%b in (he sh) do ( for /l %%c in (1,1,19) do ( if "!%%b%%c:%%a=!" neq "!%%b%%c!" set/a .+=1&set put!.!=%%b %%c ) ) for %%b in (pi ni) do ( for /l %%c in (5,1,33) do ( if "!%%b%%c:%%a=!" neq "!%%b%%c!" set/a .+=1&set put!.!=%%b %%c ) )if defined put1 set put=%%a&goto :get)echo. 已经和棋了pausegoto :restart:menfor /l %%a in (0,1,21) do (echo !z%%a!!li%%a!)set /p user=[列前,行后]:echo.if "!user!" equ "reboot" endlocal&goto :restartif "!user!" equ "exit" exitset/a pos=!user:~0,1!,poh=!user:~1,2!,var=pos-1 2>nulif not defined [!poh!.!pos! echo 输入点不存在&goto :menif "!he%poh%:~%var%,1!" neq "#" echo 该点已经有子&goto mengoto :getok:getset /a .=!random!%%.+1set put=!put%.%! !put!::随机取最佳的走法for /f "tokens=1-3" %%a in ("%put%") do ( set var=!%%a%%b:*%%c=!srqponmlkjihgfedcba0 set/a var=!var:~19,1!+%%c if "%%a" equ "he" (set/a poh=%%b,pos=20-var) if "%%a" equ "sh" (set/a poh=20-var,pos=%%b) if %%b lss 19 (set/a var=%%b-var+1) else (set/a var=38-%%b-var+1) if "%%a" equ "pi" (if %%b lss 19 (set/a pos=var,poh=%%b-var+1) else (set/a poh=20-var,pos=%%b-19+var)) if "%%a" equ "ni" (if %%b lss 19 (set/a pos=var,poh=19-%%b+var) else (set/a poh=var,pos=%%b-19+var)))echo 电脑最后下在:!z%pos%!!z%poh%!(%poh%):getokset zhi=!%zhi%!&set win=!zhi!!zhi!!zhi!!zhi!!zhi!set/a piph=poh+pos-1,lips=pos+1,niph=19+pos-pohif !piph! lss 19 (set/a pips=pos) else (set/a pips=20-poh)if !niph! lss 19 (set/a nips=pos) else (set/a nips=poh)for %%a in ("li!poh! !lips!" "he!poh! !pos!" "sh!pos! !poh!" "pi!piph! !pips!" "ni!niph! !nips!") do ( for /f "tokens=1,2" %%b in (%%a) do ( if defined %%b ( set/a .=%%c-1 for %%d in (!.!) do (set %%b=!%%b:~0,%%d!%zhi%!%%b:~%%c!) if "!%%b:%win%=!" neq "!%%b!" set win=y ) ))set/a asc%zhi%+=1if !win! neq y goto :loopfor /l %%a in (0,1,21) do (echo !z%%a!!li%%a!)set/p= !a%zhi%! %zhi%子 第!asc%zhi%!手 胜出 本文就为大家分享到这里,希望小伙伴们会喜欢。