Zulip Chat Archive

Stream: lean4

Topic: maze game


David Renshaw (May 30 2021 at 21:21):

To help myself learn about Lean 4's syntax manipulation facilities,
I coded up a little maze game: https://github.com/dwrensha/lean4-maze

David Renshaw (May 30 2021 at 21:24):

It think it's kind of mind-blowing that Lean lets you do stuff like this:

def maze3 := ╔════════════════════════════╗
             ║▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓║
             ║▓░░░░░░░░░░░░░░░░░░░░▓░░░@░▓║
             ║▓░▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░▓░▓▓▓▓▓║
             ║▓░▓░░░▓░░░░▓░░░░░░░░░▓░▓░░░▓║
             ║▓░▓░▓░▓░▓▓▓▓░▓▓▓▓▓▓▓▓▓░▓░▓░▓║
             ║▓░▓░▓░▓░▓░░░░▓░░░░░░░░░░░▓░▓║
             ║▓░▓░▓░▓░▓░▓▓▓▓▓▓▓▓▓▓▓▓░▓▓▓░▓║
             ║▓░▓░▓░▓░░░▓░░░░░░░░░░▓░░░▓░▓║
             ║▓░▓░▓░▓▓▓░▓░▓▓▓▓▓▓▓▓▓▓░▓░▓░▓║
             ║▓░▓░▓░░░░░▓░░░░░░░░░░░░▓░▓░▓║
             ║▓░▓░▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░▓║
             ║░░▓░░░░░░░░░░░░░░░░░░░░░░░░▓║
             ║▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓║
             ╚════════════════════════════╝

Scott Morrison (May 31 2021 at 01:23):

Can you solve the maze by dec_trivial? :-)

David Renshaw (May 31 2021 at 01:25):

I don't know what the Lean 4 equivalent of dec_trivial is.

David Renshaw (May 31 2021 at 01:26):

I'm sure there's a way to write a tactic that solves these things.

David Renshaw (May 31 2021 at 01:26):

can_escape is defined as:

def can_escape (state : GameState) : Prop :=
   (gs : List Move), is_win (List.foldl make_move state gs)

David Renshaw (May 31 2021 at 01:27):

I would be delighted to receive a pull request that adds some maze-solving automation to the repo. :)

Johan Commelin (May 31 2021 at 06:19):

It's really sad that there is no :amazed: emoji on Zulip :joy:

Max (May 31 2021 at 08:25):

a-maze-ing!

Damiano Testa (May 31 2021 at 08:32):

This is really awesome!

A minor typo in the Readme:
"You are free to move within lightdark-colored cells. The darklight-colored cells are walls.", correct?

Gabriel Ebner (May 31 2021 at 08:34):

I think this depends on your color scheme.

Marc Huisinga (May 31 2021 at 08:34):

Damiano Testa said:

This is really awesome!

A minor typo in the Readme:
"You are free to move within lightdark-colored cells. The darklight-colored cells are walls.", correct?

Depends on your background color theme, I suppose? :grinning_face_with_smiling_eyes:

Damiano Testa (May 31 2021 at 08:41):

Ahaha I tried to change my theme to a light one, without success, though! Anyway, I agree that this is a color scheme issue!


Last updated: Dec 20 2023 at 11:08 UTC