示例#1
0
        private static Piece[,] createLab()
        {
            Console.WriteLine("Let's start creating your labyrinth.");
            Console.Write("Labyrinth width: ");
            int y = readInt();

            Console.Write("Labyrinth height: ");
            int x = readInt();

            Piece[,] lab = new Piece[x, y];
            Console.WriteLine("OK. Lets start filling it. Please type:\n" +
                              "'g' if block is a Generator (The coloured ones)\n" +
                              "'f' if block if fillable (If you can colour it using a generator)\n" +
                              "'b' if block is solid (If it is a black obstacle)\n");
            for (int i = 0; i < x; i++)
            {
                for (int j = 0; j < y; j++)
                {
                    Console.WriteLine("Block ({0}, {1})", i, j);
                    bool retry = false;
                    do
                    {
                        retry = false;
                        switch (Console.ReadLine())
                        {
                        case "g":
                            Console.WriteLine("You need to provide extra details for generators:");
                            Console.Write("Generator available moves: ");
                            int moves = readInt();
                            lab[i, j] = LabBuilder.Build(PieceTypes.Generator, ConsoleColor.Blue, moves, i, j);
                            break;

                        case "f":
                            lab[i, j] = LabBuilder.Build(PieceTypes.Fillable);
                            break;

                        case "b":
                            lab[i, j] = LabBuilder.Build(PieceTypes.SolidBlock);
                            break;

                        default:
                            Console.WriteLine("Block type not recognized. Please retry.");
                            retry = true;
                            break;
                        }
                    } while (retry);
                }
            }
            return(lab);
        }
示例#2
0
 public Piece generatePiece()
 {
     return(LabBuilder.Build(Type, ConsoleColor.Black, TotalMoves, PositionX, PositionY));
 }