3 Replies - 2109 Views - Last Post: 11 January 2009 - 08:00 PM Rate Topic: -----

#1 huzaifa  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 02-December 08

console hangman

Post icon  Posted 10 January 2009 - 06:23 AM

hello sir... :)
i am working on a console hangman project.
so please give me some guidance about that..
static void Main(string[] args)
		{
			Console.BackgroundColor = ConsoleColor.Black;
			Console.ForegroundColor = ConsoleColor.Cyan;
			string[] a = new string[5];
			a[0] = "apple";
			a[1] = "car";
			a[2] = "house";
			a[3] = "mouse";
			a[4] = "card";
			string name,enterletter;
			Console.WriteLine("");
			Console.WriteLine("									WELCOME TO");
			Console.WriteLine("									 HANGMAN");
			Console.WriteLine("");
			Console.WriteLine("								  ______________		");
			Console.WriteLine("								   |/		 |		 ");
			Console.WriteLine("								   |		 ( )		");
			Console.WriteLine("								   |		 /|\\	  ");
			Console.WriteLine("								   |		  |		 ");
			Console.WriteLine("								   |		 /|\\	   ");
			Console.WriteLine("								   |					");
			Console.WriteLine("								  _|_______	   ");
			Console.WriteLine("");
			Console.Write("Please enter your name : ");
			name = Convert.ToString(Console.ReadLine());
			Console.WriteLine("");
			Console.WriteLine("");
			Console.WriteLine("								  Welcome "+name);
			Console.WriteLine("");
			Console.ReadKey();
			Console.Clear();
			
			Console.WriteLine("							************************	");
			Console.WriteLine("							*		 SUPER		*	");
			Console.WriteLine("							*		HANGMAN	   *	");
			Console.WriteLine("							************************	");
			Console.WriteLine("");
			Console.WriteLine("	______________		");
			Console.WriteLine("	|/					");
			Console.WriteLine("	|					 ");
			Console.WriteLine("	|					 ");
			Console.WriteLine("	|					 ");
			Console.WriteLine("	|					 ");
			Console.WriteLine("	|					 ");
			Console.WriteLine("   _|_______			  ");
			Console.WriteLine("");
			Console.WriteLine("");
			if (a[0].Length == 5)
			{
				Console.WriteLine("	 The word is : _ _ _ _ _ ");
			}
			else if (a[1].Length == 3)
			{
				Console.WriteLine("	 The word is : _ _ _ ");
			}
			else if (a[2].Length == 5)
			{
				Console.WriteLine("	 The word is : _ _ _ _ _ ");
			}
			else if (a[3].Length == 5)
			{
				Console.WriteLine("	 The word is : _ _ _ _ _ ");
			}
			else if (a[4].Length == 4)
			{
				Console.WriteLine("	 The word is : _ _ _ _ ");
			}
			
			Console.WriteLine("");
			Console.WriteLine("						   ***Enter a new letter***");
			Console.WriteLine("");
			Console.WriteLine("New guess : ");
			enterletter = Convert.ToString(Console.Read());
			Console.ReadKey();
			Console.Clear();
			Console.WriteLine("							************************	");
			Console.WriteLine("							*		 SUPER		*	");
			Console.WriteLine("							*		HANGMAN	   *	");
			Console.WriteLine("							************************	");
			Console.WriteLine("");
			Console.WriteLine("								  ______________		");
			Console.WriteLine("								   |/		 |		 ");
			Console.WriteLine("								   |		 ( )		");
			Console.WriteLine("								   |		 /|\\	  ");
			Console.WriteLine("								   |		  |		 ");
			Console.WriteLine("								   |		 /|\\	   ");
			Console.WriteLine("								   |					");
			Console.WriteLine("								  _|_______			 ");
			Console.WriteLine("");
			Console.WriteLine("");
			Console.WriteLine("");
			
			Console.WriteLine("									THANK YOU");
			Console.WriteLine("								   FOR PLAYING");
			
			Console.ReadKey();
			Console.Clear();
		}
	}
}


Is This A Good Question/Topic? 0
  • +

Replies To: console hangman

#2 badjava  Icon User is offline

  • Lux Ex Tenebris
  • member icon

Reputation: 14
  • View blog
  • Posts: 540
  • Joined: 30-October 08

Re: console hangman

Posted 10 January 2009 - 06:39 AM

View Posthuzaifa, on 10 Jan, 2009 - 05:23 AM, said:

hello sir... :)
i am working on a console hangman project.
so please give me some guidance about that..


What problems have you run in to? What is it you want to add to your program?

Need more info!
Was This Post Helpful? 0
  • +
  • -

#3 SigurdSuhm  Icon User is offline

  • D.I.C Head

Reputation: 18
  • View blog
  • Posts: 111
  • Joined: 05-August 08

Re: console hangman

Posted 10 January 2009 - 11:23 AM

If I were you I would probably run the game as a loop and then use
Console.Clear();
everytime the player has entered a letter.
You could have a seperate function that would draw the hangman for example and then have some variable keep track of how much of the hangman should be drawn after each clear.
Was This Post Helpful? 0
  • +
  • -

#4 tanliyoung  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 09-January 09

Re: console hangman

Posted 11 January 2009 - 08:00 PM

What do you want?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1