Part 1 looks very similar to the basic version. 2 heads is converted into 1 head + 1 state.
The same goes for part 2.
Part 3 is a little more tricky, and I didn’t optimize my solution. My 1 head looks at all 3 characters (this one, the one below it, and the one to the right of it). Vertical pair, write @ above. Horizontal pair, replace this character. Move on. There’s a little extra work, if the position above isn’t empty. Also I write a character at the beginning of the line, so that I can find it again easily later.
There’s a rule saying, that when a characters appears 2 times in a row, it produces an @. So with 2 heads, I can look at 2 characters at the same time, and I have rules for each of the cases: AA, AB, BA and BB.
For part 2, there can be several lines. I go right on the 1st line, left on the 2nd etc.
For part 3, pairs can occur both horizontally and vertically. I solve this by using 2×2 heads + 1 extra head for writing @. This is because when there are pairs in both directions, I need to write 2 @’s. 1 @ will replace the character appearing in both pairs, the other @ will just be written above the 1st line.
Trying to get a better position in the steps part of the competition, I wrote new programs.
Using more heads, I attack the string from both ends. This requires more rules, because I don’t have to just address the cases A, B and C, but also “A on one end, B on the other” etc., 9 combinations in all. It’s also a little more complicated detecting, that I am done.
I do something similar for part 2:
For part 3, I already had a nice 10 head program, so I didn’t do anything more.
Bonus: I experimented with using less rules for part 2. Because there are 5 heads, a lot of the time I can just write 5 P’s. And I gain a step, because I only use 1 step to spread the heads.
With quest 1 I was still learning the language. After looking at other solutions, I did my own versions with more heads. Part 1:
This is a lot more elegant, and it uses fewer steps. Part 2 has the same nice look:
For part 3 I had to be a little more creative. 10 heads couldn’t quite write 12 P’s, just like that. So I added a little bit, where the last 2 P’s were added after the first 10.
The head travels right. If it encounters an A, delete. If it encounters an B, replace. If it encounters a C, write 3 P’s by going in a little loop. The loop goes either up or down, alternating. That felt very nice and elegant.
Part 2 is very similar, the loop might just be bigger.
Because there might be 2 lines in part 3, instead of a loop, I just go straight up or down. The 1st line produces 0-5 P’s, the 2nd line produces 0-7 P’s. I use E and F to keep track of my state. E means the 1st line produced 0 P’s.
A quest 1, part 1 solution might look like this (I will get back this 3 head solution later):
The basic task is: Given a string of A, B and C, use rules to turn these into P’s. E.g., C turns into 3 P’s.
My first shot actually looks a little boring. 2 heads, the yellow to read the string, the red to write P’s. The red one quickly moves too far right to stay in the frame.
Part 2 added a D, turning into 5 P’s.
And part 3 has 2 strings interacting. This time the green head is writing the P’s. I have rules for every situation: A means 0 P’s, AA means 2 P’s etc. DD means 12 P’s and happens a lot below. I also have rules for counting P’s (as in previous iterations). AA moves unto the state ONE, meaning that state is responsible for writing 1 P and then returning to reading.
I could improve on these programs by writing some of the P’s on top of the strings. I guess my sense of order threw me a little here. It’s nice to have a writing line and a reading line.
The 2 state versions of the programs usually look a lot like the basic versions.
This week the #puzzle is: Can You Infer the Color of Your Hat? #logic #permutations
Three game show contestants must work together to win a prize. They are shown a large bag that’s initially empty, and then they see three red hats and two white hats placed into the bag. At this point, the contestants are blindfolded. Each contestant then picks a hat at random from the bag and places it on their head.
One at a time, their blindfolds are removed and they can see the hats on the others’ heads—but not the hat on their own head. If they can, with absolute certainty, identify the color of the hat on their own head, then the game is over and all three contestants win a prize! Otherwise, they skip their turn, at which point the next contestant has their blindfold removed and the process continues. If all three contestants skip their turn, then no prize is won. While blindfolded, contestants can still hear the decisions of other contestants and can identify who said what.
Will the contestants always win the prize? If so, why? If not, why not?
And for extra credit:
Now, there are four game show contestants who must work together. They are shown a large bag that’s initially empty, and then they see R red hats, W white hats, and B blue hats placed into the bag, such that R, W, and B are each less than or equal to 4. Otherwise, the game is played as before.
For some triples (R, W, B), the contestants can always win. Among these, what is the greatest value of R + W + B?
Contestant 1 sees 2 white hats. Therefore their own hat must be red.
Contestant 1 does not see 2 white hats. Inconclusive.
Contestant 2 sees contestant 3 wearing a white hat. Therefore their own hat must be red.
Contestant 2 does not see contestant 3 wearing a white hat. Inconclusive.
Contestant 3 knows, that they have a red hat.
Result: Yes, there will always be a contestant able to figure out the color of their own hat.
Let me also illustrate this with a table showing the different situations. There are 7 of them. XYZ means contestant 1 (C1) is wearing a hat with color X etc. (WWW isn’t possible.)
Situation
C1
C2
C3
RWW 🔴⚪⚪
RED!
WRW ⚪🔴⚪
?
RED!
RRW 🔴🔴⚪
?
RED!
WWR ⚪⚪🔴
?
?
RED!
RWR 🔴⚪🔴
?
?
RED!
WRR ⚪🔴🔴
?
?
RED!
RRR 🔴🔴🔴
?
?
RED!
And for extra credit:
R red hats, W white hats, B blue hats. Each number is at most 4. It is at least 0. (My guess is a maximal solution will actually have each number be at least 1.)
Each contestant picks a hat. There must be 4 hats.
WLOG:
Let’s look at the options written as RWB. So 444 means 4 hats of each color. Each row shows the options with the same sum.
444
443
442
433
441
432
333
440
431
422
332
430
421
331
322
420
411
330
321
222
410
320
311
221
400
310
220
211
The fiddler corresponds to 320, and we know the answer to that one.
My intuition is, that each contestant must be able to reduce the number of cases. Therefore there must be information enough in 3 hats to move forward. This could be ?30 or ?21. Let’s examine 430.
C1 sees 3 white hats. Therefore their own hat must be red.
C1 doesn’t see 3 white hats.
C2 sees C3 and C4 wearing white hats. Therefore their own hat must be red.
C2 doesn’t see C3 and C4 wearing white hats.
C3 sees C4 wearing a white hat. Therefore their own hat must be red.
C3 doesn’t see C4 wearing a white hat.
C4 knows their own hat must be red.
So, updated:
The case with 421 is actually similar. C1 either sees 3 non-blue hats or not, etc.
I’m not sure how to choose a case with 8 hats and test it properly. So my guess is there are 7 hats.
Recently Everybody Codes had a new competition. This time it involved a Turing machine like architecture and a new, related language, that everybody had to learn.
Thankfully I had discovered this “not in November” competition in time, so I was ready. Also, most days I was awake when the new quest appeared, and I actually got some respectable times.
The above graphic summarizes my results. Since I prepared it, I’ve remembered, that my quest 4, part 1, low golf program was very heavily inspired by a competitor. Still. I read the other program and then made my own along the same lines. Not quite stealing. I think.
It was actually a little hard to get a grip on how well I was doing. The tab “Your scores” showed some of the above, but I wanted to know more. I solved quest 1, part 1, using 481 rules. Is that good?
Also it wasn’t clear in the beginning which columns corresponded with championships. It turned out heads and states didn’t. Golf was added late, and it did. I wouldn’t say I wasted my time writing those 1 head and 2 state programs, but… I did okay on golf, without really trying, as my first program was always a shot at writing an understandable program, not optimizing for weird stuff. This turned out to create nice, short programs.
(I understand states didn’t produce any champion. I learned, that basically any program could be turned into a 2 states program by adding a head to keep track of the state. It makes sense to me, that wouldn’t be a championship. Still. I was no. 3 in that category overall.)
Yes, this is all very understandable, if you’ve been near this competition, and not, if not.
My plan is to blog about the different quests and parts and my own programs. Look forward to a lot of this:
Lad mig gøre klart med det samme: Med so-so mener jeg: Jævn middelvare. Nogle gode ting, nogle dårlige ting. Jeg er glad for, at jeg kom. Jeg har ikke tænkt mig at bede om mine penge tilbage.
I går var jeg på Fantasticon . Her er, hvad jeg havde planlagt.
Hugo nominees 2026
Jeg var ikke opmærksom på det her panel i god tid, så jeg havde kun læst 2 af de 6 relevante romaner.
Det var lidt pudsigt at høre snakken om Death of the Author, Okorafor. Hovedpersonens første bog bliver bare omgående en bestseller! En tech bro bliver skildret positivt! Når nu jeg stod af på noget helt andet, nemlig formen, hvor 3 forskellige tråde lever i forskellige kapitler.
Hvorfor taler vi i øvrigt om nominerede, når reglerne taler om finalister? Der er tilsyneladende ikke noget politisk i det. Mere at den relativt nye sprogbrug ikke rigtig har sat sig endnu.
😦 Her er mørkt. Det er simpelthen svært at se panelet. Og tilsyneladende ved ingen, hvor den relevante knap er.
We ❤ Science fiction
Der er lidt snak om forskellige fænomener, altså SF på et højere niveau.
😦 Det meste af tiden er kunsten at remse en masse titler op. Det er bl.a. trættende at lytte til, og egentlig ikke specielt interessant. Jeg bliver simpelthen utilpas og går ca. halvvejs.
Kaffeeklatch with Sarah Pinsker
Det her var egentlig ret hyggeligt. Og selvom der var en Snakker ™, der uden problemer kunne have optaget al spørgetiden, så tror jeg, at alle nåede at få snakket lidt. Jeg havde et par indspark og et egentligt spørgsmål. Og vi fik detaljer som tilblivelsen af et par historier, hvor jeg i hvert fald har læst den ene (Hvor egehjerter samles).
😦 Jeg kender ikke rækkefølgen i det her. Men som ses ovenfor, så skulle vi være i mødelokalet i stuen. Da jeg ankom, så fandt jeg dette lokale, bl.a. ud fra en kopi af programmet, der hang i nærheden af døren. Fjong. Jeg ved, hvad der foregår. På et tidspunkt blev mødelokalet så omdøbt til Hearthfire. Og på et tidspunkt blev Hearthfire navnet på et andet lokale. Så nej, jeg vidste ikke, hvad der foregik. Da kl. 12 oprandt, og vi kun var 2 i lokalet, så gik forskellige mekanismer selvfølgelig i gang, og 12.04 var jeg i det rigtige lokale. Men det var en dum start. Senere kradsede jeg lidt nye oplysninger på den der kopi af programmet, men der var det vist ligegyldigt.
Mundane Science Fiction
😦 Det her lokale er også mørkt.
Hvad meget værre er: Programpunktet passede ikke sammen med sin beskrivelse. (Og nej, beskrivelsen havde ikke spontant ændret sig undervejs.) Oplægget var Geoff Rymans definition fra 2004. Panelet bevægede sig lynhurtigt over i mundane, som hverdag. SF, der handler om indkøb og at børn bliver teenagere. Sådan noget. Jeg er ikke den bedste til at håndtere, når ting uventet ændrer sig. Og det her var på grænsen. Der var simpelthen for stor afstand mellem det lovede og det udleverede. Jeg overvejede at gå halvvejs, men på den anden side, så ville jeg jo også godt nyde kærestens indspark, så jeg prøvede at rase ud på skrift i min con-dagbog og så komme videre. Det lykkedes ikke helt. Jeg fik hovedpine og gemte mig fra con’en den næste time.
Farvel
Min plan var så egentlig at blive til dead dog.
😦 Mit korpus gør det meget ubehageligt at sidde på en stol med et træsæde. Og det var først ret sent, jeg fandt den eneste (tror jeg) bløde stol i cafe-dealers-lokalet. Der sad jeg så, mens der blev ryddet op omkring mig. Fint nok. Lidt langt væk fra alting, men pyt.
😦 Fest-delen så så ud til at blive 30-40 mennesker omkring borde, der stod meget tæt sammen, hvor lydniveauet var forfærdeligt. Efter at have overvejet tingene lidt, så smuttede jeg hjem i stedet.
Konklusion
Jeg har fået nogle gode tips til bøger, jeg nok vil læse på et tidspunkt. Og jeg har set endnu en håndfuld eksempler på kommunikation osv., der går galt.