taw's blog

The best kittens, technology, and video games blog in the world.

Thursday, September 29, 2016

EU4 Colonial Kebab AAR

Post 1 - Originally published on Google+ on 2016-09-06 21:17:25 UTC


Colonial Kebab: Part 01: 1444-1461: Regaining the cores

Time to play some EU4, and I wanted to try the new easy westernization system Eastern/Anatolian tech countries get before it goes away; and enjoy corruption, disloyal estates, states, espionage, ZoC bugs, and the rest of the new stuff.

I also checked every modification in Fun and Balance, and divided them into yes, no, and maybe groups. For changes I wasn't sure of (most notably scaled truce timer and no-mana vassal integration) I'm playing with vanilla values but I might change them as campaign progresses.

There are two variants of this easy westernization - regular variant which requires getting Vienna or Prague; and an even easier variant which requires Danzig or Krakow which Muscovy and friends get, probably as compensation for getting nerfed so hard in HoI4.

There's a lot of countries to choose from in Eastern/Anatolian groups, but as I also want to do some colonial game on improved map of Africa, I picked Ottomans.

Campaign goals are:
• westernize by taking Vienna or Prague
• unify islam (which requires blobbing quite hard)
• get nice colonial and trade empire

First step is of course getting capital. Weirdly it seems that vanilla fixed rival selection, so I have a wide choice of countries to choose as my PP cows, including Byzantium. What they did not do is fix maximum range, so F&B range fix is still necessary outside Europe, but we're doing well.

After that, I had a long list of cores to reconquer, which annoyingly generates a shitton of AE.

Then I got to some mission-based conquests, and I accidentally 104% OE, and got -30 legitimacy, -1 stability etc. So annoying.

I also get myself a very big coalition - but the faster I expand the better access I get to faraway places nobody cares for. I need to expand towards Prague or Vienna, and also towards Indian Ocean ports, and that led to lovely coalition of:

• Knights, Ragusa, Hungary, Austria (HRE), Venice
• Golden Horde, Aq Qoyunlu, Qara Qoyunlu, Timurids
• (briefly) Najd and Shammar

And then there's a bunch of countries which would love to join but are stopped by truce timers.

Fortunately I have two vassals - Bosnia and Serbia (both on scuttage, hopefully that means enemies can't pass through their territory, but who knows how ZoC rules work), and some allies - Tunis, Hedjaz, Georgia, Crimea, Wallachia, and Bohemia.

Now I'm presumably supposed to wait for coalition to either attack or get bored. I don't think I'm going to expand in Europe all that much, and I have tech advantage over everyone - mostly thanks to my starting 5/5/6 rules who's not going to last, but also thanks to estates giving me 100 of each mana type every 20 years, and +1/+1/+1 from max power projection. As far as I can tell, AI basically doesn't press estate buttons ever.

I started going for exploration ideas. Not sure what to take next. I thought religious, but conversion is crazy easy now between +3% from max piety, +1 missionary from Jerusalem, and +2% in any province I give to right estate.

 #ck2

And so it begins


4 cores to go, but let's get some fresh territory instead


It's a reasonable start. Timurids and Golden Horde have absolutely zero business being in coalitions against me.


Tech map. That won't last long, as soon as my ruler dies, it will look much worse, but then we're hoping to get free westernization at paper tech level 10.


Post 2 - Originally published on Google+ on 2016-09-07 01:38:33 UTC


Colonial Kebab: Part 02: 1461-1473: First coalition war

It should surprise nobody that I got hit by a coalition war right away.

The whole list of countries is fairly retarded:
• Austria
• Aq Qoyunlu
• Qara Qoyunlu (with Trebizond)
• Timurids
• Knights
• Golden Horde (with Ryazan, Circassia)
• Venice (with Naxos, Corfu)
• Ragusa
• Hungary

And then some random allies of Austria - Poland (with Lithuania and Moldavia), Brandenburg, Florence, and The Palatinate. It's good Austria didn't call in their remaining ally England.

Unfortunately unlike in the old patches when we just needed to defend our capital to get ticking warscore, coalitions now have bullshit show superiority wargoal.

Timurids started by completely ignoring fort ZoCs, so forts are still total bullshit.

My K:D ratios were completely ridiculous, at least at first - mostly thanks to my sword tech being 6 vs theirs 3 or 4. Of course my allies did much worse, and most of them ended up peacing out separately. On sea the fight was about even - neither of us could achieve total dominance.


Eventually I got +40 warscore from battles, but not enough to get ticking warscore - and that wasn't good enough for Austria to accept even my concession of defeat.

After five years of fighting I got them to accept giving me fairly symbolic 129 gold - they got far more in reparations from my allies, but that was the end of the coalition.

After that I beat up the Mamluks a bit more, and second coalition got reestablished - of Venice, Genoa, Aq Qoyunlu, Qara Qoyunlu, and Timurids.

Interestingly I could threaten Aq Qoyunlu to return one of my cores, and that established fresh truce and kicked them out of the coalition.

Well, not that much I can do now. I just need to wreck the whole coalition again - Venice/Genoa have stronger total navy, but not by crazy much, and I could maybe call Tunis into the war to help.

Setting up some kind of vassal Iraq and Persia to start tearing apart Qara Qoyunlu and Timurids sound like a good idea.

 #eu4



Post 3 - Originally published on Google+ on 2016-09-07 16:03:53 UTC


Colonial Kebab: Part 03: 1473-1484: Colonial era begins

Strategic goals are:

• move towards Vienna and Prague for fast westernization decision - even if capturing either would be hard due to HRE
• extend my colonial range into Indian Ocean (longer term also towards West Africa and New World), capturing Mecca and Medina on the way
• setup Iraq and especially Persia before hordes start to fall apart

So it's time to attack second coalition and setup some Eastern vassals. Except while I was waiting for rebels to go away second coalition fell apart.

That's much better - instead of coalition war, I had a quick war with Qara Qoyunlu to setup vassal Iraq and Persia, then another quick war with Timurids to enlarge Persia to size where they're a bit butthurt over being vassals.

I got expansion as second idea group, so I'm basically flooded by sword mana and spending it on development, as it doesn't do anything useful. I should perhaps pick some military idea group as third, but then again they all suck.

I've been trading for maps and stealing maps a lot in addition to sending my explorer around. Finally I discovered uninhabited island of Mahe next to Madagascar, which will be our first colony.

It would probably be a good idea to expand towards Vienna / Prague, but European alliance networks are crazy dense, and everybody's reasonably up to date with military technology, so if I do I'll face painful coalition.

 #eu4

Oh no, my troops are pocketed! Wait, wrong game.


A bit of bordergore, and it will kill like 3000 bird mana to annex all my vassals when they get all their cores back, but it keeps coalitions away.

I released Persia as Shia, not sure if it was a good idea, or if it would be better to wait a couple years to convert them, and only then release.


And there's my first colony. Also look at all those stolen maps. Africa is the only exception - it was basically bugged as I could put explorer in Red Sea, tell him to explore West Africa Coast (in range from other side), and he'd explore out-of-range South African Coast just fine.


Post 4 - Originally published on Google+ on 2016-09-08 19:25:32 UTC


Colonial Kebab: Part 04: 1484-1505: At Gates of Vienna

I got Janissaries who give me nice army bonuses, but they keep demanding money under every pretext. Oh well, I can afford that.

My amazing ruler died, and that means I really need to quick westernize - unfortunately it's difficult to focus on the West, as for coalition management I'm trying to destroy everyone who thinks I'm expanding aggressively.

I annexed Bosnia and Serbia, and I plan to annex Iraq, but Persia reached the stage of Greater Butthurt (+50% liberty desire due to being over 300 development), so that could be problematic. At least they have Sunni rebels, so there's some small hope they'll flip. Probably not, they're just too big.

When I finally decided to do something about Hungary, my tech advantage was pretty much gone. I had maxed out manpower when war begun, but I burned through almost all of it. So maybe quantity ideas wouldn't be that bad at some point? Still that's mostly because I'm overflowing with sword mana, and have shortage of paper mana, and I'll have massive shortage of bird mana when I pay about 3000 to incorporate Persia and Iraq.

I'm next to Vienna now, and Austria is setting up coalition against me, but it doesn't seem like a terribly big coalition and if they attacked me maybe I should just take Vienna as compensation. The downside is mostly that they match me in technology, and I'm currently low on manpower.

Thinking globally I got a network of allies - France, Bohemia, Crimea, Tunis, Hejaz, Sind, Brunei - so if anybody attacks me I'll have someone to throw under the bus as a distraction at least. Especially France might be useful to keep Austria-led coalition busy for a while.

I colonized up to Cape and to some minor Indonesian Islands, but it's rather uneventful so far. I can't really funnel that money into my trade node, so it's just money sink, at least for now.

The game decided to punish me for having too few rivals while simultaneously offer zero possible choices. For fuck's sake, how old is this feature and it's still broken.

 #eu4

Alliances, most just to distract any potential coalition. Austria claimed Hungarian throne, so I wanted to act before they get a PU.


Wouldn't it be nice if Sunni zealots flipped Persia to Sunni?


We're almost at Vienna, unfortunately I'll still need paper tech 10 (I'm at 7/9/9 now), and zero separatism to be able to westernize. In a way defending from coalition attack might be the easiest way to get Vienna.


Post 5 - Originally published on Google+ on 2016-09-09 02:10:39 UTC


Colonial Kebab: Part 05: 1505-1518: Still at gates of Vienna

Another attempt at building coalition against me got nowhere, so I reduced autonomy everywhere and fought some rebels while waiting for mana to build up.

I also made Persia Sunni as I really don't want to deal with messy cleanup - which weirdly only increased their liberty desire by about 40% instead of promised 100%, presumably due to some undocumented cap.

Somehow I managed to diplovassalize Adal in Horn of Africa, and used my CBs against primitives to get a bit of the coast - the good stuff are gold mines all the way to the south, so I should probably get there someday.

Hedjaz was allied to both me and the Mamluks, so when I attacked Mamluks they chose their side - and weirdly a mission giving me free claims on half of Hedjaz popped up just then - maybe it was blocked by us being long term allies. On the upside I got Mecca and Medina out of it.

Venice tried to setup another coalition against me, so I attacked them in a non-coalition war, sunk their fleet, wiped out their armies, and got Ragusa and Rhodes.

I got to tech 8/10/10 so presumably at this point if I timed thing better I might be pressing free westernization button.

And now Bohemia is attacking Hungary who's allied with Austria and Bavaria. I'm not sure how I should respond - what's likely to happen is that I'll get nothing or get wrong provinces and even bigger coalition against me.

I think Bohemia is confused because I once marked a bunch of Hungarian provinces as vital interest, but forgot to reset that once I got my border with Vienna - so they think their offer to give me Hungarian land is what I want. Well...

If Austria is cobeligerent, then it would make sense for me to accept, and maybe I'd get Vienna. Otherwise I might be simply getting another long truce for no value. I'm not sure if I can check if they're cobeligerent or not in any way.

Current coalition against me is a weird mix of Bavaria, Pope, Sienna, and Timurids - but a lot more countries would join - like Austria, Poland, Hungary, Genoa, and Naples if they weren't currently at war, and then once truces expire Venice, and Hejaz. The strategy of eliminating anyone who thinks I'm aggressively expanding is keeping it all in check.

So maybe I should just attack Austria now. They're allied with Hungary, England, Poland, Aachen, Palatinate, Saxony, Milan, Trier, and Brabant, but at least that would not be a coalition war, so I can just wait out their allies and have Vienna in ten years tops.

Of course after Vienna coalition war is pretty much inevitable, but we'll get to it in due time.

 #eu4



Post 6 - Originally published on Google+ on 2016-09-10 03:04:44 UTC


Colonial Kebab: Part 06: 1518-1523: Viennese Kebab

Well, apparently I can't start wars until I accept or refuse "call to arms". That was sort of cheesy, but I liked this tactic - "sorry, we can't join your war, we're already fighting them".

Well, I asked Muscovy for an alliance (since Hejaz's slot is now empty), and got into three wars:

• Bohemia's offensive calls to arms against Hungary/Austria/Bavaria (Bohemia thinks I want some Hungarian land I forgot to unmark as special interest)
• Muscovy's defensive call against Poland/Lithuania/Moldavia/Sweden for PU over Ryazan
• Muscovy's offensive call against Golden Horde/Uzbek, because apparently if they're in one defensive war, they can also make you join their offensive wars or something...

I've been sort of motivated to accept by mission to get 50 prestige, and I'm at 47 now. Otherwise I'd seriously consider throwing my allies under the bus - a lot of my old allies like Wallachia, Georgia, Teutonic Order, Hejaz are wrecked, and Bohemia and Crimea only so-so. Then again, Tunis is doing quite nicely, so it's not all negative.

Unfortunately I couldn't even commit all my troops to them seriously, as my lands were infested by rebels - and thanks to all the wars and rebels I've been baiting with autonomy reduction I finally ran out of manpower - and it went somewhat negative during all those wars.

Oh and I did something crazy and even build one castle in Hejaz territory - and another one in Nubia - just to keep rebels in check. I still destroyed a lot more than that, but cutting their costs to reasonable level makes them actually meaningful, at least when ZoCs are not going crazy.

Somehow all the wars turned out far better than I expected - Bohemia even actually transferred control over Vienna to me and gave it to me in the peace deal. When they transferred Vienna, I gave them control over about 15 Hungarian and Austrian provinces I sieged, but they only took Poszony in all of that. I didn't even have that much war contribution - about 16% last time I checked, with Bohemia's HRE allies doing most of the fighting, and me doing mostly just sieges.

Well, now just 30 more years to get separatism to zero and we can westernize.

For that one province I got hit by a coalition all the way to Aragon and Brabant, plus of course their dependents. When they attacked, these were a total of 42 countries - and my up to this point allied France and Muscovy (whom I recently helped in two wars) abandoned me.

Meanwhile, colonial affairs were happening on their own, disregarding European politics. I annexed Medri Bahri, whatever that might be, attacked Ethiopia for Adal's cores, circumnavigated the globe (but got no promised +100 prestige and +40 naval tradition, as explorer got stuck somehow).

I used spare prestige I had to place my relatives on thrones of Persia and Adal, but that doesn't seem to affect diploannexation speed. I vaguely recalled that it did once, but I'm not really even so sure of that.

Well, now it's time to deal with coalition war.

 #eu4

A bunch of easy wars


Oops


Post 7 - Originally published on Google+ on 2016-09-10 06:18:28 UTC


Colonial Kebab: Part 07: 1523-1532: Second, Third, and Fourth Coalition Wars

Coalition outnumbered me massively on land, I had zero manpower, and of my European allies only Bohemia joined my side, so it was time to merc up hard.

At least Tunis was on my side, and I had truces with some maritime powers (with Venice still rebuilding their fleet after I sunk it), so at least on the seas thing seemed to be doing well.

The war was series of doomstack on doomstack battles, with my stacks outnumbered, as is usual since they introduced forts:

• I lost initial 71k vs 178k battle of Varsad. Seriously, which fucking century is this?
• I won 126k vs 181k battle of Ragusa. We lost 39k men, they lost 53k. This is going to be dumb war of attrition with me throwing money at it, and they throwing manpower.
• I lost 132k vs 241k battle of Bosnia. Seriously, what the fuck. After HoI4's sophisticated strategy, this throwing around of doomstacks feels ridiculous.

I got to paper tech 10, and I decided to pick some military ideas for my third - going for quantity, as quality apparently got nerfed (no more policy for free colonist). Quantity is probably still a better idea, but since when is this a hard game where we need to make optimal choices about everything?

Unfortunately after third doomstack battle Bohemia had enough, and gave away not only the only province they took it war against Hungary, but also two more provinces to Saxony.

Apparently max attrition is now only 5%, so it's totally reasonably to keep 218k troops in a province which can supply only 34k.

Fortunately I was getting crazy warscore from killing random small stacks and minor fleets.

• I lost 112k vs 223k battle of Lika, so doomstack battles are mostly going against me.

But it was not all yet - Pope, Sienna, and Memmingen, concerned about being left out of their coalition war, started simultaneous war. It was totally ridiculous.

The coalition was technically losing the war, they've been all near war exhaustion cap, and still showed zero interest in actually ending it. Weirdly war exhaustion to reasons for peacing out translated in weirdest ways from -4 to -40 for 20 WE.

At this point I decided that enough bullshit is enough, and increased WE cap from 20 to 50. They reached the cap in about one more year of fighting - and were forced to split their doom stacks to deal with rebels at home a bit more.

Of course none of that was even close to done, as Naxos, Corfu, and Timurids attacked me in third simultaneous coalition war. It mostly cost me allies who decided to fuck that shit and after third coalition war in a row just gave up upon me.

After I finally beaten the main coalition enough to get them to give me some reparations (due to AI weights there is no middle ground between "we'll accept nothing short of total surrender" and "actually, we'll give you money"), two small coalitions weren't a huge deal.

I let Pope get away with reparations, and focused on the last war, as I wanted to get something from Timurids - one province from Khiva and Afghanistan each, to have some fresh vassals to dismantle the bastards completely.

And unfortunately EU4 is being total shit again, as I can't take provinces neighbouring my vassals at all now, because they don't neighbour me directly. For fuck's sake.

After all that mess I reestablished alliances, with new setup being:
• Crimea, Sind, Morocco (replacing Tunis), Muscovy, Brunei
• vassals Persia, Adal, Majeerteen

Now it's time to abandon any further European expansion for a good while (except maybe cleaning up leftovers islands) and focus on Africa. I wanted to expand into Asia as well, but apparently I can't before I finish annexing Persia, which currently has ETA of 1582.

I was attacked by a total of 48 countries, but it seems only 17 (Hejaz could have joined but missed on all the action) are still bothered by my so called "aggressive expansion", so I'll probably be fine.
 #eu4

CK2 attrition can reach 40%/month if you do something as ridiculous as this. Forts dumbed down the game hard, and they even lowered attrition cap to just 5%/month.


At least coalition dealt with Catholic rebels. HRE is half Protestant already.


That's how bad it eventually got before I fixed WE cap.


Now that WE is a real mechanic, they were forced to send some troops to deal with rebels at home, and I was able to push them back a bit. I burned through 2000 of my ~3500 money, but actually gained a ton of manpower in those wars - so I was relying on mercs too much and on regular troops not enough.


Post 8 - Originally published on Google+ on 2016-09-10 19:01:19 UTC


Colonial Kebab: Part 08: 1532-1539: East African Kebab

European expansion was closed due to coalitions, Asian expansion was closed because I couldn't take any land Persia bordered but I didn't. So that left East Africa, where I had two diplovassalized countries to expand.

But there was one more thing - I somehow had one Georgia's core, and Circassia with no allies had the rest, so there was thing small border correction to do.

Somehow East African fought way better than they're supposed to, and I'm not sure why. I was two sword techs ahead, had better general, and even some bonuses, and they still managed to force me to withdraw a lot of times. Part of it is that I couldn't uncover uncolonized provinces through which they surprise attacked me, and part of it is that they're also Sunni with piety-based morale bonus I guess.

Not that it mattered in the end - both my vassals there got huge swaths of new territory. Now it's time to do my missions to conquer North Africa - Europeans will be a bit annoyed as it's somewhat close to them, but not too much.

I settled some colonies in Brazil and conquered 3 OPMs, so soon I'm going to spawn a colonial nation there.

Coalition against me has 17 members, which is a fairly good reason not to expand into Europe for now.

 #eu4



Post 9 - Originally published on Google+ on 2016-09-10 23:43:45 UTC


Colonial Kebab: Part 09: 1539-1550: Western Kebab

Venice somehow got pope to call crusade on me, but nothing actually happened. Coalition looks at me funny, but they do nothing.

So I continued expanding Georgia, returned to Persia their last core, held by Circassia, got some land from Oman, and beaten up a lot of African countries to setup Mutapa as third East African vassal.

In New World I have colonial nation in Brazil, I'm setting up another in La Plata region, and I'm looking for golden cities.

Separatism in Vienna ticked down to the point I could finally westernize, even if it's like two decides behind optimal time. Now I'm overflowing on all types of mana.

Except my PP fell under 50, and my only rival is the now-unified Commonwealth who's in a fairly big coalition. I don't think they have any intention of attacking me, but they're good at stopping my expansion there.

 #eu4

I need to attack Portugal with Confusing Color CB.


With coalition in one direction, I'm expanding in others. Someday I might want to try a showdown with Commonwealth, kicking Lithuania out of them.


Post 10 - Originally published on Google+ on 2016-09-11 13:24:12 UTC


Colonial Kebab: Part 10: 1550-1568: Religious Leagues

So with westernization done, let's revisit the goals:

• Unifying Islam - that's about half done actually - Sicily is going to be the hardest part, as Morocco already took Cordoba, so I just need to grab it from them

• Control over Mediterranean - collapse of HRE in Italy and reformation both reduce AE it would generate, but mostly I'm just following peripheral road

• Control over Indian Ocean - lack of Suez canal makes any major naval operations difficult, but at least East Africa and Middle East are mostly controlled; I'd need to either build second fleet (as one in Mediterranean is very important for keeping coalitions in check), or just march to India by land.

• Control over the New World - one tiny colonial nation already spawned, but a lot more to go - lack of 4th colonist from policies and much larger number of provinces will make it harder than it used to be

• Disbanding or otherwise disabling the HRE - I could maybe take part in league wars at some point

Well, religious leagues started so I joined the Protestant league to make all my enemies join the Catholic league, then I switched to Catholic league after 5 year timer, and they all got friendly attitude and left coalition. With so few members, the remaining countries all disbanded the coalition anyway.

There are probably ways to cheese that even harder.

I got into war with Genoa, and apparently their Black Sea provinces are worth crazy amount of AE. It's as if AE was calculated based on distance to capital, not to province itself.

While I was waiting for warscore to tick up, Pope, Mantua, and Genoa all invaded my South American colonies. So much or AI giving a shit about naval range.

I finished Arabia, and almost finished conquest of East Africa, with Madagascar being split between my vassals - it turns out I overlooked tiny island held by Kilwa (with center of trade to make it sillier), and they westernized so I lost my nice CB.

My ally Brunei westernized too. Meanwhile my first colonial nation is still Anatolian. Maybe it should get border with the second one and westernize off that?

I diplovassalized Khiva and Tlemcen. I planned to release Khiva and feed it Timurid lands ages ago, but couldn't due to silly rules about not being allowed to take land unless I border it. It's all fine now.

Commonwealth briefly became possible to rival, then not again, so at least I refilled PP a bit.

Next step is to continue expanding in Asia and Africa. I plan to take influence ideas, which give AE discount, more relations, more reputation (for faster diploannexation), diploannexation cost discount etc. Considering how ridiculously long it takes to annex Persia, and how high AE in Europe is (elsewhere it's fine), I pretty much need it.

 #eu4



Post 11 - Originally published on Google+ on 2016-09-12 11:50:14 UTC


Colonial Kebab: Part 11: 1568-1580: Colonial matters

Corruption mechanic is pretty awful. I have slider at zero, so I'm not paying anything to fight it. It reduces itself by -0.02/year per stability level, and -0.05/year for being up to date on paper tech, and another -0.05/year for bird tech. So as Western (or almost Western) power, you can completely ignore it. As rest-of-the-world, you're fucked.

I fought natives near New York to establish 4th colonial nation, unfortunately I got stack wiped as I forgot how ridiculously large numbers natives get. So I sent them army twice the size, and once I conquered my way around New York, I sent them down to Mexico for 5th CN.

Colonization by Europeans is fairly anemic. Portugal got Brazil as CN, but it got wrecked so hard in Europe (reduced to Azores and Cape Verde) it had to release it. Castile got wrecked a bit less, but doesn't seem interested in colonization. Britain setup a small CN in Caribbean.

In Indonesia I conquered most of the westernmost island, and with light ships I sent to protect my transports I thought why not privateer a little. The answer is that I got found out, and that made Brunei angry at me and break our alliance. And they westernized so I can't just annex them. Oh well.

I annexed Persia, setup bigger Khiva, switched alliance from Sind to Delhi (as Sind is a lovely target), and expanded Georgia's territory into Crimea - my AE in Europe got low enough that it's fine now.

I was so busy with colonial business I missed that league wars started. I literally only noticed when I got report of naval combat. Wait, natives don't have navies, so WTF? What's that second war I'm in? What? Ouch.

This is going to be annoying, I only joined the league to disband my coalition, I guess I should have left as soon as it was done.

This is going to hurt, as 2/3 of my armies are in various remote parts of the world - Indonesia, Madagascar, Mexico, Ethiopia, Tunis. I only have 14k troops on rebel duty in my core lands, and Russia (in opposing league) already invaded by three times as much.

I even sold most of my ships (probably shouldn't have bothered, it's way too much micro with current interface), as new ships were coming in next two bird techs - but I didn't replace them as I went all in influence ideas instead of getting bird techs. And of ships I have, 2/3 are likewise away.

Then again, our league has twice the numbers and three times the ships theirs has, so even with half-hearted effort on my side we'll probably do fine. And if Germans on both sides bleed before it ends, so be it.
 #eu4

HRE Religious Leagues War interfering with my colonization plans. If it wasn't for Russian invasion of Georgia I'd be able to mostly ignore the whole thing.


New York waits for coring, Itza getting conquered, after it's done I can setup one in Louisiana.


Not sure what kind of CBs I can have on the now-independent Brazil. Just setup colony, fabricate one claim, then take the rest no-claim?


Slow kebabization of Indonesia. New Zealand is somehow filthy rich.


Post 12 - Originally published on Google+ on 2016-09-13 03:57:31 UTC


Colonial Kebab: Part 12: 1580-1590: League Wars

I was technically at war with half of Europe, but I mostly ignored it and started a bunch of others - Sind (my former allies), Timurids, Golden Horde, Bashkiria, random natives.

My fleets definitely underperformed. It wasn't quite a total disaster, but often even "won" battles ended up with more of my ships being sunk than enemy's. Once I get two next bird technologies, I'll rebuild it all.

Catholic League won a total victory, with 5 heretic electors losing their status, a lot of OPMs getting released, a lot of heretics paying up to Holland, dead Germans everywhere, and a lot of ships sunk. I got one of Greek islands from Venice as a reward, but my contribution was like 4% or so.

It was my first serious fight with Russia, and they don't fight too well, but they have huge stacks.

I'm not sure if Catholic victory benefits me or not. My most obvious enemies are Protestant League countries like Russia and Aragon, and if Holland stacks electoral roll with its allies and remain emperor, that's better for me than Austria as emperor.

On the other hand, if HRE now turns mostly Catholic and emperor starts passing reforms, that can end up poorly.

As soon as the league war ended, I finished a ring of vassals in Central Asia:

• Georgia (no good expansion opportunities left)
• Golden Horde (+50% liberty desire as historical rival, but a lot of Russia-held cores)
• Khiva (no good expansion opportunities left)
• Afghanistan (a lot of cores left)
• Baluchistan (can expand with CB on Indian tech countries)

I still have more vassal slots, so I plan to setup a few more in South-East Asia.

And meanwhile, I'll keep incorporating native tribes into my colonial nations. I'd prefer to avoid too much overextension until my corruption goes back to zero.

 #eu4

That's a very different HRE from usual.


Vassal ring.


Indonesia and New World. Those scattered colonies need to get connected.


Post 13 - Originally published on Google+ on 2016-09-14 10:30:20 UTC


Colonial Kebab: Part 13: 1590-1601: Global Kebab

I got hit by regency council, so I reloaded monthly autosave as this mechanic is bullshit (also getting removed next patch). Then again. Third time it was only a year, so I let it happen.

I continued colonial expansion, setting Sunda as Indonesian vassal to eat all OE and corruption. Unfortunately I split my fleet into 3 parts (New World, Mediterranean, Indonesia), and Indonesian fleet got sunk by Brunei.

The empire has fairly independent theaters, due to slow transfer time between them:

• New World - setup Louisiana CN, ate a bit more of Mexican minors, took over most of Brazil
• Indonesia - setup Sunda as vassal, ate most minors and chunk of (westernized) Brunei - remaining countries are mostly westernized
• Mediterranean - returned 4 cores from Morocco to my vassal Tlemcen - I'll need to conquer prettty much all of Morocco to reunify Islam
• Central Asia - ate most of Timurids and spawned OPM Punjab

Because of shortage of bird mana and lack of peace my WE was constantly >6 until I got event that made Brazil CN pay for the wall, I mean for reducing WE.

That meant a lot of rebels, and that meant a lot of attrition from fighting them, and that meant more WE. Not a fun loop, but I'm not wasting bird mana on this before I catch up on tech.

At least I got all the key shipbuilding technologies and rebuild my fleet with new ship types.

What's left of Castile and Portugal is small enough to be vassalized, but I lack good CBs for that.

Current plans is to keep expanding in multiple directions a bit, that's pretty close to coalition-proof.

 #eu4

Confusing color almost removed. Brazil somehow allied Morocco, so they got cobeligerented into this.


There's still a few CNs to do, like Canada and California.


I'm expanding so slow Europe forgot to coalition me.


Sunda had like 200k rebels by now. Because vassal OE is fine.


Post 14 - Originally published on Google+ on 2016-09-16 05:44:45 UTC


Colonial Kebab: Part 14: 1601-1613: Wars on all fronts

Even one year without starting a new war was annoying so I instantly started a lot of them:

• Castile (getting their guarantor Aragon into it) to vassalize them
• Genoa for leftovers
• some natives, then some more natives
• Kokkand, which meant breaking my alliance with Delhi
• Ahmendagar, also allied with Delhi
• Russia, for Golden Horde's cores
• OPM Ladakh because why not
• Morocco for Castile's cores (unfortunately Aragon occupied a lot of them first) and Ifni
• and a huge number of rebels - seriously, rebels are totally retarded and they spawn with 6x 42k stacks at once when the biggest armies in the world are below 100k except mine which is just a bit more than that. I think there was like a million rebels during those wars.

The problem was that I had no way around that WE as I was annexing two big vassals so until that ended, I'd not have bird mana to reduce WE (or to tech up).

The other problem was that they were actually fighting back a lot harder than I expected them to - well, mostly because I tried to do it with half as much army as I originally planned for, as the other half was fighting rebels.

And so my manpower actually went down to 0.

Unfortunately while I was fighting Morocco for Castile's cores, it got wrecked by Aragon, who took most of them, so I'll have to take them from a relatively stronger country.

In India I definitely overextended, and I had to fight about 100k of rebels from Baluchistan (140% OE) in addition to my own. So I diplovassalized Malwa, who's getting next batch of land.

I need just 4 provinces (for myself or vassals) to pass Unify Islam, and 1 of them is held by Morocco, and the other 3 by Aragon, so it will probably happen in  not too distant future.

 #eu4



Post 15 - Originally published on Google+ on 2016-09-16 14:10:58 UTC


Colonial Kebab: Part 15: 1613-1623: Kebab in Cordoba

I wanted to keep pressing, going against Aragon and Delhi, and maybe some assorted natives, but still scaling it a bit back from previous decade's warmongering.

It was still a lot more painful than expected, so against Aragon I just outlasted their allies, then I could deal with just them alone. I wanted to invade Sicily, but then new strait rules let them cheat their way back so that didn't really work out.

In the need I fully recovered Castile's territory (except for small French bits), and now I only need 3 more provinces to Unify Islam - Ifni, Palermo, and Messina.

And since Portugal accepted diplovassalization, I'll recover another good chunk of relevant trade nodes.

My army underperformed somewhat - part of the reason is that there's pretty much constant crusade against me, which gives countries fighting me military penalties. Why can't I call jihad as a caliph? It seems unfair.

My fleet underperformed too against Aragon and friends. It seems that light ships got nerfed quite hard since early days.

I let ulema go over 80% influence for a while, since penalties didn't seem that bad - it turns out there's hidden -1 stability when that happens and hidden -3 stability to remove the penalty - which I'll only be able to press after I remove their influence.

That's surprising, as penalties for very low estate loyalty are rather modest, and penalties for very high estate influence didn't seem so bad on tooltip.

 #eu4

I needed some provinces in West India for Unify Islam, but once my armies were in place, I might as well continue expanding.


I'm surprised by how many provinces I was able to get in one war. And nobody cares any more while they all wanted to wreck me for Vienna.


Post 16 - Originally published on Google+ on 2016-09-23 16:25:24 UTC


Colonial Kebab: Part 16: 1623-1643: Unifying Islam

I just noticed that having fought in league wars gives +0.5/year army tradition and -5% sword tech cost for 100 years. I didn't expect to get that as kebab.

Also taking humanist ideas, as honestly everything I want is in bird section (espionage, diplomatic), but I'm constantly short on bird mana and I have a ton of big vassals to integrate.

Getting rid of ulema was painful - I lost 1 stab when it happened, 1 by event, and 3 to remove them.

The next problem is that my vassals have been growing, and a lot of them are whiny crybabies who need constant placating. I should probably figure out how to quickly check their development to keep it just a bit under 300.

And there was one more issue - I need to be 100% Muslim to pass unify islam, but I got religious center in Ceylon. Fortunately I can cheese it, declare wars on infidel OPMs, get them to pay money, and get 100% piety this way.

A few wars later, I got remaining two provinces in Sicily necessary to unify islam. The problem is that I need all my provinces to be Muslim, which means not only those two, but also any ongoing colony.

I didn't even get any massive coalition for it - just Commonwealth and assorted Indians, the rest of Europe doesn't really care at this point.
 #eu4

With Portugal, Castile, and Tlemcen being my vassals, that's very good level of control over Mediterranean. I'd like to get the rest of coastline at some point.


Level of control over Indian Ocean is pretty good too.


Post 17 - Originally published on Google+ on 2016-09-29 13:18:59 UTC


Colonial Kebab: Part 17: 1643-1653: Islam Unified

I was about to press the Unify Islam button, but I overlooked that small thing that I needed 200 of each mana type for it, and wy bird mana was not really that high due to all the vassal integrations.

After I got the mana, I couldn't press it because one of my colonies wasn't Sunni. I'm not totally sure what's going on, as all my new world colonies became Turkish Sunni instantly, and so did early Indonesian colonies, but new ones in Philippines trade node stayed Filipino and pagan - I converted them later, but they retained wrong culture. Is it because there's a trade company in the region (even though those provinces are not assigned to it)? That's my best guess at least.

Well, it was a matter of some more waiting - and sending next colonists to New World. With all major goals achieved (except disbanding HRE, but how many times can one do this), it's good time to finish the game.

So some modding conclusions:

• long truce timers are not too awful, in sense that everything else got slowed down to that speed, so you'll be waiting with or without them
• sword mana is overflowing, paper/bird mana are always in short supply
• I wish AI was more moddable, just being able to tweak some weights would be enough
• it's painful how expensive vassals are to integrate
• it's also painful how butthurt vassals become when over 100/300 development
• the whole state/territory anti-blobbing measure seems fairly pointless
• forts and ZoCs are as broken as ever
• estates are probbaly a good addition
• I don't have much desire for more EU4

 #eu4


Tuesday, September 27, 2016

Some ideas for building a computer from scratch

Jasper's computer by evhoffman from flickr (CC-SA)
Very long time ago I tried to build a computer from 74LS parts. I didn't get too far, basically I had 40-bit switch input board, 40-bit led output board, and somewhat reasonable ALU.

I had plans to add register file and instruction decoder, and zero clue how to go from there to memory, clock, and I/O - but when I realized how painful soldering has been, and how much worse register file is going to be, I dropped the whole project.

It was still fairly cool way to learn electronics, and you can check the pictures and schematics.

So building entire computer still seems overwhelming, but here's a simpler idea.

Ingredients

  • I could skip soldering completely by just getting a stack of breadboards. It's going to be less compact, and I'll need to setup some kind of frame for them, but anything beats soldering.
  • I wondered about wirewrapping as another alternative to soldering, but nobody uses that.
  • PCBs seem even harder than soldering.
  • 74HC are apparently the new 74LS

Design tools

  • I've heard rumors that there are better languages than Verilog for modelling hardware. It would be nice to investigate one of them.
  • In addition to Verilog-level simulation, I'd like to do some wiring estimations before I start building it
  • Compiler for that architecture shouldn't be too hard to build.

What I actually want to build

  • I want ALU, register file, and instruction decoder
  • some RaspberryPi (or Arduino) will hold memory contents and interface with I/O - it will still need some kind of controller for it
  • Interface between RPi and computer will itself be somewhat complex
  • I'm not sure if I'll have separate clock, or if I'll use RPi as clock source
  • At some point I'd like to get memory - but still every bootup RPi will send contents to that memory before my computer will start running
  • Even if I get memory and clock off-RPi, it will still handle I/O, networking etc. It's nothing unusual, today every disk, every network card, every wifi dongle etc. have tiny computer on board.

Design ideas

  • The fancy multiport register file needs to go as wiring hell, and I can have classic CISC style specialized registers. It doesn't seem like a big difference when you look at Verilog, but there's a reason all old architectures did it this way, and trying to build one taught me that lesson.
  • Completely separate code and data will simplify a lot over shared memory architecture.
  • With separate code vs data, I can make code words as wide as I'd like - it sort of offloads part of decoder duties to compiler.
  • I don't think it will need any fancy microcode, then again any instruction will inevitably take multiple stages. I could start by having extremely wide words, and then moving parts of this logic gradually to instruction decoder.
  • It feels really hard not having 32bits. Maybe going 32bit is reasonable - just making registers wider is simple, ALU won't get any harder (ALU won't do multiply or anything crazy like that, we'll do that in software) except for some zero checks etc., so it's just a matter of wiring all that to memory interface.
  • 32bit architecture would definitely require RPi as controller, Arduino or small 74HC chip just won't have enough memory.

Where to start

  • I think the first step would be to see if Raspberry Pi is a viable memory controller. The RGB LED experiment with software PWM was sort of sanity checking that, but actual memory interface would be much more complicated.
  • If it can run at semi-reasonable speed, I can proceed to designing the rest of the system, and building it part by part. If it doesn't, the whole approach will need rethinking.

Monday, September 26, 2016

The Next Ruby

śpie by der_cat from flickr (CC-SA)

Ruby turned out to be the most influential language of the last few decades. In a way that's somewhat surprising, as it didn't come up with that many original ideas - it mostly extracted the best parts of Perl, Lisp, Smalltalk, and a few other languages, polished them, and assembled them into a coherent language.

The Great Ruby Convergence

Nowadays, every language is trying to be more and more like Ruby. What I find most remarkable is that features of Perl/Lisp/Smalltalk which Ruby accepted are now spreading like wildfire, and features of Perl/Lisp/Smalltalk which Ruby rejected got nowhere.

Here's some examples of features which were rare back when Ruby got created:
  • Lisp - higher order functions - Ruby accepted, everyone does them now
  • Lisp - everything is a value - Ruby accepted, everyone is moving in this direction
  • Lisp - macros - Ruby rejected, nobody uses them
  • Lisp - linked lists - Ruby rejected, nobody uses them
  • Lisp - s-expression syntax - Ruby rejected, nobody uses them
  • Perl - string interpolation - Ruby accepted, everyone does them now
  • Perl - regexp literals - Ruby accepted, they're very popular now
  • Perl - CPAN - Ruby accepted as gems, every language has it now
  • Perl - list/scalar contexts - Ruby rejected, nobody uses
  • Perl - string/number unification - Ruby rejected, nobody uses them except PHP
  • Perl - variable sigils - Ruby tweaked them, they see modest use in Ruby-style (scope indicator), zero in Perl-style (type indicator)
  • Smalltalk - message passing OO system - Ruby accepted, everyone is converging towards it
  • Smalltalk - message passing syntax - Ruby rejected, completely forgotten
  • Smalltalk - image based development - Ruby rejected, completely forgotten
You could make a far longer list like that, and correlation is very strong.

By using Ruby you're essentially using future technology.

That was 20 years ago!

A downside of having a popular language like Ruby is that you can't really introduce major backwards-incompatible changes. Python 3 release was very unsuccessful (released December 2008, today it's about even split between Python 2 and Python 3), and Perl 6 was Duke Nukem Forever level fail.

Even if we knew for certain that something would be an improvement, and usually there's a good deal of uncertainty before we try. But let's speculate on some improvements we could do if we weren't constrained by backwards compatibility.

Use indentation not end

Here's some Ruby code:

class Vector2D
  attr_accessor :x, :y
  def initialize(x, y)
    @x = x
    @y = y
  end
  def length
    Math.sqrt(@x**2 + @y**2)
  end
end

All the ends are nonsense. Why can't it look like this?

class Vector2D
  attr_accessor :x, :y
  def initialize(x, y)
    @x = x
    @y = y
  def length
    Math.sqrt(@x**2 + @y**2)

It's much cleaner. Every lexical token slows down code comprehension. Not character - it really makes no difference between end vs }, but all the extra tokens need to be processed even if they're meaningless.

Ruby dropped so much worthless crap like semicolons, type declarations, local variable declarations, obvious parentheses, pointless return statements etc., it's just weird it kept pointless end.

There's minor complication that chaining blocks would look weird, but we can simply repurpose {} for chainable blocks, while droping end:

ary.each do |item|
  puts item

versus:

ary.select{|item|
  item.price > 100
}.map{|item|
  item.name.capitalize
}.each{|name|
  puts name
}

This distinction is fairly close to contemporary Ruby style anyway.

If you're still not sure, HAML is a Ruby dialect which does just that. And Coffeescript is a Ruby wannabe, which does the same (while going a bit too far in its syntactic hacks perhaps).

Autoload code

Another pointless thing about Ruby are all the require and require_relative statements. But pretty much every Ruby project loads all code in a directory tree anyway.

As Rails and rspec have shown - just let it go, load everything. Also make the whole standard library available right away - if someone wants to use Set, Pathname, URI, or Digest::SHA256, what is the point of those requires? Ruby can figure out just fine which files are those.

Files often depend on other files (like subclasses on parent classes), so they need to be loaded in the right order, but Rails autoloader already solves this problem.

That still leaves out files which add methods to existing objects or monkeypatch things, and they'll still need manual loading, but we're talking about 1% of use cases.

Module nesting needs to die

Here's some random Ruby code from some gem, rspec-expectations-3.5.0/lib/rspec/expectations/version.rb:

module RSpec
  module Expectations
    module Version
      STRING = '3.5.0'
    end
  end
end

That's an appalling ratio of signal to boilerplate.

It could seriously be simply:

module Version
  STRING = '3.5.0'

With the whole fully qualified name being simply inferred by autoloader from file paths.

The first line is technically inferrable too, but since it's usually something more complex like Class Foo < Bar, it's fine to keep this even when we know we're in foo.rb.

Module nesting based constant resolution needs to die

As a related thing - constant resolution based on deep module nesting needs to die. In current Ruby:

Name = "Alice"
module Foo
  Name = "Bob"
end

module Foo::Bar
  def self.say_hi
    puts "Hi, #{Name}!"
  end
end

module Foo
  module Bar
    def self.say_hello
      puts "Hello, #{Name}!"
    end
  end
end

Foo::Bar.say_hi     # => Hi, Alice!
Foo::Bar.say_hello  # => Hello, Bob!

This is just crazy. Whichever way it should go, it should be consistent - and I'd say always fully qualify everything unless it's in the current module.

New operators

Every DSL is abusing the handful of predefined operators like <<, [], and friends.

But there's seriously no reason not to allow them to create more.

Imagine this code:

class Vector2DTest
  def length_test
    v = Vector2D.new(30, 40)
    expect v.length ==? 50

That's so much cleaner than assert_equal or monkeypatching == to mean something else.

I expect that custom operators alone would go halfway through making rspec style weirdness unnecessary.

Or when I have a variables representing 32-bit integers for interfacing with hardware, I want x >+ y and x >! y for signed and unsigned comparisons instead of converting it back and forth with x.to_i_signed > y.to_i_signed and x.to_i_unsigned > y.to_i_unsigned.

This obviously will be overused by some, but that's already true with operator overloading, and yet everybody can see it's a good idea.

We don't need to do anything crazy - OCaml is a decent example of fairly restrictive class of operator overloading that's still good enough - so any operator that starts with + parses like + in expressions etc., and parsers don't need to be aware of which library it uses.

a +!!! b *?% c would always mean a.send(:"+!!!", b.send(:"*?%", c)), regardless of those operators meaning anything or not.

Real keyword arguments

Ruby hacks fake keyword arguments by passing extra Hash at the end - it sort of works, but really messes up more complex situations, as Hashes can be regular positional arguments as well. It will also get messed up if you modify your keyword arguments, as it will happily modify Hash in the caller.

We don't check if last argument is a Proc, we treat them as a real thing. Same should apply to keyword arguments.

Ruby is currently built around send operation:
  object.send(:method_name, *args, &block_arg)

we should make it:
  object.send(:method_name, *args, **kwargs, &block_arg)

It's a slight incompatible change for code that relied on previous hacky approach, and it makes method_missing a bit more verbose, but it's worth it, and keyword arguments can help clean up a lot of complex APIs.

Kill #to_sym / #to_s spam

This is somewhat of a cultural rather than cultural problem, but every codebase I've seen over last few years is polluted by endless #to_sym / #to_s, and hacks like HashWithIndifferentAccess. Just don't.

This means {foo: :bar} syntax needs to be interpretted as {"foo" => "bar"}, and seriously it just should. The only reason to get anywhere close to Symbols should be metaprogramming.

The whole nonsense got even worse than Python's list vs tuples mess.

Method names should not be globally namespaced String

This is probably the biggest change I'd like to see, and it's somewhat speculative.

Everybody loves code like (2.hours + 30.minutes).ago because it's far superior to any alternatives, and everybody hates how many damn methods such DSLs add to common classes.

So here's a question - why do methods live in global namespace?

Imagine if this code was:

class Integer
  def time:hours
    60*self.time:minutes
  def time:minutes
    60*self
  def time:ago
    Date.now - self

and then:

  (2.time:hours + 30.time:minutes).time:ago

This would let you teach objects how to respond to as many messages as you want without any risk of global namespace pollution.

And in ways similar to how constant resolution works now with include you could do:

class Integer
  namespace time
    def minutes
      60*self
    def hours
      60*self.minutes
    def ago
      Date.now - self

and then:

  include time
  (2.hours + 30.minutes).ago

The obvious question is - how the hell is this different from refinements? While it seems related, this proposal doesn't change object model in any way whatsoever by bolting something on top of it - you're still sending messages around - it just changes object.foo() from object.send("foo".to_sym) global method namespace to object.send(resolve_in_local_lexical_context("foo")), with resolution algorithm similar to the current constant resolution algorithm.

Of course this is a rather speculative idea, and it's difficult to explore all consequences without trying it out in practice.

Unified matching/destructuring

Here's a feature which a lot of typed functional programming languages have, and which Ruby sort of has just for  Strings and regular expressions - you can test for a match and destructure in a single expression:

case str
when /c:[wubrg]/
  @color = $1
when /t:(\S+)/
  @type = $1

Doing this kind of matching on anything else doesn't work because $1 and friends are some serious hackery:
  • $1 and friends are accessing parts of $~ - $1  is $~[1] and so on.
  • $~ is just a regular local variable - it is not a global, contrary to $ sigil.
  • =~ method sets $~ in caller's context. It can do it because it's hacky C code.
Which unfortunately means it's not possible to write similar methods or extend their functionality without some serious C hacking.

But why add a mechanism to set caller $~, and then we could create our own matchers:

case item
when Vector2D
  @x = $~x
  @y = $~y
when Numerical
  @x = $0
  @y = $0

To be fair, there's a workable hack for this, and we could write a library doing something like:

case s = Scanner(item)
when Vector2D
  @x = s.x
  @y = s.y
when Numerical
  @x = s.value
  @y = s.value

and StringScanner class in standard library which needs just a tiny bit extra functionality beyond what String / Regexp provide goes this way.

But even that would still need some kind of convention with regards to creating scanners and matchers - and once you have that, then why not take one extra step and fold =~ into it with shared syntactic sugar?

Let the useless parts go

Here's an easy one. Ruby has a lot of crap like @@class_variables, protected visibility (pop quiz: what it actually does, and how it interacts with method_missing), Perl style special variables like $=, method synonyms like #collect for #map, flip flop operator, failed experiments like refinements etc.

Just let it all go.

Wait, that's still Ruby!

Yeah, even after all these changes the language is essentially Ruby, and backwards incompatibility shouldn't be that much worse than Python 2 vs 3.

Tuesday, September 13, 2016

Adventures with Raspberry Pi: RGB Led Take 2

Once upon a time I tried to do software PWM to set different colors in a RGB Led. It failed.

LEDs are generally either on or off, with no intermediate states - so to get LED at half the intensity, you just turn it fully on for half the time, and blink it fast enough that human eye won't be able to tell the difference.

The problem was that the blinking wasn't fast enough. So now it's time for the long overdue debugging.

First, what the hell is the gem doing? Apparently it's simply writing to files like /sys/class/gpio/gpio17/value. So what if we just write to this file in a loop, skipping the gem? It turns out that's also just not fast enough.

So fallback plan, let's get wiringPi library (git clone git://git.drogon.net/wiringPi) and write it in C:


#include <stdio.h>
#include <wiringPi.h>

int main(int argc, char **argv)
{
  int r = atoi(argv[1]);
  int g = atoi(argv[2]);
  int b = atoi(argv[3]);
  int i;

  printf("Raspberry RGB %d %d %d blink\n", r, g, b);

  if (wiringPiSetup () == -1)
    return 1;

  pinMode(0, OUTPUT); // R
  pinMode(2, OUTPUT); // G
  pinMode(3, OUTPUT); // B

  for (;;)
  {
    digitalWrite(0, rand() % 256 <= r);
    digitalWrite(2, rand() % 256 <= g);
    digitalWrite(3, rand() % 256 <= b);
  }
  return 0;
}

Then compile with gcc -o rgbled rgbled.c -lwiringPi, and run like sudo ./rgbled 255 127 0
And it works!

Now obviously I don't want to write C programs for every trivial thing, so next step would presumably be using ffi interface to wiringPi instead of what PiPiper does with file-based interface.

Monday, September 12, 2016

Using Trello for GTD

I IZ SAD. NO CHEEZBURGER 4 ME by stratman² (2 many pix and busy) from flickr (CC-NC-ND)
The big problem with GTD is that no software solution really matches the ideal workflow, and using post-it notes for it has its own problems.

I tried a lot of different software solutions. For fairly long time I tried using a bunch of files in a Dropbox folders for it. The big upside was how easy it was to integrate with it - just crontab a script to put a file into inbox if I need to be notified of something. But plain text files are really poor format for anything.

So as another tool in the long list I tried Trello. Here's the setup.

GTD board

I have one main list with a lot of columns:
  • Today (5) - just a place to highlight whatever I'm currently working on, or plan to work on if top item gets blocked. It gets empty by either finishing things or moving them back to action lists about daily.
  • Next Actions - I don't really feel like there's much value in using crazy number of contexts, most of which would contain no or very few items most of the time, so most actions go here.
  • Code Me - There's pretty much the only context which is constantly filled and clearly distinct from non-code actions.
  • Waiting For - what I'm waiting on to happen. Trello has advantage over plain text files, as I can put links, dates etc.
  • Someday/Maybe - a fairly vague list of ideas
  • Projects to Plan - these are sort of next actions, any project with no obvious next action goes there; the idea is that they'd go to Projects list once more actionable. It could be seen as another next actions column with "Plan Me" context tag.
  • Projects - any projects bigger than one action go here. Actions and projects should generally be linked, but usually it's obvious enough that I don't bother. Trello doesn't have easy way of showing projects with no associated actions, so I wanted to write a script to tag them, but I never got to it (Trello API isn't too bad).
  • Done - any recently finished action or project
  • Areas of Responsibility - mostly for reference during reviews. Anything bigger than a project.

GTD Archive board

About once a week I move Done column there, and add a proper date. It's mostly a feel-good board, with fairly little functionality.

Trello labels

Any long running project or area of responsibility gets its own label, as labels are the only easy way to tag trello cards. I use Card Color Titles for Trello Chrome extension, as otherwise Trello labels are fairly useless (you can see before and after in that link).

The only other label is red "blocked" label, which can be quickly applied and unapplied to action cards.

Off-Trello parts

Once upon a time I used to have "Buy Me" list, but nowadays I just throw things into my Tesco groceries or Amazon basket right away, and actually buy them weekly or so - and things not purchasable in either are rare enough they can go into generic action list.

Inbox is still a Dropbox folder, mostly with plain text files, so existing crontab scripts can still use it.

How Well it Works?

It all sort of works, but it's not exactly amazing. I don't plan to return to plaintext files, but I'll probably try something else eventually.

It's really annoying that I can't use it when offline, for example in London Underground - Dropbox had far better online/offline integration.

Friday, September 02, 2016

Modern Times mod for Crusader Kings 2 - Reaper's Due release

Lucy by hehaden from flickr (CC-NC)
Here's new release of Modern Times mod, now updated for 2.6.1, and mostly containing bugfixes, such as American invasion no longer accidentally being theocracy.

By accident infectious diseases were all gone in previous versions of the mod. While this could accurately show modern medicine, it's more fun to keep them, so now you can get them all depending on your game rules choices.

You'll only get Black Death if you set it to random, as on historical settings it will be long gone. Minor diseases happen just as in vanilla.

There's no SARS / HIV / bird flu or anything like that.

Thursday, September 01, 2016

How to teach coding

Book cat by raider of gin from flickr (CC-BY)

I've been helping people learn coding for a while now. Here are some notes.

Free resources

  • there's a lot of free resources out there
  • nearly all of them are of poor quality
  • it's very difficult to make good resources for make resources for someone very different than you - and by the time you can write a tutorial you're long past beginner phase
  • very often resources spend far too much time on pointless distractions, have huge difficulty spikes, present material in order where current lesson depends on something that will only be explained in the future etc. It's clear they're not adequately tested on actual beginners.

How to learn coding

There's absolutely no reason for anyone to ever do anything else than:
  • stay in-browser as much as possible
  • learn basics of HTML and CSS
  • learn basics of jQuery
  • only then progress to anything else
As far as I can tell that's the only way beginners can actually create something interesting and useful.

If you start by teaching people ruby or python, the best they can do is some completely artificial terminal programs like guess-a-number or such.

Even if someone needs to learn ruby/python, the best way is to first teach them web technologies, and then thanks to some framework like Ruby on Rails they can build something useful.

I'd very strongly recommend against teaching people "Javascript" as such. What people need is just bare minimum to be able to do simple jQuery style manipulations. Non-jQuery Javascript is better left for far later.

Tools

A lot of resources try to teach beginners how to use terminals, text editors like Atom, git, github etc. before they get to any coding. Crazy ones even try things like vim.

It's mindboggling why anybody would consider it appropriate to start with this. It's a massive distraction from the goal of learning programming and writing useful programs.

Fortunately there's a powerful environment even absolute beginners are comfortable with, and that's the browser.
  • repl.it - run simple program and repls in almost every programming language
  • codepen.io - experiment with HTML/CSS/Javascript and related technologies
  • most online courses have in-browser editors and tests
It's useful for every beginner to have a github account and to download Atom, but these shouldn't be the focus.

For people who use OSX, going off-browser is tolerable, but for people with Windows laptops that's huge amount of pain, so it's especially important to stay in-browser as much as possible.

Free resources reviews for web development

They're fairly good, and you can do a lot in-browser:
  • freecodecamp - this is the best beginner resource for web technologies I found - it covers a lot of content, it's well structured, and contains low amount of nonsense; there's a bunch of stuff that's "coming soon"
  • codecademy - it has a lot of content (web and non-web), but a lot of it has serious issues like random difficulty spikes and chapters with poor explanations
  • codebar tutorials - they're OK, but they suffer from having to download files and do everything locally - I found that in-browser lets beginners focus on the subject much better and be less confused by tooling
It's important that beginners can use minimum of unfamiliar tools for it, and mostly stay in-browser.

It's also great that hosting on github.io offers free and very easy to setup hosting for such apps.

Free resources for non-web development

I'm much less happy with these resources compared with web development resources:
  • ruby in 100 minutes - it seems to take people about twice as much. Whenever anyone wants to do it, I generally tell them to go chapters 2, 3, 5, 7, 8, 6, 9, 1 0, 11 and use repl.it.
  • Learn Ruby the Hard Way - I don't like this book, as it teaches Ruby as if it was Python, which feels like it completely misses the point.
  • codewars - good practice for intermediate level if you set the filters correctly (8kyu only, unsolved only, sort by popularity), as the defaults are completely wrong for beginners. It's much more useful for people who can already program and simply want practice in new language.
  • try ruby - a nice in-browser introduction. It suffers from minor distractions like symbols (I wish ruby just killed them completely) and ruby 1.9 leftovers.
  • udacity - I've been generally rather unhappy with quality of that, and they completely ignore all reported errors
  • books - just not worth it for beginners - in-browser environment and immediate feedback are just far superior
  • everything that you need to download to solve like rubykatas, exercism etc. - they're ok, but best left for later
It's much harder to setup hosting for your ruby/python programs, and it usually costs money.

Free resources for tools

Tools I'd recommend teaching:
  • stay in browser as much as possible - that's what everybody already knows
  • browser's development tools - this is generally fairly straightforward progression from basic browser skills everybody already has
  • codepen.io - far easier to get started than creating a bunch of files and keeping them synchronized etc.
  • repl.it - this should be deafult repl, not any kind of in-terminal irb/ipython/etc.
  • Atom - from what I've seen beginners have little trouble with it, unlike with some complex editors. It has ton of plugins, works on everything, and it's perfectly adequate for serious programming as well.
  • github - the browser side of it is reasonably approachable, terminal side much less so, and I'm not sure if there are any good client-side programs to make it easier.
  • github.io hosting - to keep people's motivations
  • terminal basics - it's fairly painful, and I wish Atom did more of it, so terminal would be needed less.
  • git basics - it really pains me, as this is extremely unfriendly towards beginners, but there's no alternative, and at some point they'll need to learn it - at least there's immediate payoff in github and github.io.
Unfortunately I haven't found great tutorials for any of the tools.