Classroom research manuscript · Agent Arcade

From Recorded Demonstrations to an Inspectable Game-Playing Agent

A controlled classroom study of imitation learning, training-data coverage, and unseen-level generalization
Merit Point Academy · prepared for the 20 August 2026 AI Toolbox workshop

Abstract

How does a sequence of human game actions become a working artificial-intelligence agent, and what can a classroom experiment legitimately conclude about that agent? We developed Agent Arcade, a local browser game in which each player action is recorded with four interpretable sensor values, an action label, and the immediate reward. A class-balanced, distance-weighted k-nearest-neighbors (k-NN) policy compares a current state with recorded demonstrations and selects LEFT, STAY, or RIGHT by weighted vote. The personal-training activity demonstrates the complete data-to-policy loop without uploading student records. A separate controlled experiment holds the model and 240-row data budget fixed while changing demonstration coverage from one training level seed to twelve. Evaluation uses 600 expert-labeled actions from twenty unseen seeds, with mean game score as a secondary outcome. In the current deterministic reference run, the one-seed policy achieved 91.0% action accuracy and mean score 105.0, while the twelve-seed policy achieved 84.3% and mean score 66.7. The observed 6.7-percentage-point decrease contradicts a simple “more diverse is always better” expectation. It does not establish that diversity is harmful: with a fixed data budget, broader seed coverage also reduces the number of demonstrations available per seed and may alter local neighborhood density. The study shows how recorded behavior can train an inspectable agent and how a surprising result becomes a prompt for a better controlled experiment rather than a broad causal claim.

Plain-language takeaway

The agent does not watch the colorful screen or “understand” the game as a person does. It receives four numbers, searches recorded situations that look numerically similar, and imitates the actions attached to those rows. In our built-in fair test, spreading the same 240 demonstrations across more levels did not improve performance. That is a real result from this implementation—but one run is a clue, not a universal law.

1. Introduction

Classroom discussions of game-playing artificial intelligence often begin with an impressive animation and end before the evidence pipeline becomes visible. Agent Arcade reverses that order. A learner first plays a controlled three-lane game, creating a dataset through ordinary choices. The learner then trains an agent, watches the policy act, inspects its decision receipt, and tests it on an unseen level. The animation is therefore not the explanation. The explanation is the trace from a measured state, through recorded demonstrations and a reproducible decision rule, to an action and outcome.

This manuscript addresses two related questions. First, how are locally recorded human demonstrations represented and converted into a policy? Second, with a fixed number of expert-labeled demonstration rows, does collecting those rows from more procedurally generated level seeds improve action accuracy on unseen seeds? The first question is instructional and descriptive. The second is a controlled empirical comparison.

1 · PLAYhuman controls the ship
2 · RECORDstate, action, reward
3 · TRAINweighted k-NN policy
4 · ACTLEFT, STAY, RIGHT
5 · TESTunseen level seeds
6 · INSPECTaccuracy, score, failures

2. Environment and recorded data

2.1 Controlled three-lane game

The environment contains a player ship, collectible coins, and hazards. The player or agent may move one lane left, remain in the current lane, or move one lane right. A pseudorandom level seed determines the object sequence, making levels reproducible while allowing unseen seeds to create new arrangements. A run ends after 450 decision steps or when three lives are lost. Coins add 10 points, hazards subtract 12 points without allowing the score to fall below zero, and survival adds 0.02 per step.

2.2 One decision becomes one row

During Player Run, the browser records a row after a human decision. A row represents one decision—not an entire game. The comma-separated-values (CSV) export contains the following fields:

FieldMeaningRole in learning
seed, stepLevel identifier and decision timeProvenance; not policy inputs
obs_dxHorizontal obstacle offset: negative = left, zero = same lane, positive = rightInput feature
obs_distanceNormalized forward distance to the nearest hazard: zero = near, one = far or absentInput feature
coin_dxHorizontal coin offset relative to the playerInput feature
coin_distanceNormalized forward distance to the nearest coinInput feature
actionHuman choice: LEFT, STAY, or RIGHTTraining label
rewardImmediate consequence after the actionOutcome for inspection; not the imitation-learning label

The suffix dx means delta x, or horizontal displacement relative to the player. The four features are normalized values rather than screen pixels or physical distances.

2.3 Privacy and scope of the human records

Personal gameplay rows remain in the learner’s browser unless the learner explicitly chooses Export CSV. The activity requires no account, camera, microphone, or connection to a commercial game. Because the workshop does not centrally collect personal rows, this manuscript does not report a class-level sample size, average student performance, or a claim that training caused student learning. Those quantities do not exist in the project evidence.

3. From demonstrations to a policy

3.1 Training set construction for the personal agent

Every personal policy begins with 180 balanced starter demonstrations: 60 LEFT, 60 STAY, and 60 RIGHT examples generated from nine seeds. The browser then adds up to the most recent 60 personal examples for each action class. This cap prevents a long sequence of STAY actions from overwhelming all LEFT and RIGHT examples. The displayed training receipt reports the resulting row count and action balance.

3.2 Distance-weighted k-nearest neighbors

For each decision, the policy converts the current state into a four-element vector. It computes squared Euclidean distance to every training row, retains the nine nearest rows (k = 9), and gives closer rows more influence. It also applies inverse-frequency class weights so an action with fewer training examples is not automatically ignored.

distance(x,r) = Σᵢ (rᵢ − xᵢ)²
vote(action) = Σ neighbors of that action class_weight ÷ (0.025 + √distance)

The action with the largest normalized vote is returned. The constant 0.025 prevents division by zero. The policy is an imitation learner: it learns to reproduce labeled actions in similar measured states. Reward is displayed for evaluation, but this version does not use reinforcement learning to optimize long-term reward.

