Google
 

Tuesday, September 27, 2011

Kindle's "Reset to Factory Defaults" does NOT Reset to Factory Defaults

I was having some trouble today with a mod for my Kindle DX, and I finally said "fuck it!" and decided to reset the thing to its factory defaults. After all, I can just re-register it to my Amazon account, and re-download all the books I bought. That will solve my problem. Right? Wrong!

Even after resetting it to defaults (twice!*), the mod I was having issue with was still installed. I'm sorry Amazon, but an installed hack is not what I call "factory defaults".

* In the middle of re-registering my Kindle after the first reset, the screen blinked and all my information was back, as if I had never reset it in the first place. I wasn't even done inputting my password yet.

Wednesday, September 14, 2011

Elder Dragon Highlander

Elder Dragon Highlander is an extremely fun Magic: the Gathering format. Wizards re-branded the format as "Commander", and they've made it available in Magic: the Gathering Online as well. Myself, I really enjoy my Thada Adel, Acquisitor deck. It doesn't win especially often, but it's incredibly fun to play. I've dubbed it "Stealy McStealypants", because the deck doesn't really have a win condition — I use my opponents' win conditions against them. No matter what it is, my deck is capable of stealing – sorry – 'acquiring' it.

Anyway, this post is mostly about the awesome game I just had on Magic Online. The game was between me (Thada Adel, Acquisitor) and two other people (one playing Sharuum the Hegemon, a known top-tier combo deck; the other playing Karador, Ghost Chieftain. The game starts off slow, with everyone playing lands and not doing much else. I play Thada on turn 3, as I usually do (normally, I use her to steal some Sol Rings or somesuch at the beginning of the game, and rarely do much with her afterward), but when I attacked the Sharuum player, he dropped a Shimmer Myr in my face.

The Karador player, who had been peacefully ramping up mana, drops Teneb, the Harvester onto the field and takes a swing at me, so I steal it with Dream Leash. Unfortunately, before I can use Teneb for anything, the Karador player is forced to leave due to unforeseen circumstances.

By this point, the Sharuum player has Leonin Abunas in play. After some back-and-forth, I finally get in a hit with Thada, and steal Norn's Annex to slow the mounting army of automata. I'm able to deal with things to some extent by using Capsize on the Leonin, but that eats up six mana each turn and it doesn't leave me with much. Then the Sharuum player equips the Leonin with Swiftfoot Boots and I'm in trouble; almost everything on his field is an artifact, I can't target any of his artifacts with anything, and I can't target the thing preventing me from targeting them. A conundrum. Current life totals — Me: 10, Him: 34.

So, I steal his Venser, the Sojourner using Blatant Thievery, and then use his third ability and start exiling permanents from his field. Unfortunately, I still can't target most of his things, and I'm forced to target his lands. Time Stop buys me another turn to find an answer, and Rite of Replication builds me a wall of creatures to hide behind. (It also gives me throwaway targets for Venser's emblem, since it's a mandatory trigger and I've run out of targets on my opponent's field.)

Here's where the fun really starts. Mystical Tutor searches my deck for Bribery. (Since I already had Future Sight, I can cast it off the top of my deck.) Bribery searches my opponent's deck for Kuldotha Forgemaster. Moving Lightning Greaves onto the Forgemaster allows me to activate its ability immediately, to search my deck for Mindslaver. Then, I activate Mindslaver to control my opponent's next turn.

At this point, the life totals are 10 to 32 (my opponent paid life into my Norn's Annex), with the following battlefield:

Him: Vault of Whispers, Seat of the Synod, Everflowing Chalice (one charge counter). Copy Artifact (copying Norn's Annex), Sculpting Steel (copying Norn's Annex), Skullclamp, Swiftfoot Boots. Leonin Abunas (equipped with Swiftfoot Boots), Shimmer Myr, Etherium Sculptor, Faeire Mechanist.
Me: 10 Snow-Covered Islands, Strip Mine, Teferi's Isle, Ghost Quarter, Reflecting Pool (enchanted with Dream Leash), Thran Dynamo. Sensei's Divining Top, Norn's Annex, Gauntlet of Power, Future Sight, Lightning Greaves. Magus of the Future, Empress Galina (equipped with Lightning Greaves), Thada Adel, 5 Sphinx Ambassador.

Controlling my opponent on his turn, I move the Swiftfoot Boots to his Faerie Mechanist and cast Demonic Tutor, searching his deck for a basic land, rather than something useful. Then, I attack with all of his creatures (paying 8 life into my Norn's Annex) and block with my Sphinxes. Now that I can target everything on his field, I capsize each of his lands and his Everflowing Chalice, using Venser's emblem to exile his Copy Artifact (Norn's Annex), Sculpting Steel (Norn's Annex), and two equipment. His field completely empty, I swing in for 38 damage and the win.

In description after-the-fact, it seems... less. But at the time, I was frantic for an out to the hexproofed field, especially once I realized Venser's emblem was mandatory and I'd have to exile my own cards ever time I cast a spell. I spent a fair bit of time trying to figure out what to get with Mystical Tutor, and picked Bribery hoping he'd have a board wipe or something. Then I spent far too much time looking at his creatures, not finding what I'd hoped for. And then a light turned on in my head, as I realized I had Mindslaver in my deck and there was a Kuldotha Forgemaster sitting there, waiting to be bribed.

Friday, September 2, 2011

Android Resources: Map Structures

Resource files host a very limited set of data types for Android developers. In a recent project, I wanted to have a mapped data set (in Java, the data type would have been Map<String, Map<String, Integer>>). I looked around the internet trying to find out how to do it, and the resounding answer was that it's not possible. Options include creating a <string-array> and an <integer-array>, and merging them into a Map at runtime, or alternatively creating a series of <string> resources, and merging them into a Map using reflection.

In my opinion, neither is a particularly good option for creating a resource, when the supported types work so seamlessly. So, I spent time developing a workaround. It turns our that the <array> type is functionally similar to Object[]. Each <item> can be any simple type (int, string, etc.), or else a reference to an existing resource (of any type). This means you can in fact have a nested array, you simply have to write each array separately and then use a reference in one to the other.

<resources> <array name="my_array"> <item>@array/a0</item> <item>@array/a1</item> <item>@array/a2</item> </array> <array name="a0"> <item>0,0</item> <item>0,1</item> <item>0,2</item> </array> <array name="a1"> <item>1,0</item> <item>1,1</item> <item>1,2</item> </array> <array name="a2"> <item>2,0</item> <item>2,1</item> <item>2,2</item> </array> </resources>

Unfortunately, you can't simply load the resource as a Map or Object[][]. It's a little more complicated than that. You've got to load the TypedArray ('my_array'), loop through the values, obtain the resourceId for each of those values, use the resourceId to load the sub-array as another TypedArray, and then loop through those values. Further levels adds more steps of the same actions.

TypedArray myArray = getResources().obtainTypedArray(R.array.my_array); int columns = myArray.length(); for(int i = 0; i < columns; i++) { int rowid = myArray.peekValue(i).resourceId; TypedArray row = getResources().obtainTypedArray(rowid); int values = row.length(); for(int k = 0; k < values; k++) { System.out.print(row.peekValue(i).coerceToString() + "\t"); } System.out.println(); }

I have not tried creating array which reference each other, but it's definitely a bad idea. I suspect it'll result in a compile-time error, but I don't intend to try.