|
everest79
金牌会员
      一叶枝头,万树皆春
积分 2564
发帖 1127
注册 2006-12-25
状态 离线
|
『第 31 楼』:
使用 LLM 解释/回答一下
先写简单的把骨架支起来,慢慢再复杂化,嘿嘿
First, write something simple to set up the framework, and then gradually make it more complex. Hehe
|

49206C6F766520796F752067757973 54656C3A3133383238343036373837 |
|
2009-5-12 08:42 |
|
|
netbenton
银牌会员
     批处理编程迷
积分 1916
发帖 752
注册 2008-12-28 来自 广西
状态 离线
|
『第 32 楼』:
使用 LLM 解释/回答一下
增加了几行代码,却提速不少,
看来还是有可能进一步提高电脑的棋艺,
并引进五子棋的禁手及其它规则,
@echo off&setlocal enabledelayedexpansion
mode con: lines=43 cols=110
set li39= A B C D E F G H I J K L M N O P Q R S
set li0= ┌─────────────────────────────────────┐
set li1=A│┌─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┐│A
set var=1
for %%a in (!li39:~5^,-1!) do (set/a var+=2&set li!var!=%%a│├─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┤│%%a)
for /l %%a in (2,2,36) do (set li%%a= ││ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ││)
set li37=S│└─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┘│S
set li38= └─────────────────────────────────────┘
set str=a b c d e f g h i j k l m n o p q r s
for %%a in (%str%) do (set/a .+=1,%%a=.&set z!.!=%%a)
set li5=!li5! 五 棋 子 人 机 对 战
set li7=!li7! 批 处 理
set li10=!li10! 电 脑 水 平 中 等
set li31=!li31! 由 netbenton 编写完成
set li33=!li33! 棋盘设计参照了 batman
title 批处理五子棋
set str=###################
set .=0
for /l %%a in (1,1,19) do (
set he%%a=!str!&set sh%%a=!str!
for /l %%b in (1,1,19) do set
:
if /i "!var!" equ "Q" goto :eof
if /i "!var!" equ "D" (set onez=○&set towz=●&set hou=☆) else (set onez=●&set towz=○&set hou=★)
set a!onez!=电脑&set a!towz!=玩家
)
(
set ttr=!idea:@=%onez%!&set ttr=!ttr:$=%towz%!
set idea=
for %%a in (!ttr!) do (set var=%%a&set !var:~,-1!=!var:~-1!&set idea=!idea! !var:~,-1!)
set ttr=
set li27=!li27! !onez! !a%onez%!
set li25=!li25! !towz! !a%towz%!
set/a pos=10,poh=10&goto :getok
)
:loop
(if %zhi% equ %onez% goto :men
set .=
for %%a in (!idea!) do (
for %%b in (he sh) do (
set all=!%%b1!!%%b2!!%%b3!!%%b4!!%%b5!!%%b6!!%%b7!!%%b8!!%%b9!!%%b10!!%%b11!!%%b12!!%%b13!!%%b14!!%%b15!!%%b16!!%%b17!!%%b18!!%%b19!
if "!all:%%a=!" neq "!all!" (
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 (
set all=!%%b5!!%%b6!!%%b7!!%%b8!!%%b9!!%%b10!!%%b11!!%%b12!!%%b13!!%%b14!!%%b15!!%%b16!!%%b17!!%%b18!!%%b19!!%%b20!!%%b21!!%%b22!!%%b23!!%%b24!!%%b25!!%%b26!!%%b27!!%%b28!!%%b29!!%%b30!!%%b31!!%%b32!!%%b33!
if "!all:%%a=!" neq "!all!" (
for /l %%c in (5,1,33) do (
if "!%%b%%c:%%a=!" neq "!%%b%%c!" set/a .+=1&set put!.!=%%b %%c
)
) )
if defined . set put=%%a&goto :get
))
echo. 已经和棋了
pause
endlocal&goto :restart
:men
(
set/a .=lips-1&for /f "tokens=1-3" %%b in ("li!liph! !lips! !.!") do (set %%b=!%%b:~0,%%d!%hou%!%%b:~%%c!)
set li38=!li38!
cls
for /l %%a in (0,1,39) do (echo !li%%a!)
for /f "tokens=1-3" %%b in ("li!liph! !lips! !.!") do (set %%b=!%%b:~0,%%d!%zhi%!%%b:~%%c!)
set li38=%li38%
set /p user=!say:say=%error%! :
if "!user!" equ "reboot" endlocal&goto :restart
if "!user!" equ "exit" exit
if "!user!" equ "back" call :悔&goto :men
set/a pos=!user:~0,1!,poh=!user:~1,2!,var=pos-1 2>nul
if not defined
Last edited by netbenton on 2009-5-14 at 00:31 ]
Added a few lines of code, but it improved a lot in speed.
It seems that it is still possible to further improve the computer's chess playing ability,
and introduce the forbidden moves and other rules of Gobang,
@echo off&setlocal enabledelayedexpansion
mode con: lines=43 cols=110
set li39= A B C D E F G H I J K L M N O P Q R S
set li0= ┌─────────────────────────────────────┐
set li1=A│┌─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┐│A
set var=1
for %%a in (!li39:~5^,-1!) do (set/a var+=2&set li!var!=%%a│├─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┤│%%a)
for /l %%a in (2,2,36) do (set li%%a= ││ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ││)
set li37=S│└─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┘│S
set li38= └─────────────────────────────────────┘
set str=a b c d e f g h i j k l m n o p q r s
for %%a in (%str%) do (set/a .+=1,%%a=.&set z!.!=%%a)
set li5=!li5! 五 棋 子 人 机 对 战
set li7=!li7! 批 处 理
set li10=!li10! 电 脑 水 平 中 等
set li31=!li31! 由 netbenton 编写完成
set li33=!li33! 棋盘设计参照了 batman
title 批处理五子棋
set str=###################
set .=0
for /l %%a in (1,1,19) do (
set he%%a=!str!&set sh%%a=!str!
for /l %%b in (1,1,19) do set
:
if /i "!var!" equ "Q" goto :eof
if /i "!var!" equ "D" (set onez=○&set towz=●&set hou=☆) else (set onez=●&set towz=○&set hou=★)
set a!onez!=电脑&set a!towz!=玩家
)
(
set ttr=!idea:@=%onez%!&set ttr=!ttr:$=%towz%!
set idea=
for %%a in (!ttr!) do (set var=%%a&set !var:~,-1!=!var:~-1!&set idea=!idea! !var:~,-1!)
set ttr=
set li27=!li27! !onez! !a%onez%!
set li25=!li25! !towz! !a%towz%!
set/a pos=10,poh=10&goto :getok
)
:loop
(if %zhi% equ %onez% goto :men
set .=
for %%a in (!idea!) do (
for %%b in (he sh) do (
set all=!%%b1!!%%b2!!%%b3!!%%b4!!%%b5!!%%b6!!%%b7!!%%b8!!%%b9!!%%b10!!%%b11!!%%b12!!%%b13!!%%b14!!%%b15!!%%b16!!%%b17!!%%b18!!%%b19!
if "!all:%%a=!" neq "!all!" (
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 (
set all=!%%b5!!%%b6!!%%b7!!%%b8!!%%b9!!%%b10!!%%b11!!%%b12!!%%b13!!%%b14!!%%b15!!%%b16!!%%b17!!%%b18!!%%b19!!%%b20!!%%b21!!%%b22!!%%b23!!%%b24!!%%b25!!%%b26!!%%b27!!%%b28!!%%b29!!%%b30!!%%b31!!%%b32!!%%b33!
if "!all:%%a=!" neq "!all!" (
for /l %%c in (5,1,33) do (
if "!%%b%%c:%%a=!" neq "!%%b%%c!" set/a .+=1&set put!.!=%%b %%c
)
) )
if defined . set put=%%a&goto :get
))
echo. 已经和棋了
pause
endlocal&goto :restart
:men
(
set/a .=lips-1&for /f "tokens=1-3" %%b in ("li!liph! !lips! !.!") do (set %%b=!%%b:~0,%%d!%hou%!%%b:~%%c!)
set li38=!li38!
cls
for /l %%a in (0,1,39) do (echo !li%%a!)
for /f "tokens=1-3" %%b in ("li!liph! !lips! !.!") do (set %%b=!%%b:~0,%%d!%zhi%!%%b:~%%c!)
set li38=%li38%
set /p user=!say:say=%error%! :
if "!user!" equ "reboot" endlocal&goto :restart
if "!user!" equ "exit" exit
if "!user!" equ "back" call :悔&goto :men
set/a pos=!user:~0,1!,poh=!user:~1,2!,var=pos-1 2>nul
if not defined
Last edited by netbenton on 2009-5-14 at 00:31 ]
|

精简
=> 个人 网志  |
|
2009-5-12 13:57 |
|
|
netbenton
银牌会员
     批处理编程迷
积分 1916
发帖 752
注册 2008-12-28 来自 广西
状态 离线
|
『第 33 楼』:
使用 LLM 解释/回答一下
增强电脑方的智能了!
已经在 7 楼更新。
Enhanced the intelligence of the computer side!
Updated on floor 7 already.
|

精简
=> 个人 网志  |
|
2009-5-17 11:44 |
|
|
matlan
初级用户
 
积分 87
发帖 63
注册 2008-8-23
状态 离线
|
|
2009-5-17 14:22 |
|
|
516526966
初级用户
 
积分 63
发帖 37
注册 2008-8-9
状态 离线
|
『第 35 楼』:
使用 LLM 解释/回答一下
真的不可思议啊,很壮观,,崇拜你,你真是个好人。。。
Last edited by 516526966 on 2009-5-18 at 08:03 ]
It's really incredible, very spectacular,, admire you, you're really a good person...
Last edited by 516526966 on 2009-5-18 at 08:03 ]
附件
1: 2009-05-18_185017.png (2009-5-18 08:01, 25.14 KiB,下载次数: 1)
|

矛盾的世界同样精彩<点击查看> |
|
2009-5-18 03:02 |
|
|
zh159
金牌会员
     
积分 3687
发帖 1467
注册 2005-8-8
状态 离线
|
『第 36 楼』:
使用 LLM 解释/回答一下
我已经晕了,除了界面,对预算法完全白痴,想改为VBS基本落空...
I'm completely confused. Except for the interface, I'm a total novice to the Budget Law, and changing to VBS is basically out of the question...
|

 |
|
2009-5-18 13:07 |
|
|
277854201
新手上路

积分 1
发帖 1
注册 2009-5-16
状态 离线
|
|
2009-5-19 04:20 |
|
|
netbenton
银牌会员
     批处理编程迷
积分 1916
发帖 752
注册 2008-12-28 来自 广西
状态 离线
|
『第 38 楼』:
使用 LLM 解释/回答一下
又进行更新了,完善了电脑方的IQ,并在多个可下点等效时进行随机取位,增加了可玩性,因此,该批处理不再仅仅是一件艺术品,还是一个实实在在的五子棋游戏了,
欢迎大家使用,并把你认为电脑下得”笨“的地方发上来,以便再度完善。
最后更新,请看7楼
There has been another update, improving the computer's IQ, and randomly selecting positions when there are multiple equivalent points that can be played, increasing the playability. Therefore, this batch script is no longer just a work of art but also a real Gobang game. Welcome everyone to use it, and post the places where you think the computer plays "stupidly" so that it can be improved again.
Final update, please see floor 7
|

精简
=> 个人 网志  |
|
2009-5-21 09:09 |
|
|
zh159
金牌会员
     
积分 3687
发帖 1467
注册 2005-8-8
状态 离线
|
『第 39 楼』:
使用 LLM 解释/回答一下
现在我想弄明白的两个算法:
1、电脑下位算法
2、5子结果的算法
The two algorithms I now want to figure out:
1. Lower computer algorithm of the computer
2. Algorithm for the result of five-in-a-row
|

 |
|
2009-5-22 23:31 |
|
|
netbenton
银牌会员
     批处理编程迷
积分 1916
发帖 752
注册 2008-12-28 来自 广西
状态 离线
|
『第 40 楼』:
批处理五子棋算法
使用 LLM 解释/回答一下
re 39L
数组定义:
1,显示缓存
2,横向(串长度为19)
3,竖向(串长度为19)
4,撇(斜向,串长度为5~19~5)
5,捺(斜向,串长度为5~19~5)
数组1,初始为空棋盘
数组2~5,初始全为#号的字符串
在有下子时,根据玩家输入或电脑取得的实际坐标,分别对5个数组中相应的位置进行替换为棋子(方法:!str:~,n!棋子!str:~n+1!)
替换后,马上匹配该串!str!是否含有五子相连,有即胜出了。
电脑怎样取位:
因为各个方向串是分别定义和替换更新的,所以只要拿各种规则串(即设置的IQ,如:#○○○#)同各个方向的数据串进行匹配,如果发现有则记录下来(在哪个数组,第几串),所有匹配完成后。则对记录下来的结果进行分析,转换为实际坐标。
(IQ规则串后的数字为该规则串的中可下点,算出规则串在方向串的位置,根据该点,即可算出方向串中的可下点,再根据是在哪个数组,即可算出在实际坐标中的可下点)
然后根据规则串给该坐标加权(初版时只求最先匹配到的可下点,没有的权计算),最后电脑取权值最大的坐标来下子。如果有权值相等的则随机取一个来下。
re 39L
Array definition:
1. Display buffer
2. Horizontal (string length is 19)
3. Vertical (string length is 19)
4. Diagonal (slash, string length is 5~19~5)
5. Diagonal (backslash, string length is 5~19~5)
Array 1 is initially an empty chessboard.
Arrays 2~5 are initially strings of all #.
When there is a move, according to the player's input or the actual coordinates obtained by the computer, replace the corresponding positions in the 5 arrays with the chess piece (method:!str:~,n!chess piece!str:~n+1!). Immediately after replacement, match whether the string!str! contains five in a row, and if so, the player wins.
How the computer takes the position:
Because each direction string is defined and updated separately, just match the various rule strings (that is, set IQ, such as #○○○#) with the data strings in each direction. If found, record it (in which array, which string). After all matching is completed, analyze the recorded results and convert them into actual coordinates.
(The number after the IQ rule string is the available point in the rule string. Calculate the position of the rule string in the direction string. According to this point, the available point in the direction string can be calculated. Then, according to which array it is in, the available point in the actual coordinates can be calculated.)
Then weight the coordinates according to the rule string (in the initial version, only the first matched available point is sought, and the weight calculation is not done). Finally, the computer takes the coordinate with the largest weight value to make a move. If there are equal weights, randomly take one.
|

精简
=> 个人 网志  |
|
2009-5-23 00:55 |
|
|
netbenton
银牌会员
     批处理编程迷
积分 1916
发帖 752
注册 2008-12-28 来自 广西
状态 离线
|
|
2009-5-25 11:39 |
|
|
netbenton
银牌会员
     批处理编程迷
积分 1916
发帖 752
注册 2008-12-28 来自 广西
状态 离线
|
『第 42 楼』:
使用 LLM 解释/回答一下
小更新:增强了一点点电脑棋艺。
(在7楼,41楼都已经更新)
看到网上有人贴出,玩家先下时,九手就赢了电脑,特此更改进。
Minor update: Slightly enhanced the computer's chess-playing skill.
(Updated on floors 7 and 41)
Saw someone online post that when the player goes first, they can win the computer in nine moves, so this has been improved.
|

精简
=> 个人 网志  |
|
2009-6-2 12:01 |
|
|
THENEWLIFE
初级用户
 
积分 78
发帖 64
注册 2008-8-29
状态 离线
|
『第 43 楼』:
使用 LLM 解释/回答一下
看了前辈的杰作,心里久久不能平静。我要学到什么时候才能达到前辈这样子的水平啊~
从今天起努力!努力!以前辈为目标
After seeing the masterpiece of the senior, my heart has been in turmoil for a long time. When will I be able to reach the level of the senior?
I will work hard from today! Work hard! Aim at the senior
|
|
2009-6-2 22:53 |
|
|
tslnyys
初级用户
 
积分 29
发帖 17
注册 2009-6-2
状态 离线
|
『第 44 楼』:
使用 LLM 解释/回答一下
音乐不会停啊,批处理关了音乐还再继续。
The music doesn't stop. The batch script is closed but the music continues.
|
|
2009-6-3 02:34 |
|
|
tslnyys
初级用户
 
积分 29
发帖 17
注册 2009-6-2
状态 离线
|
『第 45 楼』:
使用 LLM 解释/回答一下
哦,只有在游戏中打 Q退出时音乐才会停止,
直接点出关闭按纽的话游戏虽然退出了,但音乐还在响,
不知是不是只有我这里这样。
Oh, only when you type Q to exit in the game will the music stop.
If you directly click the close button, the game exits but the music continues to play.
I don't know if it's only like this for me.
|
|
2009-6-3 02:36 |
|