|
Chess
Apr 10, 2019 18:21:54 GMT
Post by Rod on Apr 10, 2019 18:21:54 GMT
Ahhh…. clock playing up so not fixed. Not incrementing black time. New strategy required!
|
|
|
Chess
Apr 10, 2019 18:59:33 GMT
Post by tsh73 on Apr 10, 2019 18:59:33 GMT
I see you use TIMER SUB. It used to hang then window is moved... I did managed to hang it. Game save format is really crude I would say. (made me cry actually ) Probably just all game state (arrays)? As an idea I suggest saving as a move list. Then load, reset board to beginning, then replay along the list. If done it will give "take move back" feature - you just replay one move less. And - you will have move list for free
Just played (finished ) it In the list, sometimes some weird symbol instead of space if moved to empty space like "KD2-?D1"
Move list area probably needs FLUSH. It DO take time to think - so switching back and forth is natural.
Just left it for 15 minutes. Nothing happened
sometimes errors with (ACTUALLY last 8 errors - so quite a lot) Runtime error: invalid branch label: [mover]
Error(Exception)>>defaultAction Error(Exception)>>activateHandler: <anUndefinedObject> Error(Exception)>>handle Error(Exception)>>signal Error class(Exception class)>>signal: <'invalid branch label...'> BasicProgram(Object)>>error: <'invalid branch label...'> BasicProgram>>goto: <'[mover]'> BasicProgram>>gotoAndIfStoppedBegin: <'[mover]'> BasicProgram>>handlerName: <'[mover]'> evaluate: <aBlockClosure> callParameters: <anOrderedCollection> BasicProgram>>submitHandlerName: <'[mover]'> evaluate: <aBlockClosure> callParameters: <anOrderedCollection> LibGraphPane(BasicGraphPane)>>button1Up: <aPoint> Message>>perform NotificationManager>>empty NotificationManager>>runPendingEvents NotificationManager>>runEventLoop Message>>perform Message>>evaluate Process>>safelyEvaluate: <aMessage> Process>>evaluate: <aMessage>
|
|
|
Chess
Apr 10, 2019 20:02:01 GMT
Post by Rod on Apr 10, 2019 20:02:01 GMT
Undo? really, is point of game not to compete/get beat? I could save game prior to every move to create an undo feature. Need to get clocks and check sorted as first priority. Both are a challenge.
One thing that I have not made clear is that currently the user can only input during white play time. Black play time ignores, or should ignore all input apart from trapclose. Probably needs a rewrite to loose that limitation.
|
|
|
Chess
Apr 10, 2019 20:23:45 GMT
Post by tsh73 on Apr 10, 2019 20:23:45 GMT
It's not "it eats me so I take it back" but rather "OOPS I moved it to wrong cell". With long play time it is desirable feature.
|
|
|
Chess
Apr 10, 2019 20:44:59 GMT
Post by tsh73 on Apr 10, 2019 20:44:59 GMT
Actually, program says But code checks if wm>15 or bm>15 then So it triggers only if time get more then 16 minutes. I just didn't wait enough If changed to if wm>14 or bm>14 then it will work as promised, stop after 15 minutes.
|
|
|
Chess
Apr 10, 2019 20:49:57 GMT
Post by tsh73 on Apr 10, 2019 20:49:57 GMT
It was CHR$(0) In the sub makemove x,y,x1,y1 empty cell is filled with 0, should be 32 (ASC(" "))
'erase square vacated bsprite$(x,y)="" bvalue(x,y)=0 ' bpiece(x,y)=0 bpiece(x,y)=32 '!!! bsign(x,y)=0
|
|
|
Chess
Apr 10, 2019 20:53:10 GMT
Post by tsh73 on Apr 10, 2019 20:53:10 GMT
It looks like white could play on after resigning. Like nothing happened
|
|
|
Chess
Apr 10, 2019 21:40:32 GMT
Post by tsh73 on Apr 10, 2019 21:40:32 GMT
Just to share - I got chess mill! It was a long time I made something like this
|
|
|
Chess
Apr 11, 2019 7:55:21 GMT
Post by Rod on Apr 11, 2019 7:55:21 GMT
Thank for the debugging. I am going to remove the timer statements and try a looping counter instead. Might be a while
|
|
|
Chess
Apr 11, 2019 16:10:11 GMT
Post by Rod on Apr 11, 2019 16:10:11 GMT
Removing the timer turned out to be an easy fix. The code is much more stable. The problem I have now is that load and save is not respecting the "status" of the sprite. So taken sprites are still being redrawn. Sigh......
|
|
|
Chess
Apr 12, 2019 10:14:51 GMT
Post by tsh73 on Apr 12, 2019 10:14:51 GMT
It looks like then saving, bsprite$(x,y) saves as empty.
So then load we can turn all sprites off
'set all sprites off sprList$="br1,bn1,bb1,bq1,bk1,bb2,bn2,br2,"+ _ "bp1,bp2,bp3,bp4,bp5,bp6,bp7,bp8,"+ _ "wp1,wp2,wp3,wp4,wp5,wp6,wp7,wp8,"+ _ "wr1,wn1,wb1,wq1,wk1,wb2,wn2,wr2" for i = 1 to 32 spr$=word$(sprList$,i, ",") #w.g "spritevisible ";spr$;" off" next '//set all sprites off and then turn on only sprites that got saved
for y=0 to 7 for x=0 to 7 line input #1,bsprite$(x,y) 'set existing sprites ON if trim$(bsprite$(x,y)) <>"" then #w.g "spritevisible ";bsprite$(x,y);" on" line input #1,bvalue(x,y) line input #1,bsign(x,y) line input #1,bpiece(x,y) next next Something is still wrong - then I reload after fresh start it looks ok but after some moves and loading I got wrong piece colored blue
|
|
|
Chess
Apr 14, 2019 10:00:43 GMT
Post by Rod on Apr 14, 2019 10:00:43 GMT
Ok, after some battling with load and save we can now save the game, to be loaded and played later. We can also "undo" our last play. The timer is no longer ticking so the whole thing is more stable but you are still against the clock. It is a turn based game, while the black player is thinking you can't do anything. Just like the real thing! After black has played you can step back with undo or make your next move. Each player must win within 15 minutes or the game is a draw. Barring any serious bugs surfacing I think I shall be moving on to something else gamebin.webs.com/Liberty/LB%20Chess.zip
|
|
|
Chess
Apr 14, 2019 21:04:45 GMT
Post by tsh73 on Apr 14, 2019 21:04:45 GMT
Whoa. Impressive work. 1. Then you play with time limit, one who blew it, looses. This is hard game . 2. I just checkmated computer - it went checking me in return! (saved_moved after checkmate.gam) pastebin.com/SxQj1Ee5save it as "saved.gam", load and do QC5-B5+ It replied with QE2:F1+ May be it just didn't get that the game is over? If it supposed to move out of check then we could (after black move) IF (black still in check) THEN it just couldn't, that is, - checkmate.
|
|
|
Chess
Apr 14, 2019 21:18:33 GMT
Post by Rod on Apr 14, 2019 21:18:33 GMT
Yep that was a bug in the original. Now everything else is stable we might get to the bottom of it. My understanding is that it should recognise the value lost when in check and resign. It does not spoil the game too much, you know when you have won. I find nine times out of ten even at level 3 I get beat near the end of the game. So finding the bug is s rarely. Sharing saved games will help tremendously!
Yes check after blacks move should be a clear sign. Need a day or two off and will come back to it.
|
|
|
Chess
Apr 15, 2019 7:48:19 GMT
Post by Rod on Apr 15, 2019 7:48:19 GMT
Getting a bit closer. With a hint from Anatoly I changed the resign code. I find it hard to beat the machine so better chess players than me need to test it!
edit: I downloaded Anatoly's saved game and made the final move, using the below code, it resigned! So some success, more testing needed.
sub blackmove x,y,x1,y1,result if Status=-1 then goto [skip]
'end less king on king end game if result < -2500 then call text "Black resigns" call text "Game ends" wait end if
'remove highlights of whites last move #w.g "spritevisible m off" #w.g "spriteimage ";bsprite$(old(1),old(2));" ";left$(bsprite$(old(1),old(2)),2)
'make blacks move call text "Black moves ";chr$(bpiece(x,y));chr$(65+x);8-y;"-";chr$(bpiece(x1,y1));chr$(65+x1);8-y1 if bvalue(x1,y1)>0 then taken=showtaken(x1,y1,-1) #w.g "spritevisible ";bsprite$(x1,y1);" off" Spritetaken$=Spritetaken$+bsprite$(x1,y1)+"," end if call makemove x,y,x1,y1
'if we cant play out of check then resign if incheck(-1) then call text "Black resigns" call text "Game ends" wait end if
'add highlights of blacks last move #w.g "spriteimage ";bsprite$(x1,y1);" ";left$(bsprite$(x1,y1),2);"1" #w.g "spritexy t ";bspritex(x,y);" ";bspritey(x,y) #w.g "spritescale t ";bspritez(x,y) #w.g "spritetoback t" #w.g "spritevisible t on" old(3)=x1 old(4)=y1 if incheck(1) then call text "White in check" call showboard
[skip]
end sub
|
|