示例#1
0
 public Passenger(int id, Pos position, Pos destinyPostion)
 {
     Id              = id;
     Position        = position;
     DestinyPosition = destinyPostion;
 }
示例#2
0
        private List <Location> GetWalkableAdjacentSquares(int x, int y, string[] map, Car car)
        {
            var proposedLocations = new List <Location>()
            {
                new Location {
                    X = x, Y = y - 1
                },
                new Location {
                    X = x, Y = y + 1
                },
                new Location {
                    X = x - 1, Y = y
                },
                new Location {
                    X = x + 1, Y = y
                },
            };

            if (proposedLocations[0].Y == -1)
            {
                proposedLocations[0] = new Location {
                    X = x, Y = 59
                }
            }
            ;
            if (proposedLocations[1].Y == 60)
            {
                proposedLocations[1] = new Location {
                    X = x, Y = 0
                }
            }
            ;
            if (proposedLocations[2].X == -1)
            {
                proposedLocations[2] = new Location {
                    X = 59, Y = y
                }
            }
            ;
            if (proposedLocations[3].X == 60)
            {
                proposedLocations[3] = new Location {
                    X = 0, Y = y
                }
            }
            ;

            Pos jarda       = new Pos(0, 0);
            Pos jarda2      = new Pos(0, 0);
            Pos korforgalom = new Pos(0, 0);

            //switch (car.Direction)
            //{
            //    case "UP":
            //        jarda.PosX = car.Position.PosX + 1; jarda.PosY = car.Position.PosY;
            //        jarda2.PosX = car.Position.PosX + 1; jarda2.PosY = car.Position.PosY + 1;
            //        korforgalom.PosX = car.Position.PosX - 1; jarda.PosY = car.Position.PosY;
            //        break;
            //    case "DOWN":
            //        jarda.PosX = car.Position.PosX - 1; jarda.PosY = car.Position.PosY;
            //        jarda2.PosX = car.Position.PosX - 1; jarda2.PosY = car.Position.PosY - 1;
            //        korforgalom.PosX = car.Position.PosX + 1; jarda.PosY = car.Position.PosY;
            //        break;
            //    case "LEFT":
            //        jarda.PosX = car.Position.PosX; jarda.PosY = car.Position.PosY - 1;
            //        jarda2.PosX = car.Position.PosX + 1; jarda2.PosY = car.Position.PosY - 1;
            //        korforgalom.PosX = car.Position.PosX - 1; jarda.PosY = car.Position.PosY;
            //        break;
            //    case "RIGHT":
            //        jarda.PosX = car.Position.PosX; jarda.PosY = car.Position.PosY + 1;
            //        jarda2.PosX = car.Position.PosX - 1; jarda2.PosY = car.Position.PosY + 1;
            //        korforgalom.PosX = car.Position.PosX + 1; jarda.PosY = car.Position.PosY;
            //        break;
            //}

            //foreach (Location l in proposedLocations)
            //{
            //    if ()
            //}


            return(proposedLocations.Where(l => map[l.Y][l.X] == 'S' || map[l.Y][l.X] == 'Z').ToList());
        }