On 03/13/2014 03:29 AM, Scott W Dunning wrote:
Hey Everyone,
I just got through doing a Guess-the-number script and was looking for
something else to practice on. Do any of you have any suggestions on some
things I could work on? Keep in mind I am not only extremely new to python I
am new to programming. Thanks for any suggestions!!!
Scott
There are many variants you can introduce in this game, small or big, that may
drive to learn or practice notions of python and programming:
* have the out-of-interval hint depend on actual present interval (rather than
initial)
* have the player choose the initial interval; or have random, in a sensible way
* reverse the game: the human choose the secret number, and the machine plays
* have both the 'chooser' and the 'guesser' be played by the computer
* make the game (the game logic and rule) defined in code, instead of spread as
a number of apparently unrelated data (the interval, the secret number...) and
functions (the guesser guesses, the whole playing loop...)
Technically, the latter point is sometimes called "reification" (literally
thingification). We constantly do that in programming, especially (OO)
object-oriented. It is argually the core of preperly structuring an app. In this
case, it is not necessary, since the game (the gaming machine) is the whole app.
However, you can do it as if it where a component or dimension of a bigger
software system. As if your whole present code were embedded in:
guess_the_number = {
...
}
and all top elements defined in your code are defining properties of the game.
(Am I clear?)
d
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor