コード例 #1
0
ファイル: PixelIcons.cs プロジェクト: Tankerxyz/localTanks
        static public void showSpeed(Point2D p, ConsoleColor colorMargins, ConsoleColor colorCursor, ConsoleColor colorBack) {
            Console.BackgroundColor = colorMargins;

            for (int i = 0; i < 3; ++i) {
                Console.SetCursorPosition((p.X + 1) + i, p.Y);
                Console.Write(" ");
            }
            p.Y++;
            Console.SetCursorPosition(p.X, p.Y);
            Console.Write(" ");

            Console.BackgroundColor = colorBack;

            Console.SetCursorPosition(p.X + 1, p.Y);
            Console.Write(" ");

            Console.SetCursorPosition(p.X + 2, p.Y);
            Console.Write(" ");

            Console.BackgroundColor = colorCursor;

            Console.SetCursorPosition(p.X + 3, p.Y);
            Console.Write(" ");

            Console.BackgroundColor = colorMargins;

            Console.SetCursorPosition(p.X + 4, p.Y);
            Console.Write(" ");
            p.Y++;

            Console.SetCursorPosition(p.X, p.Y);
            Console.Write(" ");

            Console.BackgroundColor = colorBack;

            Console.SetCursorPosition(p.X + 1, p.Y);
            Console.Write(" ");

            Console.BackgroundColor = colorCursor;

            Console.SetCursorPosition(p.X + 2, p.Y);
            Console.Write(" ");

            Console.BackgroundColor = colorBack;

            Console.SetCursorPosition(p.X + 3, p.Y);
            Console.Write(" ");

            Console.BackgroundColor = colorMargins;

            Console.SetCursorPosition(p.X + 4, p.Y);
            Console.Write(" ");
            p.Y++;
            for (int i = 0; i < 3; ++i) {
                Console.SetCursorPosition((p.X + 1) + i, p.Y);
                Console.Write(" ");
            }

            Console.ResetColor();
        }
コード例 #2
0
ファイル: Menu.cs プロジェクト: Tankerxyz/localTanks
 public Menu(List<string> button, ConsoleColor highLightColor, ConsoleColor textColor, Point2D startPos, int cursor = 0)
 {
     this.button = button;
     this.highLightColor = highLightColor;
     this.textColor = textColor;
     this.startPos = startPos;
     this.Cursor = cursor;
 }
コード例 #3
0
ファイル: DotModel.cs プロジェクト: Tankerxyz/localTanks
        // Метод для отрисовки модели в зависимости от направления
        // p - центральная координата
        public void show(Point2D p, Direction d) {

            Console.BackgroundColor = color;
            Console.ForegroundColor = Program.foregroundColor;
            Console.SetCursorPosition(p.X, p.Y);
            Console.Write(label);
            Console.BackgroundColor = Program.backgroundColor;
        }
コード例 #4
0
ファイル: TankModel.cs プロジェクト: Tankerxyz/localTanks
        public TankModel() {
            this.color = ConsoleColor.White;
            this.label = ' ';
            this.model = new Point2D[6];
            this.oldModel = new Point2D[6];

            for (int i = 0; i < this.model.Length; ++i) {
                model[i] = new Point2D();
                oldModel[i] = new Point2D();
            }
        }
コード例 #5
0
ファイル: DotModel.cs プロジェクト: Tankerxyz/localTanks
        public DotModel(Point2D p, Direction d, ConsoleColor color, char label) {
            this.color = color;
            this.label = label;
            this.model = new Point2D[6];

            for (int i = 0; i < this.model.Length; ++i) {
                model[i] = new Point2D();
            }
            model[0] = p;

            //generate(p, d);
        }
コード例 #6
0
ファイル: Menu.cs プロジェクト: Tankerxyz/localTanks
        public Menu(ConsoleColor highLightColor, ConsoleColor textColor, Point2D startPos, int cursor, params string[] button)
        {
            this.button = new List<string>();
            for (int i = 0; i < button.Length; ++i)
            {
                this.button.Add(button[i]);
            }

            this.highLightColor = highLightColor;
            this.textColor = textColor;
            this.startPos = startPos;
            this.Cursor = cursor;
        }
コード例 #7
0
ファイル: Menu.cs プロジェクト: Tankerxyz/localTanks
 public Menu(List<string> button,
     List<method> arrMethods,
     Point2D startPos,
     ConsoleColor highLightColor,
     ConsoleColor textColor,
     int cursor = 0,
     bool whritable = false)
 {
     this.button = button;
     this.arrMethods = arrMethods;
     this.highLightColor = highLightColor;
     this.textColor = textColor;
     this.startPos = startPos;
     this.cursor = cursor;
 }
コード例 #8
0
        public PlayerInfoWindow(
            int width,
            int height,
            Point2D position,
            ConsoleColor foregroundColor = ConsoleColor.DarkGray,
            ConsoleColor backgroundColor = ConsoleColor.Black
            ) {

            this.width = width;
            this.height = height;
            this.position = position;
            this.foregroundColor = foregroundColor;
            this.backgroundColor = backgroundColor;
            this.margin = new MarginWithAngles();
            this.changed = true;
        }
コード例 #9
0
ファイル: RankingTable.cs プロジェクト: Tankerxyz/localTanks
        public RankingTable(
            int width,
            int height,
            Point2D position,
            ConsoleColor foregroundColor = ConsoleColor.DarkGray,
            ConsoleColor backgroundColor = ConsoleColor.Black
            ) {

            this.width = width;
            this.height = height;
            this.position = position;
            this.foregroundColor = foregroundColor;
            this.backgroundColor = backgroundColor;
            this.margin = new MarginWithAngles();
            this.changed = true;
            rankingList = new Dictionary<int, RankingSlot>();
        }
コード例 #10
0
ファイル: FieldWindow.cs プロジェクト: Tankerxyz/localTanks
        public FieldWindow(
            int width,
            int height,
            Point2D position,
            MarginWithAngles margin,
            char backgroundIcon = ' ',
            ConsoleColor foregroundColor = ConsoleColor.DarkGray,
            ConsoleColor backgroundColor = ConsoleColor.Black
            ) {

            this.width = width;
            this.height = height;
            this.position = position;
            this.margin = margin;
            this.backgroundIcon = backgroundIcon;
            this.foregroundColor = foregroundColor;
            this.backgroundColor = backgroundColor;
            this.changed = true;
        }
コード例 #11
0
ファイル: Bullet.cs プロジェクト: Tankerxyz/localTanks
        public Bullet(Point2D point,            
            ConsoleColor color,
            Direction direction = Direction.up,
            char icon = '∙',
            int speed = 980,
            int damage = 1) 
        {            
            this.point = point;

            this.oldPoint = new Point2D(this.point.X, this.point.Y);

            this.direction = direction;
            this.color = color;
            this.icon = icon;
            this.speed = speed;
            this.damage = damage;
            this.alive = false;
            this.Changed = false;            
        }
コード例 #12
0
ファイル: Player.cs プロジェクト: Tankerxyz/localTanks
        public Player(string name, Point2D point, ConsoleColor color, Statistics stat, Direction direction = Direction.up, int speed = 1) {
            this.name = name;            
            this.point = point;
            this.oldPoint = new Point2D(this.point.X, this.point.Y);
            this.color = color;
            this.stat = stat;
            this.oldDirection = direction;
            this.direction = direction;
            this.speed = speed;
            this.Changed = true;
            this.isShooter = false;            
            this.model = new TankModel(new Point2D(point.X, point.Y), direction, color, name[0]);
            this.bullet = new Bullet(new Point2D(X, Y), model.Color, direction);
            this.timeToMove = new Stopwatch();
            this.timeToShoot = new Stopwatch();           

            timeToMove.Start();
            timeToShoot.Start();            
        }
