Hey again Evers,
You need to bring your own levels if you want to try: just paste a level in into the textbox and hit load. I've not included any levels because I'm unclear about their copyright status but you can find levels in various places around the Internet such as here:
http://www.sourcecode.se/sokoban/levels
Here's a really small level for anyone just looking to try it out quickly:
####
#@.#
#$ #
# #
# $#
#. #
# #
####
Again I had trouble implementing resetting for the game. Here are two attempts I made:
Note that (I think) I have to make a state machine to reset and load in response to a single click. This is because I have to do two things in response to a click: first remove all the records (or rather mark them as removed) and then insert a bunch of new ones. I think if I didn't add in some sort of explicit state tracking the steps, the program would fail to converge. In the cases I do have to do this Eve feels very heavyweight (it feels a lot like writing Verilog). I wonder if there might be a way to add some syntactic sugar for sequencing actions? (Which could just generate a state machine behind the scenes.)
Perhaps something like "match after previous" or "label: match...bind...match after label". I'm a bit fuzzy on exactly how it'd work so maybe something as simple as I'm suggesting isn't possible. Do you think it might be too complicated or encourage bad style or that perhaps it's worth considering down the road?
Anyway, perhaps once the ":= none" syntax is implemented I'll have an easier time getting resetting to work.
I originally wrote the win condition as:
match
box = [#box x y]
not([#goal x y])
count[given: box] = 0
bind
[#won]
I think understand why that doesn't work: there is no x and y matching that condition so it won't fire at all. I think that means that count[...] can never return 0. I wonder if Eve could give a warning whenever count[...] = 0 (or != 0) is encountered since it must be a mistake.
One thing you might find a bit odd in this implementation is the [#cell] entities. My original plan was to count the largest row index and the largest column index and then use range[] in the drawing block but since there is no max[...] aggregate so it was easier to do it this way.
One thing I found interesting while writing this was thinking about how code reuse and abstractions might work out in Eve. In the program one area I highlighted as a possible area for reuse is the decoding of presses of the directional keys into a 2d vector. Another possible abstraction would be actual operations on vectors. Yet another would be a grid display component - possibly something that could be shared between this program and Minesweeper. These abstractions might be useful for sharing between many of these type of games. I wonder if Eve will lend itself to these types of tiny abstractions better than other programming environments. Is there a plan for how importing and sharing code might work?
Cheers,
Frankie