Guess My Number (Android Game)

This is the information and support page for Guess My Number.

Get it on Google Play

Design Notes:

You cannot get much simpler than “Guess My Number”.  I cannot remember how many times I’ve witten this game in various languages and on various platforms.

That said, it makes a perfect straw man case for a platform, to allow familiarity with the nuances of the platform but without really causing a lot of development challenges.

Things I learned in the process of development:

  • How to use the android XML UI layouts
  • How to use the android string resources
  • The basic workings of the launcher icon.
  • How to create an APK from Eclipse
  • How to submit an app to Google Play.

When starting out making this game, I implemented it within a single activity. In fact, the game play itself is still within a single activity.

However, I decided that even on a game this simple, it needed to have a complete presentation package. It needed a main menu. It needed an instruction screen, and it needed an about screen.  So there is a total of  4  activities.

Analysis:

After a very short period of time in playing GMN, one will uncover the “ideal strategy” for guessing, which is to guess in the middle of whatever the remaining range is in order to exclude the maximum number of incorrect numbers from the rage.

For example, the first guess should always be 50, the second guess will be either 25 or 75 depending on the results of the 50.  The third is 12, 37, 62, or 87, depending on the results of guess #2.

In any case, under this strategy, you will never need more than 7 guesses.

In fact, the average number of guesses is 5.8, and here’s why:

If the number is 50, you only need 1 guess. (1 answer with 1 guess needed)

If the number is 25 or 72, you need 2 guesses. (2 answers with 2 guesses needed)

If the number if 12, 37, 62, or 87, you need 3 guesses. (4 answers with 3 guesses needed).

And there is a progression here.  8 answers with 4 guesses needed, 16 answers with 5 guesses needed, 32 answers with 6 guesses needed.

And at this point, we are at 63 numbers accounted for with 6 or fewer guesses, leaving the remaining 37 numbers needing 7 guesses.

So, if you crunch the numbers:

(1 x 1 + 2 x 2 + 3 x 4 + 4 x 8 + 5 x 16 + 6 x 32 + 7 x 37) /100 = 5.8

Fascinating, I know.  I can hear you yawning.

 

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: