Tuesday, January 27, 2015

Problem analysis

Response to
http://discourse.codenewbie.org/t/coding-exercise-problem-breakdown/618


  1. Check front door lock.
    1. If locked, unlock.
  2. Open front door.
  3. Until distance to car door = 0, walk toward car door (I'm deliberately ignoring pathing concerns, my car door is basically straight outside my front door)
  4. Check car door.
    1. If locked, unlock
  5. Open car door.
  6. Sit down in driver seat sideways.
  7. Juggle lunch, backpack, etc into passenger seat (this sort of crap is why robots tend to look so clumsy, just try and create an algorithm for how your arms move doing that, never mind controlling your balance through it all, your brain really is amazing)
  8. Pull feet into car.
  9. Close car door.
  10. Insert key into ignition.
  11. Turn key.

There are a few minor steps left out and there's some assumed knowledge like the car not having keyless ignition (mine does so this algorithm couldn't be applied naively to my case). It also assumes that you're able to carry whatever you're carrying without juggling anything around, and you don't have to find the right key on your key ring or look for your car in an apartment parking lot. And it still took 11 procedural steps.

Oh. And we never closed and re-locked the front door. That wasn't in the requirements. Of course in my case my wife does that in the morning so I suppose you could call me a good example of why you should follow the requirements doc once it's been reviewed and accepted by all parties.

Tuesday, January 13, 2015

Code Combet + Firefox = win

Wow. This runs so much better in Firefox. Go figure.
It's nearly unplayable in Chrome (which surprised me), it's a lot better in IE (which floored me), but it's smooth as silk in FF. Well, aside from slowing down a bit as the thang count increases.

Also, in IE my solution to one of the levels locks up every time I submit it even though it runs fine in the 'debug environment'. In FF? Works like a charm. Go figure. >.> FF just earned a spot back on my computer.

Sunday, January 11, 2015

Certainty

There is one thing about which I hold myself certain. One thing I consider inviolable truth. It is that certainty is poison to the human spirit. The more certain you are of something the less human you become. Witness fundamentalism everywhere.

If you are certain of something then that is something that you must do your utmost to inject doubt into. Examine under the light of many worlds, consider it as the ancient Persian would both drunk and sober, include as many more altered states as your lifestyle allows, consider whether you would believe the same if your moral basis were built upon something else. Perform experiments, physical or social as necessary, to test your understanding and the veracity of your certainty and keep notes. Make it impossible for yourself to ignore the edges of your certainty where logic or fact tells you otherwise. Because once you refuse to allow yourself to see one small facet of reality you begin to blind yourself to all of it. And thence, by all measures of psychiatry, lies madness.

I have yet to find evidence that certainty in any thing does more good than harm. However while there are truths that lack contrary evidence there are no truths that merit certainty. I accept even my initial statement in this post as a poison, it poisons my ability to make statements unambiguously and it poisons my ability to trust in the things that people say. Frankly, that may be a good thing in some cases. I accept that one poison regardless but no further. No other certainty will I knowingly accept into my self.

Smart methods can make a developer look stupid.

So I'm playing through Code Combat (works a lot better generally using Python and in IE though it still has a lot of head-on-desk problems) and I reach a section where I'm supposed to blow up ogres but not villagers. Thing is I only have access to findnearestenemy() in order to identify them. Now it's a pretty explicit method name but I'm much more used to dealing with very simple functions. I'm expecting this to give me whatever the nearest actor is and make me decide whether it's something I want to attack or not. Indeed, a method that does that is generally more useful. So I'm bonking my head for 5 minutes or so because the example code which you're forced to use doesn't account for villagers.

Well apparently findnearestenemy() only returns hostiles. Duh. But. As a method that makes it painfully specific. I'd much rather have a method that gives me the nearest actor and lets me decide whether it's one I care about or not. Maybe that method comes later.

Saturday, January 10, 2015

CodeCombat take 2

So, it works much better in IE. To my great disappointment. It looks like Coffeescript is rather better/more fully implemented. Since they say it's mostly written in Coffeescript that stands to reason. What doesn't stand to reason is that even the CS implementation has bugs, or at least one level/possibly game, breaking bug. You can't attack in a loop. Though to be complete I don't think I tried attacking and something else in the same loop, but the level startup script contained a comment that attacking in a loop was currently broken. Anyway. That worked in Python, but it seems a bit silly to expect someone to work an entirely different syntax just to winkle their way past a few levels here and there.

Oh, and they're looking to hire a level designer which for a 'game' like this would be a very particular set of skills. Suggests that they're doing pretty well too. Though, having a good handful of languages implemented (mostly and partially) is generally pretty good.

Having escaped the dungeon it's time to explore the countryside. Onward!

Edit: Correction. There are a ton of bugs in IE as well. For an extremely frustrating example the second level in the forest area requires the leather boots. Only I couldn't buy them because the price was 'undefined.' Which may only be a minor data error but it stymied my progress until I decided to try buying the next upgrade of boots (reinforced or something) which I thankfully already had the gems for. Equally thankfully the game only checks that you have the required methods available on your equipped gear (in this case the moveXY method) rather than checking the gear itself. So that was at least thoughtfully implemented.
And then, of course, I don't know how many times I'd gone in and out of the level in the forest before it the second level stayed unlocked without a refresh. Here's the scenario: Enter level 2. Fiddle with it some and get frustrated at the bugs. Close IE to try it in Chrome. Get sick of it there, and go back to IE. Level 2 is closed. ?!? Hit refresh. Level 2 is back. !?!
Maybe the page is cache-enabled when it shouldn't be? But Chrome didn't have that particular problem. It has different problems. Cumulatively it's getting to be enough to put me right off the game.

Oh, and apparently you can put @attack in a loop in Coffeescript as long as there's some other statement with it. So... yeah.

Monday, January 5, 2015

It's the end of the year as we know it

The year is finally over, the holidaze are past, and I think my EOM-induced jetlag is mostly receded.
And now I've discovered that CodeCombat supports Io. Best surprise I've had all year. Might even keep that title through December!

It's marked experimental but I'm always up for a bit of frustration (or I wouldn't be interested in code anyway). Time to test it out!

Edit: Aww, massive letdown. It's not implemented anywhere near fully enough to be playable. Or maybe fun. I mean, basic loop structures aren't in place. So theoretically you might be able to play through (so far everything I've seen could be done purely by hand but I have no idea how long that will hold out) but you certainly won't learn anything useful or even enjoy the experience. Mind, this is only relevant to Io; I haven't looked at any of the other language implementations yet.

Friday, January 2, 2015

Good intentions

Intention does not matter in this existence. Only result can be meaningfully measured and therefore intention matters only insofar as your focus on it guides you to the result you intend.

Aphorisms about roads to various places are mistaken. If you were focused on your intention then the destination would be in sight and you'd know you were heading the wrong direction. Intention paves nothing as it isn't substantial enough in this existence to do so; intention must be the compass. Actions (even the act of speech) are your paving stones.