Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use batch processing to realize Gobang man-machine game

2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly introduces how to use batch processing to achieve Gobang man-machine game, the introduction in the article is very detailed, has a certain reference value, interested friends must finish!

Effect picture:

Core code:

The code is as follows:

@ echo off&setlocal enabledelayedexpansion

Set li0= ┌─┐

Set li1= │┌┬┐│ 1

For / l% an in (2meme 1m 18) do (set li%%a= │├┼┤│% a)

Set li19= │└┴┘│ 19

Set li20= └─┘

Set li21= A B C D E F G H I J K L M N O P Q R S

For% an in (% li21%) do (set/a. + = 1je%% axi.resume set zonal. Examples% a)

Set Z0 = & set z20 = & set "z21 ="

Set li5! The man-machine game of Wuqi

Set li7! Batch management

Set li9! Electrical brain water leveling medium grade

Set li12 li12! Written by netbenton

Set li14! The chessboard design refers to batman.

Title batch Gobang

Set str=#

Set. = 0

For / l% an in (1pm 1m 19) do (

Set he% axiomatic stringency collection set sh% axiomatic str!

For / l% b in [% a.%%b=0] do set

)

Set. = 33

For / l% an in (5penny 1m 19) do (

Set pi%% axiomatic strlux coach%% axiomatic set%% axiom struvvudine% a!

Set pirates. Matching struts.% a% axioms set niggles. Matching struts.

Set/a.-= 1

)

Set ● = ○ & set a ● = computer

Set ○ = ● & set a ○ = player

:: set up the computer IQ

Set idea=@@@@#1 # @ 5 @ # @ @ 4 @ @ 2 @ # @ @ 3 $# $$4 $$# $$3 $# $2 $# 1 # $$5 # $# $# 3 # $# $$# 4 # @ @ # 2 # @ @ # 5 # @ @ # 3 # @ @ # 4 # @ # 1

Set ideacreative idea! # # @ @ 4 @ @ # $$# 5 # $$# # 2 # $$# 1 # # @ # 4 # # @ @ # 2 # $$# 4 # $# # 2 # $# 2 # $# # 3 @ # @ @ 3

Set ideaeducational ideas! # # @ # # 2 # 3 # @ # # 3 @ # 4 # 2 # 7 # 6 # 4 # 3 # # 2

Set ttrackers = ●! & set ttrackers = ○!

For an in (! ttr!) Do (set var=%%a&set! varvvvvvlvvlvvvvvvvvvvvvvvvvvvlvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvlvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

Set ttr=

:: set up the computer IQ

: restart

For / l%% an in (0re1je 21) do (echo! Z%% axialii% a!)

Setlocal enabledelayedexpansion

Set li21! Reboot starts again and exit exits.

Set / p var= chooses which one to go first [W, player D, computer Q, exit]:

If / I "! var!" Equ "Q" goto: eof

If / I "! var!" Equ "W" (set zhi= ●) else (set zhi= ○)

Echo.

: loop

If% zhi% equ ● goto: men

Set. = & set put1=

For an in (! idea!) Do (

For% b in (he sh) do (

For / l% c in (1pm 1m 19) do (

If "!% b% cvv%% aura!" Neq "!% b% c!" Set/a. + = 1&set putters. Percent percent b%% c

))

For% b in (pi ni) do (

For / l% c in (5penny 1m 33) do (

If "!% b% cvv%% aura!" Neq "!% b% c!" Set/a. + = 1&set putters. Percent percent b%% c

))

If defined put1 set put=%%a&goto: get

)

Echo. It's already a draw.

Pause

Goto: restart

: men

For / l%% an in (0re1je 21) do (echo! Z%% axialii% a!)

Set / p user= [before column, after row]:

Echo.

If "! user!" Equ "reboot" endlocal&goto: restart

If "! user!" Equ "exit" exit

Set/a posthumous 1 2 > nul

If not defined [! poh!.!pos! Echo input point does not exist & goto: men

If "! he%poh%:~%var%,1!" Neq "#" echo already has a son at this point & goto men

Goto: getok

: get

Set / a. =! percent% .room1

Set puttogether put%.%!

:: randomly choose the best way to walk

For / f "tokens=1-3" an in ("% put%") do (

Set varicose%% a%% borel% caterpillar% caterpillar srqponmlkjihgfedcba0

Set/a varages, varanus, 19, 1, 5, 5, 5, 5, 5, 5, 5, 9, 9, 9, 9, 9, 9, 9, 9, 4, 4, 2, 4, 2, 4, 4, 4, 2, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,

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))

)

The last place for echo computers is:! Z% poss% poh% poh%! (% poh%)

: getok

Set zhixes% zi% places set windowed flowers, zhixes, zhites, hikes, zhites, zhixes, zhixes!

Set/a piph=poh+pos-1,lips=pos+1,niph=19+pos-poh

If! 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 an in ("Lifepoh!! lips!" "heightened poh!! pos!" "shallowpos!! poh!" "pirated piph!! pips!" "nigh niph! nips!") Do (

For / f "tokens=1,2"% b in (% a) do

If defined% b (

Set/a. =% cmae1

For d in (!!) Do (set%% borex%% borex% 0J%% dag% zhi% bGV%% c!)

If "!% bvv% win% colors!" Neq "! B!" Set win=y

)

)

)

Set/an asc%zhi%+=1

If! win! Neq y goto: loop

For / l%% an in (0re1je 21) do (echo! Z%% axialii% a!)

Set/p=! a% zhi%!% zhi% child! ascend% zhi%! Win by hand

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report