Exemple #1
0
Fichier : main.go Projet : qrush/go
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])
	}
}
Exemple #2
0
Fichier : main.go Projet : qrush/go
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())
}
Exemple #3
0
Fichier : main.go Projet : qrush/go
func main() { games.Play(os.Stdin, os.Stdout, os.Stdin, os.Stdout, ttt.NewReferee()) }