Skip to content

Instantly share code, notes, and snippets.

@sasagawa888
Created August 2, 2020 07:52
Show Gist options
  • Save sasagawa888/3042c44129ec25040c4edde223d7c9ed to your computer and use it in GitHub Desktop.
Save sasagawa888/3042c44129ec25040c4edde223d7c9ed to your computer and use it in GitHub Desktop.
defmodule Midi do
@moduledoc """
Documentation for `Midi`.
"""
@doc """
Tarai function music.
## Examples
iex> Midi.tarai(12,6,0)
"""
def tarai(x,y,z) do
MidiSynth.play(x*2 + 72, 100)
Process.sleep(100)
MidiSynth.play(y*2 + 72, 100)
Process.sleep(100)
MidiSynth.play(z*2 + 72, 100)
Process.sleep(100)
if x <= y do
y
else
tarai(tarai(x-1,y,z),
tarai(y-1,z,x),
tarai(z-1,x,y))
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment