UXInteract / task_042 /instruction.md
DojiSum's picture
Publish the current 141-task UXInteract release
ef987bb verified
|
Raw History Blame Contribute Delete
3.14 kB

Build a colony excavation and survival game

Create an offline index.html inspired by the basic mechanics of Oxygen Not Included. Show a two-dimensional underground map, a lit starting area, unknown rock and a duplicant printer.

Gameplay

  • Choose a duplicant and a cell to walk through known space or excavate rock. Walk one cell at a time and climb at most one cell; fall through open space under gravity. Dig up to one cell horizontally and three cells upward. Excavation opens and lights rock; a move into unknown space must not dig it, and a dig on known empty space must not move the duplicant.
  • Continue exploring on all four sides of the starting area and render all current cells, known and unknown.
  • Display environmental oxygen and each duplicant's hydration; #oxygen contains only the current numeric oxygen value. Oxygen falls by one per accumulated second, to a minimum of zero. Hydration declines over time; digging plain rock costs more than one hydration point immediately and costs stamina. Oxygen and water discovered during excavation replenish the corresponding values. Critical oxygen or hydration causes illness.
  • Every ten seconds show the printer's yes/no question. Yes adds a randomly generated duplicant; no dismisses without adding one.

State and controls

Expose window.gameTest with reset(config), move(row,col), dig(row,col), step(milliseconds), answerPrint(yes) and state(). These operate on the real game state and UI. move, dig and step return the resulting state.

  • reset accepts {oxygen?,duplicant?,openCells?,resourceCells?}. The duplicant accepts {r,c,water}; open cells are [[r,c],...]; supplied resource cells are [{r,c,type},...] with type oxygen, water or open. They are revealed by digging; other unknown cells use game probabilities. Rows increase downward.
  • state() returns {oxygen,duplicants:[{r,c,water,stamina,sick}],resources:{oxygen,water},dimensions:{rows,cols},printPending,map}, with map[row][col] cells of shape {type,known}.
  • Give each expansion control the corresponding data-expand value: up, down, left, right. Mark each map cell with .cell, data-r and data-c; mark oxygen with id="oxygen", the prompt with data-testid="print-prompt" and responses with data-answer-print="yes" or "no".

Acceptance Checklist

  • Known-space movement, gravity, legal excavation and blocked out-of-reach actions work via visible controls and the state interface. An outside-map destination first expands the appropriate edge without bypassing movement or digging constraints.
  • Real cell clicks reveal injected resource results. Plain rock costs more hydration to dig than an idle second; oxygen and water replenish their corresponding values and the HUD stays in sync.
  • After reset, only virtual time advances the state. Tick resource consumption per accumulated 1,000 ms; show the printer prompt per accumulated 10,000 ms. Accept or decline immediately; an answer with no pending prompt cannot create a duplicant.
  • Each navigation control expands the requested edge and renders the complete larger map.