Skip to main content

FarmAlgo · Level 01

FarmAlgo is DEVLAB101’s private path for algorithmic habits. It trains one short, observable loop:

I → O → C → B → A → V

  • I — Inputs: types, size, properties and edge case;
  • O — Output: exact return shape and no-answer behaviour;
  • C — Constraints: allowed budget and rules;
  • B — Brute force: the first correct solution;
  • A — Improvement: repeated cost, retained information and trade-offs;
  • V — Verification: boundaries, invariant and tests.

Learning scope

Level 01 covers arrays, strings, scans, counters, sums, minimums, maximums, running best values, early returns, Set, Map, sorting and neighbour comparisons. The 24 mandatory exercises are distributed across diagnostic, ritual, traversal, structures, Set, Map, sorting, mixed problems, interview and mastery.

The 30 micro-prompts practise recognising the pattern, repeated cost, useful memory and complexity before coding. Modules do not block access: prerequisites recommend the next task rather than punishing a different route.

Code execution

Exercises transpile submitted TypeScript on demand (common annotations, interfaces and assertions) with the TypeScript compiler already present in the project, then run the generated JavaScript in an isolated Web Worker. The compiler is loaded only when TypeScript syntax is detected. Visible tests, validation tests, deep comparison, captured output and a maximum execution time reuse Algo XP’s execution policy, which rejects expressions outside the allowed scope.

Drafts, reasoning, custom tests, viewed hints, attempts and review dates are versioned in FarmAlgo progress. Existing DEVLAB101 progress sync is reused when an account is active.

Access and configuration

In local development, private access is checked by hash and the session stays in sessionStorage. In production, /api/farm-algo/auth checks FARM_ALGO_PASSWORD, issues a signed HttpOnly, Secure, SameSite=Lax cookie, and applies a basic address-based rate limit. The password is never logged or shipped in the client bundle.

Configure the production secret with FARM_ALGO_PASSWORD from .env.example. Do not commit its value. When production access is not configured, the interface shows a generic access error.

Schema and adding an exercise

Source content lives in src/data/farmAlgoCurriculum.js. Each exercise has a stable identifier, FR/EN copy, a TypeScript signature, examples, constraints, public and validation tests, starter code, a solution, complexities, an invariant, common mistakes, six hints, three approaches, a reconstruction, a transfer prompt and a variant. To add one, extend the source array and run npm run validate:farm-algo; the validator rejects missing identifiers, incomplete locales, missing evidence or inconsistent complexity data.

Mastery, review and pedagogy

src/domain/farmAlgo.js scores code, I/O/C/B/A/V reasoning, structure and its justification, complexity, verification and explanation separately, with 35/25/15/10/10/5 weights. Mastery requires an initial success, a variant, delayed retrieval and a mixed problem. Review dates are scheduled after each attempt according to the score and practice mode; the home page then proposes the next action.

The diagnostic calibrates a starting point without blocking access. The 15/35/60-minute sessions interleave retrieval, a new exercise and transfer. Six hints provide progressive scaffolding; the solution is available only after an attempt and reconstruction remains the next action. I/O/C/B/A/V fields, the checklist and deterministic debrief make retrieval, generation, feedback and transfer explicit without pretending to semantically interpret free text.

Local validation

npm run validate:farm-algo
npm test
npm run typecheck
npm run lint
npm run agent:audit
npm run build

The path is available at /parcours/farm-algo. The /exercise, /micro, /diagnostic, /interview, /mastery and /progress routes share the same protected session.