Blog

The Fall of Silly Bunny

For the last couple weeks, I've been playing Minecraft again, maybe half an hour a day at lunch or evening. I set up in a desert village at the corner of plains and savannah biomes, fortified it, then headed out looking for an End stronghold. A bit ago, I noticed a desert bunny had wandered over into the plains, and it was bouncing around; I didn't get too close and it was fine.

When I came back recently, I noticed a wolf which had somehow travelled a long ways from the nearest taiga, and realized it'd kill the bunny, so I tamed the wolf, brought it into camp and sat it down; I don't really like to haul them around, they get into fights and die quickly.

Today I went out, and apparently got too close, "spooked" the bunny, and it hopped right down into a ravine, with that horrible death cry YEEEEEeeek! Well, that sucked. I dug down and retrieved the hide, and made a grave at the edge.

2017-12-08-silly bunny

It's just some pixels that were there, somewhat out of place by random chance, that amused me until they made me sad, but it's got me pissed at Mojang again. The bunny AI is still awful; they routinely jump down tall hills that hurt them. It's been 3.5 years since bunnies were added (and the killer rabbits added and then removed because someone got scared a survival game might fight back), and nothing's been fixed.

The rest of the AI in the game is similarly still broken and awful. As noted, I don't use tamed wolves because they leap to their deaths off cliffs, into lava, under water, fight burning mobs, charge into skeletons firing arrows, or wander aimlessly as creepers blow up. Golems constantly get stuck spinning in circles between two or more goals they won't choose between; so I have to fence off villages, I can't rely on the golems to do anything. The polar bears look impressive, but are passive, the AI can't figure out how to attack when you do start a fight, they're super weak, and easily pillared out of reach (try that with a real bear and they'll climb up or knock over what you're on). Monster AI isn't too bad, if all you want is roughly pathfinding towards you regardless of hazard.

There's some amazing stuff in modded Minecraft, my favorite being Life in the Woods Renaissance, and things like the old Feed the Beast mod packs, but Mojang still slogs along adding trivial nonsense that doesn't work, or redesigning the file format so everything will break, instead of getting someone from Microsoft to help them with AI (maybe Microserfs explode if forced to write in a real programming language?), or adding some of the modded level of detail.

I simply don't understand their lack of development priorities on Java/desktop edition, which ought to be the hardcore version, the one where everything amazing is thrown in and "Hard" difficulty is actually hard.

The pocket/"Bedrock" edition's terrible in different ways, the controls are unusable for survival, the mobs seem even dumber, and exploration rapidly fills all flash storage, but I suspect nobody on pocket's ever played survival, they just stack blocks in creative mode. The half-billion or whatever customers playing that don't need smart mobs, just a cash shop full of bland skins instead of making their own.

Advent of Code 2017: Week 1

After 7 days, let's see how my Advent of Code 2017 is going.

  • Web framework: I made a standard web console, which I then copy forward to the next day. I could just as easily have put all the buttons on a single page, but it'd get too long by day 31.

  • Unit testing: As seen in stdlib.js, my test framework is very simple: On page load, setup, run some asserts, finish to get stats and redbar/greenbar the test console. This has been a great win, even though several of the days had only one or two examples.

  • 01:

    "The captcha requires you to review a sequence of digits (your puzzle input) and find the sum of all digits that match the next digit in the list. The list is circular, so the digit after the last digit is the first digit in the list."

    • So this is nice and easy, linear problem for JS string processing. On the second variant I turned the inner function to pick the next char into a function, which I pass in. No external state.
  • 02:

    "The spreadsheet consists of rows of apparently-random numbers. To make sure the recovery process is on the right track, they need you to calculate the spreadsheet's checksum. For each row, determine the difference between the largest value and the smallest value; the checksum is the sum of all of these differences."

    • Needed to write more utils, this time to process strings into a table of numbers. My first solution kept it as a table of strings, and then I had problems with JS type coercion. Same strategy of finding a pure functional inner loop and extracting that as a function. Actually, subtotalFunc1 mutates cols, but you'll never use it again so it doesn't matter.
  • 03:

    "Each square on the grid is allocated in a spiral pattern starting at a location marked 1 and then counting up while spiraling outward. For example, the first few squares are allocated like this:

    17 16 15 14 13
    18 5 4 3 12
    19 6 1 2 11
    20 7 8 9 10
    21 22 23---> ...

    While this is very space-efficient (no squares are skipped), requested data must be carried back to square 1 (the location of the only access port for this memory system) by programs that can only move up, down, left, or right. They always take the shortest path: the Manhattan Distance between the location of the data and square 1."

    • This was a little insane. There's apparently a pure math solution, but I am not a mathematician, I am a turtle; also song; also Lewis Carroll; also Gödel Escher Bach. So I solved it by moving a turtle around the spiral, turning left whenever there's an open space, and then I could just examine the spiral for values.
    • Yes, I store points as a vector-2 of numbers, rather than making a "Point" class with x,y. In C using a struct makes more sense (since it only takes 8 bytes intead of the 40+ in any object system!), but in anything else, the vector requires the least memory, least work, and is easiest to serialize, use as a hashtable key, and so on.
    • I just copy-pasted and modified for the second task, instead of making a nice inner function to pass in. It's not incredibly hard to parameterize, but I would need to break out of that inner function to return early, so probably using an exception for flow control?
    • Javascript objects are super-useful, like Python dicts but even easier to use. Stuff a bunch of points for the grid, and properties for the minPt, maxPt (bounds) and lastPt, one structure gets to hold everything about the spiral. Writing this in a type-safe or pure functional language would be annoying.
  • 04:

    "A passphrase consists of a series of words (lowercase letters) separated by spaces.
    To ensure security, a valid passphrase must contain no duplicate words."

    • Super simple, a histogram that only counts to 1. The second part only requires sorting the chars in each word, so you can check they aren't anagrams. I was worried that day 3 was the start of an exponential curve in difficulty, so by the end it'd take to the end of the Earth to finish.
  • 05:

    "The message includes a list of the offsets for each jump. Jumps are relative: -1 moves to the previous instruction, and 2 skips the next one. Start at the first instruction in the list. The goal is to follow the jumps until one leads outside the list.
    In addition, these instructions are a little strange; after each jump, the offset of that instruction increases by 1. So, if you come across an offset of 3, you would move three instructions forward, but change it to a 4 for the next time it is encountered.
    How many steps does it take to reach the exit?"

    • I returned the program counter at first, and that passes the sample data test, so I "guessed" wrong the first time, but then reread and found my bug. Having only one example is a problem. Both parts are as usual solved by passing in a function to determine the next state of the instruction. Trivial one aside from my stupid bug.
    • I'm building up a good library of tools by now.
  • 06:

    "In each cycle, it finds the memory bank with the most blocks (ties won by the lowest-numbered memory bank) and redistributes those blocks among the banks. To do this, it removes all of the blocks from the selected bank, then moves to the next (by index) memory bank and inserts one of the blocks. It continues doing this until it runs out of blocks; if it reaches the last memory bank, it wraps around to the first one.
    The debugger would like to know how many redistributions can be done before a blocks-in-banks configuration is produced that has been seen before."

    • Making the balancer was straightforward, I stored each state as a string in a history array, and a parallel histogram to catch the duplicate; I could get rid of hist but it turned out to make the second task easier.
  • 07: (Don't read this or the code until tomorrow if you don't want a spoiler)

    "You offer to help, but first you need to understand the structure of these towers. You ask each program to yell out their name, their weight, and (if they're holding a disc) the names of the programs immediately above them balancing on that disc. You write this information down (your puzzle input). Unfortunately, in their panic, they don't do this in an orderly fashion; by the time you're done, you're not sure which program gave which information.
    Before you're ready to help them, you need to make sure your information is correct. What is the name of the bottom program?"

    • Building the tree was a good puzzle, but not hard: Parse the text into nodes, keep them in a dictionary, then build the structure, and return the only parentless node (the root). Making a recursive toString so I could debug it was important…
    • Second task looked to be tedious (depth-first search and pass the result all the way up), but then I just looked at my output and saw the unbalanced numbers, so entered it by hand. I am a computer, too.

