Git Product home page Git Product logo

puissance-4's Introduction

Connect Four Game

This repository contains Python code for a Connect Four game implemented using Pygame and NumPy. Connect Four is a classic two-player connection game in which the players take turns dropping colored discs from the top into a vertically suspended grid. The objective of the game is to be the first to form a horizontal, vertical, or diagonal line of four of one's discs.

Introduction

Connect Four is a popular strategy game that can be played by two players. The game provides a grid where players take turns dropping their discs (represented by colors) into the grid columns. The discs fall to the lowest available position within the column. The player who first forms a sequence of four discs in a row (horizontally, vertically, or diagonally) wins the game.

Code Description

The code in this repository consists of several components:

Grille Class

The Grille class represents the game board. It includes methods for checking the validity of a move, placing a disc, checking for a win, and more.

Fenetre Class

The Fenetre class manages the graphical user interface (GUI) of the game. It uses Pygame to display the game grid and handle user interactions.

Main Game Loop

The main function initializes the game, handles player turns, and checks for a win or draw.

How to Play

  1. Run the script to start the Connect Four game.
  2. Two players take turns clicking on the columns where they want to drop their discs.
  3. The game will display the board with each player's discs.
  4. The first player to form a sequence of four discs in a row wins the game.
  5. If the board becomes full without a winner, the game ends in a draw.

puissance-4's People

Contributors

nadalbdh avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.