Prison Breakpoint

Code golfing prison escape action with high scores

Hone your code golfing skills with this absurd programming interface. Comes with manual included!

Notes on the scoring system: when calculating your score, what's important is the length of your function after minification. The length of the minified program is subtracted from a value specific to the level you're playing. This means in particular:

  • whitespace and semicolons are discarded where possible;
  • variable names like tick and walk are reduced to a single letter and so cost you only a single point.

Voting results

A.I.
1st
8.667

This game entered in the Ranked competition (3 entries).

Comments (15)

thomastc
 • 6 years ago • 

I love programming games! I mean, programming games, as well as programming games but that's another matter. Also a big Zachtronics fan of course.

There's a small but effective bit of backstory and motivation here, which really helps to set the scene. I wonder if you should add something about being innocent (and therefore have a "right" to escape). Also I wonder how this robot is going to help my/our escape…

Graphics are alright, but the inmates look like crows to me. Or maybe the crows are in locations where I'd expect inmates to be. Anyway. The main thing I would change is show the grid better, e.g. by having some floor tiling (1 tile per grid). It can be a bit hard to count sometimes. Also please show the guards' field of view somehow, because trial and error is tedious.

On to the gameplay!

There are essentially two different, theoretically intertwined problems to solve: how do I get to the exit, and how do I code that in the shortest way possible? But right now, you can solve those mostly independently from each other, because you can code any path you fancy (unless there's a limit I didn't hit). It would be nice to have levels where you can do a convoluted path that's short to code, or a more efficient path that would require more code (and thus more golfing). This might require changes in mechanics, e.g. allow walking into walls (which would just ignore that instruction).

The language "API" is well designed and really lends itself well to golfing, by using type coercion and return values to the fullest.

The golfing aspect is under-exposed, which is really a pity. For one, it's not explained how the score is calculated. Is it token count? UTF-8 byte count? Non-whitespace character count? And it seems higher is better, so is this then subtracted from some maximum? There's also no way to see how your current solution would score before you actually run it. But once you've completed the level, there's no way to get back and try to improve, which is a real pity (Wan beat me in most levels!).

There are also a couple of bugs:

  • I sometimes was able to walk through walls (or maybe windows).
  • Once, I got spotted by a guard even though I was around the corner; at least, I think there was no line of sight. Then the game reset to the start, as usual, and seconds later I suddenly got the highscore list.

To conclude: although there are some annoyances right now, they are clearly fixable. This game has a lot of potential, and if you were to make it into a full and polished release I would stand in line to buy it.

Wan
 • 6 years ago • 

A fun code golfing game! I played through it twice as I kept finding new little optimizations throughout my first playthrough. I really like the API for its simplicity and how it still allows for a variety of JS tricks.

The overall polish of the game is quite good as well, the editor being perfect with the embedded manual, pointers to where the code failed, etc. The UI overall was simple but effective. The tileset is good as well, giving a slight "film noir" atmosphere to the game :) My only suggestion would have been to leave a visible grid on the terrain for making it easier to count tiles.

In the end I found the levels quite simple, most of them ending up with a kinda similar implementation. I'm sure there's much more potential to uncover by making much more complex levels, that invite you to figure out patterns: for instance a super long corridor turning on itself in a spiral could make you use knowledge of the Fibonacci sequence.

With more time I'm sure you'd have implemented them, but comparing the game with similar Zachtronics stuff, this could have used typical features like fast-forward/step-by-step buttons, or a level selection menu that lets you look at how well you're doing in the leaderboard and go back to levels to try and improve them.

toasty
  • 6 years ago • 

Thanks for the comments guys! Very useful feedback :)

I seem to have underestimated my audience. I was mostly worried that nobody would want to scrutinise a manual to get the most out of their programs; you've proved me happily wrong. Also I'm relieved to hear you liked the API.

I actually removed one slightly more complicated level (a spiral just as you described!) because of these worries and because it didn't seem to fit. D'oh!

Fast-forward or step-by-step would definitely be an improvement. If I make a post-compo version I'll see if I can add these!

@thomastc, good points about the golfing—I'll add some explanation about the scores to the game page, and should add some means of viewing scores too. Any post-compo version will definitely make it easier to retry levels! :)

toasty
  • 6 years ago • 

The per-level scores seemed like a good idea but in hindsight may have been a mistake. For the sake of transparency, here they are:

const bonuses = {
  Kajam4_L0: 128,
  Kajam4_L1: 135,
  Kajam4_L2: 146,
  Kajam4_L3: 284,
  Kajam4_L4: 128,
  Kajam4_L5: 180,
  Kajam4_L6: 250,
};
Raindrinker
 • 6 years ago • 

