Skip to content

Perl script to generate Minesweeper boards for Discord chat

License

Notifications You must be signed in to change notification settings

greg-kennedy/Discord-Minesweeper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Discord-Minesweeper

Greg Kennedy 2019

Screenshot of Game

About

Discord-Minesweeper is Perl script that generates Minesweeper boards for Discord chat.

On March 12, 2019, Discord added support for the "Spoiler" tag, which is enabled by surrounding some text in double pipes ||like this||. Spoiler text is hidden in the chat client until clicked by the user. By using emoji and wrapping it in spoiler tags, it's possible to create a Minesweeper board that the player can uncover one cell at a time.

Usage

Configuration is done by changes at the top of the script. Three options control the board generation, while one is for posting the result to Discord.

  • HEIGHT - controls the height of the generated board.
  • WIDTH - controls the width of the generated board.
  • MINES - how many mines to hide in the board.
  • URL - the Discord WebHook URL.

(Note that very high values for HEIGHT or WIDTH may exceed Discord's maximum message size limit, and very high values for MINES may cause slow or infinite loops during mine placement and initial square reveal.)

Once configured with a URL, simply run the script to post a game to your chat channel. You may wish to add this to crontab and get boards automatically posted once a day!

Dependencies

Posting to Discord requires the WebService::Discord::Webhook module. It is available on CPAN or on GitHub.

License

This software is released under the Unlicense. It is public domain software. See LICENSE for more details.

About

Perl script to generate Minesweeper boards for Discord chat

Topics

Resources

License

Stars

Watchers

Forks

Languages