feat: add code output prediction game - #1656
Conversation
📝 WalkthroughWalkthroughAdds a timed ten-question JavaScript output quiz with answer feedback, scoring, progression, completion, and restart handling. Registers the game in the cognitive games catalog and adds login redirection for unauthenticated selections. ChangesCode Output Prediction Game
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant Player
participant CognitiveGamesPage
participant CodeOutputGame
Player->>CognitiveGamesPage: Select Code Output Prediction
CognitiveGamesPage->>CodeOutputGame: Render selected game
CodeOutputGame->>Player: Show question, options, and timer
Player->>CodeOutputGame: Select answer
CodeOutputGame->>Player: Show correctness and explanation
CodeOutputGame->>Player: Advance question or show final score
Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1⚔️ Resolve merge conflicts 💡
🧪 Generate unit tests (beta)
Comment Warning |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@frontend/src/pages/CognitiveGames/CognitiveGamesPage.jsx`:
- Around line 22-27: Update the Code Output Prediction entry in the
CognitiveGamesPage configuration to describe only JavaScript snippets, unless
CodeOutputGame is also expanded with Python questions. Keep the existing game
name, icon, and component unchanged.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 87626844-ede0-4b49-b281-bfb6c61e222c
📒 Files selected for processing (2)
frontend/src/components/CodeOutputGame.jsxfrontend/src/pages/CognitiveGames/CognitiveGamesPage.jsx
| { | ||
| name: "Code Output Prediction", | ||
| icon: Code2, | ||
| desc: "Predict the output of JavaScript and Python code snippets.", | ||
| component: CodeOutputGame, | ||
| }, |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Correct the supported-language description.
Line 25 states that the game includes JavaScript and Python snippets. frontend/src/components/CodeOutputGame.jsx currently provides JavaScript snippets only. Change the description to JavaScript, or add Python questions before advertising Python support.
Proposed fix
- desc: "Predict the output of JavaScript and Python code snippets.",
+ desc: "Predict the output of JavaScript code snippets.",📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| { | |
| name: "Code Output Prediction", | |
| icon: Code2, | |
| desc: "Predict the output of JavaScript and Python code snippets.", | |
| component: CodeOutputGame, | |
| }, | |
| { | |
| name: "Code Output Prediction", | |
| icon: Code2, | |
| desc: "Predict the output of JavaScript code snippets.", | |
| component: CodeOutputGame, | |
| }, |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@frontend/src/pages/CognitiveGames/CognitiveGamesPage.jsx` around lines 22 -
27, Update the Code Output Prediction entry in the CognitiveGamesPage
configuration to describe only JavaScript snippets, unless CodeOutputGame is
also expanded with Python questions. Keep the existing game name, icon, and
component unchanged.
|
@28106, please resolve the commit so that it will be merged soon ...... |
Implements issue #644 by adding a Code Output Prediction Game for interview preparation.
Changes
Added CodeOutputGame.jsx
Added JavaScript code-output prediction questions
Added answer selection and scoring
Added timer functionality
Added explanations for answers
Integrated the game into the Cognitive Games page
Closes #644
Adds a Code Output Prediction game with JavaScript questions, answer selection, scoring, timers, explanations, and restart support. Registers the game in
CognitiveGamesPage.jsxand redirects unauthenticated users to/login.