diff --git a/solutions/elixir/rpg-character-sheet/1/lib/rpg/character_sheet.ex b/solutions/elixir/rpg-character-sheet/1/lib/rpg/character_sheet.ex new file mode 100644 index 0000000..feaa24e --- /dev/null +++ b/solutions/elixir/rpg-character-sheet/1/lib/rpg/character_sheet.ex @@ -0,0 +1,27 @@ +defmodule RPG.CharacterSheet do + def welcome() do + IO.puts("Welcome! Let's fill out your character sheet together.") + end + + def ask_name() do + IO.gets("What is your character's name?\n") |> String.trim + end + + def ask_class() do + IO.gets("What is your character's class?\n") |> String.trim + end + + def ask_level() do + IO.gets("What is your character's level?\n") |> String.trim |> String.to_integer + end + + def run() do + welcome() + + %{} + |> Map.put(:name, ask_name()) + |> Map.put(:class, ask_class()) + |> Map.put(:level, ask_level()) + |> IO.inspect(label: "Your character") + end +end