private void scanRoom() { ProximitySensor.scanRoom(); for (int i = 0; i < roomMaxX; i++) for (int j = 0; j < roomMaxY; j++) { if (getFieldType(i, j) == FieldType.UNKNOWN) setFieldType(i, j, ProximitySensor.getFieldType(i, j)); } }
private void InitializeSimulation() { room = new Room("Room.txt"); ProximitySensor prSens = new ProximitySensor(room); DrivingUnit drivingUnit = new DrivingUnit(room); robot = new Robot(prSens, drivingUnit, room); Thread t = new Thread(new ThreadStart(runSimulation)); t.IsBackground = true; t.Start(); }
public Robot(ProximitySensor proximitySensor, DrivingUnit drivingUnit, Room room_) { ProximitySensor = proximitySensor; DrivingUnit = drivingUnit; room = new FieldType[room_.MaxX, room_.MaxY]; for (int i = 0; i < room_.MaxX; ++i) for (int j = 0; j < room_.MaxY; ++j) {room[i,j] = FieldType.UNKNOWN;} roomMaxX = room_.MaxX; roomMaxY = room_.MaxY; radius = 1; positionX = room_.RobotX; positionY = room_.RobotY; algorithm1 = new RandomPathChooserAlgorithm(this); algorithm2 = new DepthFirstSearchPathChooserAlgorithm(this); }