mossr/Snake.jl

An option to switch from periodic to walls?

Closed this issue · 2 comments

Thanks for this nice package (just saw it in the general registry).
I might be distracted in the future in my REPL.

Can you maybe add an option so one can switch from

  1. periodic mode, which you have currently, i.e you run out on the left and enter from the right

to also include

  1. wall mode, i.e. running against a wall kills the snake.

Further, one could also maybe specify a field size.

mossr commented

Thanks for the great suggestions! Glad you like it ;)

I now default to "walled" snake, and you can turn on the endless/periodic mode using:

play(walls=false)

I also added the field size option (defaults to (20,20)):

play(size=(40,20))
mossr commented

Or using

restart(size=(40,20))

etc. :)