Giter Club home page Giter Club logo

rockpaperscissors---p2's Introduction

Rock Paper Scissors

Deployed Website

Github

am i responsive

Intro

I have created a Rock Paper Scissors game which utilizes HTML & CSS, with the main purpose of the project to showcase the skills I have learned in the latest Code Institute module, Javascript. The game pits the user/player against the computer in a game of chance. The site's goal is to create a challenging game for the player while entertaining them online.

The Rules:

The user chooses one of three options (Rock, Paper or Scissors) & this choice is compared against the computers choice.

  • Rock beats Scissors
  • Paper beats Rock
  • Scissors beats Paper

The user/computer score increments by 1 each time they win & does not increment if they draw or lose a game. The first to 10 points wins!

Features

I plan to include the following features:
  • Pattern matching functionality
  • A limited number of tries before the game is over
  • A score tracking system
  • The ability to play against the computer

UX

I plan to incorporate the following into the user experience:

  • a game that is easy to understand, intuative & entertaining for the user
  • pit the user against the computer
  • make the game visually appealing to the user with complimentary colors, icons/emojis & call to actions
  • the game should work without any bugs or faults

Fonts

I used Google Fonts as it has a vast amount of modern & contemporary fonts. The two fonts I have used are Hind Siligur & Rubik, I felt these fonts complimented each other, where clean & modern & easily readible for the user.

Icons

I have used a favicon from Font Awesome

I wanted to make the website visually appealing to the user so decided to use emojis for the selection buttons;

  • Rock ✊
  • Paper ✋
  • Scissors ✌️

I used a smiling emoji (😁) when the user wins & a crying emoji (😭) in the result description when the user loses, to add to the visual experience of the user. These were sourced from GetEmoji

Design

I used Coolors to get a complimentary color palette to add to the visual experience of the user. I used the following:

  • #05445E - very dark blue very dark blue
  • #FFD700 - gold gold
  • #F0F8FF - alice blue alice blue

Features

Main Screen

main screen

Header

header

User Choice Buttons

UserChoice buttons

Scoreboard

scoreboard

Results description

results description - draw results description - lose results description - win

Game Result Alerts

you won alert

you LOST alert

Media Queries

I ensured the website would work on multiple screen sizes to ensure a smooth user experience irrespective of the device the user chose to use tablet, phone, desktop, etc. I did however chose a mobile first design & feel the game is optimal for mobile devices...entertainment & fun on the go

Validation Checks

W3c Html Validation service

image

W3c Css Validation service

image

JSHint

jshint validation

Wev Dev Tools Chrome

I used web dev tools in chrome to access the quality & accessibility of the webpage. It gave me insight into how the RockPaperScissors website performed & scored highly in Performance, Accessibility, Best Practices & SEO for both desktop & mobile devices

Mobile Devices

lighthouse 1

Desktop devices

Initially the SEO was resulting in score of 89

lighthouse desktop

I added in meta descriptions within HTML header as per advice from lighthouse guidance & increased the score to 100 (seen below)

lighthouse desktop 2

Bugs

Deployed website would not function - Issue with relative & absolute file path for javascript file "app.js", would work with gitpod website preview using:

<script src="assets/app.js"></script>

but would not function on deployed website. For javascript file to load correctly I changed to absolute file path

<script src="/rockpaperscissors---P2/assets/app.js"></script>
Issue with gameOver function - I had issues with getting game to stop when user or computer reached max_points (set to 10 in this example).I overcame this by setting a variable as "let isGameover = false;". Then adding isGameOver function into the game() function. So if isGameOver function is false then play the game. Within the game function the gameOver function was included to run with statements defined within the function gameOver() with an else if statement. These determined the conditions for who won, the user or computer or if the game was drawn. The code was executed if the conditions were true, i.e.
if(userScore === max_points && computerScore < max_points){
alert('You WON the game!! Congrats!');
userScore = 0;
computerScore = 0;
isGameOver = true;

Restart button only appearing when game was over - I initially had this as display:none within CSS but this did not work. I overcame this issue by including CSS styling rules within the gameOver function:

if(isGameOver){
restart.style.display = 'flex';
}
else {
restart.style.display = "none";
}

Deployment

The website was deployed on GitHub by using following steps:

  1. Login into GitHub and locate the repository - pharmacy
  2. At the top of repository locate the "settings" button and click on it
  3. On the left sidebar find locate the "pages" button and click on it
  4. Click on the branch dropdown menu and select: master
  5. Click save
  6. Link to your deployed repository appears
  7. image

Technologies Used

  • HTML
  • CSS
  • Javascript

Tools

Credits/References

  • Code Institute - giving me the knowledge & skills to develop this project
  • W3 Schools (https://www.w3schools.com/) - clearing up some function queries I had
  • Stack Overflow - another extremely useful resource I used to rectify many issues with my code throughout the project including how to make my game end when getting to max amount of points
  • Acknowledgements

    • martina_mentor - my mentor Martina who was always on hand to answer any questions
    • Code Institute Channel on Slack - I found this a great resource with many knowledgeable people who were more than willing to answer my questions & help out.
    • GeeksForGeeks - useful resource to see worked examples to improve my understanding of JavaScript syntax & functions
    • Youtube - I found a number of tutorials on youtube useful in helping me understand javascript & how I should structure my code in relation to a rock, paper, scissors game. I found the tutorials an invaluable resource in overcoming issues that arose. In particular I would like to acknowledge Ania Kubów, Whatsdev, Webdevsimplified, Traversy Media, Dave Gray & Rajneesh Rana

    Final Note

    I found this project to be particularly challenging, even more so than HTML & CSS. It was rewarding when functions worked correctly but was very frustrating when bugs appeared or functions would not work correctly. Through perseverance & the aid of my colleagues in the code institute slack channel, reviewing the Javascript module from Code Institute numerous times, my mentor Martina, stack overflow threads & youtube tutorials I was able to improve my understanding of Javascript structure, functions & syntax. I hope to build on the skills I have developed & realise I can improve my knowledge futher by continuing to build other projects, which I plan to do.

    Thank you

    daves

    rockpaperscissors---p2's People

    Contributors

    dsouths avatar

    Recommend Projects

    • React photo React

      A declarative, efficient, and flexible JavaScript library for building user interfaces.

    • Vue.js photo Vue.js

      🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

    • Typescript photo Typescript

      TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

    • TensorFlow photo TensorFlow

      An Open Source Machine Learning Framework for Everyone

    • Django photo Django

      The Web framework for perfectionists with deadlines.

    • D3 photo D3

      Bring data to life with SVG, Canvas and HTML. 📊📈🎉

    Recommend Topics

    • javascript

      JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

    • web

      Some thing interesting about web. New door for the world.

    • server

      A server is a program made to process requests and deliver data to clients.

    • Machine learning

      Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

    • Game

      Some thing interesting about game, make everyone happy.

    Recommend Org

    • Facebook photo Facebook

      We are working to build community through open source technology. NB: members must have two-factor auth.

    • Microsoft photo Microsoft

      Open source projects and samples from Microsoft.

    • Google photo Google

      Google ❤️ Open Source for everyone.

    • D3 photo D3

      Data-Driven Documents codes.