4. Controlled generalization experiment

4.1 Research question and hypothesis

The research question is: With the same 240 demonstration rows, does training on more level seeds improve action accuracy on unseen levels? A reasonable preregistered hypothesis is that twelve-seed coverage will expose the policy to more varied situations and improve unseen-seed accuracy. The experiment must keep data quantity fixed; otherwise seed diversity would be confounded with the number of training examples.

4.2 Conditions and controls

ComponentOne-seed conditionTwelve-seed condition
Training seeds101101, 113, 127, 139, 151, 163, 179, 191, 211, 223, 239, 251
Training rows240240 total
LabelsRule-based expert policySame expert policy
FeaturesFour normalized sensorsSame four sensors
ModelClass-balanced weighted k-NN, k = 9Same model and k
Accuracy testThe same 600 expert-labeled actions from 20 previously unseen seeds
Score testThe same first 10 unseen seeds, up to 300 steps per seed

The controlled comparison deliberately uses reproducible expert-generated rows rather than the learners’ personal records. Personal demonstrations vary in quantity, action balance, timing, and strategy, so substituting them here would prevent the experiment from isolating seed coverage.

4.3 Outcomes

The primary outcome is action accuracy: the percentage of 600 held-out states for which the learned policy returns the same action as the expert label. Mean game score is secondary because score is sequential: one wrong action can change later states, making it informative but less direct as a measure of label imitation.

5. Results

1 training seed
91.0%held-out action accuracy · mean game score 105.0
12 training seeds
84.3%held-out action accuracy · mean game score 66.7

In the current deterministic reference run, the twelve-seed policy was 6.7 percentage points lower in action accuracy than the one-seed policy. It was also 38.3 points lower in mean game score. Thus, the observed result did not support the simple directional hypothesis that broader seed coverage would improve performance under a fixed 240-row budget.

Evidence boundary. These numbers describe this implementation, its expert policy, its selected training and test seeds, one value of k, and one fixed row budget. No repeated resampling, confidence interval, or inferential test is currently included. The result is deterministic for the listed seeds; determinism is not the same as evidence of broad generality.

6. Discussion

6.1 What the result establishes

The experiment establishes that, for the specified seeds and evaluation set, distributing 240 expert demonstrations across twelve training seeds produced lower expert-action agreement and lower game score than collecting 240 rows from one seed. It also demonstrates that a plausible classroom hypothesis can fail without the experiment itself failing.

6.2 Possible explanations that remain hypotheses

Several mechanisms could produce this pattern. First, the fixed data budget creates a coverage-density trade-off: twelve seeds provide only about twenty rows per seed, whereas one seed supplies a denser local trajectory. Second, the four-feature representation may map different underlying situations to similar vectors, producing conflicting neighbor labels. Third, the chosen expert policy and seed 101 may align unusually well with the held-out state distribution. Fourth, class balancing and inverse-distance weighting may interact with the action distribution differently across conditions. The present comparison does not distinguish among these possibilities.

6.3 Why personal demonstrations still matter

The controlled experiment is not a replacement for the personal-training activity. Human records reveal data-quality problems the synthetic comparison intentionally removes: incomplete action coverage, inconsistent labels, delayed key presses, rare failure states, and different play strategies. Those problems are central to understanding real imitation learning. They should be analyzed as their own study, with consent, a defined collection protocol, anonymization, and a preregistered unit of analysis.

7. Limitations

The environment is a small, authored browser game and not evidence about commercial-game agents. The expert label is a deterministic rule, not a gold-standard account of optimal play. Action accuracy measures agreement with that rule and may not perfectly track survival or score. The test uses twenty selected seeds and the score summary uses ten of them. Only one four-feature representation, one distance metric, and k = 9 were evaluated. The experiment does not compare against a majority-action baseline, a non-weighted k-NN model, a decision tree, or reinforcement learning. Finally, no personal demonstration records were centrally collected, so student-specific and class-level performance claims are outside the evidence.

8. Next experiments

  1. Coverage ladder: compare 1, 2, 4, 8, and 12 training seeds at several fixed row budgets rather than one 1-versus-12 contrast.
  2. Repeated seed sets: repeat each condition across many sampled training/test seed groups and report the distribution of accuracy differences.
  3. Learning curves: vary total rows to separate the effect of diversity from insufficient local density.
  4. Representation ablation: add player lane or time-to-contact features and test whether conflicting neighbor labels decrease.
  5. Policy comparison: compare weighted k-NN with a majority baseline, decision tree, and compact neural policy while keeping folds and data budgets identical.
  6. Human-data study: with explicit consent, compare personal-only, starter-only, and combined demonstrations using predefined unseen seeds and de-identified participant codes.

9. Reproducibility and terminology

The complete game, data export, policy, expert generator, listed seeds, and evaluation functions run in the browser from Agent Arcade. The experiment is deterministic because each seed initializes the same pseudorandom generator. CSV means comma-separated values; k-NN means k-nearest neighbors; AI means artificial intelligence; and a policy is a function that maps the measured state to an action.

References

  1. Cobbe, K., Hesse, C., Hilton, J., & Schulman, J. (2020). Leveraging procedural generation to benchmark reinforcement learning. Proceedings of the 37th International Conference on Machine Learning. Procgen paper and benchmark.
  2. Perez-Liebana, D., et al. General Video Game AI (GVGAI) framework. Official repository.
  3. Hambro, E., et al. (2022). Insights from the NeurIPS 2021 NetHack Challenge. NeurIPS Datasets and Benchmarks. Dataset paper.

Artificial-intelligence-use disclosure. AI assisted with manuscript organization and wording. The implementation details and reported values were checked against the workshop’s local game code and a browser execution of the deterministic generalization test. No missing student results, inferential statistics, or causal claims were invented.