jack: (Default)
A recent conversation about Defence against the Dark arts teachers made me realise I use "evil" in two different ways. Sometimes I mean, "doing something bad on purpose". Sometimes I mean, "doing harm to other people". The greatest harm is often done by people who are indifferent to it. But people who maliciously hurt others are awful is a special way.

A couple of the professors were very indifferent-evil. They didn't set out to hurt people, but they didn't see any of the awful things they did to people. Others were malicious-evil, they were killing people all over the place.

And of course, it's more complicated by that. Most people who cause harm by inattention SHOULD notice, and exist somewhere on a scale from "I'm 8 and I haven't broken away from the worldview I'm immersed in" to "I'm really really really wilfully ignorant, and I must be actively avoiding thinking about this."

But insofar as it's helpful to be able to think about bad things, it's useful to realise that they often overlap, but when I say "very evil" I might mean one of two different things.
jack: (Default)
Camel Up

Played at Alex's. Quite silly and sometimes fiddly, but I really love the way it works. Camels race round a camel racing track. Each round, each camel moves once (1,2, or 3 spaces) according to a die, but the moves are spaced out as each player can either make a bet or move a camel, and the round only ends when all the camels are moved. Then the per-round bets are resolved. When a camel crossed the finish line, the per-game bets are resolved.

The camels are lovely: they're little camel meeple pieces which stack, and when multiple camels are in the same space on the track, they stack up, the top one considered in front. And when any camel moves, all the ones on top of it move along with it.

The way the bets work works fairly well, there's a token for a bet at various payoffs, and the first player to take one for a particular camel gets the best payoff, etc. So there's no "just bet as much as you want", you have to eke out small incremental advantages, which feels more in the spirit of the game.

Hogwarts Lego game

Belonging to Ms 8 (I think?). It works really well at capturing the feel of both lego and of hogwarts.

There's an arena of 4x4 lego rooms with room for four lego people to stand, which slides freely if an adjacent room has been lifted out. Four classrooms with relevant stuff to collect (potion, familiar, divination crystal, and spellbook), and the rest corridors, either straight, L-shaped, or T-shaped.

Each turn you roll a die and it gives you one of several different move types. Usually you pick up a corridor, and rotate it, or pick up a corridor and slide one to three other rooms around. You can slide classrooms and rooms with people in, but not pick them up. Then you move your meeple from one room to an adjacent room (assuming the doorways match up).

Each player controls a student from one house, and needs to collect the four collectables in their colour, and get back to their common room to win.

I don't know how well the strategy holds up, but it did very well at capturing the feel of lego: you build the arena and different rooms first, and the meeples and collectables have just the right lego bumps to click onto in the rooms and back in the common room. And also hogwarts: it's not scary, but it does feel like the layout is just constantly new to you.

The rules had a few weird omissions near the beginning (Do you need the room to match up with your common room before you first move into them?) But they also had several sections about suggestion rules modifications and additions, and had several extra pieces for them, and encourage you to experiment, which is a very lego approach to a board game.

Pandemic Legacy

C+K have pandemic legacy, Pandemic where you play a series of a dozen or so games, and each one alters the board and rules in a permanent way (good and bad). They've played about half the games and we joined on the most recent one. I'm carefully not talking about what happens, because most people who are interested probably want to play it for themselves. (But if you're curious and don't care about spoilers, feel free to ask me.)

But even knowing the general principle, it was really exciting to play a particular game and see what had happened and what happened this game. Some of the changes were about what I'd expected, but others were really interesting.
jack: (Default)
The fic I received was all the words that ever were or ever will be , a telling of some of the events in Bujold's Curse of Chalion from the Daughter's perspective. It didn't tell anything new, but I loved how it empathised with the Daughter's frustration, and told some of the story of her Father's curse from her point of view.

And I wrote Escape from the Orc Lair of Unnecessarily Revealing Armour, a Rat Queens and Oglaf crossover. It is told in a script-for-cartoon-panels format (although, as a literary device, it might not translate that well to an actual comic). It is quite smutty with bdsm and dubcon, in the general vein of both original works. If you like the sound of that, awesome, if you don't, you probably don't want to read it, although I include a break to read the set-up and ending if you'd like (see author's note).

ETA: Fixed link to my story.
jack: (Default)
http://ghoti.livejournal.com/804124.html

Ghoti started a book swap. The idea is, like a secret Santa, but you post your favorite book (or one of them) to a randomly chosen recipient. It would be cool if more people signed up.

