jwalsh / jwalsh/2048-cli-debug

Debugger-based 2048 controller implementation

Open
#6 1 comment 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 debugger-based controller using LLDB to read game memory and control execution.

## Background
We created lldb_controller.py and related scripts but they were over-engineered. Need a focused implementation that actually works.

## Requirements
- [ ] Attach LLDB to running 2048 process
- [ ] Set breakpoints at key game functions
- [ ] Read board array directly from memory
- [ ] Read score and game state from globals
- [ ] Control game flow through debugger
- [ ] Inject moves at input points

## Technical Approach
1. Use LLDB Python API for programmatic control
2. Set breakpoints on: print_board, getchar, game_loop
3. Extract board[16] array and score variable
4. Override getchar return value to inject moves
5. Continue execution between moves

## Success Criteria
- Can extract exact game state from memory
- Can inject moves without modifying game code
- More reliable than TTY parsing
- Can implement sophisticated strategies

## References
- lldb_controller.py - Over-engineered framework
- play_with_lldb.py - LLDB automation attempt
- 2048-cli source code for memory layout

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.