FlaskOthello
- 6 Devlogs
- 19 Total hours
Othello in JS but Flask backend bc python
Othello in JS but Flask backend bc python
Sixth Devlog! (IM LOWKEY REMEMBERING TO DO THESE)
This one was heavy on AI modifications, but I also implemented a replay system! I added transposition tables to the AI, which allows it to reuse positions it has already searched, along with a BUNCH of benchmarking for comparing.
I also changed the AI’s minimax search to make and undo moves in-place instead of constantly creating new OthelloBoard objects which was a BIG optimization.
Now, about that replay system! Games now keep a full move history which allows you to rewatch your game after play. You can jump to the start/end, step through moves one by one, and hold the buttons to scrub through the game.
Lastly, I improve the piece flip animations so captured pieces do a proper flip + many minor bug fixes / refactors.
Fifth devlog! (I KEEP FORGETTING TO DO THESE)
SO much has happened. I added full Player vs CPU support, fixed a major bug where if the AI was black it never made a starting move + a crash from the AI “make a move” loop firing every 1.5s 💀
Draw offers and resignation have been added. For draws, either player can offer and the other can accept/decline, and the AI automatically responds to draw requests based on piece count. Resignation has a confirm dialog to prevent accidents.
Games are now automatically archived when they conclude (read only game copy at /archive/<id> which you’re automatically redirected to if on a stale /game/<id> URL).
I also added piece ‘flip’ animations for the tiles that just got captured, so you can easily tell which tiles have just been captured.
And alongside all this, TONS of refactoring and bug fixes, including extracing common code into resolve_player() and serialize_game() functions, and a strings.js module for game status strings.
Fourth devlog!!
Today I built the actual frontend with a landing page (pick black/white, creates a game and redirects you), a live board page which polls the backend every 1.5s, click to play on legal squares, and CSS of course (green board, yellow legal move outlines).
Previously, when the player had no legal moves, the game would just stop and you’d be stuck. Now, your turn is automatically passed if you have no legal moves.
Added last-move highlighting (red outline on the most recently placed piece, so it’s obvious where your opponent just played) and a proper game-over screen showing the winning colour and final tile count.
Third devlog! (I forgot to devlog…)
I fixed a bunch of serious bugs in the engine (illegal moves overwriting occupied tiles, allowing negative indexing of the board, and more). The minimax now scores wins/loses by token count, not positional advantage at the end of the game, and some documentation cleanup.
I also started working on the Flask backend, which now features 4 API routes for creating and joining games, making your move, and calling for AI moves.
I tested this thoroughly with cURL, so hopefully there aren’t any significant bugs!
My second devlog!
It’s 1:17am right now, but I just finished implementing the most basic minimax algorithm possible, and it (miraculously) works!
I even hacked together a quick CPU vs CPU prototype, and it plays all the way through without any bugs, crashes or other breakage.
Goodnight 💀
First Devlog!
I have a really bad habit of starting 12 projects and never shipping any of them… so I started yet another project!
I loved playing Othello with my brother growing up, but we haven’t been able to play much anymore since I moved to uni. To solve this, I’m developing FlaskOthello in my free time, and I plan to add a minimax algorithm with alpha-beta pruning.
The plan is a Python Flask backend, and a vanilla HTML + CSS + JS frontend, probably hosted on Github Pages.
So far, I’ve made an OthelloBoard class, with a basic board representation, and most of the fundamental game logic (making moves, flipping opponent tiles, validity checks, etc.), and since my COSC class forces me to, I wrote a bunch of doctests out of habit…
Next up: minimax algorithm + alpha-beta pruning!