Extra people who don't already know everyone on the list would be good :) Probably most people well be UK, but people from any country are welcome (I think?)

Deadline us tomorrow-ish (?)
jack: (Default)
So, I was too busy to actually spod about it, other than a constant stream of oblique hints (thank you, cheering section on twitter!) but I did nanowrimo.

I was confident I had MORE time, and ability to schedule a large chunk of time without dropping everything else. But I didn't know if I had enough, or if it was a sensible decision.

But I was excited to try a large personal project and see if I could do it. I've toyed with the idea before, but never felt like it was a serious possibility -- I was always too likely to push myself too hard and flare out, without any ability to pace myself.

I think it was about the most I could possibly manage in a month, without a really significant impairment of work or of all other social things. Not parkinson's law, but that was about as much writing as I could manage in a day, even under good circumstances.

As it happened, the first week didn't really get started, so I ended up writing 2k words a day for the rest of the time, but I stuck to that almost all the way through. And that was usually about right -- I had about that much ideas in my head, and I could mostly go ahead and write them, and after that, I had to *think* about what would happen next.

I really enjoyed the setting and characters, they did often come alive for me (waiting on reports if that actually made it into the fic or not).

When I did pause, it was one of a couple of things. Once or twice, because what came next needed a bunch of stuff to build a story out of (a bunch of characters for the protagonist to meet, or a problem for them to encounter). More often, but less fatally, because what I wanted to happen wasn't clicking, and I had to review what I intended, what was actually needed for the novel, and what I was attached to but could be compromised if it didn't fit.

Many thanks to everyone who expressed an interest in seeing the finished work. I noted everyone down just in case. I am really, really excited to share the novel, and am very serious about getting it to anyone who would like to see. But on balance, it really is better if I fix a lot of minor problems first (things like characters having names Placeholder1 etc :)). That should be fairly easy, but I officially took December as a break where I didn't have to write any more on it :)

Yuletide was comparatively easy afterwards :) I'd already come up with a basic idea, and it took a few evenings rather than just 2 hours to complete 2k words, so a lot slower than one day's nano writing, but still, finished without any last minute panic (go me!)
jack: (Default)
I am still mulling this over after reading some articles on it (thanks, fanf, Kaela).

Background

Imagine you have a fairly simple function.

RetType func1(arg1, arg2)
{
   return func3(func2(arg1),func2(arg2)).func4();
}


But those other functions may encounter errors. Eg. they involve opening files, which may not be there.

Assume the error return can't usually be passed to a follow-up function.[1] The obvious then necessary step is for each function call, test the return value, if it's an error, return an error from this function. Else continue with the calculation. But this usually involves several lines of code for each of these functions, which obscures the desired control flow.

If you are willing to accept exceptions, you can just write the code above an allow any exceptions to propagate. But that represents a lot of hidden complexity from not knowing what might be thrown. And often overhead in runtime.

And in fact, this may obscure a common pattern, that for some function (eg. "parse this"), you SOMETIMES want to treat the failure as an error, and sometimes to interrogate it. As in, choose in the calling code whether failure is an error-value or exception.

Also remember, in C-like languages, many values unavoidably have a possible error case which can't be passed to other functions, null pointer. Ideally it would be clear which pointers might be null and which have already been assumed not to be.

In Rust

In Rust (if I understand correctly), these possibilities are often wrapped up in a try macro.

There is a conventional "Result" return type from most functions which may succeed or fail, which has one of two values. Either 'Ok' (usually though not required wrapping a return value). Or 'Err', wrapping a specific error (just a string, or an error object).

The try macro combines the "test return value, if it's an error, return that error from this function, else, evaluate to the successful value" into a brief expression:

try!(func2(arg))

Which seems like often what you want. Obviously if you want to handle the error in some way (say, you're interested in whether it succeeds, not just the successful result), you can interrogate the result value for ok or err.

And there's also a macro for "assume success, unwrap the result value, panic if it's not there", just like you can access a pointer without checking for null if you want. But functions which can't return an error shouldn't return "Result", so if you do that, it's clear you *might* fail. Which is exactly what you want for throw-away code. But it does mean, you can search for the unwrap macro if you want to find all the points where you did that and fix them.

Rust recent innovation: ?

I mention try! for historical reasons, but just recently, Rust has promoted it into a language feature, reducing the overhead further from four to six characters, to 1: '?' after a value means the same thing as the try macro.

Result<int, errtype="ErrType"> func1(arg1, arg2)
{
   return func3(func2(arg1)?,func2(arg2)?)?.func4()?; // Pseudocode, not actual rust syntax
}


Rust recent innovation: chaining

This is also really new and not standard yet, but I like the idea. Error chaining. The function .error_chain(|| "New error") is applied to the result of a function call. If it was a success, that's fine. If not, this error is added to the previous error. It is typically then followed by the try macro or ?. (I think?)

That means that your function can return a more useful error, eg. "could not open log file" or "could not calculate proportion". Which carries along the additional information of WHY it couldn't, eg. "could not open file XXXX in read mode" or "div by zero".

And then a higher level function can decide which of those it cares about handling -- usually not the lowest level one.

In some ways like exceptions, but (hopefully, because Rust) with no runtime overhead.

Footnotes

[1] I often think of it as, an error-value is one that, under any future operation of any sort, stays the same error value, but that's usually not how it's actually implemented.
jack: (Default)
For a plot bunny (yes, really :)):

