https://github.com/mmisono/bpftrace-tetris
Tetris in bpftrace
https://github.com/mmisono/bpftrace-tetris
bpf bpftrace
Last synced: about 1 year ago
JSON representation
Tetris in bpftrace
- Host: GitHub
- URL: https://github.com/mmisono/bpftrace-tetris
- Owner: mmisono
- Created: 2019-12-04T21:24:21.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-11-18T01:27:51.000Z (over 5 years ago)
- Last Synced: 2025-03-21T20:46:35.216Z (about 1 year ago)
- Topics: bpf, bpftrace
- Language: Shell
- Homepage:
- Size: 10.7 KB
- Stars: 104
- Watchers: 4
- Forks: 9
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# bpftrace-tetris
This is the ported version of [tetris.spt](https://github.com/mhiramat/stapgames/blob/master/games/tetris.stp).
## Requirements
- Linux 5.3+
- [bcc](https://github.com/iovisor/bcc) master branch version
- [bpftrace](https://github.com/iovisor/bpftrace) master branch version
## How to run
- `./run.sh`
### In Vagrant
If you do not readily have access to a recent linux kernel and bpftrace, you can try the included Vagrant file which launches ubuntu eoan so you can still play tetris!
Download vagrant from https://www.vagrantup.com/downloads.html, and make sure you have either VMWare or [Virtualbox 6.0 installed](https://www.virtualbox.org/wiki/Download_Old_Builds_6_0).
Install both, then run:
```
vagrant plugin install vagrant-vbguest
```
You can then run tetris with:
```
./run-in-vagrant.sh
```
### In Docker
```
./run-in-docker.sh
```
Note that this also run with a recent Docker Desktop for Mac.
## FAQ
### Q. Why is Linux 5.3+ required?
Otherwise the BPF program will be rejected due to the maximum instruction limit (see [this commit](https://github.com/torvalds/linux/commit/c04c0d2b968ac45d6ef020316808ef6c82325a82).)
### Q. How do I change the dropping speed?
It can be changed by modifying the interval value of `interval:ms:99`.
### Q. How are blocks represented?

## License
GPL v2 or later