h <- connectTo "wettbewerb" (PortNumber 3333) loop h z = do f <- hGetLine h putStrLn f case (zerlege_string f) of "HELO":_ -> helo h z "TURN":x:y:_ -> turn h z (read x) (read y) "THRW":x:_ -> thrw h z (read x) [...] _ -> error $ "loop: " ++ show f helo h Vor_Auth = sende h Nach_Auth "AUTH utz" turn h Nach_Auth x‘ z‘ = turn h (Ich_bin_dran 0 0 0)x‘z‘ turn h (Gegner x y z) x‘ z‘ | z==x‘ && x==z‘ = turn h (Ich_bin_dran x‘x‘z‘)x‘z‘ | otherwise = error $ "turn: gegner: " ++ show (x,y,z,x‘,z‘) turn h (Ich_bin_dran x y z) x‘ z‘ | x==x‘ && z==z‘ = turn_ h (Ich_bin_dran x y z) | otherwise = error $ "turn: ich: " ++ show (x,y,z,x‘,z‘)