Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 07:17 22 Nov 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : CMM2: TSCP Chess

     Page 2 of 7    
Author Message
Bleep
Guru

Joined: 09/01/2022
Location: United Kingdom
Posts: 509
Posted: 07:01pm 01 Oct 2022
Copy link to clipboard 
Print this post

Have a look at your PMs :-)
Regards Kevin.
 
Bleep
Guru

Joined: 09/01/2022
Location: United Kingdom
Posts: 509
Posted: 07:26pm 01 Oct 2022
Copy link to clipboard 
Print this post

Hi Volhout,

I suspect we'll need to play around with these values to give the best game play, without exceeding the memory of the Pico, unfortunately I'm crap at Chess!!
As for the bmp file, I'm actually on holiday at the moment (it's been raining on and off the last few days so I've been 'allowed' a few hours) so I don't have access to my usual image editing stuff, do you want to have a go at making them better?
Hopefully we'll hear from Tom soon, in which case we can publish it, assuming he's ok with that.

Regards Kevin.
Edited 2022-10-02 05:27 by Bleep
 
Bleep
Guru

Joined: 09/01/2022
Location: United Kingdom
Posts: 509
Posted: 09:34pm 01 Oct 2022
Copy link to clipboard 
Print this post

Hi Volhout,

I have sent you another PM.
It may be possible to allow deeper searches as the game progresses, currently it seems to be only able to do 4 to begin with, but I have manually increased this to 5 & 6 as the game progressed and there were fewer pieces?

Regards Kevin.
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9084
Posted: 08:07am 02 Oct 2022
Copy link to clipboard 
Print this post

PicoMiteVGA.zip


Have a play with this version. This includes two new mm.info functions

mm.info(stack) returns the current value of the C stack pointer
mm.info(heap) returns the amount of MMBasic heap memory free

In addition I have implemented stack checking in various places. An error will be thrown if the stack pointer goes below &H2003f800. If it does it hits the C heap which is used by the USB CDC code and after that hits some critical firmware variables hence the strange error messages you have seen

All this demonstrated by

Print factorial(100)
Function factorial(n%)
 Print n%,Hex$(MM.Info(stack)),MM.Info(heap)
 If n%=1 Then
   factorial=1
 Else
   factorial=factorial(n%-1)
 EndIf
End Function


Using the new diagnostics you should be able to tune the chess code to run within the limits of the PicoMite. NB: there is no way to increase the C stack allocation without reducing the MMbasic heap size (variable area)
Edited 2022-10-02 18:11 by matherp
 
Bleep
Guru

Joined: 09/01/2022
Location: United Kingdom
Posts: 509
Posted: 08:53am 02 Oct 2022
Copy link to clipboard 
Print this post

Hi Peter,
Fantastic :-) thank you very much, we'll give it a spin, I'm on hols in Cornwall, so it may now be a while, I'm also waiting for the original writer of TSCP to give the ok for this version to be published.
Regards Kevin.
PS. I've just sent you a PM.
Edited 2022-10-02 19:10 by Bleep
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9084
Posted: 09:35am 02 Oct 2022
Copy link to clipboard 
Print this post

The sort of thing you need to think about is to simplify expressions into multiple statements. Look at the attached


 
bar1010
Senior Member

Joined: 10/08/2020
Location: United States
Posts: 197
Posted: 08:45pm 02 Oct 2022
Copy link to clipboard 
Print this post



Here is one position from my Chess 960 variant program.  Just need to modify the castling code.  Also
am creating a Double Chess 960 version where White’s and Black’s initial setups can be different
from each other to make 960 x 960 = 921,600 unique initial positions.
 
bar1010
Senior Member

Joined: 10/08/2020
Location: United States
Posts: 197
Posted: 08:51pm 02 Oct 2022
Copy link to clipboard 
Print this post



Here is my BMP file that will be using to display the board and pieces for three chess variants.  The board squares will be 90x90 pixels.  One board will have 10x8 = 80 squares, while another will have 12x8 = 96 squares.
Screen resolution will be 1280x1024.
 
Bleep
Guru

Joined: 09/01/2022
Location: United Kingdom
Posts: 509
Posted: 09:47pm 02 Oct 2022
Copy link to clipboard 
Print this post

Hi Volhout,
I have made a few changes to the code, see your PM.
I still haven't heard from Tom, I've tried sending off another Email.
I've been testing it by using a chess program on my tablet, the tablet usually wins.
I am using Peters latest, which did seem to improve things in its on right.
Regards Kevin.
Edited 2022-10-03 16:36 by Bleep
 
Bleep
Guru

Joined: 09/01/2022
Location: United Kingdom
Posts: 509
Posted: 08:49am 03 Oct 2022
Copy link to clipboard 
Print this post

Hi Volhout,
While you are tuning, did you know you can probably use the 'bench' command, which runs a benchmark piece of code, which I assume exercises the code quite well. Using a depth of 5 search took about 30 mins and did not crash.
If you look for a routine called 'bench' you can change the time limit or the depth limit, so you can do quicker runs to aid tuning.

 max_time=324e5 'in mS
 max_depth=5

Hope this helps.
Regards Kevin.
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4213
Posted: 09:33am 03 Oct 2022
Copy link to clipboard 
Print this post

Hi Kevin,

I made some improvements, and added stack level and heap level to the screen.
Have your code running for one hour (playing itself) and not problems.
I will PM the code later today when I have more confidence (with your proposed changes).
Stack levels and heap levels seem to leave 23k free (stack starting at 36k, heap at 26k).

Volhout