Whoa I'm amazed by this. You went full programming there. How the hell did you get and editor that runs javascript? Can javascript execute strings? For this depth, yeah, selecting levels would be super appreciated. Everytime I beat a level and get the worst score I wanna try improving it.

Making the speed of execution a bit faster would help. Or highlighting in the code the function that is being ran (maybe thats really hard). The art works really well but could be a lot cleaner, I think.

If you want to keep working on this and make a more polished version, be sure to ring me if you want. I'd love to help, maybe in the art department.

I'm not sure I can add much that hasnt arleady been said. This is so well put. The only caveat would be that is not THAT original, and in the end its basic programming golf. I always love when the programming "system" is different, or more accessible to non-programmers.

Fantastic work! O_O

Raindrinker
 • 6 years ago • 

PD: Managed to break it somehow and had to restart :( Also, I think you cannot modify the tick variable, it woudl be cool if you could, to create cycles without relying so much on the %.

thomastc
 • 6 years ago • 

@Raindrinker Do not eat from the Tree Of Knowledge Of Good And eval!

toasty
  • 6 years ago • 

@Raindrinker, haha, most JS environments are able to evaluate strings as JS. Although FWIW @thomastc, I didn't use eval! ;)

The highlighting was all me though. I can tell you, it's hard to get that stuff working properly across different browsers, and I know of a couple of examples where it doesn't work properly. I ended up disabling it where I couldn't get a useful stacktrace from the error object, and haven't tested it in IE or Safari.

Ah yeah any modifications to tick won't affect the next call. Basically there's a loop that calls function main(tick, walk, turn, wait) with those variables, so a change would only affect the scope inside that call.

It's interesting that you mention accessibility—I was thinking that using JS would make it more accessible, but perhaps not. I will give this some more thought!

Raindrinker
 • 6 years ago • 

@toasy Accessibility I mean those games that teach programming without programming, like the Zachtronics games that have no code, or Human Resource Machine. Trying to have a system that lets the player write and understand code without well, writing code or needign to know syntax. That's one way to make a game about programmign less niche. Of course js is pretty accessible as a language :D

I just want to comment on how this could reach more peeps cause its an amazing way to teach programmign and such, and the game is very cool. I kinda was an assistant teacher in 1st year programming at some point and whenever I see some way to make programming more mainstream and palatable to those poor confused souls, I like.

toasty
  • 6 years ago • 

@Raindrinker That's not a bad idea actually! I'm thinking I probably will do something with this game after the Kajam—even if it's just a case of fixing a couple of bugs and popping it on itch; maybe I should promote it as gamified learning ;)

thomastc
 • 6 years ago • 

@toasty Wow, I thought you were just using CodeMirror!

toasty
  • 6 years ago • 

@thomastic Ack, that would have been so much easier ;__;

HuvaaKoodia
 • 6 years ago • 

"Failed to fetch scores! Click to continue…" is all I get after the first level.
No amount of clicking removes the error message.
(Tested on Firefox and Chrome)

toasty
  • 6 years ago • 

Hey @HuvaaKoodia, my bad, I didn't think anybody would still play the game. I took the server down, thinking nobody was playing it! Anyway, it's back up now. I hope you enjoy :)

HuvaaKoodia
 • 6 years ago • 

Took me many hours to finally complete all the levels. Not because they where very difficult, but due to bugs. Every time something broke I'd have to restart from the beginning. Started writing down the solutions after the first time. Copy and pasting isn't very compelling though.

First problem
Tried a while(true) loop. Not a smart move!
Infinite loop breaking would be a good idea, if possible.

Second problem
Level 6!

walk(1)
gives a rather interesting result as does
walk(tick > 0 && !turn(tick==1))
In both cases the robot walks past a guard and completely breaks the level (cannot reset anymore).

I didn't realize the point of the level until looking over it very carefully. There are tiny arrows on the ground! The goal in the other levels was always so obvious that I had not noticed them at all! They seem like small rocks or something. I would change the color of the arrows to make them apparent.

Third problem
Obscured scoring system.

Even after reading your explanations I still don't understand the system.

Level 0 is solved with
walk(1)

The minified score of this code is subtracted from 128 to get… a score lower than 100? The score isn't shown anywhere so I have no idea how much that code is worth.

I might be missing a Javascript trick of course, never done Code Golfing before. Otherwise something is wrong in the minimizer or the highscore system.

Forth problem
Already mentioned before in previous comments, but worth repeating. The UI is really slow to use. I'm not too keen on trying to up my scores as there is no way to quickly get to a specific level and test different things without a lot of waiting.

Conclusions
The idea is alright. I'm not too keen on programming on my leasure time, but others are by the looks of it. Ironing out these issues would certainly improve the proceedings even for someone like me.

I hope this didn't come off as too negative, it is not intended.

Login to comment

Links

Itch.io

Author

toasty

Details