You have a multivalued function from a sphere onto "some surface", continuous everywhere except two points. (Or, equivalently, a function from "some surface" to the sphere, I guess?)

If you look at points on the surface which map onto the same point on the sphere, and connections between them of "paths" on the sphere (up to continuous deformation), I feel like they end up acting like the integers, where "+1" and "-1" correspond to a clockwise of anticlockwise circumnavigation. Or possibly some subset, a cyclic group of some finite order, if there are repeats. Is that right?

If you have *three* points, what can the relationship between the points look like? What about more?

I remember doing something like that but not what it's called.

I'm trying to put something like the shadows of amber onto a more concrete mathematical footing :)
jack: (Default)
In Lucky Number Slevin, there's a bit where a guy who's life is a disaster gets a second hand tip and makes a bet on a horse race with an (illegal) bookie he can't afford, and unsurprisingly it goes horrible wrong and they try to kill him.

The main moral is "prohibition makes for good films and disastrous government policy".

But then I got to thinking about the mechanics of running a bookie without access to law enforcement and banking infrastructure, and I didn't actually understand it.

I assumed, illegal bookies would exist on a spectrum. The more honest implementation being like a legal bookie: accept bets with cash up-front, or from people you're pretty sure are a good credit risk. Pay out if they win. That's it.

The other end of the spectrum being like a loan shark: extend credit to as many people as possible, let people get in over their heads, and then milk them for as long as possible before their life falls apart in ruins. If anyone decides to just not pay, force them or make an example out of them with physical violence.

But in Slevin, it seems like, the organised crime people knew in advance the mug was broke and could never really pay. So why do they accept the bet at all? As soon as the horse loses, they make a move on him. So they never expected to get *any* money from him whatever the race outcome. Even if you're *willing* to messily kill people, what do they gain by getting into that in the first place?

Is it just to get a splashy example so other people pay up? But don't you want them to dig themselves in FIRST? If you START by scaring everyone, maybe they just won't borrow money from you?
jack: (Default)
To give context to my previous tweets, in my novel, something like a creation narrative literally happens: God, angels, adam and eve, the war in heaven, six thousand years later, the present day. It's not exactly the same as any accepted belief system, but something along those lines.

I have not decided if that's *instead* of the geological history we have evidence of in this world. If so, I need to, um, explain biodiversity, and dinosaur bones, and geology, etc, etc, etc. And coming up with a plausible present day derived from that history is more world-building than I want, I'm basing it on "like the present day, but with fallen angels occasionally wandering about".

Alternatively, the two histories are sort of parallel, God "smoothing out" the older history somehow. Which makes sense, but is a bit of a cop-out.

So far, I've just not mentioned it, but it feels like a question hard not to have any idea of.

In terms of certainty, there are still characters, like the main character, who personally remember the war in heaven and the creation of the world, and interacting directly with God. Not remember *very* well, because time passes, but have a reasonable certainty that things happened like that. And some knowledge of magic etc supporting their assertion of knowing how the universe works.

(What happens *outside* this world *since* the creation is left uncertain, because that really would overload my worldbuilding.)

But I haven't really addressed what non-religious philosophies exist. People who don't find the evidence for God convincing? Presumably those people do exist, and for people who think the evidence is convincing in *this* world, they will seem exactly the same as atheists in this world. But for me, they're more like flat-earthers. People who think God created that universe much as described, but hasn't intervened since and/or has no special moral place? They presumably exist. I think I have those characters, though they haven't had conversations about it yet.

That's what I meant by "can I have dinosaurs" and "can I have atheists" :)

ETA: And as London Crawling points out on twitter, it would be plausible to have people who believe in dinosaurs and angels, but find the account of a prime mover who personally created angels unconvincing. In fact, that might even be accurate in this world -- my account of creation is all given second hand.
jack: (Default)
Do all numbers have a multiple which you can write (in base 10) solely with 0s and 1s?

Spoiler in the comments. And probably maths.
jack: (Default)
A little while ago, someone told me about a really simple algorithm brainteaser. Suppose you want to find both the minimum and maximum of an array. Instead of writing something like:
   for (int i=0;i<size;i+=2)
   {
      if (arr[i]<min) min = arr[i];
      if (arr[i+1]<min) min = arr[i+1];
      if (arr[i+1]>max) max = arr[i+1];
      if (arr[i]>max) max = arr[i];
   }

You can reduce the number of comparisons per two elements from 4 to 3 by doing something like:
      if (arr[i]<arr[i+1])
      {
         if (arr[i]<min) min = arr[i];
         if (arr[i+1]>max) max = arr[i+1];
      }
      else
      {
         if (arr[i+1]<min) min = arr[i+1];
         if (arr[i]>max) max = arr[i];
      }

I asked, does it make a difference if that pipelines less efficiently, and I didn't really get an answer, but I got the impression that wasn't a sensible question to ask.

But when I actually tried it, with some simple instrumentation code (using "clock()" from "time.h"), the second took about twice as long. On a windows PC, compiled with cl, using O2.

When I looked at the disassembly, each comparison looked to be something like:
   if (arr[i]<min) min = arr[i];
0040118B  mov         ecx,dword ptr [i] 
0040118E  mov         edx,dword ptr [arr] 
00401191  mov         eax,dword ptr [min] 
00401194  mov         ecx,dword ptr [edx+ecx*4] 
00401197  cmp         ecx,dword ptr [eax] 
00401199  jge         min_max_2+59h (4011A9h) 
0040119B  mov         edx,dword ptr [min] 
0040119E  mov         eax,dword ptr [i] 
004011A1  mov         ecx,dword ptr [arr] 
004011A4  mov         eax,dword ptr [ecx+eax*4] 
004011A7  mov         dword ptr [edx],eax

Which didn't seem great, but did seem like the number of instructions was proportional to the number of lines expected to be executed.

What have I missed?
jack: (Default)
Jogging

I went jogging at lunchtime. It was much more useful than last year when I tried that, because I've already got the habit of particular targets. And it was so much nicer running in the light (even in the rain). But I still need to get on with it, not let myself dither before actually leaving.

Writing

The last couple of days I've been hitting my nano word targets ok. Once I got a good idea of the characters and situation I was able to plough ahead and just write for an hour or two and get an appropriate number of words. But it's hard to keep that going without being hung up on "I need to figure out what happens in this bit" (I'm trying to avoid perfectionism, and just saying, "I need some plot here, this is plot, it's good enough for now", but even so, sometimes I have inconsistent needs and need to resolve them).

However it goes, I think it's a useful metric for how much time I can plough into a project if I'm determined, and how much it drains me for the rest of my activities.

Gas

Did I remember to say? Everything got fixed. We'd accidentally turned the gas cut-off handle (what's its real name?) putting something in the cupboard. After some fiddling, I turned it on again, and got the pilot light lit. And now I know where they are when I need them in a real emergency.

Politics

I don't really have anything more to say, except, my thoughts are with anyone who needs them :(
jack: (Default)
Procrastination

I never did enough writing for it to be a major source of procrastination, but when I did, I often did "not starting" or "having started, not wanting to stop because I don't expect to be able to start again tomorrow".

That was a very similar sort of procrastination I'd have first thing of the day at work, when I had a good task in front of me, but I was scared of starting it and having to stick with it all day.

I was pleasantly surprised to discover that has almost vanished for my writing. I wouldn't like to say it was permanent -- I'm sure it will rear it's head again if I'm writing something I *am* intimidated by. But I think once something becomes "I'm used to the idea that I can do this well enough compared to the standard I expect", it's a lot less intimidating to start, there's not the uncertainty, just an assumption if I put some time in I'll get commensurate results.

Writing vs coding

I've said I sometimes have a similar process with writing and coding. Not a formal process, just a similar pattern of mind. But it occurred to me it might be interesting to try and actually examine it.

Something like, I'm having some trouble starting something. Usually a chapter or a function, but sometimes a larger scale design decision. Why? Usually because I'm not sure what's actually going to go into it.

I usually have some things I WANT to include. If I write those out, those usually are a combination of "what I want this to achieve", "what I think a nice implementation might be" and "this is just cool, I'd like to have it".

And when I do that, I can usually see the problem -- usually, I had multiple, contradictory, assumptions about what it should do, usually because I thought of a simple constraint I expected to be able to fulfil, but it was contradictory to my other expectations.

But when I write it out, I can usually see what may be contradictory. And then decide which top-level requirements are most important, and accept any ugliness elsewhere which is necessary to achieve those, and then fulfil as many of the things I thought would be very good as possible.

If I had more time, I'd contrast a couple of particular examples, and this would be a lot less vague.

Liv

Unrelated to the above, but I was very pleased to realise, after a while of practising bridge bidding, and cycling, together, we're pretty much just on the same page: we usually understand our bidding, and cycling somewhere in town is mostly automatic, rather than an adventure.

No gas??

Nov. 6th, 2016 12:19 pm
jack: (Default)
Oh my gosh, I keep thinking I'm on top of things and then it turns out I have no idea :(

Since Sat lunchtime, we seem to have no gas. I don't *think* that means a leak?? Like, there's no indication of a gas smell or anything. But no gas in the stove or heating.

I don't *think* I screwed up paying the bill.

The last several months we've has some work done in the street, we had the gas cut off for a day while they did... something. But that was, lots of notes through the door saying "warning, off on this day, on again on this day, someone will come round to disconnect you and reconnect you".

My best guess is, either a problem with the valve here?? Or a problem with the works on the gas main upstream. But I don't know how to tell the difference.

I don't know if this is a "my problem, need to get a heating engineer", or "national grid problem, need to call them and ask" or how to tell the difference. I feel like that's just obvious to everyone else, but I somehow missed out knowing :(

And if it is cut off upstream, does that mean you need a professional to reconnect it? Or that causes all sorts of problems?

I naively supposed that the website would contain some sort of information, but it seems divided into two sections: "oh my god I smell gas emergency" and "everything is working as expected but I don't like it". I seem to have a problem physically impossible to have, what does that mean?
jack: (Default)
At the poly meet, they asked for volunteers to do a short presentation -- now it's a bit larger, the equivalent of Amy's prior "I brought a few q as a discussion topic" when there was often only half a dozen or so.

Except most people weren't sure what to present, so I volunteered to lead a little discussion instead. I started with something simple but interesting, what different sorts of poly are there. I wasn't sure how it would go, but I was sure it would be ok for five minutes. And it actually lasted about 45 minutes of clearly being interesting to everyone, before it reached a natural stopping point and I broke the group up to chat individually again.

Actually, it worked really, really well. Just defining things was interesting to experienced people and newbies both. And there was some productive discussion that I, and the admins, managed to avoid spinning off into long digressions.

I've done very little public speaking of any sort, but it worked really well when I tried it.
jack: (Default)
I really liked it. Especially the first half an hour or so is exactly the blend of humour, action, frivolous and serious I like. It manages to make deadpool seem both intimidating and effective, but also whimsical and willing to charge into impossible odds.

Deadpool is notoriously edgy, in good ways and bad depending on his mood and the medium he's portrayed in. His whole schtik is doing bad things to bad people -- he openly admits that's not really ok, but that it also does good by getting bad people out of the way.

There's two problem with "edgy". Read more... )
jack: (Default)
In every back to the future film, there's a bit 2/3 of the way through where everything is sorted, all they need to do is get back to the time machine and go home, Marty has escaped Biff and is walking off without getting beaten up, and Biff calls out, "What's the matter McFly? Chicken?"

And it's funny, because we all know he COULD walk away, but we all know he WON'T.

And yes, I never WANTED him to go back. He was the protagonist, he'd triumph if he did. But walking away didn't seem especially cowardly, it seemed smart.

But that's because standing up for himself was part of his core identity, but not mine.

Mine is more "be clever". I don't especially care about being cowardly. But I find it really really really hard to back away if someone implies something is OBVIOUSLY right and it's a waste of time to explain it to me. Learning to say "please explain" or to walk away, has been a long journey. (I have inoculated myself against some of the most common scams.)
jack: (Default)
Playing backgammon with dad, after day at Cambridgeshire crocodile and ostrich farm! (No skydiving :))

If all your pieces are in your home quadrant and you've started taking then off, and you can't move your furthest back piece because it would land on a point with two of your opponent's, must/can't you bear off your second furthest back piece?
jack: (Default)
Poly speed dating again tomorrow! In 3s. I managed to escape doing the programming for the matching algorithm this time :)

What should I tell people about why they should like me?