Close

Update: USB interface, moving forward with "smart" computer player

A project log for Electronic Mancala++

Updated version of my Electronic Mancala Board that uses a ATtiny3224 microcontroller

zachary-murtishiZachary Murtishi 02/02/2025 at 19:460 Comments

I've went and added a software interface for a host PC to control game actions from a USB VCOM interface. It is a simple 9600 baud, 8N1 interface using the FT230X to bridge the ATtiny3224 USART port with a USB host. The game state can be polled as a 15-byte vector: 14 bytes containing the number of stones per pot with the current player's turn as the last byte. Bytes corresponding to a valid move (pots 0-5, 7-12) can be input to the board to make a move, provided it is the right player's turn for that move to be made. If an invalid input/move out of turn is input/illegal move (no stones in pot) is received, an appropriate error message is sent (ERROR!/WRONG TURN!/EMPTY!).

This interface will allow an external mancala game engine to control one of the players on the board. A "smart" mancala engine based on expensive recursion probably can't run very smoothly on the ATtiny3224, but it most likely will be able to on my Mac. Right now, I will work on modifying one of the many Python-based mancala game engine programs out there to serve as a second player for this board. It shouldn't be too difficult, given that the software and hardware are there on the board side. I just have to configure an existing project to output its move choice to this board in the proper way. I imagine I will have to do something like this:

  1. Integrate Pyserial read/write functions into the mancala engine
  2. Change interface for the mancala engine to read the game state
    1. Instead of reading from a Python object/list/other data structure, it will read a 15-byte vector over the serial interface to determine the game state.
  3. Change interface for the mancala engine to cast a move
    1. Instead of writing to a Python object/list/data structure, it will send a one-byte move over the serial interface to make a move

Discussions