docs: add longer explanation assuming user is not familiar with the project
This commit is contained in:
parent
80314a3a01
commit
3a11e7132f
1 changed files with 34 additions and 0 deletions
34
Proj2.hs
34
Proj2.hs
|
|
@ -3,6 +3,40 @@
|
||||||
--
|
--
|
||||||
-- Implements toPitch, feedback, initialGuess and nextGuess to efficiently
|
-- Implements toPitch, feedback, initialGuess and nextGuess to efficiently
|
||||||
-- play the game of musician as both the composer and the performer.
|
-- play the game of musician as both the composer and the performer.
|
||||||
|
--
|
||||||
|
--
|
||||||
|
-- The game of musician is two players, a composer and a performer. The
|
||||||
|
-- composer initially creates a three-pitch chord, where each pitch is a
|
||||||
|
-- usual musical note (A-G excluding flats and sharps) and an octave 1-3. The
|
||||||
|
-- performer must then guess the chord. At each turn, the performer they
|
||||||
|
-- provides a guess to the composer who returns with some feedback. The
|
||||||
|
-- feedback contains the number of correct pitches in the performer's guess, as
|
||||||
|
-- well as the number of correct notes and octaves in the composer's guess.
|
||||||
|
--
|
||||||
|
-- Note that notes and guesses are not double counted, e.g. if the performer
|
||||||
|
-- has been told pitch A1 in their guess is correct, they will not also be
|
||||||
|
-- told note A and octave 1 are correct (unless there are multiple instances of
|
||||||
|
-- A and/or 1).
|
||||||
|
--
|
||||||
|
-- As the composer, we must do the following:
|
||||||
|
-- 1. create a chord for the performer to guess
|
||||||
|
-- 2. provide feedback on the performer's guess
|
||||||
|
--
|
||||||
|
-- 1. is taken care of by the testing framework, so we only need to handle 2.
|
||||||
|
-- in this file. For pitches, find the intersection between the target and the
|
||||||
|
-- guess. This will give us the correct pitches (and the number of them). Then
|
||||||
|
-- we can remove the correct pitches from the target and the guess and split
|
||||||
|
-- up the target and guess into notes and octaves. We then permute the target
|
||||||
|
-- and match the guess with each permutation. To match means to count the
|
||||||
|
-- number of pairwise equivalences, e.g. if we match the guess [1,2,3] with a
|
||||||
|
-- permutation of the target [1,3,2], our "match value" is 2. This operation
|
||||||
|
-- can be performed on the notes lists and the octaves lists to get the number
|
||||||
|
-- of correct notes and octaves. This feedback is provided to the performer.
|
||||||
|
--
|
||||||
|
-- As the performer, we must guess the target in as few steps as possible given
|
||||||
|
-- the feedback from the composer at each turn.
|
||||||
|
--
|
||||||
|
-- TODO: finish explanation of initialGuess and nextGuess
|
||||||
|
|
||||||
module Proj2
|
module Proj2
|
||||||
( Pitch,
|
( Pitch,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue