News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

chess engine

Started by daydreamer, July 10, 2019, 03:43:16 AM

Previous topic - Next topic

daydreamer

Hi
I read up on chess and bitboards benefit from run it 64bit because 64squares fit into register and benefit from 64bit muls
Anyone tried make a chess game with chess engine?

my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

hutch--

Its not the register size that is complex with a chess game, its the size of the library which has to be truly massive to be effective. Its usually done with super computers.

daydreamer

Quote from: hutch-- on July 11, 2019, 10:38:39 PM
Its not the register size that is complex with a chess game, its the size of the library which has to be truly massive to be effective. Its usually done with super computers.
there exist chess games running at slow 32bit cpus,I have to satisfy with newbie-chessengine level to begin with

I will take one step at a time,first step adviced is a bugfree representation of the board,bugfree important in handling all chess rules before doing search/evaluation part
maybe best output the underlying datasets to console for easier debug
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

aw27

You can download and inspect the stockfish source code (Elo 3438) and try to improve on it.  :icon_idea: Despite being the best chess engine, it is all made in "slow" C++  :sad: . May be translating some parts to Asm will improve it even further.

FORTRANS

Hi,

   For your amusement only:

"SARGON A COMPUTER CHESS PROGRAM", by Dan and
Kathe Spracklen, Hayden Book Company, Inc., 1978.
A well commented Z-80 assembly language program to
play chess.  With 114 pages of mostly code, some
commentary. a description of Z-80 opcodes, and so forth.

   Amazing what gets on your bookshelf.

Cheers,

Steve N.

daydreamer

thanks AW,I check that source up
thanks steve,how big is the final z80 program?
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

FORTRANS

Hi,

Quote from: daydreamer on July 12, 2019, 11:27:23 PM
thanks steve,how big is the final z80 program?

   A quote from the introduction; "The program occupies
8K of RAM, which includes 2K of data areas, 2K graphics
display and user interface, and 4K of move logic."  Hm,
Jochen might be pleased with the lack of code bloat?

Regards,

Steve

jj2007

Quote from: FORTRANS on July 13, 2019, 12:42:48 AM
Jochen might be pleased with the lack of code bloat?

I am, I am, Steve, although my standards have shifted a little bit - I tolerate up to 40kB overhead nowadays. Still very little compared to the 8MB of a QT hello world proggie ;-)

aw27

Interesting, there is already a Stockfish ASM port, called ASMFish. It was developed in Flat Assembler G.  First time i hear about Flat Assembler G and seems like a masturbation paradise for Macro Lovers.

TimoVJL

Quote from: jj2007 on July 13, 2019, 02:48:15 AM
I tolerate up to 40kB overhead nowadays. Still very little compared to the 8MB of a QT hello world proggie ;-)
C and C++ don't have that overhead, if programmers are gentle and have some sort of knowledge of CRT :winking:
May the source be with you

jj2007

That's correct, Timo, but they also don't have commands like Recall ;-)
                    include \masm32\MasmBasic\MasmBasic.inc
                    Init                                    ; show a data set from the World Health Organisation
                    Recall "https://extranet.who.int/tme/generateCSV.asp?ds=mdr_estimates", who$(), csv
                    Print Str$("%i records downloaded", eax)
                    For_ ct=0 To who$(?)-1
                                Print CrLf$, who$(ct, 0)
                                Print At(33, Locate(y)) Spc2$, who$(ct, 4), Space$(40)
                                For_ ecx=8 To 14                ; columns 8...14 contain the data
                                                                Print At(ecx*8-25, Locate(y)) Spc2$, who$(ct, ecx)
                                Next
                    Next
                    EndOfCode


30kB is clearly too much, right? Show me the shorter C++ version ;-)

daydreamer

Quote from: jj2007 on July 13, 2019, 03:38:56 AM
That's correct, Timo, but they also don't have commands like Recall ;-)
                    include \masm32\MasmBasic\MasmBasic.inc
                    Init                                    ; show a data set from the World Health Organisation
                    Recall "https://extranet.who.int/tme/generateCSV.asp?ds=mdr_estimates", who$(), csv
                    Print Str$("%i records downloaded", eax)
                    For_ ct=0 To who$(?)-1
                                Print CrLf$, who$(ct, 0)
                                Print At(33, Locate(y)) Spc2$, who$(ct, 4), Space$(40)
                                For_ ecx=8 To 14                ; columns 8...14 contain the data
                                                                Print At(ecx*8-25, Locate(y)) Spc2$, who$(ct, ecx)
                                Next
                    Next
                    EndOfCode


30kB is clearly too much, right? Show me the shorter C++ version ;-)
cool :thumbsup:

great guys,smallest chessboard drawing a stretchblt and using a tiny checkered image?
8k chess.exe seem possible
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

aw27

@JJ
It is easy to replace your MasmBasic with a 3 or 4KB equivalent in C/C++.
But is even easier to do all that with a simple Powershell script, which shows clearly that your code has a few bugs.


$desiredColumns = 'country','year', 'e_rr_pct_new','e_rr_pct_new_lo','e_rr_pct_new_hi','e_mdr_pct_rr_new','source_rr_ret','source_drs_coverage_ret'
$web = New-Object Net.WebClient
$web.DownloadString("https://extranet.who.int/tme/generateCSV.asp?ds=mdr_estimates") | ConvertFrom-Csv | Select $desiredColumns | Format-Table


Output:


country                                              year e_rr_pct_new e_rr_pct_new_lo e_rr_pct_new_hi e_mdr_pct_rr_new source_rr_ret source_drs_coverage_ret
-------                                              ---- ------------ --------------- --------------- ---------------- ------------- -----------------------
Afghanistan                                          2017 3.7          2               5.9             79               Model
Albania                                              2017 2.3          0.64            5.8             100              Surveillance  National
Algeria                                              2017 2.5          1.1             4.3             67               Model
American Samoa                                       2017 2.3          0.86            4.4             78               Model
Andorra                                              2017 0            0               98              100              Surveillance  National
................... Cut

Zimbabwe                                             2017 4.6          3               6.2             39               Survey        National

jj2007


aw27

Quote from: jj2007 on July 14, 2019, 08:16:29 AM
Which bugs?

You clip column names to the point of appearing as duplicates. You clip results to the point of being clueless.
So, you may need a function to calculate the needed columns widths before printing, it is risky to arbitrate some fixed value and shoot.
And you show a double quote at the start of each line, only God knows why.