2021-05-24 23:17:56 -05:00
|
|
|
welcome to mastosnake
|
|
|
|
=====================
|
|
|
|
|
|
|
|
mastosnake is a community-driven croudsourced snake
|
|
|
|
application, inspired by the twitter account 'Twitter Plays
|
2021-05-24 23:22:21 -05:00
|
|
|
Snake' written in python.
|
|
|
|
|
|
|
|
behaviour
|
|
|
|
---------
|
|
|
|
|
|
|
|
every hour, roughly, mastosnake posts a poll to the given
|
|
|
|
account configured. this poll contains the game board and
|
|
|
|
score. the poll gives absolute directions as to how the
|
|
|
|
snake should move its head. players vote on the direction, and
|
|
|
|
when the hour is up, the snake moves in that particular
|
|
|
|
direction. should there be a tie, the option that is higher on
|
|
|
|
the list is decided.
|
2021-05-24 23:17:56 -05:00
|
|
|
|
|
|
|
module requirements
|
|
|
|
-------------------
|
|
|
|
|
|
|
|
- requests
|
|
|
|
- json
|
|
|
|
- time
|
|
|
|
|
|
|
|
this application has been tested on python 3.9.5 (compiled
|
|
|
|
with gcc 10.2.0).
|
|
|
|
|
|
|
|
installation
|
|
|
|
------------
|
|
|
|
|
|
|
|
- make a mastodon application
|
|
|
|
|
|
|
|
with the default mastodon interface, navigate to
|
|
|
|
preferences > development and click 'new
|
|
|
|
application'.
|
|
|
|
|
|
|
|
populate the fields 'application name' and 'application
|
|
|
|
website' however you wish.
|
|
|
|
|
|
|
|
in the 'scopes' subheader, enable the scopes 'read' and
|
|
|
|
'write'. disable any other otherwise checked scopes, as
|
|
|
|
they are not needed.
|
|
|
|
|
|
|
|
click 'submit'.
|
|
|
|
|
|
|
|
- get the access token
|
|
|
|
|
|
|
|
make sure you're still in the perferences > development
|
|
|
|
menu.
|
|
|
|
|
|
|
|
click on the name of the application you've just created,
|
|
|
|
and copy-paste the field containing 'Your access token'.
|
|
|
|
|
|
|
|
make note of this access token (in a text file, whatever)
|
|
|
|
|
|
|
|
- get the instance
|
|
|
|
|
|
|
|
look at the URL in your web browser and inspect the domain.
|
|
|
|
usually this is the instance name.
|
|
|
|
|
|
|
|
make note of the instance name.
|
|
|
|
|
|
|
|
- configure the software
|
|
|
|
|
|
|
|
in the source tree, create a file called 'config.py' and
|
|
|
|
populate it with the following text:
|
|
|
|
|
|
|
|
token = '<your access token>'
|
|
|
|
host = '<your instance name here>/'
|
2021-05-24 23:32:59 -05:00
|
|
|
dimensions = (5, 5)
|
2021-05-24 23:17:56 -05:00
|
|
|
|
|
|
|
make sure that a forward-slash proceeds the host; otherwise
|
|
|
|
the software will not work correctly.
|
|
|
|
|
2021-05-24 23:32:59 -05:00
|
|
|
for 'dimensions', it is simply the x-y measurements of the
|
|
|
|
board. negative numbers are not tested for, nor are
|
|
|
|
fractional numbers.
|
|
|
|
|
2021-05-24 23:17:56 -05:00
|
|
|
- start up the software
|
|
|
|
|
|
|
|
run main.py as 'python3 main.py', or, if your system is
|
|
|
|
a Unix-like, ./main.py.
|
|
|
|
|
|
|
|
warnings
|
|
|
|
--------
|
|
|
|
|
|
|
|
- verify that your instance allows running bots
|
|
|
|
- do not make your bot too spammy, this could make you get
|
|
|
|
banned from the instance
|
|
|
|
|
2021-05-24 23:35:05 -05:00
|
|
|
see also
|
|
|
|
--------
|
|
|
|
|
|
|
|
- https://www.youtube.com/watch?v=cREl1kB6hRs
|
|
|
|
- https://twitter.com/SnakeGameBot
|
|
|
|
- https://tilde.zone/web/accounts/136905
|
|
|
|
|
2021-05-24 23:17:56 -05:00
|
|
|
license
|
|
|
|
-------
|
|
|
|
|
|
|
|
see LICENSE
|