Lab #17 Rock Paper Scissors

Lab #17 was titled "Rock Paper Scissors". As the title implies, this webpage will not be for only display but you can play rock paper scissors with a CPU opponent (computer). This lab had no instructions on how to actually complete this task, so I put it into my own hands to make an interactive JavaScript rock paper scissors game that allows you to pick one of the three and get a result based on what the computer threw.


In order to complete this lab, I had used a lot of JavaScript and little to no CSS. In my HTML, I had created three buttons that would allow for the user to select either rock, paper or scissors. Upon clicking the button, the javascript to run a long function executes. This function consists of using a random number generator to roll for the cpu while also producing the results and displays what you and the cpu threw. This function also compares both your throw and the cpu's throw to see who won and then displays it in the middle.

A web designer would want to know how to do this so they can make web-based games as simple as rock paper scissors. Making use of the random number generator allowed me to create a cpu that can choose their own move that's completely random. Yeah, that means there is no cheating in the system, it is all luck and RNG. Applying this mechanic to other games to verse a computer opponent would allow for much more creativity like chess, checkers, other board games, etc. There is much to be done with JavaScript, as this is only a simple rock paper scissors game. In the hands of a web designer, there can be more web-based games out there to play.

Comments

Popular posts from this blog

WBL Workshop #6 Interview Skills

CTE Expo Reflection Journal

Lab #12 Reflection