public WallsAndLinesDemoBrainTests() { map = TestMap1Factory.Create(); environment = new DefaultEnvironment(map); robot = new LineAndWallDetectorRobot(environment, 50); brain = new WallsAndLinesDemoBrain(robot); }
public MainPage() { this.InitializeComponent(); environment = new DefaultEnvironment(new Map(1, 1)); // Did not load the map yet... EnvironmentTickSource = new EnvironmentTickSource(environment, SimulationCycleLengthMs); var robot = new LineAndWallDetectorRobot(environment); Brain = new WallsAndLinesDemoBrain(robot); new LogCollector(Brain, this.LogViewModel); // Ctor performs registrations this.RobotViewModel = new RobotViewModel(robot); RobotImage.Source = RobotViewModel.Image; this.MapViewModel = new MapViewModel(); InitButtonCommands(); }
public MainPage() { this.InitializeComponent(); environment = new DefaultEnvironment(new Map(1, 1)); // Did not load the map yet... var robot = new LineAndWallDetectorRobot(environment, wallSensorMaxDistance: 50); var brain = new WallsAndLinesDemoBrain(robot); brain.AddCommand(new GenericSingleStateCommand(new FollowingLineState(5.0))); this.RobotViewModel = new RobotViewModel(robot); RobotImage.Source = RobotViewModel.Image; this.MapViewModel = new MapViewModel(); SimulationTickTimer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(500) }; SimulationTickTimer.Tick += SimulationTickTimer_Tick; }
public MainPage() { this.InitializeComponent(); environment = new DefaultEnvironment(new Map(1, 1)); // Did not load the map yet... EnvironmentTickSource = new EnvironmentTickSource(environment, SimulationCycleLengthMs); var robot = new LineAndWallDetectorRobot(environment); Brain = new WallsAndLinesDemoBrain(robot); var collector = new LogCollector(Brain, this.LogViewModel); this.RobotViewModel = new RobotViewModel(robot); RobotImage.Source = RobotViewModel.Image; this.MapViewModel = new MapViewModel(); FollowLineCommand = new CommandButtonCommand(Brain, new FollowingLineState(5.0)); FollowLeftWallCommand = new CommandButtonCommand(Brain, new FollowingWallOnLeftState()); FollowRightWallCommand = new CommandButtonCommand(Brain, new FollowingWallOnRightState()); }
public CommandButtonCommand(WallsAndLinesDemoBrain brain, IState targetState) { this.brain = brain; this.targetState = targetState; }
public CommandButton(string title, WallsAndLinesDemoBrain brain, IState targetState) { this.Title = title; this.brain = brain; this.targetState = targetState; }