Current section

40 Versions

Jump to

Compare versions

3 files changed
+14 additions
-11 deletions
  @@ -1,7 +1,7 @@
1 1 {<<"links">>,
2 2 [{<<"GitHub">>,<<"https://github.com/RaymondLoranger/islands_guesses">>}]}.
3 3 {<<"name">>,<<"islands_guesses">>}.
4 - {<<"version">>,<<"0.1.37">>}.
4 + {<<"version">>,<<"0.1.38">>}.
5 5 {<<"description">>,
6 6 <<"A guesses struct and functions for the Game of Islands.">>}.
7 7 {<<"elixir">>,<<"~> 1.11">>}.
  @@ -5,8 +5,12 @@ defmodule Islands.Guesses do
5 5 @moduledoc """
6 6 A guesses struct and functions for the _Game of Islands_.
7 7
8 - The guesses struct contains the fields `hits` and `misses` representing the
9 - guesses of an opponent in the _Game of Islands_.
8 + The guesses struct contains the fields:
9 +
10 + - `hits`
11 + - `misses`
12 +
13 + representing the guesses of an opponent in the _Game of Islands_.
10 14
11 15 ##### Based on the book [Functional Web Development](https://pragprog.com/titles/lhelph/functional-web-development-with-elixir-otp-and-phoenix/) by Lance Halvorsen.
12 16 """
  @@ -28,12 +32,11 @@ defmodule Islands.Guesses do
28 32
29 33 ## Examples
30 34
31 - iex> Islands.Guesses.new()
32 - %Islands.Guesses{
33 - hits: MapSet.new(),
34 - misses: MapSet.new()
35 - }
35 + iex> alias Islands.Guesses
36 + iex> Guesses.new()
37 + %Guesses{hits: MapSet.new(), misses: MapSet.new()}
36 38 """
39 + @dialyzer {:no_opaque, [new: 0]}
37 40 @spec new :: t
38 41 def new, do: %Guesses{hits: MapSet.new(), misses: MapSet.new()}
39 42
  @@ -55,7 +58,7 @@ defmodule Islands.Guesses do
55 58
56 59 @doc """
57 60 Returns a map assigning to :squares the list of square numbers
58 - from the `guesses`'s hits.
61 + from `guesses`'s hits.
59 62 """
60 63 @spec hit_squares(t) :: %{:squares => [Coord.square()]}
61 64 def hit_squares(%Guesses{hits: hits} = _guesses) do
  @@ -64,7 +67,7 @@ defmodule Islands.Guesses do
64 67
65 68 @doc """
66 69 Returns a map assigning to :squares the list of square numbers
67 - from the `guesses`'s misses.
70 + from `guesses`'s misses.
68 71 """
69 72 @spec miss_squares(t) :: %{:squares => [Coord.square()]}
70 73 def miss_squares(%Guesses{misses: misses} = _guesses) do
  @@ -4,7 +4,7 @@ defmodule Islands.Guesses.MixProject do
4 4 def project do
5 5 [
6 6 app: :islands_guesses,
7 - version: "0.1.37",
7 + version: "0.1.38",
8 8 elixir: "~> 1.11",
9 9 start_permanent: Mix.env() == :prod,
10 10 name: "Islands Guesses",