Case study

Algorithms and Game Intelligence with Python

A collection of academic projects developed in Python during university, exploring programming fundamentals, recursion, computational mathematics, and algorithmic decision-making. The final project implements a Tic-Tac-Toe game against the computer using recursive state exploration and a Minimax-based strategy.

Feb 2020May 2020
academy-python

Technologies

Python

The problem

The assignments were designed to apply fundamental programming concepts to mathematical and logical problems without relying exclusively on built-in solutions. The challenges included calculating geometric properties from user-provided data, implementing mathematical operations using recursion, and developing a computer opponent capable of automatically making strategic decisions in a Tic-Tac-Toe game.

The solution

Command-line applications were developed in Python to solve different types of problems. Geometry modules use trigonometric relationships to calculate triangle sides, angles, heights, area, perimeter, and other properties. Another exercise implements product, quotient, and remainder through recursive calls. For the final project, the game board is represented as a matrix and the computer recursively evaluates possible game states to select the best available move using a Minimax-based strategy.

Responsibilities

Development and collaboration on academic Python assignments, including problem modeling, implementation of mathematical and recursive algorithms, user input validation, and development of the Tic-Tac-Toe game logic. Contributed to game-state evaluation, victory detection, board management, and the decision-making logic used by the computer opponent.

Technical decisions

Python was selected as the primary language to keep the focus on programming logic and algorithm fundamentals. Mathematical problems were decomposed into dedicated calculation and validation functions. Recursion was intentionally used as a core technique in several exercises, including arithmetic operations and exploration of possible Tic-Tac-Toe states. In the final project, the board was represented as a 3×3 matrix and terminal states were assigned scores, allowing the computer to compare possible moves and select the most favorable outcome.

Results

The projects strengthened core skills in structured programming, problem decomposition, matrix manipulation, recursion, and computational mathematics. The final result included a functional command-line Tic-Tac-Toe game with a computer opponent capable of evaluating future game states and selecting strategic moves, alongside applications for calculating and classifying geometric properties of triangles.