What I am trying to do is make a program that will go through a two dimensional square of numbers and find the path that gives the highest total. Starting from the top, valid moves are down, and down left/right if available.
The problem that I am having is I am using this function:
slice :: [Int] -> Int -> Int -> [Int]
slice x i k
| i > k = []
| otherwise = (take (k-i+1) (drop (i-1) x))
and this function:
path :: Board -> [Int]
path [] = []
path (x:xs) = (maximum (slice x 3 5 ) : path xs
where a type Board is a list of lists.
Could anyone explain to me how I could use variables instead of the 3 and 5, this way I could get all the combos, and then evaluate which is the best route.
hlintthat helps with indentation and ()-errors -cabal install hlint