{"id":25477226,"url":"https://github.com/jjacoboflorez95/pig-game","last_synced_at":"2025-10-05T00:08:24.117Z","repository":{"id":276521640,"uuid":"919457808","full_name":"jjacoboflorez95/pig-game","owner":"jjacoboflorez95","description":"An interactive two-player dice game implemented with object-oriented programming in JavaScript.","archived":false,"fork":false,"pushed_at":"2025-02-18T02:11:16.000Z","size":2726,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-18T02:49:40.229Z","etag":null,"topics":["college-project","game-development","javascript","oop","web-development"],"latest_commit_sha":null,"homepage":"https://pig-game-tau-henna.vercel.app","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jjacoboflorez95.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-01-20T12:30:22.000Z","updated_at":"2025-02-18T02:11:20.000Z","dependencies_parsed_at":"2025-05-18T02:39:55.337Z","dependency_job_id":"a58288a1-d228-4957-85be-c6eb6fc16de2","html_url":"https://github.com/jjacoboflorez95/pig-game","commit_stats":null,"previous_names":["jjacoboflorez95/pig-game"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jjacoboflorez95/pig-game","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jjacoboflorez95%2Fpig-game","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jjacoboflorez95%2Fpig-game/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jjacoboflorez95%2Fpig-game/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jjacoboflorez95%2Fpig-game/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jjacoboflorez95","download_url":"https://codeload.github.com/jjacoboflorez95/pig-game/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jjacoboflorez95%2Fpig-game/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278391220,"owners_count":25978947,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-04T02:00:05.491Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["college-project","game-development","javascript","oop","web-development"],"created_at":"2025-02-18T13:38:16.156Z","updated_at":"2025-10-05T00:08:24.075Z","avatar_url":"https://github.com/jjacoboflorez95.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🐷 PIG Game\n\n## 📌 Project Overview\n\nThe **PIG Game** is an interactive, two-player dice game where players compete to accumulate 100 points first. Players roll a die to earn points but risk losing their turn score if they roll a 1. They can \"hold\" to add their turn score to their total, transferring the turn to the opponent.\n\n---\n\n## 🌍 Live Demo\n\n🎮 **Try it out here**: [PIG Game Live Demo](https://pig-game-tau-henna.vercel.app)\n\n---\n\n## 🚀 Features\n\n- 👥 **Player Name Input**: Users enter names for Player 1 and Player 2.\n- 🎲 **Dice Roll Simulation**: Generates random numbers between 1 and 6 for each roll.\n- 🔄 **Dynamic Turn Display**: Highlights the current player's turn.\n- 📝 **Score Tracking**: Tracks both turn scores and total scores for players.\n- 🎉 **Winner Announcement**: Declares the winner when a player reaches or exceeds 100 points, with a congratulatory message.\n- 🔄 **New Game Option**: Allows players to reset scores and start over.\n\n---\n\n## 📌 Project Purpose\n\nThis project demonstrates:\n\n- **Game Development with JavaScript**: Implementing interactive gameplay using JavaScript and jQuery.\n- **Object-Oriented Programming (OOP)**: Utilizing JavaScript classes and objects for structured game logic.\n- **User Interaction \u0026 Experience**: Providing an engaging, competitive experience with real-time updates.\n- **DOM Manipulation**: Using JavaScript to dynamically update UI elements based on game state.\n- **Responsive Web Design**: Ensuring compatibility across different screen sizes and devices.\n- **Scalability \u0026 Future Enhancements**: Laying a foundation for additional features like custom score limits, saved game states, and animations.\n\n---\n\n## 📂 Project Structure\n\n```\n📝 pig_game\n ├── 📝 index.html          # Main HTML file for the game interface\n ├── 📝 pig.css             # Stylesheet for layout and design\n ├── 📝 pig.js              # Main JavaScript file for UI interactions\n ├── 📝 library_die.js      # Die class for dice roll simulation\n ├── 📝 library_pig.js      # Pig class for player logic\n ├── 📝 library_game.js     # Game object for controlling the game flow\n```\n\n---\n\n## 🛠 Technologies Used\n\n- **🌐 HTML5**: Structures the game interface and layout.\n- **🎨 CSS3**: Provides a visually appealing design with responsive elements.\n- **📚 JavaScript (ES6)**: Manages game logic, interactions, and updates.\n- **🔄 jQuery**: Simplifies DOM manipulation and event handling.\n- **🎮 Object-Oriented Programming**: Implements classes (`Die`, `Pig`) and an object (`game`) for structured logic.\n\n---\n\n## 🏃‍♂️ How to Play\n\n1. **Enter Player Names**:\n   - Input names for Player 1 and Player 2.\n\n2. **Start the Game**:\n   - Click **\"New Game\"** to initialize scores and begin.\n\n3. **Take Turns**:\n   - Click **\"Roll\"** to roll the die and add the result to your turn score (unless a 1 is rolled).\n   - Click **\"Hold\"** to save your turn score to your total and pass the turn to your opponent.\n\n4. **Win Condition**:\n   - The game announces the winner when a player reaches or exceeds 100 points.\n   - The \"Roll\" and \"Hold\" buttons are disabled until a new game starts.\n\n5. **New Game**:\n   - Click **\"New Game\"** to reset the game and play again.\n\n---\n\n## 📝 Code Highlights\n\n- **`Die` Class** (`library_die.js`):\n  - Simulates rolling a die by generating random numbers between 1 and 6.\n\n- **`Pig` Class** (`library_pig.js`):\n  - Manages each player's turn score, total score, and dice roll validation.\n\n- **`game` Object** (`library_game.js`):\n  - Controls the game flow, manages player turns, validates input, and checks for a winner.\n\n---\n\n## 🌟 Future Improvements\n\n- 🎮 **Custom Winning Score**: Allow users to set the target score.\n- 💾 **Save Game State**: Add functionality to save and resume games.\n- 🎧 **Sound Effects**: Add audio feedback for rolls, holds, and win announcements.\n- 🎭 **Enhanced Visuals**: Introduce animations for dice rolls and winner celebration.\n\n---\n\n## 🎭 Screenshots  \n\n| Pig Game |  \n|--------------|  \n| ![Pig Game](imgs/github/pig-game.png) |  \n\n---\n\n## 📝 License\n\nThis project was developed for educational purposes as part of a **college assignment**.\n\n---\n\n💼 **Author:** Juan Jacobo Florez Monroy | 🚀 **GitHub**: [GitHub](https://github.com/jjacoboflorez95)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjjacoboflorez95%2Fpig-game","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjjacoboflorez95%2Fpig-game","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjjacoboflorez95%2Fpig-game/lists"}