Skip to main content


One of my favorite #cardGames is #Machiavelli, similar to #Rummy but where the players have the opportunity to rearrange all played groups and runs as they please to make it easier to add their cards (as long as at the end of the play everything on the table is valid).

https://en.wikipedia.org/wiki/Machiavelli_(Italian_card_game)
This entry was edited (9 months ago)
in reply to Oblomov

I love it so much that I've implemented it on an #IRC bot. Since joining the #Fediverse, I've had this plan to port it over. The game logic is there, but there's a lot of details about how things work here compared to IRC that require some attention to detail. Just to mention one, the games were public on IRC (one game per channel) with notifications sent to users for the card list. How would multiple games be managed here? By their “managing user” only? Should game action be unlisted?
in reply to Oblomov

One of the things that made writing my #Machiavelli #IRC #bot easy was that I could work on an existing IRC bot infrastructure (the Machiavelli game feature was just a plugin). So last night I tried looking for something similar for #ActivityPub, browsing the botwiki website without much success. There are interactive bots, even open source ones, but I couldn't find anything that would allow a bot to be written with just some glue for something more sophisticated than an image poster. #AskFedi
in reply to Oblomov

I've been thinking that something like @ihabunek `toot` could work as a basis for the bot. I haven't checked yet if it can be used as a #Python library, but worst case scenario I can probably shell out to it and use it literally as just I would any other CLI tool (bonus: I wouldn't have to port the #Ruby code of my #Machiavelli #IRC‌ #bot to Python 8-D).
in reply to Oblomov

Another aspect of this bot is the relatively high interactivity. Most bots are rate-limited to avoid flood/‌spam, but during the player's turn the bot should be able to give feedback as quickly as possible. This means that at the very least the number of games managed by one bot at a time should be limited, to avoid overloading the hosting instance.
in reply to Oblomov

I almost forgot the most important and difficult aspect of this: what should I call it? What would a good name for a #Fediverse #bot used to play #Machiavelli?
in reply to Oblomov

Meanwhile I've discovered @halcy has written a #Python library for interfacing with Mastodon
https://github.com/halcy/Mastodon.py
that looks like a *much* better fit for writing the bot, especially since it supports the streaming API which is rather essential in this case. So I'm guessing it's time to start porting my #Ruby code to Python …
in reply to Oblomov

So I've started porting my #Machiavelli #Ruby #IRC #bot #plugin (how's that for hashtags, uh?) to #Python, which has been a rather frustrating experience so far. I'm much more comfortable with Ruby than Python, but the languages are similar enough that the differences fall into that grating #uncannyValley experience. Also lots of bugs due to syntactical and behavioral differences (e.g. index() raising an exception instead of returning the null type). But things are moving forward.
in reply to Oblomov

Basically what I would need now is something to feed my script to and have it statically check I'm calling the right functions for the type: the whole thing is simple enough that is should be doable.
in reply to Oblomov

in reply to Oblomov

(I'm very pissed at the 10 cards taking an extra space.)
in reply to Oblomov

I wonder if anybody would get offended at my using the roman numeral Ⅹ or the Latin alphabet letter X in place of 10.
in reply to Oblomov

Anyway, I've now completed a full “solitaire” game of the #Python reimplementation of my #Ruby #IRC #bot #Machiavelli plugin (hashtag galore yeah), so I believe the logic itself to be robust enough. The next step would be to start interfacing it with Mastodon. One thing that worries me is that the table can get rather largish, which may trip the character limit.
in reply to Oblomov

In general, I'm kind of dreading having to (re)write the whole messaging system thing. I would love to do things cleanly, which means that I have to abstract this in a way that can handle both console (for testing the game logic) and the threaded form that would develop on the Fediverse.
in reply to Oblomov

Oh hm now I wish I could do #CRTP in #Python. I guess I've been ruined by C++ forever.

#CPlusPlus
in reply to Oblomov

Oh wow I could even implement netplay-on-console with this thing …
in reply to Oblomov

I'm not joking about this BTW, and I think it would help me refine the messaging/channel protocol before trying my hand at the #Fediverse. The only thing is, I would rather not develop the whole client/server protocol for net play myself, so I was wondering if anybody knew of some kind of existing plain text protocol I could piggyback for this, possibly something with an existing Python implementation, and ideally with user@host name handling. Talk maybe? #askFedi
in reply to Oblomov

I'm going to have to roll my own using telnet + identd, wanna bet?
in reply to Oblomov

I'm going to implement the trivialest of protocols on port GAME aka 6-4-11-3 aka 0x64b3 = 25779.
in reply to Oblomov

Another thing I have to think about is the license for the bot. AGPL maybe?
in reply to Oblomov

Having decided on the license, I've put the code up as it s now on #Codeberg
https://codeberg.org/Oblomov/machiavelli-fedi-bot
You can test it locally only so far, but it's a start.
The downside is that in the coming days I'll be slowly gearing up for work again, so I'll have less time to dedicate to it.
in reply to Oblomov

I've found enough time today to set up the infrastructure for #LAN play for the #Machiavelli bot I'm writing. It's the opposite of refined, and barely functional. In particular, expect delivery issues for messages in multi-player at the moment because the server basically brute-force sending, which as anybody that has don any decent socket programming knows, it's the worst possible way to do things.

On an unrelated note, I hate socket programming.
Unknown parent

if I manage to build a bot to manage games here on the Fediverse, would you help me test it? 8-D

This website uses cookies to recognize revisiting and logged in users. You accept the usage of these cookies by continue browsing this website.