![]() |
China DOS Union-- Unite DOS · Advance DOS · Grow DOS --Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum |
| Guest | Log in | Register | Members | Search | China DOS Union |
|
中国DOS联盟论坛 The time now is 2026-11-23 02:32 |
47,820 topics / 349,938 posts / today 0 new / 48,298 members |
| DOS批处理 & 脚本技术(批处理室) » [Original] Gobang Man-machine Battle Batch Game |
| Printable Version 15,874 / 73 |
| Floor16 huchaolan | Posted 2009-05-09 20:29 |
| 新手上路 Posts 6 Credits 15 | |
|
This is quite amazing. I don't understand it, but it's fun to play.
|
|
| Floor17 everest79 | Posted 2009-05-10 07:24 |
| 金牌会员 Posts 1,127 Credits 2,564 | |
|
I copy zh159
Haha |
|
| Floor18 zh159 | Posted 2009-05-10 13:50 |
| 金牌会员 Posts 1,467 Credits 3,687 | |
|
The code can only be used when IE browser is the default one, and there is a bug: after the mouse moves away from the edge checkerboard, it does not return to the appearance of the edge checkerboard, but becomes the appearance of the middle checkerboard.
|
|
| Floor19 netbenton | Posted 2009-05-10 13:56 |
| 银牌会员 Posts 752 Credits 1,916 From 广西 | |
|
Re: 17th floor
What's the file extension for saving? I can't run it. I've tried.vbs,.js,.html,.bat and none of them work. |
|
| Floor20 HAT | Posted 2009-05-10 23:19 |
| 版主 Posts 5,017 Credits 9,023 | |
|
System: XP SP2 EN
Default browser: IE 6 Attachments 2009-05-11_100903.png (5.66 KiB) |
|
| Floor21 everest79 | Posted 2009-05-11 02:21 |
| 金牌会员 Posts 1,127 Credits 2,564 | |
Originally posted by zh159 at 2009-5-10 01:50 PM: Copied incorrectly, haha The text for the mouseout event should be char, I didn't look at the code you replaced later and directly filled it with + This script I modified also works normally with the default browser |
|
| Floor22 everest79 | Posted 2009-05-11 02:21 |
| 金牌会员 Posts 1,127 Credits 2,564 | |
| Floor23 everest79 | Posted 2009-05-11 02:23 |
| 金牌会员 Posts 1,127 Credits 2,564 | |
|
I also encountered this error. It turned out to be caused by several double-byte symbols in the script. I changed them to cha(ascii) to solve it. Maybe it's because your system is in English version.
|
|
| Floor24 HAT | Posted 2009-05-11 08:56 |
| 版主 Posts 5,017 Credits 9,023 | |
|
Can you modify the code to make it compatible with both Chinese and English systems at the same time?
|
|
| Floor25 everest79 | Posted 2009-05-11 10:44 |
| 金牌会员 Posts 1,127 Credits 2,564 | |
|
I can't see the specific content of "?????", so I can't complete the full translation. Please provide the complete content with the specific characters.
|
|
| Floor26 everest79 | Posted 2009-05-11 11:38 |
| 金牌会员 Posts 1,127 Credits 2,564 | |
|
After struggling for a long time, I wrote the following code, which is mainly used to obtain the horizontal, vertical, diagonal, and anti-diagonal lines of the Gobang move coordinates.
My idea is that the computer does not compare the entire chessboard, but judges the risk of five in a row in four lines following the opponent's move. It only reaches extracting the four-line array. Using a one-dimensional array, if the chessboard is two-dimensional, it can be converted to one-dimensional using row number * total columns (19) + column number. Because it is convenient to identify four lines with a one-dimensional array, the horizontal line steps by 1, the vertical line steps by 19, the diagonal line steps by 18, and the anti-diagonal line steps by 20. For the relationship of coordinates, you can use the following code to observe: Display two-dimensional coordinates Display one-dimensional coordinates |
|
| Floor27 netbenton | Posted 2009-05-11 12:17 |
| 银牌会员 Posts 752 Credits 1,916 From 广西 | |
|
Whether using the two-dimensional coordinate method or the one-dimensional cross-marking method, in the end, it is still necessary to perform string grouping and then match with the rule string. Because when performing rule string matching, it is done by string. Actually, it would be better to define display cache, horizontal, vertical,撇, and 捺 as array strings. There is no need to perform multiple string grouping operations.
The computer side makes a move according to the matched optimal rule string. According to which array (horizontal/vertical/撇/捺) and which string in which array and which character position it is matched, it can be converted into the actual coordinates. Because five arrays are defined, as long as one move is made, the corresponding positions of these five arrays need to be replaced respectively. Each array only needs to replace one character in a row. Displaying by row unit is definitely much faster than displaying by character unit. Because the video memory string method is used, it can be directly displayed by row unit. |
|
| Floor28 HAT | Posted 2009-05-11 12:42 |
| 版主 Posts 5,017 Credits 9,023 | |
My idea is that the computer does not compare the entire chessboard, but follows the opponent's move to judge whether there is a five-in-a-row risk in the four rows where the move is made In this case, is the computer's playing strength too weak? Usually, the Gomoku algorithm sorts the possible situations for both sides in the next step (like four-three, double-three, etc.) in order of priority, and then selects the landing point with the highest priority. |
|
| Floor29 rubble | Posted 2009-05-12 08:09 |
| 初级用户 Posts 15 Credits 23 | |
|
That's amazing, batch processing also has such powerful functions!
|
|
| Floor30 SNSB | Posted 2009-05-12 08:33 |
| 初级用户 Posts 16 Credits 31 | |
Originally posted by rubble at 2009-5-12 08:09: I really didn't expect to come up with this thing, but I find the code hard to understand. |
|
| Prev 1 2 3 4 5 Next |
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |