Jump to content

  • Log In with Google      Sign In   
  • Create Account

Am I Ready?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
43 replies to this topic

#1 melloorr   Members   -  Reputation: 100

Like
0Likes
Like

Posted 01 August 2011 - 07:05 PM

I have been reading through a book on C# and i was wondering if you think i am ready to start writing extremely basic programs. I have been doing the examples in the book and trying not to move on in the book untill i am reasonably comfortable with what i have just read. (Also, this may sound like a noob question, but what programs should i start off with?)

Thank you :)

Sponsor:

#2 Tom Sloper   Moderators   -  Reputation: 10159

Like
0Likes
Like

Posted 01 August 2011 - 07:07 PM

I have been reading through a book on C# and i was wondering if you think i am ready to start writing extremely basic programs.

Yes. Give it a try!
-- Tom Sloper
Sloperama Productions
Making games fun and getting them done.
www.sloperama.com

Please do not PM me. My email address is easy to find, but note that I do not give private advice.

#3 melloorr   Members   -  Reputation: 100

Like
0Likes
Like

Posted 01 August 2011 - 07:30 PM

Any ideas of a program i can start off with?

#4 laztrezort   Members   -  Reputation: 972

Like
3Likes
Like

Posted 01 August 2011 - 07:40 PM

(Also, this may sound like a noob question, but what programs should i start off with?)
Thank you :)


Depends on what you've learned so far. Off the top of my head:

Some very basic string manipulation, to practice input/output, loops, and a few standard library methods:

1. Ask for a name, user enters a name, output the the name in all capital letters
2. As above, except output each letter separately then pause until the user hits the enter key
3. As above, but output the letters backwards, or in alphabetical order, or shuffle them randomly
4. Create a simple database, where the user enters names and phone numbers. If the user hits enter without entering a name, ask for a name, and then output the associated phone number previously entered
5. As above, but save the name/number data to a text file.

A simple game might be a guess-the number, where after each guess the program outputs "higher" or "lower" until the user guesses correctly (or only give the user a fixed # of guesses before loosing).

#5 Sudi   Members   -  Reputation: 711

Like
0Likes
Like

Posted 01 August 2011 - 08:02 PM

A cool idea would also be a simple text andventure. Using files to drive the game instead of hardcoding it. That should keep you busy.

#6 musafir2007   Members   -  Reputation: 191

Like
3Likes
Like

Posted 01 August 2011 - 10:57 PM

One of my favorites:

XXXXXXXX
AAAXXXXX
XXAAAXXX
XXXXAXXX
XXAAAXXX
XXAXXXXX
XXAAAAAA
XXXXXXXX

Put the above 8x8 matrix in the text file. Starting at the first A, write a generic program to find a way from the the A in the first column to the A in the last column. Of course, you'll have to assume that there are no loops and first and last row only has one A each to keep it simple. At the end you must print out the number of A's to get to the end. Recursion is a very important concept and I think this is a very good exercise for that.

#7 bloodisblue   Members   -  Reputation: 137

Like
0Likes
Like

Posted 01 August 2011 - 11:34 PM

A text based calculator might work pretty well. You learn how to handle inputs pretty well from it in my opinion and you can do it very early on while learning to program.

#8 Dragonion   Members   -  Reputation: 131

Like
0Likes
Like

Posted 02 August 2011 - 01:52 AM

I have been reading through a book on C# and i was wondering if you think i am ready to start writing extremely basic programs. I have been doing the examples in the book and trying not to move on in the book untill i am reasonably comfortable with what i have just read. (Also, this may sound like a noob question, but what programs should i start off with?)

Ready are you, young Jedi! You could start with a text-based Higher or Lower card game. This would involve making both a data structure to represent a single card and one for representing a deck (which would manage 52 card structures), being able to represent each of them on the screen (for example "9C" for "9 of clubs"), and compare them to find out which has the higher value -- all in all a good, little beginner's project that will teach you some basic principals of game programming.

#9 Rakso   Members   -  Reputation: 120

Like
0Likes
Like

Posted 02 August 2011 - 01:55 AM

I have been reading through a book on C# and i was wondering if you think i am ready to start writing extremely basic programs. I have been doing the examples in the book and trying not to move on in the book untill i am reasonably comfortable with what i have just read. (Also, this may sound like a noob question, but what programs should i start off with?)

Thank you :)


Dude you don't realy learn from reading you learn from writing the code.. Just give it a try!
Myself when i started learning java i tried to make my own swing applications and i had great fun with it also and it helped me learn alot!
So realy my advice is just go for the console applications if you never realy coded before.

#10 NightCreature83   Crossbones+   -  Reputation: 3032

Like
0Likes
Like

Posted 02 August 2011 - 02:18 AM

Another good exercise is to read in your own source file and output the comments in the file only and replace all the rest with spaces. This learns you somthing about state machines and file parsing, remeber that C# has // and /**/ as comment syntax.
Worked on titles: CMR:DiRT2, DiRT 3, DiRT: Showdown, GRID 2, Mad Max

#11 sox   Crossbones+   -  Reputation: 484

Like
0Likes
Like

Posted 02 August 2011 - 07:58 AM

Never underestimate the educational value of Pong. Don't even worry about graphics yet, just learn how to clear the screen quickly, and redraw the paddle and ball with ascii characters.

As you learn new things like graphics, sound, or networking, you can add them to your Pong game... you can basically start at zero and (if you stick with it) incrementally improve things until you have a professional-looking game. Sticking with one game and improving it over time will also teach you a lot about code re-use, which plenty coders don't really grasp until they've been writing code for a year or two.

#12 melloorr   Members   -  Reputation: 100

Like
0Likes
Like

Posted 02 August 2011 - 09:28 AM

Thanks for all your suggestions, i will try to attempt them all! :)

Depends on what you've learned so far. Off the top of my head:

Some very basic string manipulation, to practice input/output, loops, and a few standard library methods:

1. Ask for a name, user enters a name, output the the name in all capital letters
2. As above, except output each letter separately then pause until the user hits the enter key
3. As above, but output the letters backwards, or in alphabetical order, or shuffle them randomly
4. Create a simple database, where the user enters names and phone numbers. If the user hits enter without entering a name, ask for a name, and then output the associated phone number previously entered
5. As above, but save the name/number data to a text file.

A simple game might be a guess-the number, where after each guess the program outputs "higher" or "lower" until the user guesses correctly (or only give the user a fixed # of guesses before loosing).


I am having trouble with #2, I dont know how to do it, i have tried looking but i have found nothing yet :blink: Can anyone give me a hint on how i could do it please?

#13 Nypyren   Crossbones+   -  Reputation: 4797

Like
0Likes
Like

Posted 02 August 2011 - 11:07 AM


2. As above, except output each letter separately then pause until the user hits the enter key

I am having trouble with #2, I dont know how to do it, i have tried looking but i have found nothing yet :blink: Can anyone give me a hint on how i could do it please?


Hint: You can use a string like an array of chars.

#14 melloorr   Members   -  Reputation: 100

Like
0Likes
Like

Posted 02 August 2011 - 12:30 PM

Hint: You can use a string like an array of chars.


Am i being stupid? I still can't do it :( All i can find is how to split string that have commas in, but none about splitting a word

#15 Dragonion   Members   -  Reputation: 131

Like
0Likes
Like

Posted 02 August 2011 - 01:02 PM

Am i being stupid? I still can't do it :( All i can find is how to split string that have commas in, but none about splitting a word

No, you are not stupid; programming can be very difficult in the beginning when you are unfamiliar with even the most basic principals. If you list your program so far I may be able to give you a few guideline =)

#16 melloorr   Members   -  Reputation: 100

Like
0Likes
Like

Posted 02 August 2011 - 02:02 PM

Am i being stupid? I still can't do it :( All i can find is how to split string that have commas in, but none about splitting a word

No, you are not stupid; programming can be very difficult in the beginning when you are unfamiliar with even the most basic principals. If you list your program so far I may be able to give you a few guideline =)


This is what i have got for # 1 and 3:
using System;

class BasicProject1
{
	static void Main()
	{
    	string name, nameUp, nameBack;

    	Console.Write("Please enter your name: ");
    	name = Console.ReadLine();

    	nameUp = name;
    	nameUp = nameUp.ToUpper();
    	nameBack = name;

    	Console.WriteLine("Your name in capitals is: " + nameUp);

    	Console.Write("Your name backwards is: ");

    	for (int i = 0; i < nameBack.Length; i++)
    	{
        	Console.Write(nameBack[nameBack.Length -i - 1]);
    	}

    	Console.ReadLine();
	}
}


#17 Dragonion   Members   -  Reputation: 131

Like
1Likes
Like

Posted 02 August 2011 - 02:49 PM

This is what i have got for # 1 and 3:

using System;

class BasicProject1
{
	static void Main()
	{
    	string name, nameUp, nameBack;

    	Console.Write("Please enter your name: ");

    	name = Console.ReadLine();
    	nameUp = name.ToUpper(); // string.ToUpper returns a copy of the string so I merged the two lines
    	nameBack = name;

    	Console.WriteLine("Your name in capitals is: " + nameUp); // Good! Task #1 complete <img src='http://public.gamedev.net/public/style_emoticons/<#EMO_DIR#>/smile.gif' class='bbc_emoticon' alt=':)' />

    	// I am not going to solve #2 for you, but here is a tip:
    	// Console::ReadKey(Boolean) will read the next keystroke by the user, including function keys,
    	// and if you set the Boolean value to "true" it will not output the read character on the screen.

    	Console.Write("Your name backwards is: ");

    	// When you are dealing with strings (that fall into the category "things that may change at run-time")
    	// it is usually a good idea to assign its length to a local variable when accessing each character in turn
    	// before you start the for-loop like this:
    	//
    	// int i,n=nameBack.Length;
    	//
    	// for(i=0;i<n;i++)
    	// {
    	// 	...
    	// }

    	for (int i = 0; i < nameBack.Length; i++)
    	{
        	Console.Write(nameBack[nameBack.Length -i - 1]);
    	}

    	Console.ReadLine();
	}
}


#18 melloorr   Members   -  Reputation: 100

Like
0Likes
Like

Posted 02 August 2011 - 05:34 PM

Still cannot do it. Will try again tomorrow, its making my head hurt.

#19 Nypyren   Crossbones+   -  Reputation: 4797

Like
1Likes
Like

Posted 02 August 2011 - 06:47 PM

Another hint for #2: Watch what happens in your loop that prints the name backwards. Put a breakpoint inside the loop and watch your output each time you step through the loop. It prints out one letter at a time, right? You should be able to add something else inside the loop which makes it wait in a similar way to the breakpoint (previous people have hinted how to do this).

#20 melloorr   Members   -  Reputation: 100

Like
0Likes
Like

Posted 02 August 2011 - 07:14 PM

Another hint for #2: Watch what happens in your loop that prints the name backwards. Put a breakpoint inside the loop and watch your output each time you step through the loop. It prints out one letter at a time, right? You should be able to add something else inside the loop which makes it wait in a similar way to the breakpoint (previous people have hinted how to do this).


Thanks! I finally done it! Well im pretty sure i have :)

using System;

class BasicProject1
{
	static void Main()
	{
    	string name, nameUp, nameBack;

    	// Task One

    	Console.Write("Please enter your name: ");
    	name = Console.ReadLine();

    	nameUp = name.ToUpper();
    	nameBack = name;

    	Console.WriteLine("Your name in capitals is: " + nameUp);

    	// Task Two

    	int s = name.Length;

    	for (int i = 0; i < s; i++)
    	{ 
        	Console.Write(name[i]);
        	Console.ReadKey(true);
        	continue;
    	}
            	
    	// Task Three

    	Console.Write("\nYour name backwards is: ");

    	int n = nameBack.Length;

    	for (int i = 0; i < n; i++)
    	{
        	Console.Write(nameBack[nameBack.Length -i -1]);
    	}

    	Console.ReadLine();
	}
}





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS