Sha256: d306f8c249a593cbe4644caa6c1d8c5077904e85f9d594bee2446897377873ad

Contents?: true

Size: 1.95 KB

Versions: 118

Compression:

Stored size: 1.95 KB

Contents

package connect

// Source: exercism/x-common
// Commit: 327db7f connect: Fix canonical-data.json formatting
// x-common version: 1.0.0

var testCases = []struct {
	description string
	board       []string
	expected    string
}{
	{
		description: "an empty board has no winner",
		board: []string{
			". . . . .",
			" . . . . .",
			"  . . . . .",
			"   . . . . .",
			"    . . . . ."},
		expected: "",
	},
	{
		description: "X can win on a 1x1 board",
		board: []string{
			"X"},
		expected: "X",
	},
	{
		description: "O can win on a 1x1 board",
		board: []string{
			"O"},
		expected: "O",
	},
	{
		description: "only edges does not make a winner",
		board: []string{
			"O O O X",
			" X . . X",
			"  X . . X",
			"   X O O O"},
		expected: "",
	},
	{
		description: "illegal diagonal does not make a winner",
		board: []string{
			"X O . .",
			" O X X X",
			"  O X O .",
			"   . O X .",
			"    X X O O"},
		expected: "",
	},
	{
		description: "nobody wins crossing adjacent angles",
		board: []string{
			"X . . .",
			" . X O .",
			"  O . X O",
			"   . O . X",
			"    . . O ."},
		expected: "",
	},
	{
		description: "X wins crossing from left to right",
		board: []string{
			". O . .",
			" O X X X",
			"  O X O .",
			"   X X O X",
			"    . O X ."},
		expected: "X",
	},
	{
		description: "O wins crossing from top to bottom",
		board: []string{
			". O . .",
			" O X X X",
			"  O O O .",
			"   X X O X",
			"    . O X ."},
		expected: "O",
	},
	{
		description: "X wins using a convoluted path",
		board: []string{
			". X X . .",
			" X . X . X",
			"  . X . X .",
			"   . X X . .",
			"    O O O O O"},
		expected: "X",
	},
	{
		description: "X wins using a spiral path",
		board: []string{
			"O X X X X X X X X",
			" O X O O O O O O O",
			"  O X O X X X X X O",
			"   O X O X O O O X O",
			"    O X O X X X O X O",
			"     O X O O O X O X O",
			"      O X X X X X O X O",
			"       O O O O O O O X O",
			"        X X X X X X X X O"},
		expected: "X",
	},
}

Version data entries

118 entries across 118 versions & 1 rubygems

Version Path
trackler-2.1.0.39 tracks/go/exercises/connect/cases_test.go
trackler-2.1.0.38 tracks/go/exercises/connect/cases_test.go
trackler-2.1.0.37 tracks/go/exercises/connect/cases_test.go
trackler-2.1.0.36 tracks/go/exercises/connect/cases_test.go
trackler-2.1.0.34 tracks/go/exercises/connect/cases_test.go
trackler-2.1.0.33 tracks/go/exercises/connect/cases_test.go
trackler-2.1.0.32 tracks/go/exercises/connect/cases_test.go
trackler-2.1.0.31 tracks/go/exercises/connect/cases_test.go
trackler-2.1.0.30 tracks/go/exercises/connect/cases_test.go
trackler-2.1.0.29 tracks/go/exercises/connect/cases_test.go
trackler-2.1.0.28 tracks/go/exercises/connect/cases_test.go
trackler-2.1.0.27 tracks/go/exercises/connect/cases_test.go
trackler-2.1.0.26 tracks/go/exercises/connect/cases_test.go
trackler-2.1.0.25 tracks/go/exercises/connect/cases_test.go
trackler-2.1.0.24 tracks/go/exercises/connect/cases_test.go
trackler-2.1.0.23 tracks/go/exercises/connect/cases_test.go
trackler-2.1.0.22 tracks/go/exercises/connect/cases_test.go
trackler-2.1.0.21 tracks/go/exercises/connect/cases_test.go
trackler-2.1.0.20 tracks/go/exercises/connect/cases_test.go
trackler-2.1.0.19 tracks/go/exercises/connect/cases_test.go