public Maybe <Direction> Decide(Level level) { var direction = _another.Decide(level); if (direction.Any()) { return(direction); } return(level.MyLength > 40 ? Maybe.Empty <Direction>() : MoveToCenter(level)); }
public Maybe <Direction> Decide(Level level) { _level = level; var direction = _another.Decide(level); if (direction.Any()) { return(IsTie(MyPointAfterMove(direction.Single())) ? SafeMove() : direction); } return(SafeMove()); }
public Maybe <Direction> Decide(Level level) { var direction = _another.Decide(level); if (direction.Any()) { return(direction); } if (!level.MyShortestPath.Any() || (!level.MyShortestPath.Any() && !level.EnemyShortestPath.Any())) { return(Maybe.Empty <Direction>()); } if (level.MyLength < 40) { return(level.EnemyShortestPath.Count < level.MyShortestPath.Count ? Maybe.Empty <Direction>() : DecideDirection(level.MyHead, level.MyShortestPath.First())); } return(DecideDirection(level.MyHead, level.MyShortestPath.First())); }
private void DecideMove() { if (!_hasPositions) { return; } Timekeep.Start(); if (_hasApple) { FindPaths(); } var direction = _decider.Decide(_level); if (direction.Any()) { _communicator.Send(new ControlMessage(direction.Single())); } Timekeep.Stop(10); }