Sha256: db820b3bb6185e505eb47711bd806dc3f66a7d5699e28670ea906c26590d98f0

Contents?: true

Size: 1.97 KB

Versions: 92

Compression:

Stored size: 1.97 KB

Contents

package connect

// Source: exercism/problem-specifications
// Commit: a02d64d connect: Apply new "input" policy
// Problem Specifications Version: 1.1.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

92 entries across 92 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/go/exercises/connect/cases_test.go
trackler-2.2.1.179 tracks/go/exercises/connect/cases_test.go
trackler-2.2.1.178 tracks/go/exercises/connect/cases_test.go
trackler-2.2.1.177 tracks/go/exercises/connect/cases_test.go
trackler-2.2.1.176 tracks/go/exercises/connect/cases_test.go
trackler-2.2.1.175 tracks/go/exercises/connect/cases_test.go
trackler-2.2.1.174 tracks/go/exercises/connect/cases_test.go
trackler-2.2.1.173 tracks/go/exercises/connect/cases_test.go
trackler-2.2.1.172 tracks/go/exercises/connect/cases_test.go
trackler-2.2.1.171 tracks/go/exercises/connect/cases_test.go
trackler-2.2.1.170 tracks/go/exercises/connect/cases_test.go
trackler-2.2.1.169 tracks/go/exercises/connect/cases_test.go
trackler-2.2.1.167 tracks/go/exercises/connect/cases_test.go
trackler-2.2.1.166 tracks/go/exercises/connect/cases_test.go
trackler-2.2.1.165 tracks/go/exercises/connect/cases_test.go
trackler-2.2.1.164 tracks/go/exercises/connect/cases_test.go
trackler-2.2.1.163 tracks/go/exercises/connect/cases_test.go
trackler-2.2.1.162 tracks/go/exercises/connect/cases_test.go
trackler-2.2.1.161 tracks/go/exercises/connect/cases_test.go
trackler-2.2.1.160 tracks/go/exercises/connect/cases_test.go