Custom test input during battles

未关闭
#22 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
52/100
Issue 类型
功能
描述清晰度
描述清楚
活跃度
活跃
技术栈
docker-compose, javascript, nextjs, nodejs

调研方向

Start with frontend/pages/battle.js and compare the custom-input flow in frontend/components/practice/ArenaPractice.js; trace the practice run endpoint's parsing and runner before adapting it for battles. Check docker-compose.judge0.yml for the real Judge0 setup, then run npm test and node scripts/check-boundary.js. Done means custom runs work across supported languages, validate parameter types and rate limits, and keep results private from the opponent without affecting submissions or ratings.

由索引模型根据 Issue 内容生成。

描述

enhancement help wanted

Practice lets players run their code on their own input (customInput in frontend/components/practice/ArenaPractice.js). Battles do not, so in a battle the only way to check an edge case is to submit, which costs time and gives away nothing useful.

What to do

  • Add a "Custom input" panel to the battle editor (frontend/pages/battle.js) that runs the player's code on input they type, showing output, errors and runtime.
  • Reuse the practice run endpoint's parsing and runner rather than writing a second path.
  • Validate the input against the problem's parameter types before sending it to Judge0, with a clear error on mismatch.
  • Rate limit custom runs per player per battle (for example 1 every 3 seconds) so Judge0 is not flooded.
  • Custom runs never count as submissions and never affect ratings or tie-breaks.

Things that must hold

  • The opponent never sees custom input or its output.
  • A custom run cannot be used to probe hidden tests: it returns only the player's own output, never an expected value.

Definition of done

  • Works in all supported languages, checked against a real Judge0 (docker-compose.judge0.yml).
  • Tests for type validation, rate limiting and the opponent not receiving the result.
  • npm test and node scripts/check-boundary.js pass.
主要语言
JavaScript
星标
0
派生
2
PR 合并指标
30 天内没有已合并 PR

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

sennaicodes/codearena 的其他 Issue

查看 sennaicodes/codearena 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。