Python Forum
Connect Four Win Check Function
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Connect Four Win Check Function
#5
Sorry about the 2d array, of course it's just a list of strings. Wall

I like the idea of a win function with horizontal, vertical, and diagonal functions within. It's the same idea I had.
I don't know about the use of any, but thanks for the suggestion.

What if I just constantly checked every horizontal, vertical and diagonal every turn? If I used the top counter as the main index, and the other three were like a tail.(if it was a diagonal).

"| x |   |   |   |   |   |   |"
"|   | x |   |   |   |   |   |"
"|   |   | x |   |   |   |   |"
"|   |   |   | x |   |   |   |"
"|   |   |   |   |   |   |   |"
"|   |   |   |   |   |   |   |"
So the top left x is the main index one, and the other ones would follow it, so that diagonal would be checked like this:
"|   | x |   |   |   |   |   |"
"|   |   | x |   |   |   |   |"
"|   |   |   | x |   |   |   |"
"|   |   |   |   | x |   |   |"
"|   |   |   |   |   |   |   |"
"|   |   |   |   |   |   |   |"
And when the bottom right when "touches" the end the index moves down. Like a space invader sort or thing.
Please tell me that makes sense. Think
Reply


Messages In This Thread
RE: Connect Four Win Check Function - by mpd - Jan-04-2018, 01:59 PM
RE: Connect Four Win Check Function - by buran - Jan-04-2018, 02:11 PM
RE: Connect Four Win Check Function - by ShadowWarrior17 - Jan-04-2018, 03:31 PM
RE: Connect Four Win Check Function - by mpd - Jan-04-2018, 04:14 PM
RE: Connect Four Win Check Function - by mpd - Jan-04-2018, 05:48 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Date format and past date check function Turtle 5 4,394 Oct-22-2021, 09:45 PM
Last Post: deanhystad
  Is there any way to check if a function is user-defined? dullboy 11 10,489 Oct-06-2016, 03:42 AM
Last Post: dullboy

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020