From efec56140f4fd6c8276f5598ff809a0c41883eb2 Mon Sep 17 00:00:00 2001 From: cqql Date: Sat, 19 Oct 2024 16:12:05 +0200 Subject: [PATCH] readme and attributions --- README.md | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4269fdb..75bf543 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,57 @@ # TCP Connect 4 -type `nc cqql.site 1234` to start playing connect 4 against an ai in your terminal. \ No newline at end of file +*type `nc cqql.site 1234` to start playing connect 4 against an ai in your terminal* + +## Game + +I just really wanted to make [Connect 4](https://en.wikipedia.org/wiki/Connect_Four) playable in the terminal from anywhere in the world without any installations (assuming you have netcat installed and using a linux terminal because who else would be the target demographic for this :3). + +This is what you should see when you connect: +``` +Connect 4 +Choose your difficulty [1-9]: 3 +Move 0: + · · · · · · · + · · · · · · · + · · · · · · · + · · · · · · · + · · · · · · · + · · · · · · · + 1 2 3 4 5 6 7 + +Choose column: 5 +[AI thinking] + +Move 2: + · · · · · · · + · · · · · · · + · · · · · · · + · · · · · · · + · · · · · · · + · · · ○ ● · · + 1 2 3 4 5 6 7 + +Choose column: 5 +[AI thinking] + +Move 4: + · · · · · · · + · · · · · · · + · · · · · · · + · · · · ○ · · + · · · · ● · · + · · · ○ ● · · + 1 2 3 4 5 6 7 +``` + +(and so on) + +have fun! 🎉 + +## Attributions + +The AI behind this was coded by [balkarjun](https://balkarjun.github.io), which I translated into Rust and got their permission to use it for this project, as long as it stays open source. I couldn't stop myself from using it after I saw how neatly it checks win conditions which I [posted about on fedi](https://tech.lgbt/@cqql/113330046815399664). + +The logic is written up in great detail on balkarjun's blog in this article: [Exploring Board Game AI Algorithms: Minimax](https://balkarjun.github.io/blog/minimax-connect-four/). It's worth a read, especially to learn more about traditional AI. + +I coded the socket interface and then added a lot of logging just for coding practice. It you'd like a leaner version of the code, take a look at [this commit](https://moonlit.technology/cqql/tcp-connect4/commit/016b3aa6cfeeeb2e53b2cd4a132357b1e3ea1022). \ No newline at end of file