1. 36
  1.  

  2. 6

    The astute reader will observe that there are few issues with this implementation. The first is that this function is partial and will crash the game if you try to undo from the initial state. The second is that the score counter doesn’t count undos because undoing decreases the length of the list. We can fix both of these by just throwing some copies6 of the initial grid onto the end of the grids list whenever we undo.

    I love this so much.

    If you want to make this even more painful on yourself, you could try implementing SSR/Parabox-style undo, where you can also undo past a reset.

    1. 6

      Thanks!

      SSR/Parabox-style undos are totally possible, but if you support them, resets count toward your score. I did choose to call it “score” because I could calculate it arbitrarily, so that isn’t exactly an issue. It just goes against my personal game dev philosophy. I originally brushed it off because of that conflict, but now that you bring it up, it would be a pretty big QoL improvement for any accidental resets… I’ll have to rethink how attached I am to the way score is calculated.

      It only takes two more characters to support those kinds of undos (can you spot the difference?), so to make it fit I could remove some characters from Lvl or revert Level 13 to an alternate, smaller version. And then of course play Bin Packing again.

      n="噞㋪㛃䚬摣ۜ㝜ቲ㜑昫⫛㍋勓ㅋ⩞䤤㱪㳃䊩㓛⤤㳝ᙪ㛅Ⳝ㩛㚙㛦䥢㔬㜞㋖⛍㣛戛㙉ኛ㙎ኛ孶抭安Ჭ㱉㚛㛛ᰛ⯙瞎㤅⛛牶䢯㛛㣠⭤㳳㑌䜜㚿㛛䜓缣㛚≣㶳ㅬ㛜㛛䛚㛛暛㛣⛛䤤䣤"
      e('λ':c)|(a,b)<-span(>'n')c=u(u a#m 1 b)%e(y b);e(c:d)=c:e d;e l=l;k="λ.";m=take
      v(x:_)=c x`mod`7;v _=0;l=print;s=[]:s;c=fromEnum;i="\no .#_λ+";y=drop 1;(%)=(++)
      e&0=u.t;f&_=f;p=putStr;(1?f)x=z x%x;(5?f)x=y x%z x%z x;(i?f)x=(f&i$r e$f$head x):x
      r=map;main=print=<<(mapM g.zip[1..].r(pure.words).lines$r(i!!).m 5.w=<<r c(n%x))
      g(k,o)|any(elem '_')$head o=do{k!o;p b;i<-v<$>d;g(k,i?([t.u,t,id,t,t,t,r u]!!i)$
      o)};g(k,x)=a x<$k!x<*p"↩"<*d;t=foldr(zipWith(:))s;z=m 1.u;w n=n`mod`8:w(n`div`8)
      n!x@(s:_)=p"\^[cLvl "*>l n*>l(a x)*>p(unlines s);d=getLine;(_:r)#""=r%k;_#""="."
      n#"."=n%k;(_:r)#"+"='.':r%k;_#"+"="..";('o':r)#"_"='O':r%k;l#x=x%l%"λ";u=reverse
      a=length;b="λ:wasd 🔄:x 🔙:u\n";x="ᴔ翉䕿䤤䜣㛚㣛㢛䛳۳四⛛竛⛛笛⛛禣✤ባ⦉档✌䡣✌ቴ✙䤣✴㛛ۣ廛⛟盻⟛㛛⛛䌜⣡㞛⛳㣣✜幜⣏㛜ࣛ"
      

      Edit: I wanted to add that one unanticipated joy of the tiny game jam is that I don’t feel (too) bad about just pasting a new version of my game into a comment reply.

      Edit 2: updated my response and moved some rambly digressions to my blog post instead of further increasing the length of this reply.

      Edit 3: added an explanation in an addendum.

    2. 4

      Does this disgust you yet? It should, because we have to put parens around i&f to prevent GHC from getting confused by operator precedence. And someone left in spaces!!

      I absolutely love everything about this.

      1. 3

        Very artistic of you. Disgusting, nevertheless, but artistic.

        1. 3

          holy shit, SUPER cool! thanks for the thorough write-up

          1. 1

            Awesome writeup!

            Quick feedback wrt. light mode theme: the HLS message is printed in dark font on dark background (Safari on MacOS)

            1. 2

              Thanks for the feedback. I fixed it by making it a json code block (yup, that’s my hack). My website is held together with duct tape and I think that bumping a dependency has cascaded various issues. Another thing for my to-do list, I suppose.