harbi811 / i-spy-game Goto Github PK
View Code? Open in Web Editor NEWTake turns playing "I Spy" game with the computer
Take turns playing "I Spy" game with the computer
In reference to Issue #2, offer clues to the player to make the game easier. If the player makes a wrong guess, the next letter of the word should be given as a clue. Repeat if the second guess is wrong and if the third guess is wrong, reveal the last letter of the word.
Currently the comparison between the player's guess and the secret word is case sensitive. The game messages do tell the player that they should type the word in lower case. But it would be nice to perform a case-insensitive comparison, so the player doesn't need to worry about this.
When the computer is trying to guess your word, it can sometimes try to guess the same word twice. This probably should be fixed, unless you want the computer to appear deliberately forgetful :)
In some categories, such as "fruits", there are no English words I am aware of that begin with letters such as i, v and x. This raises a KeyError when the user specifies any of the letters as the first letter of the secret fruit.
The game at this point relies on the user strictly following input rules for the category of words to play and also providing some form of input for each prompt. However, when the user does not provide input (ie, presses Enter at the prompt), different errors are returned at different stages of the game.
Two things could be done to create consistent code style:
foo_bar
) or camel case (fooBar
).The userPlay()
function is too complex to understand what is going on.
You can simplify the function by breaking it down into smaller functions that achieve one task i.e.
Currently it's very hard for the player to guess the right word within seven guesses, because (unless you peek at the source code) you don't have any way to narrow down the set of possible words you should be thinking of.
Perhaps it would improve playability if there was a way that the player could ask for a clue. Perhaps this clue could be revealing another letter from the word.
Another approach could be to divide the game up into different categories, like "animals", for example. Before beginning a round, the player chooses which category to play. Then at least you know you should be trying to guess the name of an animal, not just any word beginning with the given letter.
You might want to split this into different issues, or rescope this depending on what your preferred approach is - just thought I would raise an issue to start discussion :)
In reference to Issue #2, add word categories to the game to make it easier for the player to guess what word they should think of.
For example; fruit and animal categories. During each round of the game, the player should be able to decide what category to play from.
Currently, the main game logic in the main module is at the module level.
Move this code under a function called main.
def main():
# main game logic
This would be of benefit when running unit tests and if you want the game to be executed as a script on the terminal or imported in another module
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.