Coder Social home page Coder Social logo

microbit_nanochess's Introduction

Toledo Nanochess on the BBC micro:bit

Introduction

Some years ago I had the idea of implementing a chess program on the BBC micro:bit (https://microbit.org) since this little device has already a built-in 5x5 LED matrix and two buttons for user inputs. After some research I found the wonderful implementation of Oscar Toledo's Nanochess (https://nanochess.org/chess3.html). I was completely fascinated of this little program. The time has come and I ported this awesome chess program. This is probably now one of the smallest chess computers in the world.

I used https://nanochess.org/toledo_nanochess.c as a starting point and Arduino IDE 2.0.3 (see https://www.arduino.cc/en/software) with the installed "Adafruit MicroBit library" (see https://github.com/adafruit/Adafruit_Microbit).

Arduino IDE has some problems with the tricky preprocessor defines, so I sent the file through gcc with the -E option. After playing around with the tiny program and redirecting the Standard-I/O to the serial interface I decided to write a simple user interface for being completely independent.

Demo

You can find a demo of the program at https://www.youtube.com/watch?v=Vc_DAjjW53I.

Upload to the BBC micro:bit

The "one minute solution" for uploading the executable binary to the micro:bit is to drag and drop the file microbit-nanochess.hex to the micro:bit. The hex file was retrieved with the uBitTool from https://github.com/carlosperate/ubittool/releases. Since I don't own a micro:bit v2 I can't promise whether this method works there. If you want to do further development you have to install the Arduino IDE (https://www.arduino.cc/en/software) and micro:bit libraries from adafruit, documented at https://learn.adafruit.com/use-micro-bit-with-arduino. Just open the microbit_nanochess.inofile and push the Upload Button.

Usage

After starting, the user is welcomed with Nanochess followed by the color whose turn it is. A > appears, which means that you can skip the move input and let the micro:bit calculate the move.

With the A-button you can select the desired letter or number whereas with the B-button you will confirm your selection.

After entering your first move (eg. C2C4) a >appears again, which should be confirmed. Selecting a letter in this step (either N, Q, Ror B) is just for the case of a promotion indicating the desired figure.

Now the micro:bit confirms the move and repeats the procedure with the other color. So it's quite easy to switch to the other color.

Credits

microbit_nanochess's People

Contributors

ghoelzl avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.