Skip to content

CaptKraken/pyGuessTheNumber

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pyGuessTheNumber

a guess-the-number game.

finished on the 16th Nov 2020
made with Python3
executable made with pyinstaller

Menu

type:

  • p: [p]lay the game.
  • r: read the game's [r]ule/help.
  • a: read [a]bout page.
  • q: to [q]uit.

Rules

to win: you have to correctly guess a randomly generated number.

different difficulty level gives you different ranges of numbers and tries:

  1. easy: number ranges from 1 to 10. you have 5 chances to guess the number.
  2. medium: number ranges from 1 to 100. you have 7 chances to guess the number.
  3. hard: number ranges from -500 to 500. you have 10 chances to guess the number.

Binary Search Algorithm

if you understand the concept of binary search algorithm, you can win this easy.
the explanation that stuck with me was the one from of the "finding David" part of CS50 2020 Lecture 0.
the basic idea is to target the number in the middle of the range.
ie: if it's from 1-10, you should start with 5. see if it's a higher or lower number than the correct number, then you repeat the process until you win.

Screenshots

pyGuessTheNumber main screen

pyGuessTheNumber Play

pyGuessTheNumber Rules

Releases

No releases published

Packages

No packages published

Languages