Generates optimized build orders for the Lords & Knights game using simulation-based solvers. Supports castle building optimization, unit training plans, and gRPC service integration.
This skill helps you work with the solver-lnk project, a Go-based simulation solver for the Lords & Knights game that generates optimized build orders for castle development and unit training.
The solver uses a simulation-based approach with event-driven resource accumulation:
```bash
git clone --recursive [email protected]:Napolitain/solver-lnk.git
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
```
```bash
go generate ./...
go build ./cmd/server
go build ./cmd/castle
go build ./cmd/units
golangci-lint run
go test ./... # All tests (includes fuzz corpus)
go test -race ./... # With race detection
go test -cover ./... # With coverage
./server # Starts gRPC on port 50051
```
**Standard Tests:**
```bash
go test ./... # Run all tests
./scripts/test-all.sh # Full test suite
```
**Fuzz Testing:**
Note: `go test ./...` only runs fuzz seed corpus (regression). To actively fuzz:
```bash
go test -fuzz=FuzzSolverDeterminism -fuzztime=30s ./internal/solver/castle
go test -fuzz=FuzzSolverResources -fuzztime=30s ./internal/solver/castle
go test -fuzz=FuzzSolverBuildingLevels -fuzztime=30s ./internal/solver/castle
go test -fuzz=FuzzSolverConstraints -fuzztime=30s ./internal/solver/units
go test -fuzz=FuzzUnitThroughput -fuzztime=30s ./internal/solver/units
go test -fuzz=FuzzUnitResourceCosts -fuzztime=30s ./internal/solver/units
```
**Pre-Commit Check:**
```bash
golangci-lint run && go test -race ./...
```
Since this is a build order solver, use step-based notation internally:
✅ **Correct:**
❌ **Avoid:**
**Exception:** Hours are acceptable for user-facing display, test logging, and documentation.
```
solver-lnk/
├── cmd/
│ ├── castle/ # Castle CLI
│ ├── server/ # gRPC server
│ └── units/ # Units CLI
├── internal/
│ ├── converter/ # Proto ↔ internal models
│ ├── loader/ # JSON data loaders
│ ├── models/ # Domain models
│ └── solver/
│ ├── castle/ # Castle solver + tests
│ └── units/ # Units solver + tests
├── proto/ # Submodule (proto-lnk)
├── data/ # Game data JSON
└── go.mod
```
The server exposes `CastleSolverService`:
**Input:** Current castle state (buildings, resources, levels)
**Output:** Recommended next action + full build plan
```protobuf
service CastleSolverService {
rpc Solve(SolveRequest) returns (SolveResponse);
}
```
GitHub Actions workflow on push/PR:
1. Checkout with submodules
2. Install protoc + plugins
3. Generate protobuf code
4. Lint with golangci-lint
5. Run race-detected tests
6. Generate coverage report
7. Run all fuzz tests (20s each)
8. Upload to Codecov
This project favors **state-of-the-art, edge tooling** for 2025+:
1. **Submodule**: The `proto/` directory is a Git submodule (`proto-lnk`). Always clone with `--recursive`.
2. **Food Mechanic**: Farm provides absolute capacity, not production rate.
3. **Dual Queues**: Building and research can progress simultaneously.
4. **Determinism**: All solver outputs are deterministic and fuzz-tested.
5. **Modern Go**: Uses Go 1.23+ features, targeting 1.25 idioms.
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/solver-lnk-build-order-generator/raw