コード例 #13
0
ファイル: PixelIcons.cs プロジェクト: Tankerxyz/localTanks
        static public void showHeart(Point2D p, ConsoleColor color) {
            Console.BackgroundColor = color;

            Console.SetCursorPosition(p.X + 1, p.Y);
            Console.Write(" ");
            Console.SetCursorPosition(p.X + 3, p.Y);
            Console.Write(" ");
            p.Y++;

            for (int i = 0; i < 5; ++i) {
                Console.SetCursorPosition(p.X + i, p.Y);
                Console.Write(" ");
            }
            p.Y++;
            for (int i = 0; i < 3; ++i) {
                Console.SetCursorPosition((p.X + 1) + i, p.Y);
                Console.Write(" ");
            }
            p.Y++;
            Console.SetCursorPosition(p.X + 2, p.Y);
            Console.Write(" ");

            Console.ResetColor();
        }
コード例 #14
0
ファイル: PixelIcons.cs プロジェクト: Tankerxyz/localTanks
        static public void showSword(Point2D p, ConsoleColor colorHandle, ConsoleColor colorCenter, ConsoleColor colorBlade) {
            Console.BackgroundColor = colorBlade;

            Console.SetCursorPosition(p.X + 2, p.Y);
            Console.Write(" ");
            p.Y++;
            Console.SetCursorPosition(p.X + 2, p.Y);
            Console.Write(" ");
            p.Y++;

            Console.BackgroundColor = colorCenter;

            for (int i = 0; i < 3; ++i) {
                Console.SetCursorPosition((p.X + 1) + i, p.Y);
                Console.Write(" ");
            }
            p.Y++;

            Console.BackgroundColor = colorHandle;
            Console.SetCursorPosition(p.X + 2, p.Y);
            Console.Write(" ");

            Console.ResetColor();
        }
コード例 #15
0
ファイル: Player.cs プロジェクト: Tankerxyz/localTanks
        public void move(Direction d, bool check = true) {
            if (check) {
                Point2D nextMovePoint = new Point2D(point.X, point.Y);
                TankModel nextMoveModel = new TankModel();
                switch (d) {
                    case Direction.up:
                        if (nextMovePoint.Y <= 2)
                            return;
                        --nextMovePoint.Y; 
                        break;
                    case Direction.down:
                        if (point.Y >= Program.height - 2)
                            return;
                        ++nextMovePoint.Y; 
                        break;
                    case Direction.left:
                        if (nextMovePoint.X <= 2)
                            return;
                        --nextMovePoint.X;
                        break;
                    case Direction.right:
                        if (point.X >= Program.width - 2)
                            return;
                        ++nextMovePoint.X;
                        break;
                }
                nextMoveModel.generate(nextMovePoint, d);
                
                if (!canMove(d, nextMoveModel))
                    return;
            }
                oldPoint.X = X;
                oldPoint.Y = Y;
                oldDirection = direction;

                switch (d) {
                    case Direction.up:
                        up();              
                        break;
                    case Direction.down:
                        down();
                        break;
                    case Direction.left:
                        left();
                        break;
                    case Direction.right:
                        right();
                        break;
                }
                direction = d;
                model.generate(point, direction);
                this.Changed = true;
            
        }
コード例 #16
0
ファイル: Player.cs プロジェクト: Tankerxyz/localTanks
        public void revive(Point2D p) {
            bullet.Damage = 1;
            speed = 1;

            oldPoint.X = X;
            oldPoint.Y = Y;
            oldDirection = direction;

            this.point.X = p.X;
            this.point.Y = p.Y;
            this.direction = Direction.up;
            model.generate(this.point, this.direction);
            this.Changed = true;
        }
