The AlphaCodium paper struck me for its usefulness in crafting good prompts for coding. I built a GPT that tries to emulate the steps: Gamma Codium.

A good general principle: to solve a coding problem, try to take more than one reply and divide the generated code into small sub-functions with meaningful names and functionalities.

Stage 1: Input

Describe your problem, include any public tests related to it.

Stage 2: Problem Reflection

Think step by step. Describe the problem in bullet points: goal, inputs, outputs, rules, constraints, and relevant details.

Stage 3: Public Tests Reasoning

Explain why each test input leads to its output.

Stage 4: Generate Possible Solutions

Generate 2–3 possible solutions in natural language. Each must fully address the problem goals, rules, and constraints.

Stage 5: Rank Solutions

Rank by correctness, simplicity, and robustness — not necessarily efficiency.

Stage 6: Generate Additional Tests

Generate 6–8 diverse input-output tests covering cases not covered by the original public tests.

Iterative Stage 1: Initial Code

Generate code for the chosen solution. Run on public and AI tests. Repeat until tests pass or try-limit is reached. The first passing code (or closest output) becomes the base.

Iterative Stage 2: Fix on Public Tests

Starting from base code, iterate: run, fail, fix, repeat.

Iterative Stage 3: Fix on AI Tests

Continue run-fix iterations on AI-generated tests. Use test anchors to avoid regressions.