Challenge a beginner

Started by
8 comments, last by Zyndrof 17 years, 10 months ago
Hi there! I've been programming for a couple of weeks in Visual Basic.NET using the book "Beginning Visual Basic.NET" by Matthew Reynolds, Richard Blair, Jonathan Crossland and Thearon Willis. This book is great, but it lacks excersises. So now that I've learnt a little I would like to test what I'm able to do with the knowledge gained so far. This will hopefully help me to remember what I've learnt and give me something fun to do :) This is the chapters I've read: Chapter 1: Welcome to Visual Basic .NET. Covering: introduction. Chapter 2. Writing Software. Covering: algoritms, variables, functions. Chapter 3. Controlling the Flow. Covering: if, case, iterations. Chapter 4. Building Objects. Covering: classes, inheritance, framework classes. Chapter 5. The Microsoft .NET Framework. Covering: basics about the .NET Framework. Chapter 6. Working with Data Structures. Covering: vectors, constants, structures, arraylists, hashtable. Try to be as specified as possible about what the project is supposed to do and how it should be done (but don't tell me more than nessicary ;)) Thanks in advance! Projects already finished: Number guessing: functions and random The Hamburger Stand: public classes [Edited by - Zyndrof on May 22, 2006 1:54:25 PM]
Advertisement
A nice thing you can do is to make a adressbok where you let the user put in name and number of the specific person, and then store it in a struct or something ...

if this is to hard you can just type out the name and number like this after you have the input..


eg: "Name" has telephone "Number" :)

funny thing to start with :)


good luck my friend


PS: i suppose you work in console programming at this stage, so stay there while doing this... to work with the windows GDI or DirectX API is abit to advanced i guess
"Try not. Do, or do not. There is no try" - Yoda- Software Engineer, - Computer Game Developer
A nice program to start with is one that asks you to guess a random number, and tells you if you've guessed too high or low. When the user guesses the correct number, the program can tell them how many guesses it took.

EDIT: Woops, I just took a look at your profile and it looks like you've already done this... [oh]
Quote:Original post by e-Slave
A nice thing you can do is to make a adressbok where you let the user put in name and number of the specific person, and then store it in a struct or something ...

if this is to hard you can just type out the name and number like this after you have the input..


eg: "Name" has telephone "Number" :)

funny thing to start with :)


good luck my friend


PS: i suppose you work in console programming at this stage, so stay there while doing this... to work with the windows GDI or DirectX API is abit to advanced i guess


That's the example used in the book when describing structures, so making an adressbook would be like using the same code over again :P

I work in Windows, actually I have no idea how to program .NET in DOS :P
And I guess I should have wrote what projects I've done on my own, these are
number guessing and "the hamburger stand" (a project to help me learn classes).
A nice thing (we did this as a test in school) is a binary to decimal converter function:

int get_decimal(int binary)

Let the user enter an integer number using only 0's and 1's.
Add some error checking ... if there are other characters entered tell the user to enter a different number.
If it is a valid binary number let an algorithm convert it into a decimal number and output the result.

Tip: there is one operator that makes this pretty easy.
Writing errors since 10/25/2003 2:25:56 AM
Quote:Original post by Clueless
A nice thing (we did this as a test in school) is a binary to decimal converter function:

int get_decimal(int binary)

Let the user enter an integer number using only 0's and 1's.
Add some error checking ... if there are other characters entered tell the user to enter a different number.
If it is a valid binary number let an algorithm convert it into a decimal number and output the result.

Tip: there is one operator that makes this pretty easy.


Sounds like a perfect project. Will try that :)
Another project you can try, it may be a little advanced but if you keep it purely text based you may be able to do it.

For my first project back in the days of learning to program I made a 2 player tank game (using the same computer) where each person would take turns in entering a force and an angle to try to hit the opposing player's tank. It was purely all textual no graphics, not even ascii graphics just textual prompts such as:

(the numbers entered most likely will not produce the distance the projectile over-/under- shot the target. It does gives a good idea of what the simple program would produce as output)

<Player1 name>, Your target is 50 feet away.
<Player1 name>, enter a velocity (feet/sec): 30
<Player1 name>, enter the angle (degrees): 45
Shooting at target.
<Player1 name> overshot your target by 43.2 feet.

