oneshotlm
Compare all models on this prompt →

Tetris · nex-n2-mini

Build a playable Tetris on a canvas with all seven tetrominoes, rotation, line clears, increasing speed, a next-piece preview, and score.

⛨ sandboxed Open in new tab ↗
transcript · 6 messages
user

Build a playable Tetris on a canvas with all seven tetrominoes, rotation, line clears, increasing speed, a next-piece preview, and score.

assistant
thinking
We need respond by creating index.html in current dir. Need inspect maybe empty. Need build self-contained Tetris canvas playable. Need all seven tetrominoes, rotation, line clears, increasing speed, next preview, score. We need write file. Need maybe no need read? Need inspect cwd maybe. Use bash ls. Then write. Need ensure final concise with file path. Need code robust. Need no external resources. Need all in index.html. Need maybe include instructions, controls. Need implement canvas. Need consider scoring, levels speed, next piece, rotation. Need handle touch? Not required but nice. Need single self-contained file.

Let's design.

HTML with canvas game 10x20 plus side panel preview and stats. CSS inline. JS:

const COLS=10, ROWS=20, BLOCK=30 maybe. canvas width 300 height 600, preview 120x120. ctx.

Tetromino shapes:
I: [[0,0,0,0],[1,1,1,1],[0...],...]
J,L,O,S,T,Z. Need matrices. Rotation clockwise. Need wall kicks maybe simple. spawn x=floor(COLS/2)-ceil(matrix[0][0].length/2), y=0. For I y maybe 0. Need collision.

Game state: board = array rows cols zeros or null. current, next, score, lines, level, drops, lastTime, dropCounter, dropInterval. requestAnimationFrame.

Functions:
createMatrix(w,h), randomPiece returns type from all and matrix copy.
rotate(matrix) clockwise.
matrix after rotation maybe same size for O; for I 4x4 no shrink.
collides(board, piece, offsetX, offsetY): for each matrix cell if value then nx,ny; if nx<0 || nx>=COLS || ny>=ROWS return true; if ny>=0 && board[ny][nx] return true.
merge.

rotate current clockwise; try offset [0,-1,1,-2,2]? For spawn maybe okay. For I at top. Could implement kicks [0,1,-1,2,-2], y [0]. Simpler.

line clears: loop from bottom to top; if row full splice/shift. score += [0,100,300,500,800][lines] * level? Need increasing speed. Level = floor(lines/10)+1, dropInterval = Math.max(80, 800 - (level-1)*70). Could use 800. next piece set.

Game over: if collision at spawn after merging? In update after hard? We can set gameOver when update called with spawn collision. Soft drop scoring? Maybe.

Input: keydown ArrowLeft/Right, Down soft drop, Up/X rotate, Space hard drop, P pause, R restart. Prevent default.

Canvas rendering: draw board, current, grid, next preview, title maybe. Use colors. drawCell(ctx,x,y,color,preview=false). For preview center. Need maybe draw background.

Need ensure playable. We can include CSS for layout.

Need maybe run test? We can create and maybe maybe open not possible. But can run static grep? Need file present.

Let's write. Need maybe include "data" attributes? No external.

Need be careful with matrix rotations and spawn collisions. Board rows 20. If current collides spawn maybe gameOver.

Potential issue: current matrix may extend above top; collision ignores ny<0, so okay. When merging, only if ny>=0. Good.

Line clear scoring.

Speed increasing: dropInterval based on level.

Controls: maybe pause.

Need maybe "all seven tetrominoes" included.

Need maybe "canvas" for game and next preview. Score panel.

Let's write.
write /tmp/ws/index.html (19436 bytes)
toolResult

Successfully wrote 19436 bytes to /tmp/ws/index.html

assistant
thinking
Need verify file present maybe run ls maybe maybe no need but should.
bash {"command":"ls -l /tmp/ws/index.html && wc -c /tmp/ws/index.html","timeout":5}
toolResult

-rw-r--r--. 1 node node 19445 Aug 1 20:57 /tmp/ws/index.html 19445 /tmp/ws/index.html

assistant
thinking

Created `/tmp/ws/index.html` with a self-contained playable Tetris app using canvas, CSS, and JS inline.

TAKE IT TO CODE

A single self-contained HTML file — copy it and open in any browser, or reuse the prompt with your own pi-agent run.

RUN

modelnex-n2-mini
vendorNex AGI
harnesspi-agent
generated2026-08-01

EVALUATION

4/5 working

Functional Tetris with falling pieces, next-piece preview, score/lines/level, and responsive controls stacking blocks correctly.

Vision grade · anthropic/claude-sonnet-5

MEASUREMENTS

Raw readings from the capture, not a verdict — the grade above is the only judgement. Percentages are how much of the screen changed; the measure under-reports sparse motion on a dark background.

idle motion0.6%
on click0.9%
on drag1.7%
on wheel0.8%
on enter + space1.3%
on arrow keys1.5%
on w/a/s/d0.9%
frame spread25.5 / 255
console errors0
js errors none

METRICS

runtime38.7s
tokens in19k
tokens out7.0k
cached8.5k
cost / run$0.0010