Chess engine in braifuck

Discussion of chess software programming and technical issues.

Moderators: Harvey Williamson, Dann Corbit, hgm

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
Michael Sherwin
Posts: 3196
Joined: Fri May 26, 2006 1:00 am
Location: WY, USA
Full name: Michael Sherwin

Re: Chess engine in braifuck

Post by Michael Sherwin » Tue May 21, 2019 5:14 pm

flok wrote:
Tue May 21, 2019 9:18 am
any news?
Yes! Brainfuck is quickly becoming the language of choice for programming neural networks.
If you are on a sidewalk and the covid goes beep beep
Just step aside or you might have a bit of heat
Covid covid runs through the town all day
Can the people ever change their ways
Sherwin the covid's after you
Sherwin if it catches you you're through

dmc75287
Posts: 4
Joined: Wed Mar 06, 2019 7:14 pm
Full name: David Conant

Re: Chess engine in brainfuck - update

Post by dmc75287 » Wed Aug 21, 2019 11:18 pm

I am one of the original participants in this crazy project. As far as I can tell, the original project has been discontinued. That's ok, it was an unlikely undertaking in the first place, but I don't give up so easily. I no longer have access to the original files, discussions, chess engine examples. I have designed a very simple game for me to practice game engine design. The I will convert it to bf, and start to work on a very simple chess engine. It could take many years, but I'll continue to plodding along.

Michael Sherwin
Posts: 3196
Joined: Fri May 26, 2006 1:00 am
Location: WY, USA
Full name: Michael Sherwin

Re: Chess engine in braifuck

Post by Michael Sherwin » Sat Feb 29, 2020 7:13 pm

This project may yet live!

In part one the author creates a simple BF interpreter that runs the Mandelbrot Generator BF code in 38.6 seconds. Although the MG code is pure BF the interpreter undergoes several optimization upgrades that results in times of 18.4, 11.9 and finally 3.9 seconds.

https://eli.thegreenplace.net/2017/adve ... terpreter/

In part two the author starts with an unoptimised x64 JIT version of the interpreter (making it into a compiler) that executes the MG in 2.89 seconds. After optimization the time is reduced to 0.93 seconds.

https://eli.thegreenplace.net/2017/adve ... n-x64-jit/

In part three LLVM is used, 0.92 seconds, however that is deceptive because LLVM does the JIT compiling at run time after analysis or whatever a step that using asmjit does not have to do. On say a chess engine the gains using LLVM would be substantial.

https://eli.thegreenplace.net/2017/adve ... rt-3-llvm/

In part four Python is used with an embedded assembler called PeachPy. However the author gives no time. He also mentions LLVMlite which is a Python wrapper.

https://eli.thegreenplace.net/2017/adve ... in-python/

So it would seem that a BF compiler could be written, quite easily, that can run BF code at least 80x faster than a simple interpreter could. That still does not alleviate the tedious writing of millions of BF characters to accomplish a worthwhile chess engine. An earlier suggestion to have a higher level language produce BF code might be the answer. But that would beg the question, why keep BF in the chain at all if the programmer never directly works with BF code. Maybe curiosity about how fast the BF compiled code would run compared to C/C++ could be one reason. Besides curiosity a real world reason could be for use on a massively parallel BF optimized cpu with a gazillion very tiny BF cores.
If you are on a sidewalk and the covid goes beep beep
Just step aside or you might have a bit of heat
Covid covid runs through the town all day
Can the people ever change their ways
Sherwin the covid's after you
Sherwin if it catches you you're through

dmc75287
Posts: 4
Joined: Wed Mar 06, 2019 7:14 pm
Full name: David Conant

Re: Chess engine in braifuck

Post by dmc75287 » Tue Mar 10, 2020 5:24 pm

Michael Sherwin wrote:
Sat Feb 29, 2020 7:13 pm
This project may yet live!
...
I continue to work on this project. I will examine all of those links, but when I eventually start on the bf version, I will code it by hand in brainfuck. I don't plan to do any optimization or converting a high level language to bf.

Post Reply