Hi there! I was hoping you could help me a bit here with making a function. I am asked to write functions to make a mini robot game, which uses these data and types:
data Program = Move Direction Program
|Radar (Robot -> Point) Program
|Shoot Point Program
|Surrender
data Direction = N|S|E|O
type Point = (Int,Int)
data Robot = R1|R2
And then I have to write functions like this:
prog1::Program
prog1 = Move E $ Radar R1 (2,4) $ Radar R2 (5,6) $ Shoot (5,7) prog1
My problem is the function adjust::Direction->Program->Program that takes one direction and a program and moves every shot in that program one unit in the given direction. I can't figure out how to do this, I would really appreciate you could help me, thanks!