manitofigh / connect-four

Connect 4 to win
0 stars 0 forks source link

did not detect diagonal win #1

Open manitofigh opened 1 week ago

manitofigh commented 1 week ago
| [1] | [2] | [3] | [4] | [5] | [6] | [7] | [8] |
|-----------------------------------------------|
| [ ] | [ ] | [ ] | [ ] | [ ] | [o] | [ ] | [ ] |
| [ ] | [ ] | [ ] | [ ] | [ ] | [x] | [ ] | [ ] |
| [ ] | [ ] | [x] | [o] | [ ] | [x] | [ ] | [ ] |
| [ ] | [o] | [o] | [x] | [o] | [x] | [o] | [ ] |
| [ ] | [x] | [o] | [x] | [x] | [o] | [x] | [ ] |
| [ ] | [o] | [x] | [o] | [o] | [x] | [o] | [x] |
| [x] | [o] | [o] | [x] | [x] | [x] | [o] | [o] |
| [x] | [x] | [x] | [o] | [o] | [o] | [x] | [o] |
|-----------------------------------------------|

O Won!

x was supposed to win in 3,4,5,6 (last x placed in col 5)

manitofigh commented 1 week ago

I'm stupid... of course it's not gonna detect it if x ws placed in col 5 last. The current implementation is stupid. It detects only when you place the winning (4th) connecting element at the edge (either very right, left, top right/left, or bottom right/left, not when the middle one makes a 4+ connection. Logic needs re-implementation.