jwalsh / jwalsh/2048-cli-debug

TTY-based 2048 controller implementation

Open
#5 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

## Goal
Build a proper TTY-based controller that can read game state from terminal output and send intelligent moves.

## Background
We successfully used a simple TTY approach (piping moves) in down_right_spam.sh to achieve 1708 points. Now we need to build a proper bidirectional TTY controller.

## Requirements
- [ ] Create PTY (pseudo-terminal) for game process
- [ ] Capture and parse terminal output in real-time
- [ ] Extract board state from ANSI/VT100 sequences
- [ ] Parse score from terminal output
- [ ] Send keyboard input at appropriate times
- [ ] Handle terminal control sequences properly

## Technical Approach
1. Use Python's module or similar for PTY creation
2. Parse ANSI escape sequences to extract game state
3. Implement state machine for game flow
4. Add move decision logic based on parsed state

## Success Criteria
- Can reliably read current board state from terminal
- Can send moves and see results
- Achieves consistent scores over 1000
- No debugger dependencies

## References
- down_right_spam.sh - Simple input piping approach
- /tmp/2048_downright.txt - Example terminal output to parse

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.