# Thread: [Beginner] Programming Challenge: 5

1. Banned
Join Date
Apr 2007
Beans
14,781

## [Beginner] Programming Challenge: 5

After a bigger gap, we are resuming.

Here is the last challenge: http://ubuntuforums.org/showthread.php?t=889710

From now on, there will be no final grading (actually, it has been like that before). Anyone can comment whenever they wish on submissions. This is for learning and getting/giving advice.

The Challenge:
We will focus on a small "game" and Structured Programming.

In addition to the small task, you should pay careful attention to the code itself.

You will have to do the following:

• Write a program that will emulate a common guessing game.
• The game should randomly set a number which the user will have to guess and will get "higher" or "lower" hints as it goes. Only integers will be used for the target number.
• The target number should be 1 to 100 (although this "game" is harldy a game. Anybody will get it in 7-8 tries without even "guessing", by using logic)
• The game will end with a note of the win when the correct number is guessed.
• The program should tell the number of guesses it took to get it as well.

In addition, these are also part of the challenge:

• The code should be well formatted.
• The code layout should be structured and logical.
• The use of logical design is a big part of this, so keep a consistant format, and use logical variable and function names.

Rules:
Do not copy code, but you can obviously read it

Try to comment on other submissions if you are not a beginner. If you are not a beginner, don't post solutions for commenting, although you can show off skills as the thread progresses if you want to showcase something you are learning.

Hints:
• Most languages contain standard library functions (or even inbuilt) for getting random numbers.
• This is a good time to learn about the modulus operator if you haven't done so already

How it will be judged:
• It has to do what it is specified.
• It has to be structured.

As before, try to follow the following:
• Clean code. Readable code is a must for being a programmer who wishes to possibly interact with others. Some languages can be more readable than others, so it will be judged on the effort of writing clean code, not which language is easier to read by design.
• Logical code. Be a programmer, not a code monkey
• Commented code. If something is possibly unclear (like an obscure use of math), let the readers know. Do not over comment, and let the code speak for itself whenever you can. Have logical variable names and function names. (Excessive commenting is a minus factor)
• Working code. It has to work as it is posted. The codw will be read on the forum, so remember to use this guide to paste code if you don't know how: http://ubuntuforums.org/showthread.php?t=606009
Last edited by LaRoza; August 29th, 2008 at 03:55 AM.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•