That weird Kjorteo-like thing ([info]kjorteo) wrote,
@ 2009-05-28 00:15:00
Previous Entry  Add to memories!  Tell a Friend  Next Entry
Thanks to [info]slither for the awesome link.

http://www.kongregate.com/games/Coolio_Niato/light-bot

Level 10 in particular requires some particularly horrible workaround logic. ("I need to walk forward one space and turn a light...I have a function that walks forward four places, jumps, takes another step forward, turns right, and flicks a light...there's a wall in front of the light so he'd just be harmlessly walking against it and jumping in place and it won't actually hurt anything, and calling the function gets the light in one move whereas walking forward and flicking it directly takes two, so let's call that function! :D" As a theoretical made-up example.) If you can beat it, then you are clearly an expert at mangling your own code in the name of compression (it's horrible and unreadable and the robot spends half the time dancing around in place like an idiot, but the other half actually solves the level and it's small enough to fit in the size limit and it technically works God damn it and that's the important thing) and therefore you should start making ZZT games immediately.

(I beat the entire game, because I'm an insane coding mad scientist-type due to my ZZT background awesome like that.)

My solutions for the last three levels (hidden behind spoiler text, don't worry) because I'm proud enough to show them off:

Level 10:
Main method:
F1, F2, F1, Counterclockwise, F1, Clockwise, F2, Counterclockwise, F1, Clockwise, Jump, F1

Function 1:
Forward, Forward, Forward, Jump, Forward, Counterclockwise, Forward, Light

Function 2:
Jump, Jump, Clockwise, Jump



Level 11:

Main method:
F1, Jump, Clockwise, F1, Jump, Clockwise, F1

Function 1:
F2, F2, Counterclockwise, Jump, Counterclockwise, F2, F2, Clockwise

Function 2:
Light, Forward, Light, Forward, Light, Forward, Light, Forward



Level 12:

Main method:
Forward, Jump, Clockwise, F1, F1, Counterclockwise, Jump, Light, Jump, Light

Function 1:
F2, Counterclockwise, F2, Counterclockwise, F2

Function 2:
Light, Jump, Light, Jump, Light, Jump


(14 comments) - (Post a new comment)


[info]davidn
2009-05-28 03:28 pm UTC (link)
AAAAAAAAAAAAAGHGGGH

I breezed through the first nine levels and am totally stuck on the tenth - I'm meant to be working now so should use that as an excuse to step away from it. You're right, it is all about compression of things down into the most compact possible steps, very much like ZZT, or lower-level assembly or things. What an excellent idea for a game, though.

(Reply to this) (Thread)


[info]jacel
2009-05-28 05:57 pm UTC (link)
Seconded, and I suspect this is where I'll leave it. I'm on upwards of fourteen attempts so far, and my brain can't take it this soon after an exam. @.x

Great fun, but I can see it tormenting me in days to come!

(Reply to this) (Parent)


[info]kjorteo
2009-05-28 07:03 pm UTC (link)
Level ten certainly had me thinking "oh God, my poor brain" for quite a while. It took all of my ZZT-honed "make it ugly and workaround-y as long as it's small and it technically works" skills to come up with something, and my solution is barely readable in an abstract sense, until you plug it in and run it and see how it actually happens to work. When I beat the level, I felt like a true mad scientist--utter elation that I conquered it to the point where I was tempted to let out a hearty mwahahaha, mixed with a slight tinge of "oh God what have I created."

Actually, half the reason I made this entry was because I was proud enough of what I came up with (in a twisted sort of sense) to want to show it off, though it's obviously better if you can (somehow! Good luck!) beat it yourself, then compare notes with how I did it. I'm actually curious how different the solutions can be--in general, programming challenges tend to allow more variation on the path to the ultimate end result than most other types of games, but I suppose we'll see.

(Reply to this) (Parent)(Thread)


[info]davidn
2009-05-28 07:44 pm UTC (link)
YES

Main:
1 2 1 Left
1 2 2 Left
Jump Left 2 1

Function 1:
Jump Forward Forward Forward
Light Jump Left

Function 2:
Jump Jump Forward Right Jump


I spent so long wanting just one extra square for a final call of function 1, but then restarted and somehow... everything fell into place that time. It's that last double turn on the high platform on the left that does it.

About 98% of productivity today has been lost due to this. If our clients had a working server at the moment I'd probably be in trouble.

(Reply to this) (Parent)(Thread)


[info]kjorteo
2009-05-28 07:56 pm UTC (link)
Congratulations! I think 10 is probably the hardest level in the game, as it's the only one that goes beyond making you think like a programmer and into making you think like a ZZT programmer.

I see you did not disappoint in coming up with something sufficiently different to compare! Actually, it looks like you have a similar idea, even down to function 1 primarily being the moving forward function (among other things) and function 2 being the jumping function (among other things,) but you split up the work between the two more--your 1 does a little less, your 2 does a little more, and you call them both equally, whereas my 1 did everything and I called it five times, and my 2 was much more specialized and I only called it twice.
Also, thanks for indirectly teaching me the display:block attribute for the spoiler text!

Edited at 2009-05-28 07:56 pm UTC

(Reply to this) (Parent)(Thread)


[info]davidn
2009-05-28 08:03 pm UTC (link)
You're welcome, it's nice for large, well, blocks of text :)

I was very surprised as well at just how different the two solutions were, even though we definitely had fragments of the same sequences of moves in them, broken up among different commands that sometimes did things and sometimes didn't.

If I were thinking like a programmer I'd have gone "Let's get rid of this arbitrary function size limit and add some side-stepping commands"!

(Reply to this) (Parent)


[info]davidn
2009-05-28 07:59 pm UTC (link)
So in comparison of our solutions (and I'll look at yours for the first time as I write this), that gives...

Mine, all commands, those that don't do anything in []:

[Jump] Forward Forward Forward [Light] Jump Left Jump Jump [Forward] Right Jump Jump Forward [Forward] [Forward] Light [Jump] Left Left [Jump] Forward [Forward] [Forward] [Light] [Jump] Left [Jump] [Jump] Forward Right Jump Jump [Jump] [Forward] Right Jump Left Jump Left [Jump] [Jump] Forward Right Jump [Jump] Forward Forward [Forward] Light [Jump] Left

Yours, all commands, those that don't do anything in []:

Forward Forward Forward Jump [Forward] Left [Forward] [Light] Jump Jump Right Jump [Forward] [Forward] [Forward] Jump Forward Left [Forward] Light Left Forward [Forward] [Forward] [Jump] [Forward] Left Forward [Light] Right Jump Jump Right Jump Left [Forward] [Forward] [Forward] Jump [Forward] Left Forward [Light] Right Jump Forward Forward [Forward] [Jump] [Forward] Left [Forward] Light

Leading to...

My list of actual moves:

Forward Forward Forward Jump Left Jump Jump Right Jump Jump Forward Light Left Left Forward Left Forward Right Jump Jump Right Jump Left Jump Left Forward Right Jump Forward Forward Light Left

Your list of actual moves:

Forward Forward Forward Jump Left Jump Jump Right Jump Jump Forward Left Light Left Forward Left Forward Right Jump Jump Right Jump Left Jump Left Forward Right Jump Forward Forward Left Light

Which are identical apart from every time a light is lit, you turn left before it happens and I turn left afterwards. As you suspected, two completely separate solutions that somehow work to achieve the same thing. Surprisingly they're also equally efficient, as yours has one more move that doesn't do anything but finishes without having to then perform an extra move in the end.

(I was only spurred on to finish that level so that I could compare them like this)

(Reply to this) (Parent)(Thread)


[info]kjorteo
2009-05-28 08:17 pm UTC (link)
Counting the moves that don't actually do anything (because those aren't just free actions when actual programming is concerned, I suppose,) yours is barely more efficient, weighing in at 52 actual moves to my 53. However, I don't think even college CS professors (who are deliberately way more anal about efficiency than anything that will ever happen in real life just make some sort of point and frighten students) would begrudge me for losing by one move in the actual end result move list when everything else is such a perfect matchup (number of moves that actually do anything is identical, procedure when only counting moves that actually do anything is almost identical except for left-light vs. light-left, both sets of code are equally horrific and unreadable.)

Also, here's the best part: you called functions a total of eight times, I did seven. If you count a function call as a move (the go-from-this-set-of-instructions-to-that-one move wouldn't be computationally free either, would it?) then even the actual expanded move list turns into a perfect tie, 60 to 60.

(Reply to this) (Parent)


[info]davidn
2009-05-28 08:32 pm UTC (link)
Cobblers.

Well, I know I'm fairly filling this entry up with white space, but I just got through the last two as well, after thinking I would just be satisfied with beating Level 10 - the last two are indeed nowhere near as difficult. Level 11 isn't particularly interesting because our solutions were practically identical - I just had the extra "clockwise" you had at the end of function 1 done right after every call to function 1 in main instead.

But Level 12...!


Main:
Forward Jump Left F1 F1 F1 F1 Left F1 F1 F1 Light

Function 1:
Right Jump Light Jump Light Jump Light Jump Light

Function 2:
[Completely unused!]

I just made use of a high number of repetitions of the single F1 pattern, nudging it left a bit to compensate for when I didn't want to make a turn. The doubling up of the light at the end to sort out the one that I'd hit twice felt slightly cheeky, but it works!

I can see that that's what you were doing too, just achieved in a slightly different way - moving the repetition out to a function within a function and using the extra room that that gave you for a bit more tidying up at the end.


Phew.

(Reply to this)


[info]raptor41887
2009-06-01 01:00 am UTC (link)
My solution for level 12:

[spoiler]
Main sequence: Forward, Jump, F1, F2, F2, Clockwise, F1, F2, F2, F2, Light

F1: Counterclockwise, Jump, Light, Jump, Light, Jump, Light

F2: Clockwise, Jump, Light, Jump, Light, Jump, Light

[/spoiler]

(Reply to this)


[info]davidn
2009-06-01 03:49 pm UTC (link)
I bet you need even more overanalysis - I was very surprised when Whitney (after some pointing as I couldn't remember my own solution) came up with this:

Main:
F1 F2 Jump F1
Left F1 Forward Right
F2 Left F1 F2

Function 1:
Forward Forward Forward Light Jump Left

Function 2:
Jump Jump Forward Right Jump Forward Forward Light

Therefore:
Forward Forward Forward [Light] Jump Left Jump Jump [Forward] Right Jump [Forward] [Forward] [Light] Jump Forward [Forward] [Forward] Light [Jump] Left Left Forward [Forward] [Forward] [Light] [Jump] Left Forward Right Jump Jump [Forward] Right Jump [Forward] [Forward] [Light] Left [Forward] [Forward] [Forward] [Light] Jump Left [Jump] [Jump] Forward Right Jump Forward Forward Light (53)

And:
Forward Forward Forward Jump Left Jump Jump Right Jump Jump Forward Light Left Left Forward Left Forward Right Jump Jump Right Jump Left Jump Left Forward Right Jump Forward Forward Light (31)

Which is yet again a completely different way of getting there - it's the only solution that has two separate ways of lighting a square, with the ending tacked on to the second function and happily never affecting anything that came before it.

(Reply to this) (Thread)


[info]kjorteo
2009-06-01 07:31 pm UTC (link)
And just to make all of us feel stupid, Slither pointed out that a friend of his made the breakthrough realization that jumping off from where the left light is puts you back exactly at the starting position, and that knowledge allowed me to actually go back and make something with no wasted moves, provided you have a function to get from start to the top-middle of the stairs, since you'll need to do that twice, and one just to get from there to the left light since that is still a fairly long journey.

Main method:
F1, F2, Light, Counterclockwise,
Jump, Counterclockwise, F1, Clockwise,
Jump, Jump, Forward, Light

Function 1:
Forward, Forward, Forward, Jump,
Counterclockwise, Jump, Jump

Function 2:
Counterclockwise, Jump, Counterclockwise, Forward,
Clockwise, Jump, Forward, Forward

Put together, this gives us:
Forward, Forward, Forward, Jump, Counterclockwise, Jump, Jump, Counterclockwise, Jump, Counterclockwise, Forward, Clockwise, Jump, Forward, Forward, Light, Counterclockwise, Jump, Counterclockwise, Forward, Forward, Forward, Jump, Counterclockwise, Jump, Jump, Clockwise, Jump, Jump, Forward, Light

With, again, no wasted moves. Also, it weighs in at 31 moves (34 if you count the function calls themselves) making it almost twice as efficient.


I take credit for putting the exact details of that program together (all he told me was that his friend figured out that jumping off from the left light gets you back to the starting position, I actually took it from there) but definitely not for that breakthrough.

Edited at 2009-06-01 07:35 pm UTC

(Reply to this) (Parent)(Thread)


[info]davidn
2009-06-01 07:59 pm UTC (link)
... Well. That is, undoubtedly, how the author intended you to do it - I just raced through it again, got to it and came up with that exact solution as well with that small bit of new information (which seems so obvious now that someone says it). An example of a very logical method being missed in favour of insane cobbled together solutions caused by trying to work around limitations... why does that sound so familiar? :)

(Reply to this) (Parent)(Thread)


[info]kjorteo
2009-06-01 08:11 pm UTC (link)
I still assert that the ZZT solution works, and therefore it's good! ...by ZZT standards, anyway.

(Reply to this) (Parent)


(14 comments) - (Post a new comment)

Create an Account
Forgot your login or password?
Login w/ OpenID
English • Español • Deutsch • Русский…