GithubHelp home page GithubHelp logo

victorqribeiro / googol Goto Github PK

View Code? Open in Web Editor NEW
47.0 4.0 1.0 47 KB

Googol Game or "You should learn when to quit". A JavaScript game.

Home Page: https://victorribeiro.com/googolGame

License: MIT License

CSS 6.98% HTML 11.00% JavaScript 82.02%
googol euler javascript game theory

googol's Introduction

Googol Game

...or "You should learn when to quit"! - A JavaScript game.

screenshot

Play it here

About

After watching this video, that tells you a good time to quit gambling, I decided to create a game to test the theory.

This game is very simple: given N numbers, that could have the value 0 to googol (10 ** 100 | the number 1 with 100 zeros), you choose a number. You can go home with that number (if you think that is the biggest one) or you could choose another from the options. You last choice is your number! If you got a big number and decided to pick another one, you can't go back to the one you already had. When you think you have the biggest number, click "I'm done" and the game will answer if you have the biggest one or not.

The experiment

The experiment on the video says that if you take all your options (N) and divede it to the euler's number e and round that to the next integer, the result will give you a good sample of all the values. So you keep picking numbers until you get one that is bigger than the ones you got from the sample. The video says that you'll then have a 1/3 probability of winning. Cool, right?! No?! Don't want to play? Ok, just click "Computer" and let the computer play for you.

How to play

On the right top corner, where it says "Plays", it's the amount of numbers you already choosen.

Next to it, is a "history" log, with all the number you've selected, being the first one (the red line) your current number.

Bellow all that is the numbers: 1 - N, you just click one to select a number.

When you think you have the biggest number of all, click "I'm done" to see if you got it right.

The "Computer" button makes the computer play the game for you (it wins a lot).

googol's People

Contributors

victorqribeiro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

googol's Issues

getRandomBigNumber Isn't Evenly Distributed

Appreciate the project; something to take note:

The length of digits generated via
const r = Math.floor(Math.random() * 101);
is not evenly distributed.

Consider a number with a max of 2 digits (instead of a googol).
Numbers 0-9 will have a 50% chance to be chosen as would numbers 10-99.

A solution would be to always generate a fixed length of digits, then remove any preceding zeros.

Link to HN Discussion

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.