Skip to content

go-counting: Move hints to HINTS.md #344

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 21, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions exercises/go-counting/HINTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
## Hints

To complete this exercise, you need to implement the following functions:

- `territories` returns the coordinates (1 based, top left is (1,1))
of the points in each territory along with who "owns" the territory.

- `territoriesFor` returns the territory that contains the coordinate
along with the owner of the territory. If the coordinate does not point
to an empty location, returns *Nothing*.

A territory is owned by one of the players if that player's stones
are the only stones adjacent to the territory.

You will find the type signatures already in place, but it is up to you
to define the functions.
7 changes: 0 additions & 7 deletions exercises/go-counting/src/Counting.hs
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,8 @@ import Data.Set (Set)
data Color = Black | White deriving (Eq, Ord, Show)
type Coord = (Int, Int)

-- | Returns the coordinates (1 based, top left is (1,1)) of of the points
-- in each territory along with who "owns" the territory. A territory is
-- owned by one of the players if that player's stones are the only
-- stones adjacent to the territory.
territories :: [[Char]] -> [(Set Coord, Maybe Color)]
territories = undefined

-- | Returns the territory that contains the coordinate along with the
-- owner of the territory. If the coordinate does not point to an empty
-- location returns Nothing.
territoryFor :: [[Char]] -> Coord -> Maybe (Set Coord, Maybe Color)
territoryFor = undefined
24 changes: 0 additions & 24 deletions exercises/go-counting/test/Tests.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,6 @@ import Data.List (foldl', sort)
import qualified Data.Set as Set
import Counting (Color(..), territories, territoryFor)

-- Your code should define the following types:
--
-- data Color = Black | White
-- deriving (Eq, Ord, Show) -- More derivations are allowed
--
-- The signatures below assume the following type alias:
--
-- type Coord = (Int, Int)
--
-- Your code should define the following functions:
--
-- territories :: [[Char]] -> [(Set Coord, Maybe Color)]
--
-- Returns the coordinates (1 based, top left is (1,1)) of of the points
-- in each territory along with who "owns" the territory. A territory is
-- owned by one of the players if that player's stones are the only
-- stones adjacent to the territory.
--
-- territoryFor :: [[Char]] -> Coord -> Maybe (Set Coord, Maybe Color)
--
-- Returns the territory that contains the coordinate along with the
-- owner of the territory. If the coordinate does not point to an empty
-- location returns Nothing.

exitProperly :: IO Counts -> IO ()
exitProperly m = do
counts <- m
Expand Down