I've got both gold stars each day. I'm completely incapable of reliably checking in at exactly 21:00 PST, and I'm too fussy about my code to ever be "the fastest", so my rankings are awful; maybe it ought to count from when you read the problem set, but then everyone would cheat on at least the first task.

Animal Crossing: New Phone Book Edition

New animals and furniture just got added: Bluebear, Antonio, Phoebe, and Raddle! And a ton of new furniture, noticeably tiki torches, campfires, some new rugs, medical machines that go Bing!. I had all 40 animals unlocked, and 37/40 befriended, so this is just in time.

Rather than wait for the new ones to appear in random rotation, I'm starting to call them up with the Calling Cards I got from levelling other animals to Level 10 or 15. Never waste leaf tickets on anything temporary, only on inventory, market boxes, and maybe camper paint jobs.

If you visit my.nintendo at least once a week, you can click on your Mii wandering around, sometimes it'll give you coins (Club Nintendo points). Then hit Redeem, and you can redeem both AC-only points and Club Nintendo points for materials, like the ever-scarce cotton; in the app, you can only redeem AC points. I wish I could trade over some Miitomo points, too.

You can mark craftable furnishings as Favorites (star icon) on the order screen, without finishing the order. Do this for all the items you need to summon each animal, and for their special request items, and then they'll be on the star tab, without having to go hunt for the item or look thru contacts again. When you actually craft it, un-favorite it so you don't have to see it in the list again.

AC inventory favorites

After crafting 4 levels of the Cool street scene instantly (but had to wait for materials), for the 5th I'm now back to a giant 48-hour construction box and the endless sound of hammering and sawing. UGH. I'm at 240-something CC now, so I'll finish the holiday items tomorrow, a day ahead of prediction.

AC holiday kotatsu

Animal Crossing: Candy Cane Addiction

  • The first few holiday items went quick, and doing the ones with CC (Candy Cane) rewards in the Timed Goals, they're free or even generate a profit. The rest are a little pricey. Every day between the quarry and a few rounds of animal requests I make about 100 CC, so I should have all the holiday items by the 6th. Someone playing more casually should still get there by the end of the month.

  • Feature requests filed with Nintendo (More->Misc->Customer Support->Feedback): Market Box Search: Search all friends' market boxes for a specific item, and see a list sorted by unit price ascending. Sort Inventory: A button to sort clothes and furnishings A-Z instead of date-added. Breezy Hollow, the orchard area, has no reason to revisit it except when fruit resets every 3 hours. The other 3 harvest areas all have 2 fruit trees and fish/bugs, so Breezy Hollow should have 2 bug spots. Who knows if some English feature requests are even going to make it to the dev staff, but better than just complaining to the blog.

  • I've been thinking about the need for chat. It'd be nice to give feedback on camps beyond a Kudo (which for the daily goals is often just "first in the friend list"). Ideally we could just see our friends' Miitomo accounts and go chat there, it's been dead quiet for a year.
    But then I think of Nintendo's Disney-like purity goals and remember Randy Farmer's BlockChat post. So I'm pondering ways to share a URL with items, say with letter/number shirts in the camper.

These animals are crazy:

Beau Picnic

But not always wrong:

Bunnie Blogs

And sometimes full of wisdom:

Tex Coffee