<Player2 name>, Your target is 50 feet away.
<Player2 name>, enter a velocity (feet/sec): 20
<Player2 name>, enter the angle (degrees): 45
Shooting at target.
<Player2 name> overshot your target by 10.2 feet.


Are there any games that you like, that would be easy to code. Most card games use stack and vector datatypes. Think of text based user interfaces or with minor graphics (up to your skill level) Possibly swapping image files. Card games may fit into this category.
Someone posted a game that was an assignment for a class. This game was played like Yahtzee but the rules were a little simpler as far as keeping score. The game was called something like "ship, captain, mate, crew".

With your knowledge of VB.Net you may be able to handle this program. It may be a slight challenge for you (it is what you asked for), but it is within your grasp of what you know. It will encompass just about every chapter that you read, almost like a Final Exam :)

You take 5 dice and roll them all at once. You are trying to isolate a ship (6), captain (5), mate (4) in that order. If you happen to get a mate or a captain before you have your ship you have to re-roll the dice again. Once you get your ship, captain, mate, the remaining 2 dice is your crew. You then add up all the dice and that is your score for that round.

For example.
First roll:
5 4 2 4 5.
No 6's were rolled so we have to re-roll all of them, even though we have a captain (5) and a mate (4), we have to re-roll them all. A captain or mate is no good without a ship.

Second Roll:
6 4 2 4 1.
We have our ship (6). Did we roll any 5's for our captain. no so we have to re-roll 4 out of the 5 dice (keeping the ship (6) out of the re-rolling process) The 4's that were rolled also have to be re-rolled since we did not find a captain (5).

Third and final Roll:
6 5 2 3 4.
Ship (6) was retained from the last roll. We now have our captain (5) and we also have a mate (4). All the remaining dice are the crew. We add all the dice for that turn, 6 + 5 + 4 + 2 + 3 = 20 and that will be our score for that round.

If we did not find a ship (6), captain (5) and mate (4) at the end of the last roll, 0 points would be added for that player total score.

Play continues to the next player until a player gets 100 points or whatever you decide.

Note: It is possible to have a crew being 6,6 or 5,6 or 4,5 etc. just as long as you have already found a ship (6), captain (5), mate (4) before hand.

If you get your ship (6), captain (5), mate (4) on roll 1 or 2 you can choose 1 or both of the crew dice to make it a better crew by re-rolling the remaining times or just say you are happy with what you have.
The 3rd project that we did in CSC 101(equivalent to C++ part 1) in college was to write a BINGO program. if i remember most of it you had to read from 2 separate files. One file listed the Bingo Cards(i think there was 10 of them). for example on card might look like this:

8  18 44 48 74
12 23 40 58 70
4  17 33 56 75
11 19 35 60 64
3  27 38 55 65

in the other file are the actual Bingo Calls.. for example:

0-65
B-12
I-17..etc etc

the file had enough calls to where someone would have to bingo by at least the last call but it could be before then. you have to determine in the program when Bingo is called and if it is, what card had the Bingo and HOW they achieved the Bingo(i.e., diagonally, vertically, or horizontally). If there was more than 1 Card Bingo'd in the same turn then output this result as well if applicable. Again, Keep in mind that you can get Bingo by getting 5 in row either vertically, horizontally or diagonally.

Obviously you can treat the Bingo cards as a 5 x 5 matrix in an 2D array OR if you are adventurous you could have one 3D array, with the card numbers and the 10 5x5 matrices making up the 3D array. The 2nd option is less code but you have to be a little more clever in achieving the same result. Each call in the Calls.txt file would be one iteration through the loop that you will need for sure.

I would recommend this program to anyone that is a beginner and has gone through the basics or if you have programmed before but need to brush up on your skills, b/c of the use of array indexing that will be needed to complete the program but also a fairly good use of logic and thinking ahead such as choosing where to go with 2D array or the use of a 3D array. When i did the program i chose a 3D array to challenge myself. Theres also a few twists to trip the beginner up too that i wont reveal :)

what you think? you can make up your own files or i can provide you with some if you want to take on the task. :)
heh
That Bingo-game sounds pretty hard :/ I would like to try it but I wont manage on my own. A little push in the right direction would be nice, because I think I could learn a lot by doing it :)

That dice-game seems like a program I should be able to do, but would it be very different to make a yatzee instead?

Thank you all for your suggestions :)

This topic is closed to new replies.

Advertisement