ELA component

Rock, Paper, and Scissors - Journal Entries

Day 1: Planning and Setting Up


Today, I began the process of coding a Rock, Paper, Scissors game in Python. I started by outlining the basic structure of the game and its functionalities. Here's a summary of what I did:


Project Setup: Created a new Python script file named "rps_game.py" to contain the game code.


Defined Game Logic: Outlined the game's basic rules and logic, such as how the player selects their choice (rock, paper, or scissors), how the computer generates its choice, and how the winner is determined.


Coding the Player's Choice: Implemented code to allow the player to input their choice (rock, paper, or scissors) using the input() function.


Generating Computer's Choice: Developed code to randomly generate the computer's choice using the random.choice() function from the random module.


Displaying Results: Wrote code to compare the player's choice with the computer's choice and determine the winner, then displayed the result to the player.


Problems Encountered:


Initially, I encountered an issue with generating the computer's choice randomly. However, after consulting the Python documentation and fixing the syntax, I successfully resolved this problem.

I also had to consider how to handle invalid input from the player, such as if they entered a choice other than rock, paper, or scissors. I decided to implement error handling using a loop to prompt the player to enter a valid choice.

Day 2: Refining the Game Logic


Today, I focused on refining the game logic and adding additional features to enhance the gameplay experience. Here's what I accomplished:


Error Handling: Improved error handling for invalid player input by implementing a loop that continuously prompts the player until they enter a valid choice (rock, paper, or scissors).


Scoring System: Introduced a scoring system to keep track of the player's and computer's wins, losses, and ties throughout the game.


Game Loop: Implemented a game loop that allows the player to play multiple rounds of Rock, Paper, Scissors until they choose to exit the game.


Displaying Scores: Added code to display the current scores at the end of each round, providing feedback to the player on their progress.


Problems Encountered:


One challenge I faced was ensuring that the game loop properly reset the scores at the start of each new game. I resolved this by resetting the score variables within the game loop.

Additionally, I needed to ensure that the game loop correctly exited when the player chose to end the game. I implemented a conditional statement to check for the player's input and break out of the loop if necessary.

Day 3: User Interface Improvements


Today, I focused on improving the user interface and adding some visual enhancements to the game. Here's what I did:


ASCII Art: Added ASCII art representations of rock, paper, and scissors to make the game more visually appealing.


Formatted Output: Improved the formatting of the game's output to make it easier for the player to read and understand.


Color Coding: Experimented with adding color coding to the output text using ANSI escape codes to make it more visually engaging.


Problems Encountered:


One challenge I encountered was figuring out how to properly display colored text in the terminal using ANSI escape codes. After some trial and error, I found a solution by using the colorama library, which simplified the process of adding color to the output text.

Day 4: Testing and Bug Fixing


Today, I focused on testing the game thoroughly and identifying any bugs or issues that needed to be addressed. Here's what I accomplished:


Testing Edge Cases: Conducted extensive testing to ensure that the game handled various scenarios, including invalid input, ties, and edge cases.


Bug Fixing: Identified and fixed several bugs, such as incorrect scoring calculations and formatting issues with the output text.


Code Refactoring: Reviewed the code for clarity and readability, refactoring any sections that were unclear or redundant.


Problems Encountered:


One issue I encountered during testing was a discrepancy in the scoring system, where the player's score was not updating correctly after each round. I traced this issue back to a typo in the variable name used to store the player's score and quickly resolved it.

Day 5: Finalizing and Documentation


Today, I focused on finalizing the game and documenting the code to make it easier for others to understand and use. Here's what I accomplished:


Final Testing: Conducted a final round of testing to ensure that all features were working as intended and that the game was bug-free.


Documentation: Added comments and documentation throughout the code to explain its functionality, input/output, and any important considerations.


Code Review: Reviewed the entire codebase one last time to ensure consistency, clarity, and adherence to best practices.


Packaging: Packaged the game into a standalone executable or distribution package using tools like PyInstaller or setuptools for easier distribution and installation.


Problems Encountered:


No major problems were encountered today. However, I spent extra time reviewing and polishing the code to ensure its quality and readability.

Overall, the process of coding a Rock, Paper, Scissors game in Python was both challenging and rewarding. Through careful planning, problem-solving, and iteration, I was able to create a functional and enjoyable game experience.