February 2018
Beginner
200 pages
4h 37m
English
Here’s the function that calculates the total points spent in attributes:
| | defmodule CharacterAttributes do |
| | def total_spent(%{strength: str, dexterity: dex, intelligence: int}) do |
| | (str * 2) + (dex * 3) + (int * 3) |
| | end |
| | end |
The Tic-Tac-Toe module should be like this:
| | defmodule TicTacToe do |
| | def winner({ |
| | x, x, x, |
| | _, _, _, |
| | _, _, _ |
| | }), do: {:winner, x} |
| | |
| | def winner({ |
| | _, _, _, |
| | x, x, x, |
| | _, _, _ |
| | }), do: {:winner, x} |
| | |
| | def winner({ |
| | _, _, _, |
| | _, _, _, |
| | x, x, x |
| | }), do: {:winner, x} |
| | |
| | def winner({ |
| | x, _, _, |
| | x, _, _, |
| | x, _, _ ... |
Read now
Unlock full access