docs: format section comments nicely
This commit is contained in:
parent
3a11e7132f
commit
df8bd3290f
1 changed files with 3 additions and 9 deletions
12
Proj2.hs
12
Proj2.hs
|
|
@ -52,7 +52,7 @@ import Data.List
|
||||||
import Data.Set qualified as S
|
import Data.Set qualified as S
|
||||||
import Debug.Trace
|
import Debug.Trace
|
||||||
|
|
||||||
-- datatypes --
|
-- ==== DATA STRUCTURES =======================================================
|
||||||
|
|
||||||
type GameState = [[Pitch]]
|
type GameState = [[Pitch]]
|
||||||
|
|
||||||
|
|
@ -75,10 +75,7 @@ instance Show Octave where
|
||||||
|
|
||||||
instance Show Pitch where
|
instance Show Pitch where
|
||||||
show (Pitch note octave) = show note ++ show octave
|
show (Pitch note octave) = show note ++ show octave
|
||||||
|
-- ==== REQUIRED FUNCTIONS ====================================================
|
||||||
--
|
|
||||||
|
|
||||||
-- required functions --
|
|
||||||
|
|
||||||
toPitch :: String -> Maybe Pitch
|
toPitch :: String -> Maybe Pitch
|
||||||
toPitch [note, octave] = Pitch <$> charToNote note <*> charToOctave octave
|
toPitch [note, octave] = Pitch <$> charToNote note <*> charToOctave octave
|
||||||
|
|
@ -136,9 +133,8 @@ initialGuess = (chord, chords)
|
||||||
nextGuess :: ([Pitch], GameState) -> (Int, Int, Int) -> ([Pitch], GameState)
|
nextGuess :: ([Pitch], GameState) -> (Int, Int, Int) -> ([Pitch], GameState)
|
||||||
nextGuess (prevGuess, chord : chords) _ = (chord, chords)
|
nextGuess (prevGuess, chord : chords) _ = (chord, chords)
|
||||||
|
|
||||||
--
|
-- ==== HELPER FUNCTIONS ======================================================
|
||||||
|
|
||||||
-- helper functions --
|
|
||||||
|
|
||||||
allChords :: [[Pitch]]
|
allChords :: [[Pitch]]
|
||||||
allChords =
|
allChords =
|
||||||
|
|
@ -170,5 +166,3 @@ matches xs ys = maximum permutationMatches
|
||||||
where
|
where
|
||||||
permutationMatches = map (pairwiseMatches xs) (permutations ys)
|
permutationMatches = map (pairwiseMatches xs) (permutations ys)
|
||||||
pairwiseMatches xs ys = length $ filter (uncurry (==)) $ zip xs ys
|
pairwiseMatches xs ys = length $ filter (uncurry (==)) $ zip xs ys
|
||||||
|
|
||||||
--
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue