Пример #1
0
        public Program()
        {
            wndWidth   = 50;
            wndHeight  = 40;
            score      = 0;
            deltaSpeed = 12;

            Console.SetWindowSize(wndWidth, wndHeight);
            Console.SetBufferSize(wndWidth, wndHeight);
            Console.OutputEncoding = Encoding.UTF8;
            Console.CursorVisible  = false;

            road          = new Road();
            road.leftSide = 2;

            controledCar = new ControlledCar();
            oncomingCar  = new OncomingCar();

            controledCar.setLeft(road.rightSide - controledCar.getWidth());
            controledCar.setTop(Console.WindowHeight - controledCar.getLength() - 1);
        }
Пример #2
0
 public Car(
     Road road,
     Position position,
     Position destination,
     int length = DEFAULT_LENGTH,
     int width  = DEFAULT_WIDTH,
     int acc    = DEFAULT_ACC,
     int dec    = DEFAULT_DEC,
     int speed  = 0)
 {
     Length        = length;
     Width         = width;
     Acceleration  = acc;
     Decceleration = dec;
     Speed         = speed;
     CarId         = new CarId();
     CurrentRoad   = road;
     CurrentRoad.AddCar(this);
     Destination = destination;
     Position    = position;
 }
Пример #3
0
 public void AddIntersection(Position position, Road road)
 {
     _intersections.Add(position.Point, road);
 }