20170225

Mastermind Game #2: Failing to plan is planning to fail!

ARDUINO: Been having a bit of a rethink of the Mastermind game project. The rather prolonged inactivity on it have been unfortunate. Been busy in other areas, though I have mulled over this project to refine it before I get started proper.

First and foremost, I've ditched the idea of using a rotary encoder. I'll use three buttons instead. One for select, and then two for browsing. Not so much for coding considerations, but UX and saving some precious space in what I think will be a very cramped enclosure.

Secondly, my previous though of using three shift-registers to drive the LEDs was somewhat wasteful. I can get by with one as it happens. And four NPN transistors plus eight resistors.



As for the general layout of the project, I've landed on a 4x3 LED grid plus a single LED. Since two rows are made of RGB LEDs, electrically it is an 7x4 grid - and the lone LED making sure I use all 8 outputs from the shift-register. Finally the three button go on the bottom. Inside, it'll be a two-layer proto-board design. Lower layer for the ICs and glue hardware, upper layer for the LEDs. The buttons will be attached directly to the lid.

Basic 'display' as it were will be from top to bottom:

- A 4x row of Blue LEDs to count the tries. Binary FTW!
- A 4x row of RGB LEDs to signal result. Blue for a correct colour, Green for a correct color and placement, Red for neither.
- A 4x row of RGB LEDs for user selection of colour.
- A single Green LED to signal browse row or commit row mode.

How the UI will work:

- On the left there will be one button (1) to select and commit.
- On the right there will be two buttons (2 and 3) to browse.

Basic procedure:

00 - Power switch is turned on.
---
01 - Game starts, a little lights-show and then all LEDs turn off.
02 - User in edit mode, browse colours on a column - when happy commit colour with button 1. Current column will blink.
03 - User in edit mode, browse left-righ to select another column with button 1.
04 - Repeat from 2 until four colours are committed at which point user may:
05 - Browse off left or right column to get to mode select.
06 - If green LED is blinking, browse previous history by hitting button 2 (back) and 3 (forward) if available.
07 - If green LED is blinking and at current go to commit mode by hitting button 3.
08 - If green LED is blinking and at current go to edit mode by hitting button 1.
09 - If green LED is solid, commit turn by hitting button 3.
10 - If green LED is solid, go back to browse history mode by hitting button 1.
11 - Result is computed and displayed, if not solved, back to 2
12 - Result is computed and correct. A little lights-show, reset to 1 on hitting button 1
---
13 - Power switch is turned off.

To start off, it'll all have to be breadboarded up of course. And even-though the final product will run off a bare Atmega328, during the prototyping, programming and testing - I'll use an UNO. It's such a nice device for that purpose. Though it'll be quite the rats-nest of wires :)

Since I got no serious plans for the weekend, some actual hands on progress and write up of it all may even surface soon(tm)

1 comment: