Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Issue #2 #2

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
20 changes: 10 additions & 10 deletions connect4.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
import sys
import math

BLUE = (0,0,255)
BLACK = (0,0,0)
RED = (255,0,0)
RED = (165, 42, 42)
GREEN = (0,120,0)
WHITE = (255,255,255)
YELLOW = (255,255,0)

ROW_COUNT = 6
COLUMN_COUNT = 7
ROW_COUNT = 8
COLUMN_COUNT = 8

def create_board():
board = np.zeros((ROW_COUNT,COLUMN_COUNT))
Expand Down Expand Up @@ -57,8 +57,8 @@ def winning_move(board, piece):
def draw_board(board):
for c in range(COLUMN_COUNT):
for r in range(ROW_COUNT):
pygame.draw.rect(screen, BLUE, (c*SQUARESIZE, r*SQUARESIZE+SQUARESIZE, SQUARESIZE, SQUARESIZE))
pygame.draw.circle(screen, BLACK, (int(c*SQUARESIZE+SQUARESIZE/2), int(r*SQUARESIZE+SQUARESIZE+SQUARESIZE/2)), RADIUS)
pygame.draw.rect(screen, GREEN, (c*SQUARESIZE, r*SQUARESIZE+SQUARESIZE, SQUARESIZE, SQUARESIZE))
pygame.draw.circle(screen, WHITE, (int(c*SQUARESIZE+SQUARESIZE/2), int(r*SQUARESIZE+SQUARESIZE+SQUARESIZE/2)), RADIUS)

for c in range(COLUMN_COUNT):
for r in range(ROW_COUNT):
Expand Down Expand Up @@ -98,7 +98,7 @@ def draw_board(board):
sys.exit()

if event.type == pygame.MOUSEMOTION:
pygame.draw.rect(screen, BLACK, (0,0, width, SQUARESIZE))
pygame.draw.rect(screen, WHITE, (0,0, width, SQUARESIZE))
posx = event.pos[0]
if turn == 0:
pygame.draw.circle(screen, RED, (posx, int(SQUARESIZE/2)), RADIUS)
Expand All @@ -107,7 +107,7 @@ def draw_board(board):
pygame.display.update()

if event.type == pygame.MOUSEBUTTONDOWN:
pygame.draw.rect(screen, BLACK, (0,0, width, SQUARESIZE))
pygame.draw.rect(screen, WHITE, (0,0, width, SQUARESIZE))
#print(event.pos)
# Ask for Player 1 Input
if turn == 0:
Expand Down Expand Up @@ -145,4 +145,4 @@ def draw_board(board):
turn = turn % 2

if game_over:
pygame.time.wait(3000)
pygame.time.wait(5000)