top of page
Search

Rock-Paper-Scissors

  • kliu3758
  • Jan 12
  • 2 min read

It all started when I noticed a friend coding at the lunch table. Curious, I asked what he was working on, and he explained it was a rock-paper-scissors game for his CSA class. The project seemed pretty straightforward, but what really interested me was when he mentioned extra credit for adding music or an interface. I wasn’t in the class, but I had a basic understanding of Java and thought that It sounded like a fun way to challenge myself.


Background image code
Background image code


There were many things that I wanted from this project. I wanted this project to theoretically get the extra credits if I was in that class. After a bit of thought I decided that instead of 3 objects, you could choose from a selection of 5 objects; rock, paper, scissors, shield, and a gun. I made that in the game, and set it up so that the player would go against a randomly generated object, and whoever won 3 rounds won the game. 


ree

After looking into the assignment for that class, the assignment wanted the game to have music, and to have an actual interface. While the game itself was not too complicated. I did not have experience in putting in sounds and making it so that the player could click buttons to choose their option. For the music, I explored Java's built-in libraries like javax.sound.sampled to play audio files. It was hard learning all the new code I had to use, but I managed to add a short background tune that played during the game. As for the interface, I learned to use Java's Swing library to create a basic graphical user interface (GUI). I added buttons for the player to click on their choice and a label to display the results of each round.


ree

The interface was another challenge. I’d never worked with Java’s Swing library before, so creating a graphical user interface (GUI) from scratch was pretty scary. I had to learn how to add buttons for players to click and a label to display the results of each round. Figuring out how to position everything and make the buttons actually do something when clicked was frustrating. More than once, I felt like giving up when nothing seemed to work the way I expected.



In the end, though, I managed to finish the project. Looking back, I think the struggle was what made the project so rewarding. It forced me to push past my comfort zone and learn skills I’d never tried before.

What started as a curiosity-driven side project turned into something I was genuinely proud of. I learned a lot from figuring out how to add sound and build a GUI, but more importantly, I enjoyed seeing a basic idea evolve into something more creative. It reminded me that even small, simple projects can teach you a lot if you’re willing to push a bit beyond the basics.


 
 
 

Recent Posts

See All

Comments


bottom of page