Code Jam 1: Snakes

The theme of the code jam was snakes Participants were assigned a random partner, and used Git to submit code to us. Staff members reviewed the code both during and after the code jam, and provided suggestions for changes and improvements. The best submissions were implemented into our community bot. Winners recieved a special Code Jam Champion title.

Task description

Here is the original task description which was posted on the code-jam-1 GitHub repo:

For this code jam, your task will be to create a Snake cog for a Discord.py rewrite bot. You can find the documentation for Discord.py rewrite here. The best cog commands will be added to the official Python Discord bot and made available to everyone on the server. The overall best cog will be awarded custom Code Jam Champion roles, but the best commands from the teams who did not win will also be added to our bot, and any users who write something that ends up in the bot will be awarded Contributor roles on the server.

Your initial task will be to write get_snek(). This is the minimum requirement for this contest, and everyone must do it. get_snek() should be a method that goes online and fetches information about a snake. If you run it without providing an argument, it should fetch information about a random snake, including the name of the snake, a picture of the snake, and various information about it. Is it venomous? Where can it be found? What information you choose to get is up to you.

get_snek() should also take an optional argument name, which should be a string that represents the name of a snake. For example, the call get_snek('cobra') should get information about a cobra. name should be case insensitive.

If get_snek('Python') is called, the method should instead return information about the programming language, but making sure to return the same type of information as for all the other snakes. Fill in this information in any way you want, try to have some fun with it.

Once you have finished get_snek(), you should make at least two bot commands. The first command, get(), should simply call get_snek() with whatever arguments the user provided, and then make a nice embed that it returns to Discord. For example, if the user in the Discord channel says bot.snakes.get('anaconda'), the bot should post an embed that shows a picture of an anaconda and some information about the snake.

The second command is entirely up to you. You can choose to use get_snek for this command as well, or you can come up with something entirely different. The only requirement is that it is snake related in some way or other. Here is your chance to be creative. It is these commands that will win or lose you this code jam. The best original ideas for these commands will walk away with the victory.

Result

The Winning Team: Team 23, kel and Momo!

These two experts worked together to create what can only be described as a flawless submission. The staff were unable to find a single thing to complain about in the 1100 lines that were committed. Here are some of the features they created for their snake cog:

  • A fully functional implementation of Snakes and Ladders
  • A feature that uses perlin noise to draw a random snake, and posts the picture in the chat.
  • Hatch your very own baby snake!
  • Snakify your post history with a Markov chain
  • Rattlesnake sound effects in the voice channels

These features, as well as the best ones from the other teams, have been implemented into our community bot. Use .snakes in #sir-lancebot-commands to play with it.