Introduction: Stone Paper Scissor Game

About: a very passionate lover of technology and making stuff

This is my first instructable. I wanted to write one for a long time but i didn't had any project at hand which i could publish here. So when i came up with idea of this project, i decided this is the one.

So i was browsing tensorflow.js's site, it is a library which enables training and running ml models on browser and node.js environment and i stumbled upon this demo which lets you train a model on browser to classify different images from your webcam and then lets you export and download that trained model for use in your projects. Cool right!

So i instantly made the game of stone, paper, scissor and trained the model in such a way that i always win i.e. when i do paper it predicts stone, and similar for stone -> scissor, scissor -> paper.

This is a stone, paper & scissor game in which you always win!!


A computer with internet connection.

Step 1: Train Your Ml Model

Head over to tensorflow.js demo and create 3 classes in the order scissor, paper then stone and then train them as instructed by the demo.

Step 2: Download the Trained Model

Download the model and keep the compressed file in a safe folder. It will be used in steps ahead.

Step 3: Download the Source Code

You can download the source code by clicking this link - source code.

or You can head over to my github repo here - git repo

Step 4: Extract

Extract the downloaded zip file.

There is my-model folder. This is where your download model needs to be extracted.

Extract the downloaded model file here. Three files must be extracted from it.

  1. metadata.json
  2. model.json
  3. weights.bin

# if you have extracted the downloaded model file here some where else. Cut and paste the three files in the my-model folder.

Step 5: Hosting the Project

You can not run the project directly like a simple html page because this project requires some external libraries to be loaded via script.

So you need to host the project locally on your computer. the simplest way to do that is using web server for chrome.

to download it just head over to google and search for web server for chrome. Go to link and add it to your browser.

Select the folder containing the project and start the server if it automatically doesn't start.

Step 6: Finished

click on start. And start playing the game specially designed for you so that you always win.