public PodMove[] GetMoves(State state, Countdown countdown) { ExplainedScore bestScore = double.NegativeInfinity; PodMove[] bestMoves = null; var possibleTargets = state.Checkpoints; var possibleThrusts = new[] { Constants.MaxThrust, 0 }; foreach (var target0 in possibleTargets) { foreach (var target1 in possibleTargets) { foreach (int thrust0 in possibleThrusts) { foreach (int thrust1 in possibleThrusts) { /* * Simulate timeToSimulate ticks, with i-th pod targets to target_i with thrust_i. * Select the best option. * * Explore the different meanings of the «best». Compare different meanings with the test SingleTargetAi_Should.MovePodToTarget. */ } } } } return(bestMoves); }
public void CalculateNextMove() { var state = new StateReader("...0...|..000..|.00000.|0000000|.00000.|..000..|...0...|3 2|5 2|-1 -1|-1 -1|") .ReadState(new InitializationData(7, 2)); var evaluator = new StateEvaluator(); var action = new GreedyAi(evaluator).GetAction(state, 100); ExplainedScore score = null; using (new MoveAndBuildAction(0, Direction.N, Direction.N).ApplyTo(state)) score = evaluator.Evaluate(state, 0); using (action.ApplyTo(state)) evaluator.Evaluate(state, 0).Should().BeGreaterOrEqualTo(score); }
public static Scored <TObject> WithScore <TObject>(this TObject obj, ExplainedScore score) => new Scored <TObject>(obj, score);