func main() { if len(os.Args) == 2 { file, _ := os.Open(os.Args[1], os.O_RDWR, 0) games.Play(os.Stdin, os.Stdout, file, file, rps.NewReferee()) } else if len(os.Args) == 1 { games.Play(os.Stdin, os.Stdout, os.Stdin, os.Stdout, rps.NewReferee()) } else { fmt.Printf("Invalid arguments. Usage: %s [terminal]", os.Args[0]) } }
func main() { var player1, player2 games.View if *games.PlayerA { player1 = games.NewLocalView("A", os.Stdin, os.Stdout) player2 = games.NewProxyView("B", flag.Arg(0), flag.Arg(1)) } else { player2 = games.NewProxyView("A", flag.Arg(0), flag.Arg(1)) player1 = games.NewLocalView("B", os.Stdin, os.Stdout) } games.Play(player1, player2, rps.NewReferee()) }