本帖最后由 pcl_test 于 2015-3-15 19:47 编辑
回复 30# panda951
按你图的样式改了(说真的游戏体验没带格子的直观),记得给bailong360评分哟,多亏了他的思路- @Echo Off 2>nul 3>nul
- setlocal enabledelayedexpansion
- echo insert player name 1 :
- Set /P Player1=
- echo insert player name 1 :
- Set /P Player2=
- :Start
- Set /A N+=1
- Set .%N%=
- >nul Set .9||Goto Start
- :RT
- Set /a T+=1
- Set #%T%=%T%,
- >nul Set #9||Goto RT
- echo begin
- :Loop
- set num=!#1!!#2!!#3!!#4!!#5!!#6!!#7!!#8!!#9!
- set num=%num:~,-1%
- echo player 1 %player1% move ^<%num%^>:
- Set /P Turn=
- Set ..%Turn%&&Goto :Eof
- set #%Turn%=
- Set .%Turn%=O
- Set ..%Turn%=0
- Set "_%.1%%.2%%.3%=0"
- Set "_%.4%%.5%%.6%=0"
- Set "_%.7%%.8%%.9%=0"
- Set "_%.1%%.4%%.7%=0"
- Set "_%.2%%.5%%.8%=0"
- Set "_%.3%%.6%%.9%=0"
- Set "_%.1%%.5%%.9%=0"
- Set "_%.3%%.5%%.7%=0"
- >nul Set _OOO&&(echo player 1 %player1% win&Pause&Goto :Eof)
- set num=!#1!!#2!!#3!!#4!!#5!!#6!!#7!!#8!!#9!
- set num=%num:~,-1%
- echo player 2 %player2% move ^<%num%^>:
- Set /P Turn=
- Set ..%Turn%&&Goto :Eof
- set #%Turn%=
- Set .%Turn%=X
- Set ..%Turn%=0
- Set "_%.1%%.2%%.3%=0"
- Set "_%.4%%.5%%.6%=0"
- Set "_%.7%%.8%%.9%=0"
- Set "_%.1%%.4%%.7%=0"
- Set "_%.2%%.5%%.8%=0"
- Set "_%.3%%.6%%.9%=0"
- Set "_%.1%%.5%%.9%=0"
- Set "_%.3%%.5%%.7%=0"
- >nul Set _XXX&&(echo player 2 %player2% win&Pause&Goto :Eof)
- Goto Loop
复制代码
|