- Madera is a bare bones TUI implementation written in Go.
- The name is a play on the Tūī bird genus classification 'Prosthemadera'.
Run the following cmd in a separate terminal
tail -f tmp.log | jq
# jq options:
# -C (Coloured)
# -unbuffered (process each new log individually)See: Learn Makefiles
Quick Overview
Makefile is the standard build tooling written for GNU Make.
Note: You MUST indent with tabs and not spaces to compile successfully.
Example
Run with $ make
# ./makefile
hello:
echo "Hello, World"- Make grid size configurable in
New()function - Update ALL movement functions to use new dimensions
- Fix the
cursorBounds()function to work with 2D grid
Outcome: You can create grids of any size (3x3, 10x10, etc.) without code changes
- Create
ChessRendererinterface or struct in chess package - Move board border drawing, file (a-h), rank (1-8) to
ChessRenderer- Grid should only handle generic cell layout
- Keep the pretty box-drawing characters working
- Don't lose the current visual formatting
- Make sure cursor highlighting still works
Outcome: Grid's
Draw()function is generic and chess rendering is separate
- Pick ONE coordinate system: either 1D array index OR 2D (X,Y) coordinates
- If keeping 2D: write helper functions to convert between (X,Y) and array index
- Update all movement functions to use consistent coordinate system
- Fix
SelectedCell()to work with chosen coordinate system- Chess boards are weird: A1 is bottom-left, H8 is top-right
- Don't mix up row/column with X/Y coordinates
- Test diagonal movement and edge cases
Outcome: Cursor movement works correctly in all directions without coordinate confusion
- Create event types (CellSelected, CursorMoved, etc.)
- Grid should emit events instead of directly handling chess logic
- Chess game should listen to grid events and respond accordingly
- Replace direct method calls with event passing
- Don't break existing key bindings during transition
- Keep the event system simple (avoid over-engineering)
- Make sure events carry necessary data (like cursor position)
Outcome: Grid component sends events and chess game responds to them
- Define interface for what grid needs from chess game
- Define interface for what chess game needs from grid
- Remove direct access to internal fields
- Use getter/setter methods or interfaces for communication
- Don't make interfaces too complex
- Keep performance reasonable (avoid excessive method calls)
- Make sure both components can work independently
Outcome: You could swap out chess game for checkers without changing grid code
- Start with separate chess logic - clear separation of concerns
- Then fix coordinates - prevents bugs in other changes
- Then make grid generic - enables reusability
- Save Event System andClean Interface for last - architectural improvements