Skip to content
bstabs-altPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

madera

  • Madera is a bare bones TUI implementation written in Go.
  • The name is a play on the Tūī bird genus classification 'Prosthemadera'.

Logging

Run the following cmd in a separate terminal

tail -f tmp.log | jq
# jq options:
    # -C (Coloured)
    # -unbuffered (process each new log individually)

Build (Makefile)

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"

TODO

Make Grid Component Generic

  • 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 Chess-Specific Renderer

  • Create ChessRenderer interface 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

Fix Coordinate System

  • 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

Add Event System

  • 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

Create Clean Interface Between Components

  • 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

Quick Start Priority Order:

  1. Start with separate chess logic - clear separation of concerns
  2. Then fix coordinates - prevents bugs in other changes
  3. Then make grid generic - enables reusability
  4. Save Event System andClean Interface for last - architectural improvements

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages