feat: change the initialguess based on average metrics derived from the testing branch

This commit is contained in:
wi11-holdsworth 2025-10-08 15:11:34 +11:00
parent 46ece35fde
commit b8f85fbbcf

View file

@ -36,7 +36,10 @@
-- As the performer, we must guess the target in as few steps as possible given -- As the performer, we must guess the target in as few steps as possible given
-- the feedback from the composer at each turn. -- the feedback from the composer at each turn.
-- --
-- TODO: finish explanation of initialGuess -- To pick the best first guess, we play musician with a range of first-guess
-- candidates and calculate the average number of guesses needed over all
-- targets. The guess with the lowest average was [A1, D2, G3]. some
-- justifying metrics are provided in a comment above `initialGuess`.
-- --
-- To pick the best next guess, we filter the game state to contain only -- To pick the best next guess, we filter the game state to contain only
-- targets that are consistent with the received feedback from the previous -- targets that are consistent with the received feedback from the previous
@ -161,17 +164,26 @@ feedback target guess = (pitches, notes, octaves)
-- which is all possible starting guesses. characteristics of these guesses -- which is all possible starting guesses. characteristics of these guesses
-- are described in the documentation for `allChords` -- are described in the documentation for `allChords`
-- --
-- currently, the best first guess is "vibes based". there is a TODO to -- a pretty good first guess was found by playing musician over all possible
-- actually evaluate the best guess properly. -- targets and calculating the average number of guesses (given a first guess)
--
-- here are some convincing metrics:
--
-- [A1, D2, G3]: 4.25
-- [C1, D2, E3]: 4.27
-- [A2, D2, G2]: 4.32
-- [C2, D2, E2]: 4.34
-- [D1, D2, D3]: 4.80
--
-- we choose [A1, D2, G3] as it has the lowest average number of guesses
-- --
initialGuess :: ([Pitch], GameState) initialGuess :: ([Pitch], GameState)
initialGuess = (bestFirstGuess, allChords) initialGuess = (bestFirstGuess, allChords)
where where
-- TODO: is this really the best first guess?
bestFirstGuess = bestFirstGuess =
[ Pitch C One, [ Pitch A One,
Pitch D Two, Pitch D Two,
Pitch E Three Pitch G Three
] ]
-- takes in the previous guess, the game state, and the feedback for the -- takes in the previous guess, the game state, and the feedback for the