コード例 #17
0
ファイル: TankModel.cs プロジェクト: Tankerxyz/localTanks
        public void generate(Point2D p, Direction d) {
            center.X = p.X;
            center.Y = p.Y;
            for (int i = 0; i < model.Length; ++i) {
                oldModel[i].X = model[i].X;
                oldModel[i].Y = model[i].Y;
            }

            if (d == Direction.up) {
                #region up generate
                //   [+]
                //[ ][ ][ ]
                //[ ]   [ ]
                model[0].X = p.X; model[0].Y = p.Y - 1;

                //   [ ]
                //[+][ ][ ]
                //[ ]   [ ]
                model[1].X = p.X - 1; model[1].Y = p.Y;

                //   [ ]
                //[ ][+][ ]
                //[ ]   [ ]
                model[2].X = p.X; model[2].Y = p.Y;

                //   [ ]
                //[ ][ ][+]
                //[ ]   [ ]
                model[3].X = p.X + 1; model[3].Y = p.Y;

                //   [ ]
                //[ ][ ][ ]
                //[+]   [ ]
                model[4].X = p.X - 1; model[4].Y = p.Y + 1;

                //   [ ]
                //[ ][ ][ ]
                //[ ]   [+]
                model[5].X = p.X + 1; model[5].Y = p.Y + 1;
                #endregion
            } else if (d == Direction.down) {
                #region down generate
                //[ ]   [ ]
                //[ ][ ][ ]
                //   [+]   
                model[0].X = p.X; model[0].Y = p.Y + 1;

                //[ ]   [ ]
                //[+][ ][ ]
                //   [ ]  
                model[1].X = p.X - 1; model[1].Y = p.Y;

                //[ ]   [ ]
                //[ ][+][ ]
                //   [ ]  
                model[2].X = p.X; model[2].Y = p.Y;

                //[ ]   [ ]
                //[ ][ ][+]
                //   [ ]  
                model[3].X = p.X + 1; model[3].Y = p.Y;

                //[+]   [ ]
                //[ ][ ][ ]
                //   [ ]  
                model[4].X = p.X - 1; model[4].Y = p.Y - 1;

                //[ ]   [+]
                //[ ][ ][ ]
                //   [ ]  
                model[5].X = p.X + 1; model[5].Y = p.Y - 1;
                #endregion
            } else if (d == Direction.left) {
                #region left generate
                //   [+][ ]
                //[ ][ ]
                //   [ ][ ]
                model[0].X = p.X; model[0].Y = p.Y - 1;

                //   [ ][+]
                //[ ][ ]
                //   [ ][ ]
                model[1].X = p.X + 1; model[1].Y = p.Y - 1;

                //   [ ][ ]
                //[+][ ]
                //   [ ][ ] 
                model[2].X = p.X - 1; model[2].Y = p.Y;

                //   [ ][ ]
                //[ ][+]
                //   [ ][ ] 
                model[3].X = p.X; model[3].Y = p.Y;

                //   [ ][ ]
                //[ ][ ]
                //   [+][ ]
                model[4].X = p.X; model[4].Y = p.Y + 1;

                //   [ ][ ]
                //[ ][ ]
                //   [ ][+] 
                model[5].X = p.X + 1; model[5].Y = p.Y + 1;
                #endregion
            } else if (d == Direction.right) {
                #region right generate
                //[+][ ]   
                //   [ ][ ]
                //[ ][ ]
                model[0].X = p.X - 1; model[0].Y = p.Y - 1;

                //[ ][+]   
                //   [ ][ ]
                //[ ][ ]
                model[1].X = p.X; model[1].Y = p.Y - 1;

                //[ ][ ]   
                //   [+][ ]
                //[ ][ ]
                model[2].X = p.X; model[2].Y = p.Y;

                //[ ][ ]   
                //   [ ][+]
                //[ ][ ] 
                model[3].X = p.X + 1; model[3].Y = p.Y;

                //[ ][ ]   
                //   [ ][ ]
                //[+][ ]
                model[4].X = p.X - 1; model[4].Y = p.Y + 1;

                //[ ][ ]   
                //   [ ][ ]
                //[ ][+]
                model[5].X = p.X; model[5].Y = p.Y + 1;
                #endregion
            }
        }
