Kreij
Senior Monkey Moderator
- Joined
- Feb 6, 2007
- Messages
- 13,817 (2.20/day)
- Location
- Cheeseland (Wisconsin, USA)
Projects For Beginning Programmers (any language)
Since I don't have any programming projects that I am working on at the moment, I allowed myself to slip back into the nostalgic moments of the days when I was first writing code.
It was a lot of fun as everything was new and it was exciting to see the results of your coding play out on the screen in what usually turned out to be either disastrous, humorous or both.
Here are a few of ideas I put into code. These are just the descriptions as it's up to the new coders to make them work ... for better or worse. They are all text based console programs (no GUIs).
Who, What, Where
This is a fun little exercise that involves random numbers and string arrays. The basic concept is to have one array that represents who, one that represents what and the last one where.
You enter strings in the arrays, and then a random number generator pick one entry from each array and make a sentence from it. For instance, you could have one of the "who" entries be "My roommate", the what could be "chewed on his soiled underwear", and the where could be "in the women's restroom at Walmart.
The more strings you add the weirder the results become. Just remember that the random numbers generated must fall within the bounds of the array they are accessing.
Great for parties.
Text Archery
The concept here is that you are at location 0. The program generates a random object (bear, lion, your girlfriend, etc.) at some random distance. You then have to input the power behind your archery pull and the angle of trajectory. A simple calculation gives you where it lands. If you hit the object you win.
Beware, the first time I wrote this it was calculating to 5 decimal point precision. You may want to have the program calculate that if it is within a range, it is a hit.
Text Dungeon
This is the famous NSEW type of text dungeon. It's done with two-dimensional arrays which include the description of where you are at, and the directions which you can go as well as any other things you want to include (like picking things up or solving a puzzle).
This is an exceptionally good exercise to learn a lot of programming basics.
Text Lunar Lander
You are in a space capsule that is x feet from the ground. Gravity is pulling it down. You must fire the retro rockets to slow it down and meet the ground at a safe speed to land successfully.
This is a good exercise in minor physics calculations. Watch out! Just like "Text Archery", this one will bite you in the butt if you do not reduce or compensate for high precision floating point calculations.
Anyway ... have fun learning to program, and if any other coders want to get nostalgic and offer some of the fun little exercises they did when first starting, feel free.
Since I don't have any programming projects that I am working on at the moment, I allowed myself to slip back into the nostalgic moments of the days when I was first writing code.
It was a lot of fun as everything was new and it was exciting to see the results of your coding play out on the screen in what usually turned out to be either disastrous, humorous or both.
Here are a few of ideas I put into code. These are just the descriptions as it's up to the new coders to make them work ... for better or worse. They are all text based console programs (no GUIs).
Who, What, Where
This is a fun little exercise that involves random numbers and string arrays. The basic concept is to have one array that represents who, one that represents what and the last one where.
You enter strings in the arrays, and then a random number generator pick one entry from each array and make a sentence from it. For instance, you could have one of the "who" entries be "My roommate", the what could be "chewed on his soiled underwear", and the where could be "in the women's restroom at Walmart.
The more strings you add the weirder the results become. Just remember that the random numbers generated must fall within the bounds of the array they are accessing.
Great for parties.
Text Archery
The concept here is that you are at location 0. The program generates a random object (bear, lion, your girlfriend, etc.) at some random distance. You then have to input the power behind your archery pull and the angle of trajectory. A simple calculation gives you where it lands. If you hit the object you win.
Beware, the first time I wrote this it was calculating to 5 decimal point precision. You may want to have the program calculate that if it is within a range, it is a hit.
Text Dungeon
This is the famous NSEW type of text dungeon. It's done with two-dimensional arrays which include the description of where you are at, and the directions which you can go as well as any other things you want to include (like picking things up or solving a puzzle).
This is an exceptionally good exercise to learn a lot of programming basics.
Text Lunar Lander
You are in a space capsule that is x feet from the ground. Gravity is pulling it down. You must fire the retro rockets to slow it down and meet the ground at a safe speed to land successfully.
This is a good exercise in minor physics calculations. Watch out! Just like "Text Archery", this one will bite you in the butt if you do not reduce or compensate for high precision floating point calculations.
Anyway ... have fun learning to program, and if any other coders want to get nostalgic and offer some of the fun little exercises they did when first starting, feel free.