Dear Gophers,
I have recently made a project of Connect Five. When the imput is wrong it
will have a goroutine problem that says something about out of index, as my
game win function depends on if the x = b and x+1 = b and so on. But if the
imput is not 1,2 1,3 and so on, or it is over 15, 15 it will be wrong. I
made a solution of creating a function like this:
func fix() {
if x == "1"|| x == "2"|| x == "3"|| x == "4"|| x == "5"|| x == "6"|| x ==
"7"|| x == "8"|| x == "9"|| x == "10"|| x == "11"|| x == "12"|| x == "13"||
x == "14"|| x == "15" {
if y == "1"|| y == "2"|| y == "3"|| y == "4"|| y == "5"|| y == "6"|| y ==
"7"|| y == "8"|| y == "9"|| y == "10"|| y == "11"|| y == "12"|| y == "13"||
y == "14"|| y == "15" {
blwi()
} else {
showBoard()
fmt.Println("Sorry you had entered wrong please enter again")
fmt.Scanln(&x,&y)
fix()
}
}
It for some reason won't work. So I wonder if any of you can help me
correct the function and simplify it. (it goes right between the imput and
the win function.)
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.