halma/src/Game/Halma/AI/Competitive.hs

Summary

Maintainability
Test Coverage

Use guards
Open

    go (Just (currentMax, bestMove)) (option@(rating, move):options) =
      if isWin rating then
        option
      else if newRating <= currentMax then
        go (Just (currentMax, bestMove)) options

Found

go (Just (currentMax, bestMove)) (option@(rating, move) : options)
  = if isWin rating then option else
      if newRating <= currentMax then
        go (Just (currentMax, bestMove)) options else
        if boundReached newRating then (newRating, move) else
          go (Just (newRating, move)) options
  where newRating = fst $ nextLevel option (Just currentMax)

Perhaps

go (Just (currentMax, bestMove)) (option@(rating, move) : options)
  | isWin rating = option
  | newRating <= currentMax =
    go (Just (currentMax, bestMove)) options
  | boundReached newRating = (newRating, move)
  | otherwise = go (Just (newRating, move)) options
  where newRating = fst $ nextLevel option (Just currentMax)

There are no issues that match your filters.

Category
Status