Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.ObjectModel;
- using System.Runtime.InteropServices;
- namespace Basics
- {
- class Program
- {
- static void Parrot(int count, string str)
- {
- int i = 0;
- while (i<count )
- {
- Console.WriteLine(str);
- i++;
- }
- }
- static void Introduction(string name, uint age, string city, string work)
- {
- Console.WriteLine("Hello, my name is " + name + ", I am " + age + ", I live in" + city + " and I work in " +
- work);
- }
- public static void Ground()
- {
- string bas = @"
- | _ |
- | | | |
- |____|_|____|";
- Console.WriteLine(bas);
- }
- public static void Roof()
- {
- string toit = @"
- ___________
- | |";
- Console.Write(toit);
- }
- public static void Floor(int nb)
- {
- string etage = @"
- | _ _ |
- | |o| |o| |
- | |_| |_| |";
- int i = 0;
- while (i<nb)
- {
- Console.Write(etage);
- i = i + 1;
- }
- }
- public static bool CheckNumber(int input, int number)
- {
- {
- if (input > number)
- {
- Console.ForegroundColor = ConsoleColor.Red;
- Console.WriteLine("The correct number is inferior to " + input);
- return false;
- }
- else if (input < number)
- {
- Console.ForegroundColor = ConsoleColor.Red;
- Console.WriteLine("The correct number is superior to " + input);
- return false;
- }
- else
- {
- Console.ForegroundColor = ConsoleColor.Green;
- Console.WriteLine("Congratulation, the number was: " + number);
- return true;
- }
- }
- }
- public static bool Game(int number, int tries)
- {
- int resultat = number;
- while (tries>0)
- {
- Console.WriteLine("Saisir un nombre :");
- int nb = Convert.ToInt32(Console.ReadLine());
- if (CheckNumber(nb,resultat))
- {
- return true;
- }
- tries--;
- Console.ForegroundColor = ConsoleColor.Black;
- Console.WriteLine("x tries left:" + tries );
- }
- Console.ForegroundColor = ConsoleColor.Red;
- Console.WriteLine("The correct number was "+ resultat);
- return false;
- }
- public static void difficulties()
- {
- string ez = "easy";
- string med = "medium";
- string hard = "hard";
- int nb;
- Random rnd = new Random();
- Console.WriteLine("Choisir la difficultes : (easy/medium/hard)");
- string choice = Console.ReadLine();
- if (choice==ez)
- {
- nb = rnd.Next(0,10);
- Game(nb, 5);
- }
- else if (choice==med)
- {
- nb = rnd.Next(0,100);
- Game(nb, 15);
- }
- else if (choice==hard)
- {
- nb = rnd.Next(0, 1000);
- Game(nb, 20);
- }
- }
- public static void TheGame()
- {
- string the = @"
- ________ __ __ ________
- | \| \ | \| \
- \$$$$$$$$| $$ | $$| $$$$$$$$
- ______ ______ | $$ | $$__| $$| $$__
- | \| \| $$ | $$ $$| $$ \
- \$$$$$$ \$$$$$$| $$ | $$$$$$$$| $$$$$
- | $$ | $$ | $$| $$_____
- | $$ | $$ | $$| $$ \
- \$$ \$$ \$$ \$$$$$$$$
- ";
- string game = @"
- ______ ______ __ __ ________
- / \ / \ | \ / \| \
- | $$$$$$\| $$$$$$\| $$\ / $$| $$$$$$$$
- | $$ __\$$| $$__| $$| $$$\ / $$$| $$__ ______ ______
- | $$| \| $$ $$| $$$$\ $$$$| $$ \| \| \
- | $$ \$$$$| $$$$$$$$| $$\$$ $$ $$| $$$$$ \$$$$$$ \$$$$$$
- | $$__| $$| $$ | $$| $$ \$$$| $$| $$_____
- \$$ $$| $$ | $$| $$ \$ | $$| $$ \
- \$$$$$$ \$$ \$$ \$$ \$$ \$$$$$$$$
- ";
- Console.ForegroundColor = ConsoleColor.Magenta;
- Console.Write(the);
- Console.ForegroundColor = ConsoleColor.Blue;
- Console.Write(game);
- Console.ForegroundColor = ConsoleColor.Green;
- Console.WriteLine();
- Console.WriteLine(" Choisir un mode : (solo/multi)");
- string rep = Console.ReadLine();
- string solo = "solo";
- string multi = "multi";
- if (rep == solo)
- {
- difficulties();
- }
- if (rep== multi)
- {
- Console.WriteLine("Choisir votre nombre puis votre nombre d'essaie :");
- int nombre = Convert.ToInt32(Console.ReadLine());
- int essaie = Convert.ToInt32(Console.ReadLine());
- Console.Clear();
- Console.WriteLine("Le jeu demare :");
- Game(nombre, essaie);
- }
- }
- static void Main(string[] args)
- {
- TheGame();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement