|
Post by Rod on Mar 25, 2019 19:24:51 GMT
Liberty folks are fully involved in LB5 testing. This Chess routine popped up on the Face Book group. It was written by Dean Menezes a while ago for QB and is probably one of the best examples of recursion you will find. I have messed it up a little while porting to Liberty/Just BASIC but it appears to run. More work to do yet but any comments or bug reports welcome.
'Based on How To Write A Chess Programm in QBASIC 'By Dean Menezes. Ported to Liberty BASIC by Rod Bird. 2019
snipped
|
|
|
Chess
Mar 25, 2019 21:33:08 GMT
Post by B+ on Mar 25, 2019 21:33:08 GMT
Cool! Looks like it needs a graphics interface.
|
|
|
Post by carlgundel on Mar 25, 2019 22:01:34 GMT
Liberty folks are fully involved in LB5 testing. What, do we need Just BASIC v3.0 alpha testing to wake this place up? Say it isn't so!
|
|
|
Chess
Mar 26, 2019 5:31:35 GMT
Post by tsh73 on Mar 26, 2019 5:31:35 GMT
|
|
|
Chess
Mar 26, 2019 7:56:37 GMT
Post by Rod on Mar 26, 2019 7:56:37 GMT
Yes Anatoly I found your nice interface. But my code is not fully debugged yet and it’s such a long evaluation process it needs an audit trail to see where it goes wrong. But sometime soon we will have a nice chess game with a nice graphical interface. I am off to try and extract all the array position calculations and see if multiple arrays speed up processing. I also need to set up some loadable game plays. That will speed testing as well.
|
|
|
Chess
Mar 26, 2019 7:59:49 GMT
Post by Rod on Mar 26, 2019 7:59:49 GMT
JB3 would be fantastic, but if you want to get LB5 more stable first that would be cool too.
|
|
|
Chess
Mar 26, 2019 12:47:56 GMT
Post by B+ on Mar 26, 2019 12:47:56 GMT
It does look good. I did an interface with Chess Font then switched to code drawn pieces. One big difficulty is "arguments" with the Chess AI about legal moves but after the AI is hooked in, you could click "pickup" a piece and it would highlight all legal moves with that piece until 2nd click or drop.
|
|
|
Post by Rod on Mar 26, 2019 12:53:18 GMT
This is what I have just now, kinda 3D ish board. Colors are a bit lurid I may tone that down.
|
|
|
Chess
Mar 26, 2019 14:42:53 GMT
Post by carlgundel on Mar 26, 2019 14:42:53 GMT
This is what I have just now, kinda 3D ish board. Colors are a bit lurid I may tone that down. Cool! You got that someplace online including sprites for the pieces?
|
|
|
Chess
Mar 26, 2019 14:44:39 GMT
Post by carlgundel on Mar 26, 2019 14:44:39 GMT
JB3 would be fantastic, but if you want to get LB5 more stable first that would be cool too. Yeah there will probably be Just BASIC v3.0 at some point, but you just got JB2 so don't be too much in a hurry.
|
|
|
Chess
Mar 26, 2019 17:43:05 GMT
Post by tsh73 on Mar 26, 2019 17:43:05 GMT
Whoa nice pieces, Rod. As a side note since algorithm does not contain RND (by search) it should pick same moves, right? I tried to run original code but QBasic refused to run on Win 10 64 and QB64 errored on seemingly normal line. Will try on older Windows.
EDIT run it in QBasic inside DOSBox. JB runs so much faster I thought QBasic just hang! %) but indeed it made same move. OOPS it was first same move, they differ on second.
EDIT Win 10 32 Qbasic requires NTVDM - install- yes attempt to run "NTVDM encountered system error", closes made a shortcut with compatibility set to Win 95 it WORKS now it works FAST, one could really see how figure move is checked but moves are different. JB: e2e4 e7e5 Ng1f3 d7d6 QB: e2e4 e7e5 Ng1f3 Qd8f6
|
|
|
Post by Rod on Mar 26, 2019 19:28:07 GMT
I created the sprites for the chess men from a static image quite some time ago. So too the board, which is a real board with alpha numeric labels added then perspective stretched. I have searched and searched online but I cannot find the original artwork. If we needed a distributable set of artwork we could find that, but debugging first!
|
|
|
Chess
Mar 26, 2019 19:32:56 GMT
Post by Rod on Mar 26, 2019 19:32:56 GMT
That is because I had a bug in the Bishop move routine which the Queen move routine uses, it jumped over own players. It uses the Bishop and Rook moves because it gives the same Queen movement. I have fixed a few things and will post the revised code. I also had a bug where illegal moves restored the white player but left the black player eliminated.
Still lots to debug. Reducing the recursion level really speeds up play, good for testing, probably not so good for gameplay.
|
|
|
Chess
Mar 26, 2019 19:37:02 GMT
Post by Rod on Mar 26, 2019 19:37:02 GMT
This version simplifies the array addressing and uses more arrays with simplistic x,y addressing. It is probably a whole lot easier to follow. It also only searches two instead of four plays and runs so much faster.
'Based on How To Write A Chess Programm in QBASIC 'By Dean Menezes. Ported to Liberty BASIC by Rod Bird. 2019
snipped
|
|
|
Chess
Mar 26, 2019 20:26:39 GMT
Post by tsh73 on Mar 26, 2019 20:26:39 GMT
New code do marvels QF6:KE1 queen just eat up my king %) More debug obviously needed 0 1 2 3 4 5 6 7 A B C D E F G H 0 8 R N B Q K B N R 1 7 P P P P P P P P 2 6 3 5 4 4 5 3 6 2 p p p p p p p p 7 1 r n b q k b n r YOUR MOVE: e2e4 checking player move for E2-E4 Piece P 0 1 2 3 4 5 6 7 A B C D E F G H 0 8 R N B Q K B N R 1 7 P P P P P P P P 2 6 3 5 4 4 p 5 3 6 2 p p p p p p p 7 1 r n b q k b n r Computers move E7-E5 0 1 2 3 4 5 6 7 A B C D E F G H 0 8 R N B Q K B N R 1 7 P P P P P P P 2 6 3 5 P 4 4 p 5 3 6 2 p p p p p p p 7 1 r n b q k b n r YOUR MOVE: g1f3 checking player move for G1-F3 Piece N 0 1 2 3 4 5 6 7 A B C D E F G H 0 8 R N B Q K B N R 1 7 P P P P P P P 2 6 3 5 P 4 4 p 5 3 n 6 2 p p p p p p p 7 1 r n b q k b r Computers move D8-F6 0 1 2 3 4 5 6 7 A B C D E F G H 0 8 R N B K B N R 1 7 P P P P P P P 2 6 Q 3 5 P 4 4 p 5 3 n 6 2 p p p p p p p 7 1 r n b q k b r YOUR MOVE: d2d3 checking player move for D2-D3 Piece P 0 1 2 3 4 5 6 7 A B C D E F G H 0 8 R N B K B N R 1 7 P P P P P P P 2 6 Q 3 5 P 4 4 p 5 3 p n 6 2 p p p p p p 7 1 r n b q k b r Computers move F6-E1 0 1 2 3 4 5 6 7 A B C D E F G H 0 8 R N B K B N R 1 7 P P P P P P P 2 6 3 5 P 4 4 p 5 3 p n 6 2 p p p p p p 7 1 r n b q Q b r I took your YOUR MOVE:
|
|