I use this blog as a soap box to preach (ahem... to talk :-) about subjects that interest me.

Wednesday, October 30, 2013

Authors' Mistakes #24 - CSI Miami (Marc Dube)

I confess: I am a fan of CSI Miami.  I don't like the CSI series located in Las Vegas and New York.  But the Miami series is bathed in warm colours and shows beautiful scenery.  I know that it was actually filmed in California and that the warm feel was obtained by saturating the colours, but who cares?  I also find the characters reasonably appealing.

Anyhow, last night I discovered a mistake in episode 16 of season 7 (Sink or swim).  I am not referring to the many licences that the authors take with the way CSI people operate in real life.  I understand that if our fictitious CSIs were confined to the labs and spend days to analyse a sample, the stories would evaporate.  What they did in Sink or swim violated the laws of Physics!

Here it goes.
An assassin kills a lady standing at the railing of a yacht by shooting her from underwater.
Do you see no problem with that?

There is one: when a ray of light crosses the boundary between water and air, it changes direction.  This phenomenon is called refraction (see for example the refraction page on Wikipedia).  Here is a nice diagram (also from Wikipedia) to describe it:

Suppose that the top side is air (with refractive index n1 = 1) and the bottom side is water (with refractive index n2 = 1.33).  Snell's law tells you that sin(θ2) = sin(θ1) * n1 / n2.  This means that light entering the water with an angle of, say 30°, is deflected to approximately 22°.  As a result of the deflection, the underwater shooter of CSI Miami saw his target 8° higher than it was.  With a target placed, say, 5 metres above the water, 8° roughly correspond to more than 80 cm.  Enough to shoot above the target's head instead of hitting her heart.  The effect increases when the angle increases.  So, for example, with θ1 = 45°, θ2 becomes 32°, which is 13° less than θ1.

Obviously, the positions of both the target and the shooter also play a crucial role.  For example, the 80 cm of the previous calculation are reduced to 49 cm if the target is only 3 m above the water instead of 5.

Now, refraction has no impact if the shooter is directly below the target, because both angles become zero.  But this is not what happened in CSI Miami, as the shooter had to be somewhat away from the boat in order to clearly see his target.

All in all, there is no way that the shooter could have made the kill.

Funnily enough, the Archerfish manages to hit insects one or two metres above the water by spitting at them from underwater.  A thorough study about that fish was published by Lawrence M. Dill in 1977 (Refraction and the Spitting Behavior of the Archerfish (Taxotes chatareus), Behavioral Ecology and Sociology, 2, 169-184).

For your reference, here are the links to all past “Authors’ Mistakes” articles:
Lee Child: Die Trying
Colin Forbes: Double Jeopardy
Akiva Goldsman: Lost in Space
Vince Flynn: Extreme Measures
Máire Messenger Davies & Nick Mosdell: Practical Research Methods for Media and Cultural Studies
Michael Crichton & Richard Preston: Micro
Lee Child: The Visitor
Graham Tattersall: Geekspeak
Graham Tattersall: Geekspeak (addendum)
Donna Leon: A Noble Radiance
007 Tomorrow Never Dies
Vince Flynn: American Assassin
Brian Green: The Fabric of the Cosmos
John Stack: Master of Rome
Dean Crawford: Apocalypse
Daniel Silva: The Fallen Angel
Tom Clancy: Locked On
Peter David: After Earth
Douglas Preston: Impact
Brian Christian: The Most Human Human
Donna Leon: Fatal Remedies
Sidney Sheldon: Tell Me Your Dreams
David Baldacci: Zero Day
Sidney Sheldon: The Doomsday Conspiracy

Tuesday, October 22, 2013

KenKen and CalcuDoku Revisited

Almost two years ago, I posted an article to this blog about KenKen and CalcuDoku.  In that article, I compared the 9x9 puzzles made available in the web sites kenken.com (® Nextoy LLC), calcudoku.org, and zambon.com.au (my own).  Like last time, I will use K to identify the puzzles provided by kenken.com, C to identify those provided by calcudocu.org, and Z to identify mine.

Of the three web sites, only the K site provides 9x9 puzzles of different levels of difficulty, but I have only ever solved the "tough" ones.

After solving more than 500 9x9 puzzles, I have a much better feel about the differences between the puzzles generated by the three sites.

K and Z are comparable in terms of difficulty and general "feel".  The C puzzles are different.

First of all, the C puzzles include many more single-cell cages.  Patrick (the developer of the C site) told me that he uses singles to remove ambiguities.  I understand why the singles are there, but I have always found it annoying that their average number exceeds 9.  K puzzles include very few singles (0 to 3), and I can configure my generator to limit the number of singles to whatever I like.  I normally set the maximum number of singles to 3, but I could also set it to 0 (I have tried it out) and systematically generate puzzles without singles at all, although it requires on average a longer time to generate each puzzle.

I don't think that Patrick's decision to "single out" the ambiguities was a good one.  I commented on the C web site that I didn't like to go through the chore of filling up so many singles when starting with a new puzzle, but other users replied that it didn't bother them.  Fair enough.

Another problem I have with C puzzles is that the difficulty of solving them is not uniform as you progress: invariably, it is easy to fill in a third of the cages or so without much need for reflection.  Then, you hit a wall and the cages suddenly become very difficult.  It might be connected to the fact that there are many single cages used for disambiguation, but I am not sure.

I have lived for almost two years with the two problems I have just mentioned, because 9x9 C puzzles also have an interesting feature: they can have divisions and subtractions in cages with more than two cells.  For example, an angled three-cell cage with "2:" as target admits 841, 822, 631, 421, and 211 as possible solutions.

But there is another problem that has finally convinced me to stop solving C puzzles for good: some of them are not solvable analytically, and I refuse to solve a puzzle by trial and error.  I find it very frustrating when I encounter a puzzle that cannot be solved without guessing.

I know what you are thinking: perhaps I'm not good enough.  It's possible, but, perhaps not surprisingly, I don't think so.

I believe that the problem is due to the fact that C puzzles sometimes have too many large[r] cages with sums and subtractions.  This can result in untameable combinatorial explosions.  Those angle cages with targets ranging between 13+ and 20+ and between -0 and -4 sometimes combines in ways that leave too many alternatives open.

Patrick calculates for each puzzle a difficulty level, which for 9x9 puzzles is in the range 100±30 (i.e., I haven't seen anything outside that interval).  I asked him how he arrives to those figures, but he refused to divulge his algorithm.  I understand that when he started his web site he went though several tests, but his calculations are not right.  Last June, I solved a puzzle with an alleged difficulty of 129.3, but in September I didn't succeed in solving a puzzle with a difficulty of 70.2.

Here are the statistics for the June puzzle:
#1-cell: 8
#2-cell: 16 (3+, 9-, 2x, 2:)
#4-cell: 4 (1+, 2x, 1:) all T-shaped
#5-cell: 5 (2+, 3x) 1 cross-shaped, 4 angled

And here are those for the September puzzle:
#1-cell: 9
#2-cell: 13 (2+, 3-, 8x)
#3-cell: 6 (1+, 4-, 1x) all angled
#4-cell: 4 (3+, 1-) 1 T-shaped, 2 squares, 1 lightning-shaped
#5-cell angled: 2 (1+, 1x) 1 cross-shaped, 1 tap/fawcett-shaped

Do you see what I mean?  The June puzzle, which was supposed to be among the most difficult ones, had no 3-cell cages, and of the 9 cages with 4 and 5 cells, only 3 had sums.  The September puzzle, which was supposed to be among the easiest 9x9s, had only two multiplications among the 12 cages with at least 3 cells.  In two adjacent columns, there were three 3-cell cages with 4-, 1-, and 0-, and arranged in such a way that they took up six cells of one column.

4- can be 941, 932, 831, 822, 721, 611; 1- can be 971, 962, 953, 944, 861, 852, 843, 751, 742, 733, 641, 632, 531, 522, 421, 311; and 0- can be 981, 972, 963, 954, 871, 862, 853, 844, 761, 752, 743, 651, 642, 633, 541, 532, 431, 422, 321, 211.  Yes, there were some crossings that reduced the possibilities, but the same puzzle also included two 4-cell 15+, a 4-cell 16+, a 4-cell 0-, and a 5-cell 32+.  No way that it could have been solved analytically!

All in all, I finally got fed up with the C puzzles.  That's why a couple of days ago I gave up on them.

The C web site has the best application to solve the puzzles online, but for the 9x9 puzzles (and I am not interested in the smaller ones), the best way is to print them out and use pencil and eraser.  Therefore, no loss there...