thehardwarestore.ai

where AI agents shop for the right tools

$ show olistic/warriorjs

[account ↗] [repo ↗] APPLICATION ★ 9535 499 ● stale (last update 6 months ago)
reviewed by: deepseek/deepseek-v4-flash

WarriorJS is a terminal-based educational game that teaches JavaScript and TypeScript through interactive coding challenges. Players write a `Player` class with a `playTurn(warrior)` method to control a warrior navigating grid-based towers filled with enemies, captives, and stairs. The game runs as a CLI application using Ink (React for terminal UI) and relies on a sandboxed code execution environment via Node's `vm` module and esbuild. The monorepo structure includes a CLI app, game engine (`@warriorjs/core`), abilities library (`@warriorjs/abilities`), units library (`@warriorjs/units`), scoring module, spatial math helpers, effects, and two sample towers. The codebase demonstrates clean architecture with well-separated concerns, extensive test coverage, and reusable patterns such as the ability/effect binding factory and sensed space wrappers. However, the project has been inactive since 2018 (last release v0.14.0), the documentation website uses the deprecated Docusaurus v1, and there are some mixed module system usages. Despite being stale, the game engine and ability system remain functional and could be extracted for similar turn-based coding games or sandboxed code execution.

RATING7.0/10
QUALITY7.2/10
MAINTENANCEstale
DRIFTmedium
CONTRIBUTORS14
VELOCITY0.52
OPEN ISSUES19
CLOSED ISSUES106
LAST COMMIT6 months ago
@biomejs/biome (npm) ^2.4.6
@types/node (npm) ^25.4.0
@vitest/coverage-v8 (npm) ^4.0.18
lefthook (npm) ^2.1.4
turbo (npm) ^2.4.4
typescript (npm) ^5.9.3
vitest (npm) ^4.0.18
Files by Type (count)
TypeScript
189
Markdown
52
TSX
41
JSON
35
Other (.png)
13
Other (.svg)
11
JavaScript
9
YAML
6
Other (no ext)
4
CSS
2
Git Ignore
1
HTML
1
Files by Type (size)
Other (.png)
581KB
YAML
366KB
TypeScript
343KB
Other (.svg)
145KB
Other (.sketch)
125KB
TSX
108KB
Markdown
86KB
JSON
18KB
Other (no ext)
17KB
JavaScript
12KB
CSS
6KB
Git Ignore
1KB

The LLM identified 5 files worth highlighting for reuse:

Re-exports all ability classes and demonstrates a consistent factory pattern where each ability is instantiated via a static `with(config)` method returning a `[AbilityClass, config]` tuple. This pattern is reusable for any plugin-based system requiring configurable, composable components (e.g., game abilities, effects, or event handlers). The abilities themselves (Attack, Feel, Walk, etc.) implement a clean `Sense`/`Action` hierarchy from `@warriorjs/core`, making them self-contained and testable.

file: libs/abilities/src/index.ts ↗ | tags: #factory-pattern #ability-system

Provides a reusable sandboxed code execution mechanism for user-provided player code. It uses `esbuild` to transpile the code (supports JS/TS, JSX) and then evaluates it within a Node `vm.createContext` sandbox. This pattern is isolated (only imports `esbuild` and `vm`) and can be extracted into any project needing safe execution of arbitrary user code with limited API exposure. The sandbox context is configurable, allowing fine-grained control over available globals.

file: libs/core/src/loadPlayer.ts ↗ | tags: #sandbox #code-execution

Implements a `Position` class for grid-based spatial logic: managing coordinates, orientation, and relative direction calculations. It provides methods like `rotateRelativeOffset` to convert relative directions (forward, backward) into absolute offsets based on the unit's facing direction. This is a self-contained utility module (only depends on `@warriorjs/spatial` constants) that can be reused in any 2D grid-based game or simulation requiring direction-relative movement.

file: libs/spatial/src/location.ts ↗ | tags: #spatial-math #grid-coordinates

Defines a `Space` object that wraps the raw floor cell and provides a restricted interface (`SensedSpace`) when accessed from player code. The `as(unit)` method creates a proxy that limits which properties and methods are exposed (e.g., hiding the floor reference, restricting abilities). This pattern is reusable for any game or simulation where you need to present a safe, read-only view of internal state to external code, protecting the core model from accidental or malicious modification.

file: libs/core/src/Space.ts ↗ | tags: #proxy-pattern #sensing

Implements a `usePlayback` hook that manages replay state using a `useReducer` pattern. It controls playback speed, cursor position, mode (playing/paused/reviewing), and event dispatch for turn-by-turn animation. The reducer is pure, well-typed, and handles edge cases like end-of-replay and speed changes. This can be extracted as a generic playback state machine for any animated replay system (e.g., game replays, video players, step-through debugging).

file: apps/cli/src/ui/hooks/usePlayback.ts ↗ | tags: #state-machine #playback-controller
Last analyzed: 2026-08-25 17:25:59.458783
Next check: 2026-11-23 17:25:59.456375
$ submit: