типы поправил в игре

This commit is contained in:
2024-11-10 03:53:11 +03:00
parent 3848e72498
commit f647c9fce5

View File

@@ -14,7 +14,7 @@ indexOf (x : xs) target
| x == target = 0 | x == target = 0
| otherwise = 1 + indexOf xs target | otherwise = 1 + indexOf xs target
nashEquilibriumStrategy :: [a] -> [Char] -> Int -> [Char] nashEquilibriumStrategy :: [Char] -> [Char] -> Int -> [Char]
nashEquilibriumStrategy opponentMoves generatedMoves n = nashEquilibriumStrategy opponentMoves generatedMoves n =
if n <= 100 && length opponentMoves > 0 if n <= 100 && length opponentMoves > 0
then then
@@ -29,7 +29,7 @@ nashEquilibriumStrategy opponentMoves generatedMoves n =
] ]
nextStep = cases !! indexOf results result !! 1 nextStep = cases !! indexOf results result !! 1
getScore :: Num t => [Char] -> [Char] -> t -> t -> (t, t) getScore :: [Char] -> [Char] -> Int -> Int -> (Int, Int)
getScore moves1 moves2 score1 score2 = getScore moves1 moves2 score1 score2 =
if length moves1 == 0 then (score1, score2) if length moves1 == 0 then (score1, score2)
else getScore (tail moves1) (tail moves2) newScore1 newScore2 else getScore (tail moves1) (tail moves2) newScore1 newScore2