Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/adityaathalye/oxo

A game of traditional 3x3 Noughts and Crosses, in Bash.
https://github.com/adityaathalye/oxo

bash bash-script functional-programming shell shell-script study study-project

Last synced: 16 days ago
JSON representation

A game of traditional 3x3 Noughts and Crosses, in Bash.

Awesome Lists containing this project

README

        

[![justforfunnoreally.dev badge](https://img.shields.io/badge/justforfunnoreally-dev-9ff)](https://justforfunnoreally.dev)

**To play**

- Clone, cd into the root dir, and run the "main" script: `$ ./oxo`
- Your machine should have Bash 4+, preferably Bash 4.4+ (latest stable)
- Be kind to the "Computer player". It is randumb :D

**To code-read**

- Board design and setup is at the beginning of `oxo_logic.sh`

- The scoring logic is based on pattern matches against a regularly-formatted board. See:
- The linchpin function `fit_board_to_square_grid`
- The commentary in the `# SCORING LOGIC` section
- The scoring functions, particularly `__all_crosses`, `__all_noughts`, `__player_wins_grid`, `crosses_win`, `noughts_win`, and `its_a_draw`

- I like to write [Functional Programming style Bash](https://www.evalapply.org/tags/bash/).

- Follow the commit history to trace how the game logic gradually emerged.

**But why?!?**

For unabashed mirth and merriment, of course. Why else?