从回答我的用户那里更新 到 C# 解决方案项目的链接: https ://github.com/TedDawkin/C64_AI_Movement
更新
我找到了——如果有人感兴趣,只需使用 C64 论坛中的主题链接:http: //www.lemon64.com/forum/viewtopic.php? p=712902#712902我在这里讨论了这个话题(和我自己)。有趣的是它最终是多么简单。没那么好笑,我花了两个多星期的时间。
稍后我会将 BASIC 发布到 C# 代码并“回答”我自己的问题。
如果有人关心并且不想去论坛链接,这里是它在 C64 basic 中的工作方式。
30110 IF KS(S)=0 THEN GOSUB 30400 : GOTO30105
30400 POKE 211,20: POKE214,18: SYS CS: PRINT"SPIELER"F
30405 Y=INT(KP(S,F)/40)
SYS CR, KP(S,F)-40*Y, Y
X=PEEK(UA)-1
Y=PEEK(UA+1)-40
30410 IF PEEK(UA+2)=1 OR PEEK (UA+3)=1 GOTO 30420
30415 IFINT(RND(1)*2)=0ORGW(KS(S),F)<4GOTO30450
30420 IFX=0THENX=Y:GOTO30215
30421 IFY<>0GOTO30450
30425 GOTO30215
30450 IFX<>0ANDRI(F)<>(1+2*(X=1))THENP=X:GOSUB30490:IFP=0THENRETURN
30451 IFY<>0ANDRI(F)<>(40+80*(Y=1))THENP=Y:GOSUB30490:IFP=0THENRETURN
30455 IFX<>0ANDRI(F)<>(1+2*(X=1))GOTO30460
30456 IFRI(F)<>-1THENP=1:GOSUB30490:IFP=0THENRETURN
30457 IFRI(F)<>1THENP=-1:GOSUB30490:IFP=0THENRETURN
30458 GOTO30465
30460 IFY<>0ANDRI(F)<>(40+80*(Y=1))GOTO30465
30461 IFRI(F)<>-40THENP=40:GOSUB30490:IFP=0THENRETURN
30462 IFRI(F)<>40THENP=-40:GOSUB30490:IFP=0THENRETURN
30465 RETURN
30490 Q=KP(S,F)+P:IFQ<0ORQ>520OR(PEEK(BR+Q)<>32ANDPEEK(BR+Q
<>96)THENRETURN
30491 POKEBR+KP(S,F),32:KP(S,F)=Q:POKEBR+KP(S,F),193:POKEFR+KP(S,F),6
30492 RI(F)=P:P=0:RETURN
一些提示:
X = moved right (1), left (-1), up (-40) or down(40)
P = Position. There is no Y because the next/prev line is
40 characters away. (C64 Screen = 40 Columns and 25 Rows)
S = switches between 0 and 2 to determine if its human or ai turn
KP(S,F) = Offset-Position in Video-Memory-Adress
BR = Start-Adress of Video-Memory
32 = 0x20 = Space to clear old position
193 = Ascii-Character used as pawn for player and ai
6 = Mark field as AI (Human position is marked with 0x0b)
F = Playernumber
RI(F) = dont know yet
原始问题:
进行翻拍并试图理解 C64 代码我正在努力应对 AI 运动。在它上面工作了一个多星期,我无法重现 100% 相同的行为。