Added an actual win condition
Also realized that I was supposed to decrement the X/Y values instead of incrementing them
This commit is contained in:
parent
38fe54f3de
commit
a4667e2039
|
@ -9,14 +9,14 @@ var x int
|
|||
var y int
|
||||
|
||||
func main() {
|
||||
a := [][]string{
|
||||
matrix := [][]string{
|
||||
{cell, cell, cell},
|
||||
{cell, "1", cell},
|
||||
{cell, cell, cell},
|
||||
}
|
||||
|
||||
for i := 0; i < len(a); i++ {
|
||||
for _, v := range a[i] {
|
||||
for i := 0; i < len(matrix); i++ {
|
||||
for _, v := range matrix[i] {
|
||||
fmt.Printf("%v ", v)
|
||||
}
|
||||
fmt.Println()
|
||||
|
@ -27,9 +27,13 @@ func main() {
|
|||
fmt.Scanln(&x)
|
||||
fmt.Printf("Y coordinate: ")
|
||||
fmt.Scanln(&y)
|
||||
x++
|
||||
y++
|
||||
x--
|
||||
y--
|
||||
|
||||
fmt.Println(a[x][y])
|
||||
if matrix[x][y] == "1" {
|
||||
fmt.Println("You win!")
|
||||
} else {
|
||||
fmt.Println("You lose!")
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue