【发布时间】:2014-09-24 12:20:39
【问题描述】:
对于一项任务,我需要在提供给该功能的游戏树上编写一个 Minimax 函数(作为棋盘树;玫瑰棋盘)和轮到它的玩家。但是,我收到有关输入“|”上的解析错误的错误。可能是因为我嵌套了条件和 where 语句,但我不确定我是否正确地做到了这一点,或者这是否可能(或者应该以不同的方式完成):
minimax :: Player -> Rose Board -> Rose Int --Rose Int = Int :> [Rose Ints]
minimax p rb = minimax' rb p
where minimax' (b :> [rbs]) p0 | null rbs = result
where result | p0 == p = 1
| otherwise = -1
| otherwise = 0 :> (minimax' rbs (nextPlayer p0))
如果有人可以帮助我,非常感谢!
最好的问候, Skyfe。
【问题讨论】:
-
你必须将内部
where移到警卫之后。