A fully accessible, interactive Rock Paper Scissors game built with HTML, CSS, and JavaScript. This project demonstrates modern web development practices including accessibility standards (WCAG 2.1), semantic HTML, and clean code organization.
This is a single-player Rock Paper Scissors game where you compete against the computer. The first player to reach 5 points wins the match. The game features a fully accessible interface with keyboard navigation support, screen reader compatibility, and high contrast ratios.
rockpaperscissors/
├── index.html # Main HTML file
├── css/
│ └── style.css # All styling and accessibility features
├── js/
│ └── script.js # Game logic and interactivity
├── README.md # This file
└── ACCESSIBILITY_AUDIT.md # Detailed accessibility audit report
- CSS Folder: Contains all stylesheet files for styling and responsive design
- JS Folder: Contains all JavaScript files for game logic and event handling
- Created
css/andjs/folders for organized file structure - Moved
script.jsinto thejs/folder - Created
index.htmlwith HTML5 boilerplate - Added proper meta tags (charset, viewport for responsive design)
File: index.html
- H1 Heading: "Choose Your Weapon" - main page title
- Instructions: Clear text describing how to play
- Three Game Buttons:
#rock- Choose rock#paper- Choose paper#scissors- Choose scissors
- Results Display:
<div id="results">to show game outcomes - Reset Button: Hidden button to reset the game when finished
- Added
aria-labelattributes to all buttons for screen readers - Added
role="status"andaria-live="polite"to results div for dynamic content announcement - Proper semantic HTML structure
- Bootstrap CSS framework for responsive design
File: js/script.js
let scorePlayer = 0; // Track player's wins
let scoreComputer = 0; // Track computer's wins
// DOM element references
const rockBtn = document.querySelector("#rock");
const paperBtn = document.querySelector("#paper");
const scissorsBtn = document.querySelector("#scissors");
const resultsDiv = document.querySelector("#results");
const resetBtn = document.querySelector("#reset");1. playRound(playerSelection, computerSelection) (Lines 11-24)
- Compares player choice with computer choice
- Returns appropriate message:
- "It's a tie!" if both chose the same
- "You win! [Choice] beats [Choice]" if player wins
- "You lose" if computer wins
2. getComputerChoice() (Lines 26-30)
- Generates random computer choice (rock, paper, or scissors)
- Uses
Math.random()for selection
3. handleClick(playerSelection) (Lines 32-55)
- Main game logic function called when player clicks a button
- Gets computer's choice
- Calls
playRound()to determine winner - Updates results display
- Increments score (player or computer)
- Displays current score
- Checks for match winner (first to 5 wins)
- Shows reset button and disables game buttons when match ends
4. disableButtons() (Lines 57-62)
- Disables all game buttons when match is over
- Prevents player from clicking during game over state
5. resetGame() (Lines 64-77)
- Resets scorePlayer and scoreComputer to 0
- Clears results display
- Re-enables all game buttons
- Hides reset button
- Allows user to play another match
rockBtn.addEventListener("click", () => handleClick("rock"));
paperBtn.addEventListener("click", () => handleClick("paper"));
scissorsBtn.addEventListener("click", () => handleClick("scissors"));
resetBtn.addEventListener("click", resetGame);File: css/style.css
- Font family: System fonts (Apple System, Segoe UI, Roboto)
- Background color: Light gray (#f5f5f5)
- Max-width: 800px for optimal readability
- Centered layout with padding
- Primary color: Blue (#0d6efd)
- Padding: 12px 24px
- Border radius: 6px for rounded corners
- Smooth transitions on hover
1. Keyboard Focus Indicators:
button:focus {
outline: 3px solid #0d6efd;
outline-offset: 2px;
box-shadow: 0 0 0 5px rgba(13, 110, 253, 0.25);
}- Ensures keyboard users can see which button is focused
- Uses high-contrast outline
2. Contrast Ratios (WCAG AA Compliant):
- Primary buttons: 5.5:1 ✓ (meets AA standard of 4.5:1)
- Body text: 15:1 ✓ (far exceeds requirement)
- Instructions text: 8.4:1 ✓
- Footer links: 5.5:1 ✓
3. Disabled State:
- Buttons are disabled when game ends
- Visual feedback with reduced opacity
4. Results Display:
- Prominent background color when content is present
- Border changes to indicate active state
- Minimum 60px height for easy reading
- Mobile-friendly breakpoint at 600px
- Full-width buttons on small screens
- Adjusted font sizes for readability
File: ACCESSIBILITY_AUDIT.md
✅ Fixed Issues:
- ✅ Added focus outlines for keyboard navigation
- ✅ Added
aria-livefor dynamic content updates - ✅ Added visible instructions text
- ✅ Verified contrast ratios (all WCAG AA compliant)
- ✅ Ensured semantic HTML structure
Testing Recommendations:
- Keyboard navigation (Tab, Shift+Tab, Enter, Space)
- Screen reader testing with NVDA or JAWS
- Color contrast verification
- Browser compatibility
Added to: index.html
<footer class="footer">
<p>© 2026 <a href="mailto:allieclarkdev@gmail.com">Allison Clark</a>
| <a href="https://allie.me" target="_blank">My Portfolio</a>
| <a href="https://github.com/REILANA" target="_blank">GitHub</a></p>
</footer>- Copyright notice with creator's name
- Email link (mailto) for contact
- Portfolio website link
- GitHub profile link
- Accessible link styling with focus indicators
git init # Initialize repository
git config user.name "Allison Clark"
git config user.email "allieclarkdev@gmail.com"
git add . # Stage all files
git commit -m "Initial commit: Rock Paper Scissors game with accessibility features"git remote add origin https://github.com/REILANA/rockpaperscissors.git
git branch -M main # Rename master to main
git push -u origin main # Push to GitHubRepository: https://github.com/REILANA/rockpaperscissors
- ✅ Interactive single-player gameplay
- ✅ Score tracking (first to 5 wins)
- ✅ Real-time result display
- ✅ Game reset functionality
- ✅ Button disable during game over
- ✅ WCAG 2.1 Level AA compliant
- ✅ Keyboard navigation support (Tab, Enter, Space)
- ✅ Screen reader compatible (aria-labels, aria-live)
- ✅ High contrast ratios (5.5:1 to 15:1)
- ✅ Focus indicators for keyboard users
- ✅ Semantic HTML structure
- ✅ Responsive mobile design
- ✅ Clean, organized code structure
- ✅ Modular JavaScript functions
- ✅ CSS with accessibility standards
- ✅ Bootstrap framework integration
- ✅ Version control with Git
- ✅ GitHub deployment
- Open
index.htmlin a web browser - Read the instructions: "Select your choice below to play against the computer. First to 5 wins!"
- Click one of three buttons:
- Rock
- Paper
- Scissors
- View the result showing:
- Game outcome (win/lose/tie)
- Current score (Player vs Computer)
- Continue playing until someone reaches 5 wins
- Click "Reset Game" button to play again
- Press Tab to move between buttons
- Press Enter or Space to select a choice
- Use Tab to navigate to "Reset Game" button when game ends
- Press Enter to reset and play again
- HTML5: Semantic markup and structure
- CSS3: Styling, accessibility, responsive design
- JavaScript (ES6): Game logic, event handling, DOM manipulation
- Bootstrap 5.3: CSS framework for responsive design
- Git: Version control
- GitHub: Code repository and deployment
- Chrome/Chromium (latest)
- Firefox (latest)
- Safari (latest)
- Edge (latest)
- Mobile browsers (iOS Safari, Chrome Mobile)
This project meets WCAG 2.1 Level AA standards:
- ✅ Sufficient color contrast ratios
- ✅ Large, readable text
- ✅ Clear visual hierarchy
- ✅ Keyboard accessible
- ✅ Focus indicators visible
- ✅ All functionality available via keyboard
- ✅ Clear, simple language
- ✅ Aria labels for buttons
- ✅ Visible instructions
- ✅ Predictable behavior
- ✅ Valid HTML5
- ✅ Compatible with assistive technologies
- ✅ Semantic structure
Potential improvements for future versions:
- Add difficulty levels (easy, medium, hard)
- Implement best-of-3 or best-of-7 options
- Add animation effects for choices
- Create statistics/history tracking
- Add sound effects and music
- Implement multiplayer mode
- Add themes/dark mode
- Create a leaderboard
Developer: Allison Clark
GitHub: @REILANA
Portfolio: allie.me
Email: allieclarkdev@gmail.com
This project is open source and available under the MIT License.
For questions, feedback, or suggestions:
- 📧 Email: allieclarkdev@gmail.com
- 🌐 Portfolio: allie.me
- 💻 GitHub: @REILANA
Started: January 26, 2026
Completed: January 28, 2026
Status: ✅ Complete and Deployed
Thank you for playing Rock Paper Scissors! Enjoy the game! 🎮