packages feed

SoccerFun-0.5: SoccerFun/Tape/Record.hs

{-# LANGUAGE UnicodeSyntax #-}
-- | Usage: Hit /q/ to abort the match
module Main where

import Control.Monad
import System.Exit
import Prelude.Unicode
import Data.Binary
import SoccerFun.Tape
import SoccerFun.MatchControl
import SoccerFun.MatchGame
import System.Environment

main ∷ IO ()
main = do
	prog ← getProgName
	args ← getArgs
	let (t1,t2) = case args of
		[t1,t2] → (t1,t2)
		notTwo → error $ unlines
			["Record a match between two teams <Team1> and <Team2>",
			 "Usage: " ⧺ prog ⧺ " <dir1> <dir2>",
			 "  where both arguments are paths to directories containing a team module."]
	dynRecord t1 t2

--	(t1name,t2name,match) ← dynSetupMatch t1 t2
--	let tape = recordMatch match
--	encodeFile (t1name ⧺ "-" ⧺ t2name ⧺ ".sft") tape
--	let Tape steps = tape
--	    endOfMatch = snd (last steps)
--	    finalScore = score endOfMatch
--	putStrLn $ show (fst finalScore) ⧺ " / " ⧺ show (snd finalScore)