private static async Task DoTheKonami(IAmazeingClient mazeClient) { try{ await mazeClient.Move(Direction.Up); } catch { } try{ await mazeClient.Move(Direction.Up); } catch { } try{ await mazeClient.Move(Direction.Down); } catch { } try{ await mazeClient.Move(Direction.Down); } catch { } try{ await mazeClient.Move(Direction.Left); } catch { } try{ await mazeClient.Move(Direction.Right); } catch { } try{ await mazeClient.Move(Direction.Left); } catch { } try{ await mazeClient.Move(Direction.Right); } catch { } }
private async Task <PossibleActionsAndCurrentScore> MakeMove(Direction direction, List <Stack <Direction> > exitCrumbs, List <Stack <Direction> > collectCrumbs, Stack <Direction> crumbs) { try { var newOptions = await _client.Move(direction); if (newOptions == null) { throw new ArgumentException(); } // Record the move in all crumbs foreach (var st in exitCrumbs) { Push(st, direction); } foreach (var st in collectCrumbs) { Push(st, direction); } Push(crumbs, direction); // Check for nearby exits and collectionPoints TrackExits(newOptions, _exitCrumbs); TrackCollectionPoints(newOptions, _collectCrumbs); return(newOptions); } catch (Exception e) { Console.WriteLine(e.Message); return(null); } }
public async Task <PossibleActionsAndCurrentScore> Move(Direction direction) { IncreaseInvocationCount(); return(await _amazeingClientImplementation.Move(direction)); }