2025-11-14 22:38:06 +01:00
2025-11-14 22:33:17 +01:00
2025-11-14 22:38:06 +01:00
2025-11-14 22:32:03 +01:00
2025-11-14 22:32:39 +01:00
2025-11-14 22:32:43 +01:00

Drop4

A simple implementation of the game Puissance 4, written in C.

Why ? Because I got bored on friday night.

Implementation details

The board is represented as a 2D array of integers.

The last played piece is stored in the last_row and last_col variables, allowing us to efficiently check for a win by examining lines extending from that position in 4 directions (horizontal, vertical, and both diagonals).

Game is a struct with the board, the current player, and the last played piece.

What else... I guess input handling is prettty robust, I check most of the possible edge cases.

Rules

The game is played on a 6x7 grid.

The players take turns dropping their pieces into the grid.

The first player to get 4 pieces in a row (horizontally, vertically, or diagonally) wins.

How to play

Just compile and run the program.

make
./drop4

License

BSD 3-Clause License

Description
Puissance 4 written in C
Readme BSD-3-Clause 33 KiB
Languages
C 98.1%
Makefile 1.9%