Skip to content

Added my project: Rock-Paper-Scissors Game#40

Merged
gitsofaryan merged 3 commits intogitsofaryan:mainfrom
mahakagarwal7:rock-paper-scissors
Oct 29, 2025
Merged

Added my project: Rock-Paper-Scissors Game#40
gitsofaryan merged 3 commits intogitsofaryan:mainfrom
mahakagarwal7:rock-paper-scissors

Conversation

@mahakagarwal7
Copy link
Contributor

@mahakagarwal7 mahakagarwal7 commented Oct 28, 2025

This pull request adds a beginner-friendly Rock Paper Scissors game built with HTML, CSS, and basic JavaScript. The game lets users play against the computer by choosing Rock, Paper, or Scissors using simple buttons. All logic is implemented using basic JavaScript concepts, including variables, functions, and simple conditionals. Styling is minimal for ease of understanding.​

Changes
Added index.html for the game structure .

Added style.css for simple visual styling

Added script.js for core game logic and interaction.

Please consider this for Hacktoberfest 2025.

Summary by CodeRabbit

  • New Features

    • Added a Rock Paper Scissors mini-game: play against the computer with instant win/lose/tie results and interactive buttons.
  • Documentation

    • Included a README section describing the game, rules, and beginner-friendly setup.
  • Style

    • Added responsive styling for layout, buttons, and result display for a pleasant mobile-friendly experience.

@coderabbitai
Copy link

coderabbitai bot commented Oct 28, 2025

Walkthrough

Adds a new Rock Paper Scissors example: README documentation, an HTML UI with three buttons, CSS styling, and a JavaScript play(playerChoice) function that picks a random computer move and updates the page with win/lose/tie results.

Changes

Cohort / File(s) Summary
Documentation
rock-paper-scissors/README.md
Adds project description, features, and game rules
UI Structure
rock-paper-scissors/index.html
Adds HTML page with header, three buttons wired to play(...), result element, and links to stylesheet and script
Styling
rock-paper-scissors/style.css
Adds CSS for layout, centered content, button styling and hover effects, and result text styling
Game Logic
rock-paper-scissors/script.js
Adds play(playerChoice) function implementing random computer choice, outcome determination (win/lose/tie), and DOM update

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Page as HTML/Button Handler
    participant JS as play(playerChoice)
    participant DOM as Result Element

    User->>Page: Click rock/paper/scissors
    Page->>JS: play(playerChoice)
    activate JS
    JS->>JS: Pick random computer choice
    JS->>JS: Compare choices → outcome (win/lose/tie)
    JS->>DOM: Update result text
    deactivate JS
    DOM->>User: Show outcome
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Check rock-paper-scissors/script.js for correct outcome logic and edge cases.
  • Verify index.html correctly links style.css and script.js and that button onclick attributes match the function name.
  • Confirm README matches implemented behavior.

Suggested labels

hacktoberfest, hacktoberfest-accepted

Poem

I nibble keys and tap the ground,
A choice is made, three buttons sound.
Rock, Paper, Scissors — quick and spry,
A tiny win, a joyful cry,
Hopping code and carrot-high! 🐇🎲

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "Added my project: Rock-Paper-Scissors Game" directly and accurately describes the main change in the pull request. The changeset adds four new files (README.md, index.html, script.js, and style.css) that together constitute a complete Rock-Paper-Scissors game project, which is exactly what the title conveys. The title is clear, specific, and concise at 5 words, providing sufficient context for a reviewer scanning the history to understand that this is a new game project addition.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d6a3ffa and 9acc1c3.

📒 Files selected for processing (1)
  • rock-paper-scissors/script.js (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • rock-paper-scissors/script.js

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
rock-paper-scissors/README.md (1)

1-17: Consider improving Markdown formatting.

The documentation content is adequate, but the formatting could be enhanced for better readability. Consider using proper Markdown headers and lists.

Apply this diff to improve the formatting:

-Rock Paper Scissors Game:-
-A simple Rock, Paper, Scissors game where you play against the computer! Designed for beginners using only basic HTML, CSS, and JavaScript (loops, functions, and variables).​
+# Rock Paper Scissors Game
+
+A simple Rock, Paper, Scissors game where you play against the computer! Designed for beginners using only basic HTML, CSS, and JavaScript (loops, functions, and variables).
 
-Features:-
-Play Rock, Paper, Scissors against a computer opponent.​
+## Features
 
-Easy-to-read, beginner-friendly code structure.
+- Play Rock, Paper, Scissors against a computer opponent
+- Easy-to-read, beginner-friendly code structure
 
-Game Rules:-
-Rock beats Scissors
-
-Scissors beats Paper
-
-Paper beats Rock
-
-If both you and the computer choose the same option, it's a tie.
+## Game Rules
+
+- Rock beats Scissors
+- Scissors beats Paper
+- Paper beats Rock
+- If both you and the computer choose the same option, it's a tie
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 194390c and 9a277d9.

📒 Files selected for processing (4)
  • rock-paper-scissors/README.md (1 hunks)
  • rock-paper-scissors/index.html (1 hunks)
  • rock-paper-scissors/script.js (1 hunks)
  • rock-paper-scissors/style.css (1 hunks)
🧰 Additional context used
🪛 Biome (2.1.2)
rock-paper-scissors/script.js

[error] 20-20: Shouldn't redeclare 'play'. Consider to delete it or rename it.

'play' is defined here:

(lint/suspicious/noRedeclare)

🔇 Additional comments (3)
rock-paper-scissors/style.css (1)

1-26: LGTM!

The CSS styling is clean, well-structured, and appropriate for a beginner-friendly project. The color scheme is pleasant and the button interactions are properly defined.

rock-paper-scissors/index.html (1)

1-18: Good use of semantic HTML structure.

The HTML structure is clean and appropriate for a beginner project. The onclick handlers provide straightforward interaction with the game logic.

rock-paper-scissors/script.js (1)

1-19: Game logic is correct and well-structured.

The game logic correctly implements all win/lose/tie conditions and updates the DOM appropriately. Once the duplicate function is removed, this implementation will work as expected.

@gitsofaryan gitsofaryan merged commit bd82fef into gitsofaryan:main Oct 29, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants