2024-02-25 07:34:27 +01:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
)
|
|
|
|
|
2024-02-29 06:50:39 +01:00
|
|
|
var cell string = "x"
|
|
|
|
var x int
|
|
|
|
var y int
|
|
|
|
|
2024-02-25 07:34:27 +01:00
|
|
|
func main() {
|
2024-03-01 20:45:21 +01:00
|
|
|
matrix := [][]string{
|
2024-02-29 06:50:39 +01:00
|
|
|
{cell, cell, cell},
|
|
|
|
{cell, "1", cell},
|
|
|
|
{cell, cell, cell},
|
2024-02-25 07:34:27 +01:00
|
|
|
}
|
|
|
|
|
2024-03-01 20:45:21 +01:00
|
|
|
for i := 0; i < len(matrix); i++ {
|
|
|
|
for _, v := range matrix[i] {
|
2024-02-29 06:50:39 +01:00
|
|
|
fmt.Printf("%v ", v)
|
2024-02-25 07:34:27 +01:00
|
|
|
}
|
|
|
|
fmt.Println()
|
|
|
|
}
|
2024-02-29 06:50:39 +01:00
|
|
|
|
|
|
|
fmt.Printf("Where's the one?\n")
|
|
|
|
fmt.Printf("X coordinate: ")
|
|
|
|
fmt.Scanln(&x)
|
|
|
|
fmt.Printf("Y coordinate: ")
|
|
|
|
fmt.Scanln(&y)
|
2024-03-01 20:45:21 +01:00
|
|
|
x--
|
|
|
|
y--
|
2024-02-29 06:50:39 +01:00
|
|
|
|
2024-03-01 20:45:21 +01:00
|
|
|
if matrix[x][y] == "1" {
|
|
|
|
fmt.Println("You win!")
|
|
|
|
} else {
|
|
|
|
fmt.Println("You lose!")
|
|
|
|
}
|
2024-02-29 06:50:39 +01:00
|
|
|
|
2024-02-25 07:34:27 +01:00
|
|
|
}
|