Skip to main content

Connect Square

From wikipedia: Connect Four:

Connect Four is a game in which the players choose a color and then take turns dropping colored tokens into a six-row, seven-column vertically suspended grid. The pieces fall straight down, occupying the lowest available space within the column. The objective of the game is to be the first to form a horizontal, vertical, or diagonal line of four of one's own tokens.

As a twist, this TUI implementation also offers two more variations of the game:

  • form a square, i.e. four cells forming 90 degree angles and equidistant from each other
  • form a line or square

Screenshots

Adjust your terminal's dimension for the game widgets to appear properly, for example 80x30 (characters x lines). Sample screenshots are shown below:

Sample Connect Four game

Sample Connect Square game

Sample Connect Four or Square game

Guide

  • Press the n key to start a new game. Existing game, if any, will be abandoned
  • You can choose between Connect Four, Connect Square (default) and Both types of game
  • You can choose between Easy (default), Medium and Hard difficulty modes:
    • In the Easy mode, the AI will make a random move
    • In the Medium mode, the AI will make a random move based on certain weight calculations
    • In the Hard mode, the AI will make the best move based on the weight calculations (the algorithm is based only on the current board state and thus it is not impossible for the user to win)
  • The first move is based on the User first (default) and AI first choices
  • Only the bottom most empty cell of each column will be considered as a valid move
  • Press the t key to toggle between light and dark themes
  • Press the q key to quit the app

User moves are denoted by the ⭕️ character and AI moves are denoted by the ✖️ character.

The text panel under the game board displays the current status of the game. If the game ends with one of the players forming a valid line or square, the cells forming the winning move will be highlighted.

Metadata

Release files for connectsquare 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for connectsquare 1.0.0
File Size Uploaded
connectsquare-1.0.0.tar.gz 5.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for connectsquare 1.0.0
File Interpreter ABI Platform
connectsquare-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 12.3 kB

Release files / connectsquare-1.0.0.tar.gz

Download URL connectsquare-1.0.0.tar.gz
Size 5.5 kB
Tags Source
SHA-256 checksum
How to use checksums
824de7285a69e7747b15039ec9348e162f0993416c55ca3afd489cc3ccd1b6c2
BLAKE2b-256 checksum
How to use checksums
e7677b42b471eeb9e29030d6d60701082dd273d02251643581be2557e3bcd60e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.21

Release files / connectsquare-1.0.0-py3-none-any.whl

Download URL connectsquare-1.0.0-py3-none-any.whl
Size 6.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a5a503fc25b043012feee70bb4d19b4ea854dbdb58234eaacbcf1acc8e51478e
BLAKE2b-256 checksum
How to use checksums
566ce3edce1bf91d9bbc87a08b7783c506d6efb2c2a0e246c3da63eadcf09345
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.21

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page