Python Forum
Connect Four Win Check Function
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Connect Four Win Check Function
#1
I am creating a Connect Four game and was wondering on how to create a function to determine if a player has won.

This is my board:
"|   |   |   |   |   |   |   |"
"|   |   |   |   |   |   |   |"
"|   |   |   |   |   |   |   |"
"|   |   |   |   |   |   |   |"
"|   |   |   |   |   |   |   |"
"|   |   |   |   |   |   |   |"
The nth term between each counter space is 4n-2.

I have started with something like this:
def wincheck(alist):
    x=0
    y=0
    pos=(4*x)-2
My board is stored as a 2d array, so the function will use that.

Any suggestions?
Reply


Messages In This Thread
Connect Four Win Check Function - by ShadowWarrior17 - Jan-03-2018, 09:37 PM
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 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,334 Oct-22-2021, 09:45 PM
Last Post: deanhystad
  Is there any way to check if a function is user-defined? dullboy 11 10,451 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