News

My campaign to produce Shakespeare's Sonnets: A Graphic Novel Adaptation needs your help! Please sign up at https://www.patreon.com/fisherking for access to exclusive content and the opportunity to be a part of the magic!

I'm also producing a podcast discussing the sonnets, available on
industrial curiosity, itunes, spotify, stitcher, tunein and youtube!
For those who prefer reading to listening, the first 25 sonnets have been compiled into a book that is available now on Amazon and the Google Play store.
Showing posts with label algorithms. Show all posts
Showing posts with label algorithms. Show all posts

Saturday, December 13, 2025

a quiet winter's day

balatro until late again. and a fair amount of it today.

i started the day slowly, finishing the fourth percy jackson novel and leaving the following review:

a bittersweet experience, a great story but clearly rushed.

the first three books of the series set a really high bar, and i wondered how it could be that the percy jackson franchise hasn't gained as much traction as the harry potter one.

but then i read #4.

while the story itself is great, with lots of exciting and clever elements, riordan and his editors seem to have started taking their readers for granted, and a whole lot of things just seem lazy. and i find myself offended by every single incorrect usage of the word "shined" as opposed to "shone"; if those editors got paid, the publisher should demand its money back. 

**SPOILERS** 

two scenes in particular of the glaringly obvious cardinal sin of breaking the fourth wall to tell, rather than show. one of them is kelli the monologuing empousa:

“a vampire, you say?” kelli laughed. “that silly legend was based on us, you fool. we are empousai, servants of hecate.” “mmmm.” tammi edged closer to me. “dark magic formed us from animal, bronze, and ghost! we exist to feed on the blood of young men. now come, give me that kiss!”

seriously.

and then there's the telekhines receiving on-the-job sex-ed in the forges.

“now, younglings,” the instructor said, “what is the proper name of our kind?” “sea demons!” one of them barked. “no. anyone else?” “telekhines!” another monster growled.

i'm still feeling a bit gross and weak, but i'm definitely doing better. mr smear's still pretty sick, though, very feverish. it's been a rough day for him. but in spite of that, he's always ready to jump up and down in front of the screen playing minecraft...

i thought we'd watch the fellowship of the ring together (the extended edition), but after i woke up from passing out i realized that so had mr smear, and then he decided he wasn't interested in continuing :(

i spent some time finishing the draft of that algorithm i mentioned a few weeks ago, and i'm about to get up for my third round of dish duty, which is honestly the only thing that's gotten me out of my chair / off the couch today.

Saturday, November 22, 2025

from the AI warning to the sea

 the rest of yesterday was pretty relaxed. gd and i made extra-strength challah-peño, which really just means extra-delicious, and we finished watching eddie murphy's dr dolittle which - in spite of some spectacularly lazy writing - quite entertaining.

last night before going to bed, mr smear let me know that he'd decided that he did want to finish watching the matrix after all.

today:

gd hasn't been sleeping well, and i've been kind on/off the past weeks, with last night being one where i definitely slept some. but i woke up very early, and finished reading the first percy jackson novel.

extremely underrated.

on the one hand, it pains me to think that i only just discovered percy jackson. on the other, i've just had the distinct pleasure of discovering percy jackson! this is top shelf stuff, a brilliant, exciting blend of modern fantasy and ancient tales.

the first highlight of the day was settling in to watch the second half of the matrix. with AI tech being where it is, it's never been more relevant, and seeing my boy's face light up* as he encountered bullet time and neo's superavatar powers was so much fun!

* as well as his body twitch involuntarily, he's wired different

i spent most of the early part of the day alternating between the second percy jackson book, trying to write up manacher's algorithm in a readable way, and napping.

i'd made a pact with mr smear about going to the beach in the afternoon, which he sealed by doing something that lost him privileges (he has a compulsion that causes him to scratch himself until he has holes in his skin, and that's unfortunately the only tool we have to get it to stop) so he didn't have anything better to do...

so that became the second highlight of the day: we walked across to the promenade to meet up with a couple of ze germans, enjoyed a pleasant walk with them, then separated to go into the sea. the weather was absolutely amazing all day (hot, but dry), the sea was calm (except for very small waves crossing each other), and we chilled in the water as the sun sank lower and eventually set.

it was a glorious evening.

there was - as usual - a little unpleasantness getting mr smear out of the water again, and then out of the sand, and then across to and through the showers, but otherwise everything was cool and we enjoyed a pleasant walk-and-talk until we happened to find an open hummusia.

we opened a table and ate too much, and it was excellent.

by the time we got out of there the buses were running.

while waiting for the bus, my son blew my mind with a suggestion to reinvent the question mark.

we arrived home fairly quickly, and showered, and then i passed out on the couch, as much from the post-hummus food coma as from the day in the sun. i got dragged off the couch to say goodnight to mr smear (i'm starting to give up on keeping his door closed when putting him to bed), then tried and failed to get back to sleep even though i was half-asleep the entire time.

and then suddenly i wasn't, so i've written all of this and am now going to try to tire myself out again with youtube and minesweeper...

Monday, November 17, 2025

contamination

 i went to bed pretty soon after posting last night (i had one more cup of tea and read some more percy jackson).

around 2am, mr smear woke up coughing and choking, and it took a while before he was able to breathe normally and go back to sleep. i suspected it was related to the mold and the dusting we've been doing :/

the morning started off pretty well, and mr smear essentially handled the bus ride by himself. it was particularly nice watching him being responsible and putting his phone away after paying, and actually observing the world around the bus for once.

since i got back home, gd and i have been having a proper go at two of the airconditioners, and what we've cleared out so far is horrific. and never-ending. i hope i didn't get any of the cleaning stuff in my eye (i'm not sure). i hope it's now actually safe enough to run for a while...

i'm not sure whether i'm ready for the technical interview today, but it'll probably be fine. i have one goal for today: to try and find a way to explain manacher’s algorithm in a way that normal people can understand.

Wednesday, April 30, 2014

crossing fingers

okay, i'm feeling considerably less elated about the job offer i received because it sounds like the recruitment agency isn't happy with the permit application process. so while i'm hoping everything will be turn out alright, i'm also praying really hard that i get offered the job i finally finished interviewing for yesterday, because that company won't have any problems with permit applications and it's also a job that i really, really want.

---
monday:

i actually spent monday studying, which was my plan. then gd came with me to muay thai. it amused me to see the look on the face of the guy who knocked me off my feet when gd introduced me as her boyfriend; he also trains at h2o and knows her from there. ahh, pride :)

the muay thai class was primarily conditioning, as usual, and gd's back couldn't handle the suicide bear-crawls followed by suicide runs. after all the exercises we'd done before those, none of us were handling particularly well even without having back troubles and by the time i got to the running i was actually wobbling. even if i hadn't been planning on taking it (relatively) easy before the final interviews i wouldn't have been able to box after all that.

i continued studying while gd made dinner, and the salad was even better than when i do it. i got through some important stuff, but went to bed feeling the muay thai class. tense back + gd + tiger balm = falling asleep in a trance.

---
yesterday:

i slept really well, and woke up easily with no need to snooze. i began my day with an hour focused on the introduction to algorithms book, the one i bought ages ago and really, *really* should've treated as my primary source over the past few weeks. it's an amazing book.

i shouldn't have forgotten my kindle with the aforementioned book loaded onto it, but as it turned out i wouldn't get much time to read after leaving home anyway.

the final interviews:

i felt offline for most of the time. just... slower. it was a slow day.

the first interview was about system architecture, and i think i did well.

the second was on algorithms, and not only was it a struggle but it was only in the final moments when the interviewer told me what he was thinking that i suddenly realized that the problem was almost identical to one i'd read about the night before :S

lunch was spent with pulse's friend, the guy who put forward my resume, and was really nice even though there weren't any vegan protein options. oh, well. nobody's perfect. the conversation ran in all sorts of directions and i was comforted to hear that everyone feels the same way about the kid who made me nervous in my first interview.

the final interview was certainly not my best, but i definitely did what needed to be done and i appeared to satisfy the interviewer - although it could be that he was just being nice.

anyway, i walked out of the offices with a positive feeling and hoping that they feel the same. then i entered "what if" mode; what if they extend an offer? how do i delay them or turn them down without closing the door? that was really troubling me until this morning.

i got home, paid the rent, got a form from the bank for the recruitment agency, all of that was pleasant. then i printed out my tax forms, and couldn't make heads or tails of them. much, much less pleasant. that set off a serious headache that i took with me to jiu-jitsu.

i worked with a guy who's about 20 pounds heavier than me, and we worked really hard. i didn't feel particularly satisfied when we were done, just tired and itchy. i suspect that the latter is some kind of allergic reaction to the combination of training shirts i wear in lieu of a proper rash-guard :/

gd had eaten without me, so i went to p.m. and had their japanese tofu while reading the new wired. it was delicious and i ate too much - only towards the end i realized that it's a dish with egg in it so i'm not going to do that again :(
i couldn't find someone homeless to give the leftovers to, and then realized that giving someone something like that without utensils would be a little cruel anyway.

...

the "disruptive by design" ad in this month's wired disrupted my reading in the metro because it kept unfolding.

---
today:

it was a beautiful start to the day and i left gd's with electrified emotions. i ran into pulse on the metro, apologizing for putting her in the awkward position of knowing that i've accepted a job offer but not being able to update her friend. i mentioned her to gd later and it's now been made clear to me that the two of them are no longer friends after an incident last week. i'm disappointed to say the least :(

i spoke to the immigration lawyer who helped me with my previous permit application, and was relieved to hear that a) it's better that i haven't applied for the csq without the minimum year of work experience and b) a rejected permit application won't invalidate the current one.

so that's me breathing more easily and feeling less stupid.

then i got dressed and headed down to the recruitment agency to sign papers. no papers were signed, issues were raised and a bit of faith was lost. now i'm playing that all by ear, and i'm glad i didn't cancel the interview i have in forty minutes...

Wednesday, March 19, 2014

on preparation - round i

my phone interview is over. i feel like it went well, i *HOPE* it went well and if i did screw up anything it was probably by not having any questions when he asked if i had any questions.
or by misunderstanding a question about recursion, stacks and references that saw me confusing him until i eventually expressed the correct answer.

anyway, it really wasn't bad, and now it's wait-and-see time. and practice-some-french and keep-playing-with-algorithms-and-data-structures and looking-for-work time.

---
i was going to read discrete maths until i fell asleep (not much of a challenge, to be honest), and couldn't find my kindle in any of its usual spots. panic set in, i tore through my apartment and was on the verge of giving up and heading to the metro station where i'd last held it for sure when i found it carelessly left beneath a stack of random shit.

damn.

just then i received a response from a message i'd sent to a friend about the latest humble bundle. she didn't understand how it worked so i explained it to her, and then realized that there're a couple of things i want and i'm perfectly happy to give a little money to charity in order to get them.

i paid using paypal, and decided that it was time to increase my password's security. only... paypal doesn't accept passwords of more than twenty characters. wtf, paypal? why doesn't everyone know this?!

last night was just another in three or four that i've had lots of vivid dreams, though i don't remember much of them afterwards. i'm obviously learning shit, though. keep it up, brain!

i prepared for the interview by doing laundry and taking a deep nap, and now i'm ready to chill for the afternoon. and pray. perhaps i'll pray a little. i really want to have gotten through the screening process.

overflow

i'm getting ready for bed. there's tons of stuff i haven't touched, but so much that i have... i can't believe how much i have and haven't used over the past decade or so. i remember weird shit, and i've forgotten some things so drastically that i can't make heads or tails of where i stand. well, i'll find out tomorrow morning, i guess.

i feel like i have computer science coming out my ears. but i haven't segfaulted yet, so i'm positive ;)

---
paris forces half the car owners to use public transport in order to relieve excess smog.

crazy!

but it's nice to know they understand what to do. not as well as the spaniards, though...

Monday, June 14, 2010

sliding back

apron strings? maybe, but my mother did manage to calm me down tonight (although it's the third time she's repeated the same thing in as many weeks) and reminded me of something very important: i can't do better than i am right now.

*breathes*

today began with chc making a giant breakfast - i couldn't finish my oats - while i caught up on patv. when she heard their accents:
"are they american?"
"yes"
"so they're, like, emotionally retarded?"
"no, not these ones. these guys are awesome"

i remember i once thought that all americans were lost causes, but now that i know a whole bunch of them i have to say that i'm confident that it's only the majority ;)

i walked quickly to work - that'll be the last time - and arrived about five minutes late. i'll be blading from now on, for two reasons: because it's faster and easier, and because we get a travel allowance instead of lunch coupons, and that allowance will cover my replacement wheels ^_^

i was totally blown away by the fact that i could remember the building code, and after being told only once all the other numbers and facts and figures have slid into place. i haven't worked there in a very long time.

i spent the afternoon brushing up and signing the contract, meeting the new guys (:P) in the office, eating m&m's (they have about fifteen kilos of the things) and drinking good espresso and feeling good about myself. i left early (around 5.30pm) to go past my apartment and pick up my taekwondo gear before meeting up with scrapper in the park.

we went to the other side - closer to his place, closer for me, and there're usually bunches of martial arts groups in that area because the leaves form a pleasant canopy overhead. we worked hard, and i'm particularly satisfied with the spinning exercise we did (i think i can rehabilitate my hips with another couple of sessions) and with my forms.

i spun around the rink on my way back home - i was a bit too tired to jump, though - and then returned to watch some more patv while cooling down enough to hit the shower. i've eaten, had a bit to drink, conversed online, now posted, and am just about ready to hit the image algorithm paper i need to ingest before a meeting with a potential employer :)

ooh! and i'm very excited about having discovered that daphna and the cookies are playing in my neighbourhood this weekend ^_^ (it may make it impossible to see artifakt, but he's not my favourite sa dj so i'll deal)

Wednesday, October 03, 2007

tic tac toe logic



the standard game of tic tac toe is played on a 3x3 board. this is the trivial case. the diagrams shown as examples apply to the trivial case. this method is appropriate for a game played on a larger board, hence the more generic definitions.

