exNoops v0.1.1 Exnoops.Directbot View Source

Module to interact with Github's Noop: Directbot

See the official noop documentation for API information including the accepted parameters

Link to this section Summary

Functions

Query Directbot for direction(s)

Link to this section Functions

Link to this function

get_direction(opts \\ []) View Source
get_direction(keyword()) :: {atom(), list()}

Query Directbot for direction(s)

  • Parameters are sent with a keyword list into the function
  • Returns a list of tuples: {direction, distance, speed, coordinate tuple {{a_x, a_y}, {b_x, b_y}}}

Examples

iex> Exnoops.Directbot.get_direction()
{:ok, [{:up, 96, 97, nil}]}

iex> Exnoops.Directbot.get_direction([count: 5])
{:ok, [
  {:down, 73, 58, nil},
  {:right, 58, 69, nil},
  {:down, 42, 12, nil},
  {:right, 51, 84, nil},
  {:down, 35, 14, nil},
]}

# Set max speed and distance
iex> Exnoops.Directbot.get_direction([count: 5, speed: 5, distance: 10])
{:ok, [
  {:left, 10, 2, nil},
  {:down, 10, 2, nil},
  {:right, 10, 2, nil},
  {:down, 10,1, nil},
  {:up, 10,4, nil}
]}

iex> Exnoops.Directbot.get_direction([count: 1, connected: 1])
{:ok, [{:up, 32, 6, {{84,609}, {91,609}}}]}