Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nelsbrock/dev-tictactoe
A Linux driver for a character device which can be used to play Tic-tac-toe.
https://github.com/nelsbrock/dev-tictactoe
education educational linux linux-device-driver linux-driver linux-kernel linux-module tic-tac-toe
Last synced: about 1 month ago
JSON representation
A Linux driver for a character device which can be used to play Tic-tac-toe.
- Host: GitHub
- URL: https://github.com/nelsbrock/dev-tictactoe
- Owner: nelsbrock
- License: mit
- Created: 2024-07-08T17:09:58.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-08-13T19:44:47.000Z (3 months ago)
- Last Synced: 2024-09-29T14:42:40.422Z (about 2 months ago)
- Topics: education, educational, linux, linux-device-driver, linux-driver, linux-kernel, linux-module, tic-tac-toe
- Language: C
- Homepage:
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# /dev/tictactoe
A Linux driver for a character device which can be used to play
[Tic-tac-toe](https://en.wikipedia.org/wiki/Tic-tac-toe).## Usage
*Disclaimer:* I make no guarantees about the soundness of the driver code.
Use with caution (i.e. only in a virtual machine).### Building
Clone this repository, `cd` to it, then run `make`.
### Loading
After building the module, run `insmod tictactoe.ko` as root to load it.
### Using the device
After loading the module, player X can write grid coordinates
(ranging from 1 to 3, format `XY`) to `/dev/tictactoe` to make their first move:```console
# echo 12 > /dev/tictactoe
```After player X has made their move, player O can do the same:
```console
# echo 22 > /dev/tictactoe
```To inspect the current state of the game, simply read from `/dev/tictactoe`:
```console
# cat /dev/tictactoe
``````
#####
# X #
# O #
# #
#####It's X's turn!
```Alternatively, you can `watch` the file in a separate terminal for automatic
updating:```console
# watch -n 0.5 cat /dev/tictactoe
```To start a new game, write `reset` to `/dev/tictactoe`:
```console
# echo reset > /dev/tictactoe
```### Unloading
Run `rmmod tictactoe` as root to unload the module.