Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Net.Mime;
- using System.Text;
- using System.Threading.Tasks;
- using System.Threading;
- public struct Cursor
- {
- public int x;
- public int y;
- public char c;
- }
- public struct Words
- {
- public int x;
- public int y;
- }
- namespace Pucanica
- {
- class Pucanica
- {
- #region CURSOR
- private static void PrintOnPosition(int x, int y, char c)
- {
- Console.SetCursorPosition(x, y);
- Console.Write(c);
- }
- private static void PrintOnPositionString(int x, int y, string str, int index)
- {
- Console.SetCursorPosition(x, y);
- Console.Write("{0}. {1}", index, str);
- }
- #endregion CURSOR
- static void Main()
- {
- int currentPosition = 0;
- Console.BufferHeight = Console.WindowHeight = 31;
- Console.BufferWidth = Console.WindowWidth = 80;
- Cursor newCursor = new Cursor();
- newCursor.x = 32;
- newCursor.y = 16;
- newCursor.c = '>';
- Thread thread = new Thread(() => PlayMusic());
- thread.Start();
- int lives = 3;
- string Animation = "";
- #region WordsAndDescriptions
- List<string> Description = new List<string> { "animal", "fly", "suck", "kids", "drive", "animal" , "animal", "IDE","Movie Franchise by LucasArts",
- "Apple`s mobile pnone","A bird`s body part","You Watch Movies On It","You Code On It","Something Without a Price","a Pain Medication Of The opitate Type",
- "Famous TV Series From HBO","Forwards Data Packets Between Networks", "Game franchise by Blizzard", "World’s most famous business street", " A game which involves kicking a ball",
- "The other name of Football", "Electronic Book", "A type of warrior, who operated in feudal Japan", "The first president of the USA", "A work of Homer about the Troy Wars", "One of the continents",
- "Ball game, very popular in the US", "Famous Game franchise by Blizzard", "Japanese Car Brand", "You make music with it","Soft drink, made from coca cola" ,"A very big cat",
- "You make wine from them","You sit on it in the park","If you get stabed, this will come out","The most famous anti-semit","Male reproductive organ","Feeds babies and its useless in men","The unability to sleep",
- "You get it from a wild animal bite","Our master","Somebody important enough to be mentioned twice","Somebody importnat enough to be mentioned three times","A dead person who is eating brains","A drug you most likely smoked",
- "You inject it and become a better programmer","When a wound goes bad","A curse word meaning sex"," Thats how you make babies","The word comming after Knock in the joke"};
- List<string> Words = new List<string> { "dog", "plane" , "lollipop", "kite", "car", "elephant" ,"cat", "visual studio","star wars","iphone","wing",
- "television","computer","invaluable","Morphine","Game Of Thrones","Router","warcraft", "Wall Street" , "Football","Soccer" , "eBook" , "Ninja" ,
- "Washington" , "Iliad" , "Europe" , "Basketball" , "StarCraft", "Mitsubishi", "Guitar", "Lift","Tiger","Grape","Bench","Blood","Hitler","Penis",
- "Nipple","Insomnia","Rabies","Nakov","Nakov","Nakov","Zombie","Marijuana","Steroids","Infection","Fuck","Sex","Knock"};
- #endregion WordsAndDescriptions
- Menu:
- List<int> usedWords = new List<int>();
- while (true)
- {
- if (Console.KeyAvailable)
- {
- ConsoleKeyInfo pressedKey = Console.ReadKey(true);
- while (Console.KeyAvailable) Console.ReadKey();
- if (pressedKey.Key == ConsoleKey.UpArrow)
- {
- if (newCursor.y - 1 >= 16)
- {
- newCursor.y = newCursor.y - 2;
- }
- }
- else if (pressedKey.Key == ConsoleKey.DownArrow)
- {
- if (newCursor.y + 1 < 23)
- {
- newCursor.y = newCursor.y + 2;
- }
- }
- else if (pressedKey.Key == ConsoleKey.Enter)
- {
- currentPosition = newCursor.y;
- break;
- }
- }
- Console.WriteLine("\r\n\r\n\r\n\r\n{0," + (Console.WindowWidth / 2 + 11) + "}", "Welcome to PUCANICA !");
- Console.WriteLine(MenuAnimation(Animation));
- Console.WriteLine("\r\n{0," + (Console.WindowWidth / 2 + 2) + "}\r\n", "1.Start");
- Console.WriteLine("{0," + (Console.WindowWidth / 2 + 5) + "}\r\n", "2.Add Word");
- Console.WriteLine("{0," + (Console.WindowWidth / 2 + 8) + "}\r\n", "3.Delete Word");
- Console.WriteLine("{0," + (Console.WindowWidth / 2 + 1) + "}\r\n\r\n\r\n", "4.Exit");
- PrintOnPosition(newCursor.x, newCursor.y, newCursor.c);
- Thread.Sleep(100);
- Console.Clear();
- lives = 3;
- }
- if (currentPosition == 16 || currentPosition == 18 || currentPosition == 20 || currentPosition == 22)
- {
- switch (currentPosition)
- {
- case 16:
- #region Game
- Console.Clear();
- int CheckUsedWords = 0;
- Random random = new Random();
- int randomNumber = random.Next(0, Words.Count());
- CheckUsedWords = usedWords.IndexOf(randomNumber);
- if (CheckUsedWords != -1)
- {
- goto case 16;
- }
- List<char> WrongLetters = new List<char>();
- string OriginalWord = Words[randomNumber].ToUpper();
- char[] OriginalWordArr = OriginalWord.ToCharArray();
- char[] FirstAndLastLetter = { OriginalWord[0], OriginalWord[OriginalWord.Length - 1] };
- char[] CenzuratedWordArr = OriginalWord.ToCharArray();
- for (int i = 1; i < CenzuratedWordArr.Length - 1; i++)
- {
- if (CenzuratedWordArr[i] == FirstAndLastLetter[0] || CenzuratedWordArr[i] == FirstAndLastLetter[1])
- {
- continue;
- }
- else if (CenzuratedWordArr[i] == ' ')
- {
- CenzuratedWordArr[i] = ' ';
- }
- else
- {
- CenzuratedWordArr[i] = '_';
- }
- }
- Start:
- Console.WriteLine("\r\n\r\n\r\n\r\n{0," + ((Console.WindowWidth / 2) + 4) + "}", "PUCANICA");
- Console.WriteLine("\r\n{0," + ((Console.WindowWidth / 2 + 3)) + "}{1}", "Lives: ", lives);
- Console.WriteLine(StartAnimation(Animation, lives));
- if (lives == 0)
- {
- Console.ReadKey();
- Console.Clear();
- goto Menu;
- }
- Console.WriteLine("\r\n{0," + ((Console.WindowWidth / 2) + Description[randomNumber].Length / 2) + "}", Description[randomNumber].ToUpper());
- Console.WriteLine("\r\n{0," + ((Console.WindowWidth / 2) +
- (CenzuratedWordArr.Length / 2 + ((CenzuratedWordArr.Length - 1) / 2))) + "}", string.Join(" ", CenzuratedWordArr).ToUpper());
- Console.Write("\r\nWrong letters: ");
- Console.WriteLine(string.Join(" | ", WrongLetters));
- Console.Write("\r\n\r\n\r\n{0," + ((Console.WindowWidth / 2) + 4) + "}", "Letter: ");
- try
- {
- char Letter = char.Parse(Console.ReadLine().ToUpper());
- int CheckLetter = OriginalWord.ToUpper().IndexOf(Letter);
- Console.Clear();
- if (CheckLetter == -1 || Letter == OriginalWordArr[0] || Letter == OriginalWordArr[OriginalWordArr.Length - 1])
- {
- WrongLetters.Add(Letter);
- lives--;
- }
- else
- {
- List<int> IndexOfLetter = new List<int>();
- for (int i = 0; i < OriginalWord.Length; i++)
- {
- if (OriginalWordArr[i] == Letter)
- {
- IndexOfLetter.Add(i);
- }
- }
- for (int i = 0; i < IndexOfLetter.Count(); i++)
- {
- int Index = IndexOfLetter[i];
- CenzuratedWordArr[Index] = Letter;
- }
- bool Check = true;
- for (int i = 0; i < CenzuratedWordArr.Length; i++)
- {
- Check = OriginalWordArr[i] == CenzuratedWordArr[i];
- if (Check == false) break;
- }
- if (Check == true)
- {
- Console.WriteLine(AnimationWin(Animation));
- Console.WriteLine("\r\n\r\n\r\n\r\n{0," + (Console.WindowWidth / 2 + 6) + "}{1}", "The word was: ", OriginalWord.ToUpper());
- Console.ReadKey();
- usedWords.Add(randomNumber);
- Console.Clear();
- if (usedWords.Count() == Words.Count())
- {
- Console.WriteLine("\r\n\r\n" + WinGameAnimation(Animation));
- Console.WriteLine("\r\n\r\n{0," + (Console.WindowWidth / 2 + 12) + "}", "NO MORE WORDS !!!");
- Console.ReadKey();
- Console.Clear();
- goto Menu;
- }
- else
- goto case 16;
- }
- }
- }
- catch (FormatException)
- {
- Console.Clear();
- goto Start;
- }
- goto Start;
- #endregion Game
- case 18:
- #region AddWord
- try
- {
- Console.Clear();
- AddWord(Words);
- AddDescription(Description);
- Console.WriteLine("\r\n\r\n{0," + (Console.WindowWidth / 2 + 9) + "}", "WORD WAS ADDED !");
- Console.ReadKey();
- Console.Clear();
- goto Menu;
- }
- catch (FormatException)
- {
- Console.Clear();
- goto case 18;
- }
- #endregion AddWord
- case 20:
- #region DeleteWord
- try
- {
- PrintWords(Words);
- int Delete = int.Parse(Console.ReadLine());
- if (Delete < 0 || Delete > Words.Count - 1) goto case 20;
- DeleteWord(Words, Delete);
- DeleteDescription(Description, Delete);
- Console.Clear();
- Console.WriteLine("\r\n\r\n{0," + (Console.WindowWidth / 2 + 9) + "}", "WORD WAS DELETED !");
- Console.ReadKey();
- Console.Clear();
- goto Menu;
- }
- catch (FormatException)
- {
- Console.Clear();
- goto case 20;
- }
- #endregion DeleteWord
- case 22:
- #region Exit
- Console.WriteLine("\n\n\n");
- Console.WriteLine("\n\n Thank You For Playing Our Game!");
- Console.WriteLine("\n The pleasure has been brought to you by: ");
- Console.WriteLine("\n\n\n Jani Fandi");
- Console.WriteLine("\n Valentin Minkov");
- Console.WriteLine("\n Karim Hlaif");
- Console.WriteLine("\n Philip Pepegov");
- Console.WriteLine();
- Console.WriteLine();
- Console.SetCursorPosition(23, 22);
- Environment.Exit(0);
- break;
- #endregion Exit
- }
- }
- else
- {
- Console.WriteLine("Invalid input !");
- Console.ReadKey();
- Console.Clear();
- goto Menu;
- }
- }
- public static void PrintWords(List<string> Words)
- {
- Console.Clear();
- for (int i = 0; i < 3; i++) { Console.WriteLine("\r\n"); }
- int index = 0;
- Words wordsToDelete = new Words();
- wordsToDelete.x = 2;
- wordsToDelete.y = 1;
- int rounds = 0;
- foreach (var Word in Words)
- {
- PrintOnPositionString(wordsToDelete.x, wordsToDelete.y, Word, index);
- wordsToDelete.y++;
- index++;
- rounds++;
- if (rounds == 26)
- {
- wordsToDelete.x = wordsToDelete.x + 20;
- wordsToDelete.y = 1;
- }
- }
- Console.SetCursorPosition(30, 27);
- Console.Write("\r\n\r\n Type the number of the word you want to delete: ");
- }
- public static void DeleteWord(List<string> Words, int Delete)
- {
- Words.RemoveAt(Delete);
- }
- public static void DeleteDescription(List<string> Description, int Delete)
- {
- Description.RemoveAt(Delete);
- }
- public static List<string> AddWord(List<string> Words)
- {
- for (int i = 0; i < 6; i++) { Console.WriteLine("\r\n"); }
- Console.Write("{0," + (Console.WindowWidth / 2 + 5) + "}", "Add a Word: ");
- string Word = Console.ReadLine().ToUpper();
- Words.Add(Word);
- return Words;
- }
- public static List<string> AddDescription(List<string> Description)
- {
- Console.Write("\r\n{0," + (Console.WindowWidth / 2 + 5) + "}", "Add a description: ");
- string description = Console.ReadLine().ToLower(); ;
- Description.Add(description);
- return Description;
- }
- #region Animations
- public static string MenuAnimation(string Animation)
- {
- Animation = @"
- _____________________
- | |
- | HI ! Let's play ! |
- ___ |_ __________________|
- /o o\ |/
- \_V_/
- __|__
- |
- / \ ";
- return Animation;
- }
- public static string StartAnimation(string Animation, int Lives)
- {
- if (Lives == 3)
- {
- Animation = @"
- ___
- /o o\
- \_V_/ /
- __|__ <========== YOU !
- | \
- / \ ";
- }
- else if (Lives == 2)
- {
- Animation = @"
- _________
- | |
- | HI ! |
- ___ ___ |__ ____|
- /o o\ /o o\ |/
- \ \_-_/ \_V_/
- NAKOV ! ========> __|__ __|__
- / | |
- / \ / \ ";
- }
- else if (Lives == 1)
- {
- Animation = @"
- __________________
- | |
- | Last chance !!! |
- ___ |_ _______________| ___
- /o o\ |/ /O O\
- \_-_/ _ _____ \_^_/
- __|__(X|=====> __|__
- | |_| |
- / \ / \ ";
- }
- else if (Lives == 0)
- {
- Animation = @"
- ______________
- | |
- | GAME OVER ! |
- ___ |__ __________|
- /o o\ |/
- \_V_/ _ _____ ___
- __|__(X|=====> | X|
- | |_| \__|_|| |
- / \ / | |__X| ";
- }
- return Animation;
- }
- public static string AnimationWin(string Animation)
- {
- Animation = "\r\n\r\n\r\n\r\n\r\n" + @"
- ________________
- | |
- | YOU WIN !!! |
- ___ |__ ___________|
- /o o\ |/
- \_V_/
- \__|__/
- |
- / \ ";
- return Animation;
- }
- public static string WinGameAnimation(string Animation)
- {
- Animation = "\r\n\r\n\r\n\r\n\r\n" + @"
- __________________________
- | |
- | YOU WIN THE GAME !!! |
- ___ |__ ____________________|
- /o o\ |/
- \_V_/
- \__|__/
- |
- / \ ";
- return Animation;
- }
- #endregion Animations
- #region Music
- static void PlayMusic()
- {
- while (true)
- {
- Console.Beep(659, 125);
- Console.Beep(659, 125);
- Thread.Sleep(125);
- Console.Beep(659, 125);
- Thread.Sleep(167);
- Console.Beep(523, 125);
- Console.Beep(659, 125);
- Thread.Sleep(125);
- Console.Beep(784, 125);
- Thread.Sleep(375);
- Console.Beep(392, 125);
- Thread.Sleep(375);
- Console.Beep(523, 125);
- Thread.Sleep(250);
- Console.Beep(392, 125);
- Thread.Sleep(250);
- Console.Beep(330, 125);
- Thread.Sleep(250);
- Console.Beep(440, 125);
- Thread.Sleep(125);
- Console.Beep(494, 125);
- Thread.Sleep(125);
- Console.Beep(466, 125);
- Thread.Sleep(42);
- Console.Beep(440, 125);
- Thread.Sleep(125);
- Console.Beep(392, 125);
- Thread.Sleep(125);
- Console.Beep(659, 125);
- Thread.Sleep(125);
- Console.Beep(784, 125);
- Thread.Sleep(125);
- Console.Beep(880, 125);
- Thread.Sleep(125);
- Console.Beep(698, 125);
- Console.Beep(784, 125);
- Thread.Sleep(125);
- Console.Beep(659, 125);
- Thread.Sleep(125);
- Console.Beep(523, 125);
- Thread.Sleep(125);
- Console.Beep(587, 125);
- Console.Beep(494, 125);
- Thread.Sleep(125);
- Console.Beep(523, 125);
- Thread.Sleep(250);
- Console.Beep(392, 125);
- Thread.Sleep(250);
- Console.Beep(330, 125);
- Thread.Sleep(250);
- Console.Beep(440, 125);
- Thread.Sleep(125);
- Console.Beep(494, 125);
- Thread.Sleep(125);
- Console.Beep(466, 125);
- Thread.Sleep(42);
- Console.Beep(440, 125);
- Thread.Sleep(125);
- Console.Beep(392, 125);
- Thread.Sleep(125);
- Console.Beep(659, 125);
- Thread.Sleep(125);
- Console.Beep(784, 125);
- Thread.Sleep(125);
- Console.Beep(880, 125);
- Thread.Sleep(125);
- Console.Beep(698, 125);
- Console.Beep(784, 125);
- Thread.Sleep(125);
- Console.Beep(659, 125);
- Thread.Sleep(125);
- Console.Beep(523, 125);
- Thread.Sleep(125);
- Console.Beep(587, 125);
- Console.Beep(494, 125);
- Thread.Sleep(375);
- Console.Beep(784, 125);
- Console.Beep(740, 125);
- Console.Beep(698, 125);
- Thread.Sleep(42);
- Console.Beep(622, 125);
- Thread.Sleep(125);
- Console.Beep(659, 125);
- Thread.Sleep(167);
- Console.Beep(415, 125);
- Console.Beep(440, 125);
- Console.Beep(523, 125);
- Thread.Sleep(125);
- Console.Beep(440, 125);
- Console.Beep(523, 125);
- Console.Beep(587, 125);
- Thread.Sleep(250);
- Console.Beep(784, 125);
- Console.Beep(740, 125);
- Console.Beep(698, 125);
- Thread.Sleep(42);
- Console.Beep(622, 125);
- Thread.Sleep(125);
- Console.Beep(659, 125);
- Thread.Sleep(167);
- Console.Beep(698, 125);
- Thread.Sleep(125);
- Console.Beep(698, 125);
- Console.Beep(698, 125);
- Thread.Sleep(625);
- Console.Beep(784, 125);
- Console.Beep(740, 125);
- Console.Beep(698, 125);
- Thread.Sleep(42);
- Console.Beep(622, 125);
- Thread.Sleep(125);
- Console.Beep(659, 125);
- Thread.Sleep(167);
- Console.Beep(415, 125);
- Console.Beep(440, 125);
- Console.Beep(523, 125);
- Thread.Sleep(125);
- Console.Beep(440, 125);
- Console.Beep(523, 125);
- Console.Beep(587, 125);
- Thread.Sleep(250);
- Console.Beep(622, 125);
- Thread.Sleep(250);
- Console.Beep(587, 125);
- Thread.Sleep(250);
- Console.Beep(523, 125);
- Thread.Sleep(1125);
- Console.Beep(784, 125);
- Console.Beep(740, 125);
- Console.Beep(698, 125);
- Thread.Sleep(42);
- Console.Beep(622, 125);
- Thread.Sleep(125);
- Console.Beep(659, 125);
- Thread.Sleep(167);
- Console.Beep(415, 125);
- Console.Beep(440, 125);
- Console.Beep(523, 125);
- Thread.Sleep(125);
- Console.Beep(440, 125);
- Console.Beep(523, 125);
- Console.Beep(587, 125);
- Thread.Sleep(250);
- Console.Beep(784, 125);
- Console.Beep(740, 125);
- Console.Beep(698, 125);
- Thread.Sleep(42);
- Console.Beep(622, 125);
- Thread.Sleep(125);
- Console.Beep(659, 125);
- Thread.Sleep(167);
- Console.Beep(698, 125);
- Thread.Sleep(125);
- Console.Beep(698, 125);
- Console.Beep(698, 125);
- Thread.Sleep(625);
- Console.Beep(784, 125);
- Console.Beep(740, 125);
- Console.Beep(698, 125);
- Thread.Sleep(42);
- Console.Beep(622, 125);
- Thread.Sleep(125);
- Console.Beep(659, 125);
- Thread.Sleep(167);
- Console.Beep(415, 125);
- Console.Beep(440, 125);
- Console.Beep(523, 125);
- Thread.Sleep(125);
- Console.Beep(440, 125);
- Console.Beep(523, 125);
- Console.Beep(587, 125);
- Thread.Sleep(250);
- Console.Beep(622, 125);
- Thread.Sleep(250);
- Console.Beep(587, 125);
- Thread.Sleep(250);
- Console.Beep(523, 125);
- Thread.Sleep(625);
- }
- }
- #endregion Music
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement