mirror of
https://github.com/8b-is/space-bender.git
synced 2026-11-21 23:19:58 +01:00
Codewars katas + verified solutions — the space bender
- Python 27%
- Assembly 23.5%
- Rust 19.1%
- JavaScript 11.9%
- Prolog 7%
- Other 11.5%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| .forgejo/workflows | ||
| .woodpecker | ||
| exercism-solutions | ||
| katas | ||
| scripts | ||
| tests | ||
| .gitignore | ||
| ELI5.md | ||
| GEMINI.md | ||
| README.md | ||
space-bender
Codewars katas + verified solutions — the space bender.
A curated collection of solved katas, each with its solution. The suites
listed under Running tests verify the solutions exhaustively — Python
test files for the Python katas, a Node harness against the real
@codewars/lambda-calculus compiler for the λ Calculus ones — and
per-kata README.md files document the approach. Solutions are written
from first principles and verified before being recorded here.
Katas
1 kyu
| Kata | Solution | Approach |
|---|---|---|
| Express number as sum of four squares (Rust) | solution.rs |
Double-sqrt cascade (1024\text{b} \to 513\text{b} \to 258\text{b}) + stack U320 CIOS Montgomery + Cornacchia (~7.2 ms) |
| Game of Life in Reverse (Factor) | solution.factor |
Interval neighbor-bound pruning + $(W+1)$-cell 4-bit sliding frontier profile DP |
2 kyu
| Kata | Solution | Approach |
|---|---|---|
| Evaluate mathematical expression | solution.py |
Recursive descent parser, no eval |
| Simpler Interactive Interpreter | solution.py |
Recursive descent REPL with variable state |
| Regular Expression parser | solution.py |
Recursive descent AST builder |
| Prime Streaming (NC-17) | solution.py |
Segmented sieve, C-level bytearray + regex |
| Divisible by 0b111 (7) | solution.py |
7-state DFA → state elimination → regex |
| Church Numerals - Prefix is Overrated (All Operations) | solution.lc |
Triple-role d = \p. p A + unified U_x continuation dispatch |
| NegaBinary (λ Calculus) | solution.lc |
Base -2 Scott encoding + 1-step sign-flip unrolling + BinaryScott divmod (~0.73s) |
| ASCII Games: Dance Dance Evolution I (Rust + NASM + ARM64) | solution.rs, solution.asm, solution_arm64.s |
Precompiled u64 adjacency bitmasks + bidirectional trailing_zeros()/tzcnt/rbit+clz reachability pruning (~11.8 ms / 100 mazes) |
| Break the pieces (C++ + NASM + ARM64) | solution.cpp, solution.asm, solution_arm64.s |
Power-of-two 128\times 128 stride grid + moat-sentinel BFS + bnd_stamp T-junction corner healing |
3 kyu
| Kata | Solution | Approach |
|---|---|---|
| Loopover | solution.py |
Local 3-cycles (swap_adj, three_slip) + parity |
| Assembling a Circular Genome | solution.py |
Greedy suffix-prefix merge + circular wrap |
| Bloxorz Solver (Haskell + NASM + ARM64) | solution.hs, solution.asm, solution_arm64.s |
Data.Sequence 3-pose BFS + branchless 12-bit (orient << 10) | idx 32\times 32 zero-moat LUT assembly |
| Ternary Matrix SIMD Contraction (Rust + ARM64 NEON + NASM + Prolog) | solution.rs, solution_arm64.s, solution.asm, solution.pl |
SPQT Base-243 (5\text{ trits/B}) + zero-multiplier eor/sub/and + sadalp 8-lane NEON SIMD + exact p/q TGEMM + Kleene Strong-3 NAND semiring |
4 kyu
| Kata | Solution | Approach |
|---|---|---|
| Hamming Numbers (NASM + Prolog) | solution.asm, solution.pl |
3-pointer DP in .bss (cmovb + lea *3/*5) + 6-insn O(1) lookup + SWI-Prolog functor(Table, h, N) shift-add DP |
| Range Extraction (Haskell + Julia + NASM + ARM64 + Prolog) | solution.hs, solution.jl, solution.asm, solution_arm64.s, solution.pl |
Single-pass (lo, hi) interval coalescing (hi + 1 == x) + hi - lo >= 2 threshold + stack-buffered idiv/udiv ITOA |
5 kyu
| Kata | Solution | Approach |
|---|---|---|
| Beeramid (Prolog) | solution.pl |
Deterministic tail-recursive (-> ;) accumulator + O(1) cube-root pyramidal sandwich n^3 < 3P_n < (n+1)^3 |
| CoCoA VBF & EU868 Duty-Cycle Gate P1..P6 (Prolog) | solution.pl |
Pure shift-add CoCoA Variable Backoff Factor (3x, 2x, 1.3x Q8 & 3-tap shift) + OMNI P1..P6 Gate-Before-Mutate |
6 kyu
| Kata | Solution | Approach |
|---|---|---|
| Basics 08: next higher with same bits (λ Calculus) | solution.lc |
BinaryScott Gosper walk — Even/Odd wrap accumulators |
| A+A=B+B so A=B? Prove it! (Coq) | solution.v |
Double structural induction + add_succ_r + inversion (Closed under the global context) |
| Program Verification #2: Fibonacci numbers (Coq) | solution.v |
Generalized window invariant fib_aux (fib k) (fib (S k)) n = fib (n + k) |
7 kyu
| Kata | Solution | Approach |
|---|---|---|
| Number Pairs (λ Calculus) | solution.lc |
Church lists + pred-trick tail + monus max |
| Fibonacci (λ Calculus) | solution.lc |
Scott pair-iteration + lazy Scott add via Z |
| Spinning Rings (λ Calculus) | solution.lc |
Scott ring-state walk (decw/incw) + Z structural eq |
| Google interview (Idris) | solution.idr |
Structural induction + binary congruence congBranch (%default total) |
Kumite
| Kata | Solution | Approach |
|---|---|---|
| Finding the duplicate number (Haxe) | solution.hx |
Single O(n) seen-map pass vs length-branched baseline |
Running tests
With the paired 8b-is/codewars-cli (codewars / cw):
codewars bender list --live # list all katas enriched live via Codewars API v1
codewars bender test # run all Python + λ Calculus + Idris verification suites
codewars bender eli5 <slug> # publish a 4-post ELI5 educational Bluesky thread with GitHub links
Or directly per kata:
python3 katas/1kyu/express-number-as-sum-of-four-squares/test_solution.py
python3 katas/2kyu/evaluate-math/test_solution.py
python3 katas/2kyu/simpler-interpreter/test_solution.py
python3 katas/2kyu/regexp-parser/test_solution.py
python3 katas/2kyu/prime-streaming/test_solution.py
python3 katas/2kyu/divisible-by-7/test_solution.py
python3 katas/3kyu/loopover/test_solution.py
python3 katas/3kyu/circular-genome/test_solution.py
python3 katas/4kyu/hamming-numbers/test_solution.py
python3 katas/6kyu/a-plus-a-equals-b-plus-b/test_solution.py
python3 katas/6kyu/fibonacci-verification/test_solution.py
python3 katas/7kyu/google-interview/test_solution.py
npm install --prefix katas/2kyu/church-infix-all-ops && node katas/2kyu/church-infix-all-ops/test.mjs
npm install --prefix katas/7kyu/number-pairs && node katas/7kyu/number-pairs/test.mjs
npm install --prefix katas/6kyu/basics-08-next-higher && node katas/6kyu/basics-08-next-higher/test.mjs
npm install --prefix katas/7kyu/fibonacci && node katas/7kyu/fibonacci/test.mjs
npm install --prefix katas/7kyu/spinning-rings && node katas/7kyu/spinning-rings/test.mjs
the constellation · 0 + 1 · fine touch from within · vaked.dev