[Haskell-beginners] Function problem
Bruno Sotelo Klinec
janus_1118 at outlook.com
Mon Jun 22 16:08:09 UTC 2015
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!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20150622/eb5e9ce4/attachment.html>
More information about the Beginners
mailing list