EDIT: correction, the C-stack is only 8.8k and often reaches 2k level... This is seriously close to crashing. But it keeps running with the levels you set. I will need to improve more....
Thanks Peter, for this tool....
Edited 2022-10-03 19:53 by Volhout
PicomiteVGA PETSCII ROBOTS
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4213
Posted: 01:24pm 03 Oct 2022
Copy link to clipboard 
Print this post


Still running (playing against itself) after 4 hours. Not even close to an end-game yet. All pieces are still on the board, except 2 pawns. This will take all night. Let's see where it is tomorrow.

Probably need more horse power.
Edited 2022-10-03 23:29 by Volhout
PicomiteVGA PETSCII ROBOTS
 
Rickard5

Guru

Joined: 31/03/2022
Location: United States
Posts: 463
Posted: 01:43pm 03 Oct 2022
Copy link to clipboard 
Print this post

Volhout you sir are a Gentleman and a Genus, Chess on the Picomite is there anyway to move the board tor the left side of the screen and the game notation on the right ? but Chess on the PM OMG OMG OMG OMG
I may be Vulgar, but , while I'm poor, I'm Industrious, Honest,  and trustworthy! I Know my Place
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4213
Posted: 02:17pm 03 Oct 2022
Copy link to clipboard 
Print this post

Hi Richard,

Please understand this is mostly Kevin's (Bleep) and bar1010's work. And of coarse the heavy lifter Tom Kerrigan, who wrote the chess engine. I merely tune the code to minimize stack usage as to Peter's advise. The thinking is all on Kevin...

Volhout
Edited 2022-10-04 00:20 by Volhout
PicomiteVGA PETSCII ROBOTS
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6760
Posted: 02:27pm 03 Oct 2022
Copy link to clipboard 
Print this post

It says just as much for MMBasic. A BASIC interpreter (not a compiler) being able to handle a chess program at all is something. :)

The fact that the Pico (which is closer in most ways to a microcontroller than a SoC) can handle a fast BASIC interpreter is pretty cool too, of course. :)

I, personally, first saw chess on a Nascom-2 (Z80) in about 1980ish. That was Sargon, but it was a machine code program.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9084
Posted: 02:50pm 03 Oct 2022
Copy link to clipboard 
Print this post

  Quote  Please understand this is mostly Kevin's (Bleep) and bar1010's work. And of coarse the heavy lifter Tom Kerrigan, who wrote the chess engine. I merely tune the code to minimize stack usage as to Peter's advise. The thinking is all on Kevin...


The person who did the MMbasic conversion from C with permission from Tom was Martin Round (ceptimus) everything else is derivative of his work. Martin was part of the team of testers of the CMM2 before its announcement and the chess port was a very useful test program.
Edited 2022-10-04 00:58 by matherp
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4213
Posted: 03:32pm 03 Oct 2022
Copy link to clipboard 
Print this post

Thanks,

I didn't know that .... ceptimus, thank you !!
PicomiteVGA PETSCII ROBOTS
 
Bleep
Guru

Joined: 09/01/2022
Location: United Kingdom
Posts: 509
Posted: 04:37pm 03 Oct 2022
Copy link to clipboard 
Print this post

Hi, yes, I claim no credit for converting it to MMBasic from C, other than getting the version from Bar1010 working on the Pico. The graphics are quite poor, simply a rescale of Bar1010 pieces, they need to be improved but I'm away from home at the moment.  

Question for Ceptimus or Bar or Peter, I have tried Emailing Tom Kerrigan several times now to ask for permission to publish a PicoMite version of Chess, this is on the Email from his website, but I've had no response, do you know of a better address?

As you can see it's quiet slow, but may be ok for a casual player. I would think that if the original C could be compiled as a csub if that is even possible, with MMBasic providing the user interface it would then potentially give quite acceptable results.

Regards Kevin
Edited 2022-10-04 06:18 by Bleep
 
Rickard5

Guru

Joined: 31/03/2022
Location: United States
Posts: 463
Posted: 09:05pm 03 Oct 2022
Copy link to clipboard 
Print this post

  Bleep said  Hi Volhout,

I suspect we'll need to play around with these values to give the best game play, without exceeding the memory of the Pico, unfortunately I'm crap at Chess!!
As for the bmp file, I'm actually on holiday at the moment (it's been raining on and off the last few days so I've been 'allowed' a few hours) so I don't have access to my usual image editing stuff, do you want to have a go at making them better?
Hopefully we'll hear from Tom soon, in which case we can publish it, assuming he's ok with that.

Regards Kevin.



PLEASE NO the original Graphics are Wonderful!!!!!! the only thing is could the Game Notation be moved on the right and the board to the left?
I may be Vulgar, but , while I'm poor, I'm Industrious, Honest,  and trustworthy! I Know my Place
 
bar1010
Senior Member

Joined: 10/08/2020
Location: United States
Posts: 197
Posted: 10:06pm 03 Oct 2022
Copy link to clipboard 
Print this post

  Bleep said  Hi, yes, I claim no credit for converting it to MMBasic from C, other than getting the version from Bar1010 working on the Pico. The graphics are quite poor, simply a rescale of Bar1010 pieces, they need to be improved but I'm away from home at the moment.  

Question for Ceptimus or Bar or Peter, I have tried Emailing Tom Kerrigan several times now to ask for permission to publish a PicoMite version of Chess, this is on the Email from his website, but I've had no response, do you know of a better address?

As you can see it's quiet slow, but may be ok for a casual player. I would think that if the original C could be compiled as a csub if that is even possible, with MMBasic providing the user interface it would then potentially give quite acceptable results.

Regards Kevin


Tom Kerrigan’s email address is tom.kerrigan@gmail.com
He has responded to me, although sometimes it may take a day or two.
He mentioned that he is currently on vacation.
Does anyone have contact information for ceptimus?
 
     Page 2 of 7    
Print this page
© JAQ Software 2024