Skip to main content

Maze Generator

This command generates a maze image with an optional number of crossings/bridges. It also includes a link to a downloadable solution and execCC support.

Trigger

Type: Command
Trigger: maze

Usage

  • -maze - Generates a maze with 0 crossings.
  • -maze <crossings> - Generates a maze with the given number of crossings.
execCC usage

To trigger the command via execCC, just call the CC with data set to the number of crossings.

Code

{{/*
Sends a maze with an optional amount crossings/bridges.
See <https://yagpdb-cc.github.io/fun/maze> for more information.

Author: Crenshaw <https://github.com/Crenshaw1312>
*/}}

{{/* No touchy touchy */}}
{{ $seed := randInt 100000000 999999999 }}
{{ $embed := sdict "thumbnail" (sdict "url" (.User.AvatarURL "128")) "title" (title "maze") "description" (joinStr "" "Requested by " .User.String " -") "image" (sdict "url" nil) "color" 123 }}
{{ $crossings := 0 }}
{{ if .CmdArgs }}
{{ $crossings = (index .CmdArgs 0) }}
{{ else if .ExecData }}
{{$crossings = .ExecData }}
{{ end }}
{{ $maze := joinStr "" "http://maze5.de/cgi-bin/maze?sample=1&type=4&rows=12&columns=12&crossings=" $crossings "&seed=" $seed "&algorithm=backtracker&algorithm=0.5&foreground=%23ffffff&background=%2336393f&bordersize=16&cellsize=32&linewidth=2.5&format=png" }}
{{ $embed.image.Set "url" $maze }}
{{ $maze:= (joinStr "" $maze "&solution=true") }}
{{ $embed.Set "description" (print $embed.description " [Solution](" $maze ")") }}
{{ sendMessage nil (cembed $embed) }}

Author

This custom command was written by @Crenshaw1312.