コード例 #18
0
ファイル: DotModel.cs プロジェクト: Tankerxyz/localTanks
        public void generate(Point2D p, Direction d) {
            if (d == Direction.up) {
                #region up generate
                //   [+]
                //[ ][ ][ ]
                //[ ]   [ ]
                model[0].X = p.X; model[0].Y = p.Y - 1;

                //   [ ]
                //[+][ ][ ]
                //[ ]   [ ]
                model[1].X = p.X - 1; model[1].Y = p.Y;

                //   [ ]
                //[ ][+][ ]
                //[ ]   [ ]
                model[2].X = p.X; model[2].Y = p.Y;

                //   [ ]
                //[ ][ ][+]
                //[ ]   [ ]
                model[3].X = p.X + 1; model[3].Y = p.Y;

                //   [ ]
                //[ ][ ][ ]
                //[+]   [ ]
                model[4].X = p.X - 1; model[4].Y = p.Y + 1;

                //   [ ]
                //[ ][ ][ ]
                //[ ]   [+]
                model[5].X = p.X + 1; model[5].Y = p.Y + 1;
                #endregion
            } else if (d == Direction.down) {
                #region down generate
                //[ ]   [ ]
                //[ ][ ][ ]
                //   [+]   
                model[0].X = p.X; model[0].Y = p.Y + 1;

                //[ ]   [ ]
                //[+][ ][ ]
                //   [ ]  
                model[1].X = p.X - 1; model[1].Y = p.Y;

                //[ ]   [ ]
                //[ ][+][ ]
                //   [ ]  
                model[2].X = p.X; model[2].Y = p.Y;

                //[ ]   [ ]
                //[ ][ ][+]
                //   [ ]  
                model[3].X = p.X + 1; model[3].Y = p.Y;

                //[+]   [ ]
                //[ ][ ][ ]
                //   [ ]  
                model[4].X = p.X - 1; model[4].Y = p.Y - 1;

                //[ ]   [+]
                //[ ][ ][ ]
                //   [ ]  
                model[5].X = p.X + 1; model[5].Y = p.Y - 1;
                #endregion
            } else if (d == Direction.left) {
                #region left generate
                //   [+][ ]
                //[ ][ ]
                //   [ ][ ]
                model[0].X = p.X; model[0].Y = p.Y - 1;

                //   [ ][+]
                //[ ][ ]
                //   [ ][ ]
                model[1].X = p.X + 1; model[1].Y = p.Y - 1;

                //   [ ][ ]
                //[+][ ]
                //   [ ][ ] 
                model[2].X = p.X - 1; model[2].Y = p.Y;

                //   [ ][ ]
                //[ ][+]
                //   [ ][ ] 
                model[3].X = p.X; model[3].Y = p.Y;

                //   [ ][ ]
                //[ ][ ]
                //   [+][ ]
                model[4].X = p.X; model[4].Y = p.Y + 1;

                //   [ ][ ]
                //[ ][ ]
                //   [ ][+] 
                model[5].X = p.X + 1; model[5].Y = p.Y + 1;
                #endregion
            } else if (d == Direction.right) {
                #region right generate
                //[+][ ]   
                //   [ ][ ]
                //[ ][ ]
                model[0].X = p.X - 1; model[0].Y = p.Y - 1;

                //[ ][+]   
                //   [ ][ ]
                //[ ][ ]
                model[1].X = p.X; model[1].Y = p.Y - 1;

                //[ ][ ]   
                //   [+][ ]
                //[ ][ ]
                model[2].X = p.X; model[2].Y = p.Y;

                //[ ][ ]   
                //   [ ][+]
                //[ ][ ] 
                model[3].X = p.X + 1; model[3].Y = p.Y;

                //[ ][ ]   
                //   [ ][ ]
                //[+][ ]
                model[4].X = p.X - 1; model[4].Y = p.Y + 1;

                //[ ][ ]   
                //   [ ][ ]
                //[ ][+]
                model[5].X = p.X; model[5].Y = p.Y + 1;
                #endregion
            }
        }
コード例 #19
0
ファイル: DotModel.cs プロジェクト: Tankerxyz/localTanks
 public void clear(Point2D oldPoint) {
     Console.BackgroundColor = Program.backgroundColor;
     Console.SetCursorPosition(oldPoint.X, oldPoint.Y);
     Console.Write(" ");
 }
コード例 #20
0
ファイル: Program.cs プロジェクト: Tankerxyz/localTanks
        static void Handler() {
            while (true) {
                if (receivedPackaged.Count > 0) {
                    string[] package = receivedPackaged.Dequeue().Split('¶');

                    #region Обработчик пакетов
                    if (package[0] == "0" && package.Length == 11) { //первый пакет

                        string name = package[1];
                        Point2D point = new Point2D(Int32.Parse(package[2]), Int32.Parse(package[3]));
                        ConsoleColor color = (ConsoleColor)Int32.Parse(package[4]);
                        Statistics stat = new Statistics(Int32.Parse(package[5]),
                            Int32.Parse(package[6]),
                            Int32.Parse(package[7]),
                            Int32.Parse(package[8]));
                        Direction direction = (Direction)Int32.Parse(package[9]);
                        int id = Int32.Parse(package[10]);

                        players.Add(id, new Player(name, point, color, stat, direction));

                        screen.updateTitle();
                    } else if (package[0] == "1" && package.Length == 3) {// движение

                        int id = Int32.Parse(package[2]);
                        players[id].move((Direction)Int32.Parse(package[1]), false);

                    } else if (package[0] == "2" && package.Length == 9) {// выстрел

                        int damage = Convert.ToInt32(package[1]);
                        int speed = Convert.ToInt32(package[2]);
                        char icon = Convert.ToChar(package[3]);
                        Point2D point = new Point2D(Int32.Parse(package[4]), Int32.Parse(package[5]));
                        Direction direction = (Direction)Convert.ToInt32(package[6]);
                        ConsoleColor color = (ConsoleColor)Convert.ToInt32(package[7]);
                        int id = Int32.Parse(package[8]);

                        players[id].Bullet = new Bullet(point, color, direction, icon, speed, damage);
                        players[id].shot();

                    } else if (package[0] == "3" && package.Length == 3){// симулируется попадание
                        int idWhom = Int32.Parse(package[1]);
                        int idShooter = Int32.Parse(package[2]);
                        try {                            
                            players[idWhom].Stat.Health -= players[idShooter].Bullet.Damage;
                            if (players[idWhom].Stat.Health <= 0) {
                                players[idWhom].Stat.Health = players[idWhom].Stat.MaxHealth;
                                players[idWhom].Stat.Deaths++;
                                players[idShooter].Stat.Kills++;
                            }
                            players[idShooter].Bullet.Alive = false;

                        } catch { // если ключа нет, значит это я

                            myPlayer.Stat.Health -= players[idShooter].Bullet.Damage;
                            if (myPlayer.Stat.Health <= 0) {
                                myPlayer.Stat.Health = myPlayer.Stat.MaxHealth;
                                myPlayer.Stat.Deaths++;
                                if (players[idShooter].Stat.Health + 2 <= players[idShooter].Stat.MaxHealth) {
                                    players[idShooter].Stat.Health += 2;
                                } else {
                                    players[idShooter].Stat.Health = players[idShooter].Stat.MaxHealth;
                                }
                                players[idShooter].Stat.Kills++;
                            }
                            players[idShooter].Bullet.Alive = false;
                        }
                    } else if (package[0] == "4" && package.Length == 4 || package.Length == 3) {// воскрешение (3-себя)
                        int x = Int32.Parse(package[1]);
                        int y = Int32.Parse(package[2]);

                        if (package.Length == 4) {
                            int id = Int32.Parse(package[3]);
                            players[id].revive(new Point2D(x, y));
                        } else {
                            myPlayer.revive(new Point2D(x, y));
                        }
                    } else if (package[0] == "5" && package.Length == 1) {
                        packages.Enqueue("5");
                    } else if (package[0] == "6" && package.Length == 2) {
                        int id = Int32.Parse(package[1]);
                        players[id].clear(true);
                        players.Remove(id);
                        screen.RankingWindow.RankingList.Remove(id);
                        screen.RankingWindow.Changed = true;
                        screen.updateTitle();
                    } 
                    continue;
                    #endregion
                    
                }
                Thread.Sleep(1);
            }
        }
コード例 #21
0
ファイル: PixelNumbers.cs プロジェクト: Tankerxyz/localTanks
        static public void show(Point2D p, ConsoleColor color, int numb) {
            Console.BackgroundColor = color;
            if (numb == 1) {
                for (int i = 0; i < 5; ++i) {
                    Console.SetCursorPosition(p.X + 2, p.Y + i);
                    Console.Write(" ");
                }
            } else if (numb == 2) {
                for (int i = 0; i < 3; ++i) {
                    Console.SetCursorPosition(p.X + i, p.Y);
                    Console.Write(" ");
                }
                ++p.Y;

                Console.SetCursorPosition(p.X + 2, p.Y);
                Console.Write(" ");

                ++p.Y;

                for (int i = 0; i < 3; ++i) {
                    Console.SetCursorPosition(p.X + i, p.Y);
                    Console.Write(" ");
                }
                ++p.Y;

                Console.SetCursorPosition(p.X, p.Y);
                Console.Write(" ");

                ++p.Y;
                for (int i = 0; i < 3; ++i) {
                    Console.SetCursorPosition(p.X + i, p.Y);
                    Console.Write(" ");
                }
            } else if (numb == 3) {
                for (int count = 0; count < 2; ++count) {
                    for (int i = 0; i < 3; ++i) {
                        Console.SetCursorPosition(p.X + i, p.Y);
                        Console.Write(" ");
                    }
                    ++p.Y;

                    Console.SetCursorPosition(p.X + 2, p.Y);
                    Console.Write(" ");

                    ++p.Y;
                }
                for (int i = 0; i < 3; ++i) {
                    Console.SetCursorPosition(p.X + i, p.Y);
                    Console.Write(" ");
                }
            } else if (numb == 4) {
                Console.SetCursorPosition(p.X, p.Y);
                Console.Write(" ");
                Console.SetCursorPosition(p.X + 2, p.Y);
                Console.Write(" ");
                p.Y++;
                Console.SetCursorPosition(p.X, p.Y);
                Console.Write(" ");
                Console.SetCursorPosition(p.X + 2, p.Y);
                Console.Write(" ");
                p.Y++;
                for (int i = 0; i < 3; ++i) {
                    Console.SetCursorPosition(p.X + i, p.Y);
                    Console.Write(" ");
                }
                p.Y++;
                Console.SetCursorPosition(p.X + 2, p.Y);
                Console.Write(" ");
                p.Y++;
                Console.SetCursorPosition(p.X + 2, p.Y);
                Console.Write(" ");
            } else if (numb == 5) {
                for (int i = 0; i < 3; ++i) {
                    Console.SetCursorPosition(p.X + i, p.Y);
                    Console.Write(" ");
                }
                ++p.Y;

                Console.SetCursorPosition(p.X, p.Y);
                Console.Write(" ");

                ++p.Y;

                for (int i = 0; i < 3; ++i) {
                    Console.SetCursorPosition(p.X + i, p.Y);
                    Console.Write(" ");
                }
                ++p.Y;

                Console.SetCursorPosition(p.X + 2, p.Y);
                Console.Write(" ");

                ++p.Y;
                for (int i = 0; i < 3; ++i) {
                    Console.SetCursorPosition(p.X + i, p.Y);
                    Console.Write(" ");
                }
            } else if (numb == 6) {
                for (int i = 0; i < 3; ++i) {
                    Console.SetCursorPosition(p.X + i, p.Y);
                    Console.Write(" ");
                }
                ++p.Y;

                Console.SetCursorPosition(p.X, p.Y);
                Console.Write(" ");

                ++p.Y;

                for (int i = 0; i < 3; ++i) {
                    Console.SetCursorPosition(p.X + i, p.Y);
                    Console.Write(" ");
                }
                ++p.Y;

                Console.SetCursorPosition(p.X, p.Y);
                Console.Write(" ");

                Console.SetCursorPosition(p.X + 2, p.Y);
                Console.Write(" ");

                ++p.Y;
                for (int i = 0; i < 3; ++i) {
                    Console.SetCursorPosition(p.X + i, p.Y);
                    Console.Write(" ");
                }
            } else if (numb == 7) {
                for (int i = 0; i < 3; ++i) {
                    Console.SetCursorPosition(p.X + i, p.Y);
                    Console.Write(" ");
                }
                p.Y++;

                Console.SetCursorPosition(p.X, p.Y);
                Console.Write(" ");

                Console.SetCursorPosition(p.X + 2, p.Y);
                Console.Write(" ");
                p.Y++;
                Console.SetCursorPosition(p.X + 2, p.Y);
                Console.Write(" ");
                p.Y++;
                Console.SetCursorPosition(p.X + 2, p.Y);
                Console.Write(" ");
                p.Y++;
                Console.SetCursorPosition(p.X + 2, p.Y);
                Console.Write(" ");
            } else if (numb == 8) {
                for (int i = 0; i < 3; ++i) {
                    Console.SetCursorPosition(p.X + i, p.Y);
                    Console.Write(" ");
                }
                ++p.Y;

                Console.SetCursorPosition(p.X, p.Y);
                Console.Write(" ");

                Console.SetCursorPosition(p.X + 2, p.Y);
                Console.Write(" ");

                ++p.Y;

                for (int i = 0; i < 3; ++i) {
                    Console.SetCursorPosition(p.X + i, p.Y);
                    Console.Write(" ");
                }
                ++p.Y;

                Console.SetCursorPosition(p.X, p.Y);
                Console.Write(" ");

                Console.SetCursorPosition(p.X + 2, p.Y);
                Console.Write(" ");

                ++p.Y;
                for (int i = 0; i < 3; ++i) {
                    Console.SetCursorPosition(p.X + i, p.Y);
                    Console.Write(" ");
                }
            } else if (numb == 9) {
                for (int i = 0; i < 3; ++i) {
                    Console.SetCursorPosition(p.X + i, p.Y);
                    Console.Write(" ");
                }
                ++p.Y;

                Console.SetCursorPosition(p.X, p.Y);
                Console.Write(" ");

                Console.SetCursorPosition(p.X + 2, p.Y);
                Console.Write(" ");

                ++p.Y;

                for (int i = 0; i < 3; ++i) {
                    Console.SetCursorPosition(p.X + i, p.Y);
                    Console.Write(" ");
                }
                ++p.Y;

                Console.SetCursorPosition(p.X + 2, p.Y);
                Console.Write(" ");
                ++p.Y;
                for (int i = 0; i < 3; ++i) {
                    Console.SetCursorPosition(p.X + i, p.Y);
                    Console.Write(" ");
                }
            } else if (numb == 0) {
                for (int i = 0; i < 3; ++i) {
                    Console.SetCursorPosition(p.X + i, p.Y);
                    Console.Write(" ");
                }
                ++p.Y;

                Console.SetCursorPosition(p.X, p.Y);
                Console.Write(" ");

                Console.SetCursorPosition(p.X + 2, p.Y);
                Console.Write(" ");

                ++p.Y;

                Console.SetCursorPosition(p.X, p.Y);
                Console.Write(" ");

                Console.SetCursorPosition(p.X + 2, p.Y);
                Console.Write(" ");

                ++p.Y;

                Console.SetCursorPosition(p.X, p.Y);
                Console.Write(" ");

                Console.SetCursorPosition(p.X + 2, p.Y);
                Console.Write(" ");

                ++p.Y;

                for (int i = 0; i < 3; ++i) {
                    Console.SetCursorPosition(p.X + i, p.Y);
                    Console.Write(" ");
                }
            }

            Console.ResetColor();
        }