Menu

1 / 2

Game::Terminal: Perl game implementations in a terminal

DEV Community: perl·LNATION·5 days ago
#S8PPJTWv
#devtoperl#devto#dev#game#board
Reading 0:00
15s threshold

Recently I have been building https://peer2peergames.com , a site where two or more people play a board or card game against each other in a browser, each moving when they get round to it. Every game on it needs an engine: the rules, the endings, a bot to stand in when nobody else is online. So I wrote them, one dist at a time, each with the same discipline, the engine does no input and no output, a game is a pure function of its moves, and a terminal front end sits on top so I could play the thing before it had a web page. Cribbage was the one that existed before the site, everything after it was built for it.

That is how I have ended up with twenty plus terminal games and little memory of which script wanted which params.

So now I have one command.

$ cpanm Game::Terminal $ game

Enter fullscreen mode

Exit fullscreen mode

That gives you a menu. Arrow keys move, enter plays, q leaves, and a letter jumps to the next game starting with it.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.