Git Product home page Git Product logo

edu-lucky-number's Introduction

Lucky Number X

In this game, the application randomly determines a sample size of numbers. Within the sample, a number is assigned the lucky number.

Your job is to find the lucky number programmatically using as few guesses as possible.

Assignment

Write a function that consistently finds the lucky number with the least number of guesses.

Anatomy

<div data-value="32" class="number n32">32</div>

Each number is wrapped in a div that contains the data attribute value which stores the numeric value of the number. Remember, "32" is different from 32.

Classes

Each number has two classes when the application initializes:

  • number
  • n[X]

The number class can be used to identify all of the available numbers on the page.

The second class, n[X] is unique to each number and can be used to identify a specific number on the page. The naming of the unique class follows a simple pattern: the number prefixed with the letter "n". For example, number 32’s unique class will be n32.

HINT: You’ll need to make use of both of these classes when writing your algorithm to find the lucky number.

Guessing

Use the guess() function to make a guess:

guess(number);

guess() accepts one argument which is the name of the unique class for a given number. For example, if you want to guess 32, write guess('.n32');.

Responses

Each guess will return one of three results:

  • higher The lucky number is higher than your guess
  • lower The lucky number is lower than your guess
  • win You guessed the lucky number

edu-lucky-number's People

Contributors

briansw avatar

Stargazers

 avatar

Watchers

 avatar  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.