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.Text;
- using System.Threading.Tasks;
- namespace CSLight3
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.WindowWidth = 150;
- Console.WindowHeight = 50;
- int score = 0;
- Console.CursorVisible = false;
- char[] bag = new char[0];
- char[,] map =
- {
- {'#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#' },
- {'#',' ','#',' ',' ',' ',' ',' ',' ',' ',' ','#',' ',' ',' ',' ',' ',' ','#',' ','#',' ',' ',' ','#',' ',' ',' ',' ',' ','#','#','#','#','#',' ',' ',' ','#',' ',' ',' ',' ',' ',' ','#' },
- {'#',' ',' ',' ','#',' ',' ','#','#','#',' ','#',' ','#','#','#','#',' ','#',' ',' ',' ','#',' ','#',' ','#','#','#',' ','#','#','#','#',' ',' ','#',' ','#',' ','#','#','#',' ','#','#' },
- {'#',' ','#','#','#','#',' ','#',' ',' ',' ','#',' ',' ',' ',' ','#',' ','#',' ','#','#','#',' ','#',' ',' ',' ','#',' ',' ',' ','#',' ',' ','#','#',' ','#',' ','#',' ',' ',' ',' ','#' },
- {'#',' ','#',' ',' ',' ',' ','#',' ','#',' ','#',' ',' ',' ',' ','#',' ',' ',' ','#',' ',' ',' ','#',' ','#',' ',' ',' ','#',' ','#',' ','#','#','#',' ','#',' ','#',' ','#','#','#','#' },
- {'#',' ','#',' ','#','#',' ','#',' ','#',' ','#','#','#','#',' ','#','#','#',' ','#',' ','#','#','#',' ','#',' ','#',' ','#',' ',' ',' ',' ',' ',' ',' ',' ',' ','#',' ','#',' ',' ','#' },
- {'#',' ',' ',' ',' ',' ',' ','#',' ','#',' ',' ',' ','#',' ',' ',' ','#',' ',' ','#',' ','#',' ',' ',' ','#',' ','#',' ','#','#','#','#','#','#','#','#','#','#','#',' ','#',' ','#','#' },
- {'#','#','#','#','#',' ',' ','#',' ','#',' ','#',' ','#',' ','#',' ',' ',' ','#','#',' ','#',' ','#','#','#',' ',' ',' ','#',' ',' ',' ',' ',' ',' ','#',' ',' ',' ',' ','#',' ',' ','#' },
- {'#',' ',' ',' ',' ',' ',' ','#',' ','#',' ','#',' ',' ',' ',' ',' ','#','#','#',' ',' ','#',' ',' ',' ','#',' ','#','#','#',' ','#','#',' ','#',' ','#',' ','#','#','#','#','#',' ','#' },
- {'#',' ','#',' ','#','#','#','#',' ','#',' ','#','#','#','#','#','#','#',' ',' ',' ','#','#',' ','#',' ','#','#','#',' ',' ',' ','#',' ',' ','#',' ','#',' ',' ',' ',' ',' ',' ',' ','#' },
- {'#',' ','#',' ',' ',' ',' ',' ',' ','#',' ','#',' ',' ',' ',' ',' ','#',' ','#','#','#','#',' ','#',' ','#',' ',' ',' ','#',' ',' ',' ','#','#',' ','#','#','#','#','#',' ','#','#','#' },
- {'#',' ','#',' ',' ',' ',' ','#','#','#',' ','#',' ','#',' ','#',' ','#',' ',' ',' ',' ',' ',' ','#',' ','#',' ','#',' ','#',' ','#','#','#',' ',' ','#',' ',' ',' ',' ',' ','#','#','#' },
- {'#',' ','#','#','#','#',' ',' ',' ',' ',' ','#',' ','#',' ','#',' ','#','#','#',' ','#',' ','#','#',' ','#',' ','#',' ',' ',' ','#',' ',' ',' ','#','#',' ','#',' ','#','#','#','E','#' },
- {'#',' ',' ',' ',' ','#',' ','#',' ','#','#','#',' ','#',' ','#',' ',' ',' ',' ',' ','#',' ','#',' ',' ','#',' ','#','#','#','#','#',' ','#','#','#',' ',' ','#',' ','#',' ','#',' ','#' },
- {'#','#','#','#',' ','#',' ','#',' ',' ','#','#',' ','#',' ','#','#','#','#','#',' ','#',' ','#',' ','#','#',' ',' ','#',' ','#',' ',' ','#',' ',' ',' ','#','#',' ','#',' ',' ',' ','#' },
- {'#',' ',' ',' ',' ','#',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','#',' ',' ',' ','#',' ','#',' ','#','#',' ','#','#',' ','#',' ','#','#',' ','#',' ','#',' ',' ','#',' ','#','#','#' },
- {'#','#','#',' ','#','#','#','#','#','#','#',' ',' ','#','#','#',' ','#',' ','#','#','#',' ','#',' ',' ',' ',' ',' ','#',' ','#',' ',' ',' ',' ',' ',' ','#',' ',' ',' ',' ',' ',' ','#' },
- {'#',' ',' ',' ','#',' ',' ','#','#',' ','#','#',' ',' ',' ','#',' ','#',' ','#',' ',' ',' ','#','#','#','#','#',' ','#',' ','#','#','#','#','#','#','#','#','#','#','#','#','#',' ','#' },
- {'#',' ','#','#','#','#',' ','#','#',' ','#',' ',' ','#',' ','#',' ','#',' ','#',' ','#',' ',' ',' ',' ','#',' ',' ',' ',' ','#',' ',' ',' ',' ',' ',' ',' ',' ',' ','#',' ',' ',' ','#' },
- {'#',' ','#',' ','#','#',' ','#','#',' ','#',' ','#','#',' ','#',' ',' ',' ','#',' ','#','#','#','#',' ','#',' ','#','#','#','#',' ','#','#','#',' ','#','#','#','#','#',' ','#',' ','#' },
- {'#',' ','#',' ',' ',' ',' ','#','#',' ',' ',' ','#',' ',' ','#',' ','#','#','#',' ',' ',' ',' ','#',' ','#',' ',' ',' ','#',' ',' ','#',' ',' ',' ','#',' ',' ',' ','#',' ','#',' ','#' },
- {'#',' ','#',' ','#','#','#','#','#',' ','#','#','#','#','#','#',' ','#',' ',' ',' ',' ','#',' ','#',' ','#','#','#',' ','#',' ','#','#',' ','#',' ','#','#','#',' ','#',' ','#',' ','#' },
- {'#',' ','#',' ',' ','#',' ',' ',' ',' ','#',' ',' ',' ','#',' ',' ','#',' ','#','#',' ','#',' ','#',' ',' ',' ','#',' ','#',' ','#',' ',' ','#',' ',' ',' ',' ',' ','#',' ',' ',' ','#' },
- {'#',' ','#','#',' ','#',' ','#',' ','#','#',' ','#',' ','#',' ','#','#',' ',' ',' ',' ','#',' ',' ',' ','#',' ','#',' ',' ',' ','#',' ','#','#','#','#','#','#','#','#',' ','#','#','#' },
- {'#',' ',' ',' ',' ',' ',' ','#',' ',' ',' ',' ','#',' ','#',' ','#',' ',' ','#','#','#','#',' ','#',' ',' ',' ','#',' ','#',' ','#',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','#' },
- {'#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#' },
- };
- int userX = 1, userY = 1;
- while (true)
- {
- score++;
- Console.SetCursorPosition(70, 1);
- Console.WriteLine("Количество ходов: " + score);
- Console.SetCursorPosition(70, 2);
- Console.Write("Сумка: ");
- for (int i = 0; i < bag.Length; i++)
- {
- Console.Write(bag[i]);
- }
- Console.SetCursorPosition(0, 0);
- for (int i = 0; i < map.GetLength(0); i++)
- {
- for (int j = 0; j < map.GetLength(1); j++)
- {
- Console.Write(map[i, j]);
- }
- Console.WriteLine();
- }
- Console.SetCursorPosition(userX, userY);
- Console.ForegroundColor = ConsoleColor.Red;
- Console.Write('@');
- Console.ForegroundColor = ConsoleColor.Gray;
- ConsoleKeyInfo charKey = Console.ReadKey();
- switch (charKey.Key)
- {
- case ConsoleKey.LeftArrow:
- if (map[userY, userX - 1] != '#')
- userX--;
- break;
- case ConsoleKey.RightArrow:
- if (map[userY, userX + 1] != '#')
- userX++;
- break;
- case ConsoleKey.UpArrow:
- if (map[userY - 1, userX] != '#')
- userY--;
- break;
- case ConsoleKey.DownArrow:
- if (map[userY + 1, userX] != '#')
- userY++;
- break;
- }
- if (map[userY, userX] == 'E')
- {
- Console.Clear();
- Console.WriteLine("Поздравляю!");
- Console.WriteLine("Вы справились за " + score + " ходов!");
- Console.ReadKey();
- break;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement