Arduino Uno Tournament

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

Is an arduino Uno Chess engine tournament an interesting idea

Poll ended at Sat Aug 30, 2014 1:49 am

yes?
13
59%
no?
9
41%
not sure?
0
No votes
 
Total votes: 22

DavidEather
Posts: 15
Joined: Fri Aug 15, 2014 3:24 am

Arduino Uno Tournament

Post by DavidEather »

Hi,

Just checking if there would be any interest in this:
A chess engine tournament with all competitors running on the Arduino Uno platform.

This would give everyone the same hardware and a new experience in programing in a limited resource environment. (An Arduino Uno has 32k of ROM, 2K of RAM and 1K of eeprom on a RISC chip running at 16 MHz. It programs in a reasonably standard 'C' language - actually C++). This is (roughly) about the same as good standalone hardware in the 90's. How much has programing technique improved?, evaluation functions? etc

Any interest or thoughts (a tournament won't be up and running before mid 2015)
matthewlai
Posts: 793
Joined: Sun Aug 03, 2014 4:48 am
Location: London, UK

Re: Arduino Uno Tournament

Post by matthewlai »

DavidEather wrote:Hi,

Just checking if there would be any interest in this:
A chess engine tournament with all competitors running on the Arduino Uno platform.

This would give everyone the same hardware and a new experience in programing in a limited resource environment. (An Arduino Uno has 32k of ROM, 2K of RAM and 1K of eeprom on a RISC chip running at 16 MHz. It programs in a reasonably standard 'C' language - actually C++). This is (roughly) about the same as good standalone hardware in the 90's. How much has programing technique improved?, evaluation functions? etc

Any interest or thoughts (a tournament won't be up and running before mid 2015)
I would be interested.

It would be pretty different, since code size will be come much more important (it doesn't take a lot of code to use up the ROM), and bitboards are most certainly a very bad idea.
Disclosure: I work for DeepMind on the AlphaZero project, but everything I say here is personal opinion and does not reflect the views of DeepMind / Alphabet.
User avatar
lucasart
Posts: 3232
Joined: Mon May 31, 2010 1:29 pm
Full name: lucasart

Re: Arduino Uno Tournament

Post by lucasart »

DavidEather wrote:Hi,

Just checking if there would be any interest in this:
A chess engine tournament with all competitors running on the Arduino Uno platform.

This would give everyone the same hardware and a new experience in programing in a limited resource environment. (An Arduino Uno has 32k of ROM, 2K of RAM and 1K of eeprom on a RISC chip running at 16 MHz. It programs in a reasonably standard 'C' language - actually C++). This is (roughly) about the same as good standalone hardware in the 90's. How much has programing technique improved?, evaluation functions? etc

Any interest or thoughts (a tournament won't be up and running before mid 2015)
You are so naive. Just try to compile any modern C++ engine on this, and you will understand...

Only C engines have a chance to be compilable with the kind of paleolithic compiler that will work for this fossil. But even basic C engines would have to be compiled with ancient compilers, or else even a "hello world" program would not run on 2K of RAM. Still I don't think you will be able to compile anything beyond FaryMax and the likes. Even Olithink I'm not sure... So it's completely pointless, because these programs do not represent what I would call "state-of-the-art 2014" in chess programming.

I think it would be far more relevant to compile old engines with a modern C compiler and run them on a modern hardware. Then compare with modern programs.

But this is pointless anyway. The progression since 1990 is >99% in software and <1% in hardware. Anyone who understands something about modern chess engines knows that already.
Theory and practice sometimes clash. And when that happens, theory loses. Every single time.
matthewlai
Posts: 793
Joined: Sun Aug 03, 2014 4:48 am
Location: London, UK

Re: Arduino Uno Tournament

Post by matthewlai »

lucasart wrote:
DavidEather wrote:Hi,

Just checking if there would be any interest in this:
A chess engine tournament with all competitors running on the Arduino Uno platform.

This would give everyone the same hardware and a new experience in programing in a limited resource environment. (An Arduino Uno has 32k of ROM, 2K of RAM and 1K of eeprom on a RISC chip running at 16 MHz. It programs in a reasonably standard 'C' language - actually C++). This is (roughly) about the same as good standalone hardware in the 90's. How much has programing technique improved?, evaluation functions? etc

Any interest or thoughts (a tournament won't be up and running before mid 2015)
You are so naive. Just try to compile any modern C++ engine on this, and you will understand...

Only C engines have a chance to be compilable with the kind of paleolithic compiler that will work for this fossil. But even basic C engines would have to be compiled with ancient compilers, or else even a "hello world" program would not run on 2K of RAM. Still I don't think you will be able to compile anything beyond FaryMax and the likes. Even Olithink I'm not sure... So it's completely pointless, because these programs do not represent what I would call "state-of-the-art 2014" in chess programming.

I think it would be far more relevant to compile old engines with a modern C compiler and run them on a modern hardware. Then compare with modern programs.
Did you know the Arduino IDE actually uses AVR-GCC behind the scene, and it actually supports all modern C++ features?

I don't know what kind of modern compiler you are using, but it is perfectly possible to run reasonably complicated and modern C++ code on an Arduino, and I have done that numerous times.
But this is pointless anyway. The progression since 1990 is >99% in software and <1% in hardware. Anyone who understands something about modern chess engines knows that already.
I guess Dr. Hyatt doesn't know anything about modern chess engines then - http://www.talkchess.com/forum/viewtopic.php?t=36059

I thought I knew a little bit about modern chess engines, too, but I guess not.
Disclosure: I work for DeepMind on the AlphaZero project, but everything I say here is personal opinion and does not reflect the views of DeepMind / Alphabet.
DavidEather
Posts: 15
Joined: Fri Aug 15, 2014 3:24 am

Re: Arduino Uno Tournament

Post by DavidEather »

And you are so ignorant.

Arduino's program with the AVR-gcc C++ compiler, just like the Atmel AVR studio does - i.e. it is a reasonable complier for a microcontroller and the whole point is to experience working with limited processing resources.

Because of these limits, any unthinking code monkey who simply ports an engine across is very unlikely to get anywhere near the top results.

As to if it is possible, yes, it was first done years ago (2009) with the C++ chess program minimax being ported to an ATMega88. So despite what you say, a C++ engine can be ported, and since the new hardware has four times the ROM and twice the RAM as an ATMeaga88, and in addition for this competition it will not require resources for a human interface, a lot more is possible. I'm not saying "easy", Stockfish is never going to make it across, but your assertion is clearly wrong. A Uno is not nearly as limited as you seem to imagine. AVR-gcc code on a microcontroller is very efficient compared to x86 on any form of PC. For a start only variables need to go into RAM, and program code is written into ROM.

ATMega is modern hardware and one of the highest selling microcontroller ever. So I don't see you having a point at all.

You are also wrong about the hardware / software divide. If maximum performance was the only goal then everyone would be using dedicated hardware and programing their own FPGA and having ASIC's fabricated with non-disclosure agreements.

The reason it doesn't happen is not because of lack of performance, but because most tournaments no longer accept custom hardware for the good reason that the cost and skill sets required would stop many people from starting and discourage anyone from entering software.

Remember that IBM's hardware was thousands of times faster than it's software competitors. It is still the same today, and you can build hardware to perform any algorithm you like. Unrestricted hardware vs software is not even a competition but more like Leeds United kicking the crap out of the local under 5's.

And why do people allow programs to be weakened if max power is the only goal?

Is there no joy in having something that you can say "I built this myself" (followed by a perhaps unvoiced "and it can beat 97% of people who play chess)"?

No point in learning something new or picking up new skills? For every PC sold, thousands of microcontrollers are produced and this is a nice way to leverage your existing programing skills to enter into the Internet of Things.

Arduino is low cost: about $20 but you can make your own for $4 if you want. Arduino avoids the cost associated with custom hardware. It is very well supported with a very active and knowledgeable forum, books, blogs and more, so no one should get stuck alone with a problem that can't be resolved.

And because the hardware is identical who wins will be much more a function of who is the best programmer compared to who has the most money.

World shaking? No., but interesting if you have an open and curios mind (and spare time)!
User avatar
stegemma
Posts: 859
Joined: Mon Aug 10, 2009 10:05 pm
Location: Italy
Full name: Stefano Gemma

Re: Arduino Uno Tournament

Post by stegemma »

DavidEather wrote:Hi,

Just checking if there would be any interest in this:
A chess engine tournament with all competitors running on the Arduino Uno platform.

This would give everyone the same hardware and a new experience in programing in a limited resource environment. (An Arduino Uno has 32k of ROM, 2K of RAM and 1K of eeprom on a RISC chip running at 16 MHz. It programs in a reasonably standard 'C' language - actually C++). This is (roughly) about the same as good standalone hardware in the 90's. How much has programing technique improved?, evaluation functions? etc

Any interest or thoughts (a tournament won't be up and running before mid 2015)
I would be interested but i think that an assembly program could be the better choice, for a limited hardware. My old softwares were all in assembly and a port of Freccia (my last chess software written in assembly) could fit in that platform. Maybe even the new Satana could fit, because is all C++ portable code. But just let me know: you can use only 2K of RAM for both the executable and the work memory? That sounds like programming a ZX81 and this would make me very happy! ;)
matthewlai
Posts: 793
Joined: Sun Aug 03, 2014 4:48 am
Location: London, UK

Re: Arduino Uno Tournament

Post by matthewlai »

stegemma wrote:
DavidEather wrote:Hi,

Just checking if there would be any interest in this:
A chess engine tournament with all competitors running on the Arduino Uno platform.

This would give everyone the same hardware and a new experience in programing in a limited resource environment. (An Arduino Uno has 32k of ROM, 2K of RAM and 1K of eeprom on a RISC chip running at 16 MHz. It programs in a reasonably standard 'C' language - actually C++). This is (roughly) about the same as good standalone hardware in the 90's. How much has programing technique improved?, evaluation functions? etc

Any interest or thoughts (a tournament won't be up and running before mid 2015)
I would be interested but i think that an assembly program could be the better choice, for a limited hardware. My old softwares were all in assembly and a port of Freccia (my last chess software written in assembly) could fit in that platform. Maybe even the new Satana could fit, because is all C++ portable code. But just let me know: you can use only 2K of RAM for both the executable and the work memory? That sounds like programming a ZX81 and this would make me very happy! ;)
Code is not typically copied into memory on microcontrollers (because it won't fit!). It's run straight from flash.
Disclosure: I work for DeepMind on the AlphaZero project, but everything I say here is personal opinion and does not reflect the views of DeepMind / Alphabet.
elcabesa
Posts: 855
Joined: Sun May 23, 2010 1:32 pm

Re: Arduino Uno Tournament

Post by elcabesa »

I think it would be very difficult programming a chess engine on a 8bit microcontroller.
evene 16 bit is done through software library
User avatar
sje
Posts: 4675
Joined: Mon Mar 13, 2006 7:43 pm

No, not the Arduino Uno

Post by sje »

A few years ago I wrote Myopic, a portable C++ chess program for the Arduino Mega (128 KB flash, 8 KB RAM). The program also runs on any desktop targeted by the GNU g++ tool chain. The two versions are identical other than the desktop version can compile an opening book from a file of PGN games.

The big problem with getting any kind of speed with the gcc tools was that all the eight bit arithmetic was done with 16 bit intermediate values instead of with 8 bit intermediates that would have saved much space and time.

Much, much better than the Arduino or Arduino Mega is the BeagleBone Black. The now shipping BB Black model C is a 1 GHz 32 bit processor with Ethernet, HDMI output, 4 GB flash, 512 MB RAM, and a bunch of other stuff. All this for US$55, less than two Arduino Uno boards or one Arduino Mega board. You can get these with Debian Linux installed for free.

If your code can be built with Linux, then you should be able to build and run it on a BB Black.

Compared to a US$35 Raspberry Pi, a BB Black costs US$20 more but has 87% better throughput when tested with by bitboard program Symbolic.

https://www.adafruit.com/products/1876
http://elinux.org/BeagleBoneBlack
elcabesa
Posts: 855
Joined: Sun May 23, 2010 1:32 pm

Re: No, not the Arduino Uno

Post by elcabesa »

BeagleBone black is a PC :) if you have a linux program in plain c++ ( no sse intrinsic) you can run it on it. this is not a challenge :)