2023-Oct-24, Tuesday

The knives we hide

2023-Oct-24, Tuesday 14:03
dorchadas: (Iocaine Powder)
A while ago, I met someone at an anime convention. She ended up becoming part of the anime-going friends I had, and I ran into her a couple times at parties after that until I moved to Japan. In Japan, I followed her Livejournal and I learned that she got much closer to another of those anime-going friends, they started dating, got engaged, made a wedding website, and the wedding was scheduled for just before I was going to move back from America. There was a post on her blog with quotes like:

A lot of quotes interspersed with story below )

Code "style"

2023-Oct-24, Tuesday 14:38
dorchadas: (JCDenton)
So I did more programming for my Cataclysm mod and I wrote the following statement:
if( in_species( species_PSI_NULL ) ) {
return false;
} else if( has_flag( mon_flag_HAS_MIND ) ) {
return true;
} else if( in_species( species_ZOMBIE ) ) {
return false;
} else if( has_flag( mon_flag_HUMAN ) ) {
return true;
}
else {
return false;
}

Simple, right? It makes the clear decision hierarchy obvious to the reader. If not A, then B. If not A or B, then C, and so on.

Well, no. It turns out the heads of the project have very particular ways they like things to be done, and they don't want any nested statement where different branches return the same thing--so no having two branches return true or two branches return false. This is set as a warning in the tests, but they deliberately elevated it to an error.

Alright, so I need to change it. And I thought, and I thought, and I said, you want a simplified statement? Alright, I'll give you a simplified statement!

return ( ( !in_species( species_PSI_NULL ) && has_flag( mon_flag_HAS_MIND ) ) ||
( !in_species( species_PSI_NULL ) && !in_species( species_ZOMBIE ) && has_flag( mon_flag_HUMAN ) ) )


Malicious compliance is a go.

(I did leave a comment explaining the logic, before you ask).