# `Journey.Examples.UselessMachine`
[🔗](https://github.com/shipworthy/journey/blob/main/lib/journey/examples/useless_machine.ex#L1)

This module ([lib/journey/examples/useless_machine.ex](https://github.com/shipworthy/journey/blob/main/lib/journey/examples/useless_machine.ex)) contains an example of building a Useless Machine using Journey.

Here is an example of running the useless Machine:

```elixir
iex> graph = Journey.Examples.UselessMachine.graph()
iex> execution = Journey.start(graph)
iex> Journey.get_value(execution, :switch)
{:error, :not_set}
iex> Journey.get_value(execution, :paw)
{:error, :not_set}
iex> Journey.set(execution, :switch, "on")
iex> # updating switch triggers :paw
iex> {:ok, "updated :switch"} = Journey.get_value(execution, :paw, wait: :any)
iex> # :paw set switch back to "off"
iex> {:ok, "off"} = Journey.get_value(execution, :switch, wait: :any)
```

# `graph`

This function defines the graph for the Useless Machine.
It starts with a switch input and mutates the state to "off" when the switch
is toggled, simulating the behavior of a Useless Machine.

# `lol_no`

This function simulates the paw's response when the switch is toggled.
It prints a message and mutates the state of the :switch node to "off".

---

*Consult [api-reference.md](api-reference.md) for complete listing*