it is irrelevant whether both players are handled by the computer, or only one. each turn will see the definition of player and opponent switch, so if in the first turn the player is X and the opponent is O, then in the second turn the player will be O and the opponent X. in each turn the weight grid must be calculated anew.

the game grid
(1,1) | (1,2) | (1,3)
---------------------
(2,1) | (2,2) | (2,3)
---------------------
(3,1) | (3,2) | (3,3)


potential line cell (PL)
an empty cell which is on the same line as either an X or an O (not both on the same line), but if controlled by the same player (X if the other cells contain Xs, O if the other cells contain Os) will not finish the game

 X | PL| PL
-----------
   | PL|   
-----------
 O | PL| PL



in the above example (2,1) is on a line containing both X and O (1,3),(2,2),(3,3) are each found on distinct lines each containing one or the other


opponent's completion move cell (OC)
an empty cell which, if filled by the opponent will win him the game
   |   |   
-----------
 O | O | OC
-----------
   |   |   


in the above example the player is X


player's completion move cell (PC)
an empty cell which, if filled by the player will win him the game
   | X |   
-----------
   | PC|   
-----------
   | X |   


in the above example the player is X
the weights are calculated as follows:
+1
for a potential line cell
+10 (width * height + 1)
for an opponent's completion move cell (X)
+100 ((width * height + 1) ^ 2)
for the player's completion move cell (O)
the reasoning behind the weights is that we do not want the possibility, in the case of a larger grid, of a number of crossing potential lines (which are additive) to interfere with the priority of closing off an opponent's completion, or for a number of potential opponent completions to interfere with a player completion (winning the game). regardless of the size of the grid, (width * height + 1) and (width * height + 1)^2 will always be safe values. the basic method is fairly simple. we construct a weight grid with the same dimensions as the game grid to contain the weights, with each cell initialized to zero.

initial state for the turn
 game grid      weight grid
 X | X |         0 | 0 | 0 
-----------     -----------
   |   |         0 | 0 | 0 
-----------     -----------
 O |   |         0 | 0 | 0 


we then go over each line, modifying the line's cell's weights accordingly. in the figures below, it is player O's turn. if it was player X's turn, then cell (1,3) would be weighted 101 instead of 11 by the end of the process.

if the line contains more than one available cell, and contains either Os or Xs (in the trivial case, if the line contains exactly one filled cell), then any available cells are on the potential line, and their counterpart cells in the weight grid are each incremented by 1.

if the line contains exactly one available cell, and the rest of the line's cells are controlled by the opponent, then the available cell is incremented by (width * height + 1), or 10 in the trivial case.

if the line contains exactly one available cell, and the rest of the line's cells are controlled by the player, then the available cell is incremented by (width * height + 1)^2, or 100 in the trivial case.

row 1
 game grid      weight grid
 X | X |         0 | 0 | 10
-----------     -----------
   |   |         0 | 0 | 0 
-----------     -----------
 O |   |         0 | 0 | 0 


row 2
 game grid      weight grid
 X | X |         0 | 0 | 10
-----------     -----------
   |   |         0 | 0 | 0 
-----------     -----------
 O |   |         0 | 0 | 0 


row 3
 game grid      weight grid
 X | X |         0 | 0 | 10
-----------     -----------
   |   |         0 | 0 | 0 
-----------     -----------
 O |   |         0 | 1 | 1 


column 1
 game grid      weight grid
 X | X |         0 | 0 | 10
-----------     -----------
   |   |         0 | 0 | 0 
-----------     -----------
 O |   |         0 | 1 | 1 


column 2
 game grid      weight grid
 X | X |         0 | 0 | 10
-----------     -----------
   |   |         0 | 1 | 0 
-----------     -----------
 O |   |         0 | 2 | 1 


column 3
 game grid      weight grid
 X | X |         0 | 0 | 10
-----------     -----------
   |   |         0 | 1 | 0 
-----------     -----------
 O |   |         0 | 2 | 1 


diagonal 1
 game grid      weight grid
 X | X |         0 | 0 | 10
-----------     -----------
   |   |         0 | 2 | 0 
-----------     -----------
 O |   |         0 | 2 | 2 



diagonal 2
 game grid      weight grid
 X | X |         0 | 0 | 11
-----------     -----------
   |   |         0 | 3 | 0 
-----------     -----------
 O |   |         0 | 2 | 2 


once we have gone over each line (row, column, diagonal), we select the maximum weighted cell as the next move. in the case of a number of cells with the maximum weight, one can be selected at random.

we have now defined the computer's priorities as
1) finish the game by winning
2) prevent the opponent from winning
3) control the cell with the most completion options for either player

that was fun :)