{"id":2675,"date":"2019-06-21T12:49:26","date_gmt":"2019-06-21T17:49:26","guid":{"rendered":"https:\/\/laurentlessard.com\/bookproofs\/?p=2675"},"modified":"2019-06-24T09:06:31","modified_gmt":"2019-06-24T14:06:31","slug":"quarter-flipping-on-a-spinning-table","status":"publish","type":"post","link":"https:\/\/laurentlessard.com\/bookproofs\/quarter-flipping-on-a-spinning-table\/","title":{"rendered":"Quarter flipping on a spinning table"},"content":{"rendered":"<p>This week&#8217;s <a href=\"https:\/\/fivethirtyeight.com\/features\/youve-been-marooned-by-kidnappers-can-you-escape-at-dawn\/\">Riddler Classic<\/a> is a simple-sounding problem about statistics. But it&#8217;s not so simple! Here is a paraphrased version of the problem:<\/p>\n<blockquote><p>\nThere is a square table with a quarter on each corner. The table is behind a curtain and thus out of your view. Your goal is to get all of the quarters to be heads up \u2014 if at any time all of the quarters are heads up, you will immediately be told and win.<\/p>\n<p>The only way you can affect the quarters is to tell the person behind the curtain to flip over as many quarters as you would like and in the corners you specify. (For example, &#8220;Flip over the top left quarter and bottom right quarter,&#8221; or, &#8220;Flip over all of the quarters.&#8221;) Flipping over a quarter will always change it from heads to tails or tails to heads. However, after each command, the table is spun randomly to a new orientation (that you don&#8217;t know), and you must give another instruction before it is spun again.<\/p>\n<p>Can you find a series of steps that guarantees you will have all of the quarters heads up in a finite number of moves?\n<\/p><\/blockquote>\n<p>Here is my solution:<br \/>\n<a href=\"javascript:Solution('soln_quarterflip','toggle_quarterflip')\" id=\"toggle_quarterflip\">[Show Solution]<\/a><\/p>\n<div id=\"soln_quarterflip\" style=\"display: none\">\n<p>Every time a move is made, the table spins around randomly. This sort of randomization actually simplifies the game considerably by reducing the number of distinct positions and moves possible:<\/p>\n<ol>\n<li>Although there are $2^4 = 16$ different ways to arrange quarters in combinations of Heads (H) and Tails (T) on the four corners of the table, if one position can be reached from another via rotation, then those two positions can be treated as one, since there is no way to distinguish them after the table spin. There are in fact only 6 distinct positions:\n<ul>\n<li> all Heads: (H,H,H,H). This is the winning position\n<li> all Tails: (T,T,T,T).\n<li> opposite Heads: (H,T,H,T). There are 2 configurations for this position.\n<li> one Head: (H,T,T,T). There are 4 configurations for this position.\n<li> one Tail: (T,H,H,H). There are 4 configurations for this position.\n<li> two at a time: (H,H,T,T). There are 4 configurations for this position.\n<\/ul>\n<li> Although there are also $2^4-1=15$ different moves we can make (minus one because we exclude the move where you flip nothing), again the spinning makes several of these moves equivalent. There are really only five different possible moves:\n<ul>\n<li> flip one quarter (ONE)\n<li> flip two opposite quarters (OPP)\n<li> flip two adjacent quarters (ADJ)\n<li> flip three quarters (TRI)\n<li> flip all the quarters (ALL)\n<\/ul>\n<\/ol>\n<p>Given this information, we can look at all the possible transitions between states that can occur if we make a certain move from any given position. Here is a diagram showing all possible transitions. I excluded the &#8220;flip three quarters&#8221; move because this move turns out not to be necessary.<\/p>\n<p><a href=\"https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2019\/06\/quarter_table_spin_moves.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2019\/06\/quarter_table_spin_moves.png\" alt=\"\" width=\"1148\" height=\"1108\" class=\"aligncenter size-full wp-image-2681\" srcset=\"https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2019\/06\/quarter_table_spin_moves.png 1148w, https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2019\/06\/quarter_table_spin_moves-300x290.png 300w, https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2019\/06\/quarter_table_spin_moves-768x741.png 768w, https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2019\/06\/quarter_table_spin_moves-1024x988.png 1024w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><\/a><\/p>\n<p>For example, if we &#8220;flip two opposite quarters&#8221;, the (H,H,T,T) position always remains unchanged. Meanwhile, the (H,T,H,T) could lead us to the winning positions (H,H,H,H), or it could lead us to the (T,T,T,T) position.<\/p>\n<h3>Winning strategy<\/h3>\n<p>A key observation: the &#8220;one-off&#8221; positions (H,T,T,T) and (T,H,H,H), which I colored in purple, will only ever transition between each other if we flip two quarters or all quarters. We can use this to our advantage: we will begin by only using these moves to try to win. If we cannot win, then we conclude that we must be in one of the &#8220;one-off&#8221; positions. Essentially, the strategy consists of making moves that successively test possible states. Every time we test a state, if we are correct we reach (H,H,H,H) and the game stops. Otherwise, the game continues and we can eliminate that state from the list of possible states. We continue in this fashion until there are no states left. Here are the logical steps:<\/p>\n<ol>\n<li> Are we in (T,T,T,T)? Try (ALL) to find out.<br \/>\n     If the game continues, we must not be in (T,T,T,T).<\/p>\n<li> Are we in (H,T,H,T)? Do (OPP) to escape.<br \/>\n     If the game continues, we moved to (T,T,T,T).<br \/>\n     Repeat step 1 to test if this is true.<br \/>\n     If the game continues, we must not be in (H,T,H,T).<\/p>\n<li> Are we in (H,H,T,T)? Do (ADJ) to escape.<br \/>\n     If the game continues, we moved to (T,T,T,T) or (H,T,H,T).<br \/>\n     Repeat steps 1-2 to test if this is true.<br \/>\n     If the game continues, we must not be in (H,H,T,T).<\/p>\n<li> By elimination, we must be in (T,H,H,H) or (H,T,T,T). Do (ONE) to escape.<br \/>\n     If the game continues, we moved to (T,T,T,T), (H,T,H,T), or (H,H,T,T).<br \/>\n     Repeat steps 1-3 to test if this is true.\n<\/ol>\n<p>If we &#8220;unroll&#8221; the recipe above, the sequence guaranteed to win is:<br \/>\nALL,OPP,ALL,ADJ,ALL,OPP,ALL,ONE,ALL,OPP,ALL,ADJ,ALL,OPP,ALL<\/p>\n<p>These 15 moves are guaranteed to find (H,H,H,H) at some point along the way, no matter what position we start in, and no matter how unlucky we get with the spins of the table.\n<\/p><\/div>\n","protected":false},"excerpt":{"rendered":"<p>This week&#8217;s Riddler Classic is a simple-sounding problem about statistics. But it&#8217;s not so simple! Here is a paraphrased version of the problem: There is a square table with a quarter on each corner. The table is behind a curtain and thus out of your view. Your goal is to get all of the quarters &hellip; <a href=\"https:\/\/laurentlessard.com\/bookproofs\/quarter-flipping-on-a-spinning-table\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Quarter flipping on a spinning table&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":2681,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[7],"tags":[23,2],"class_list":["post-2675","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-riddler","tag-logic","tag-riddler"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/laurentlessard.com\/bookproofs\/wp-json\/wp\/v2\/posts\/2675","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/laurentlessard.com\/bookproofs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/laurentlessard.com\/bookproofs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/laurentlessard.com\/bookproofs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/laurentlessard.com\/bookproofs\/wp-json\/wp\/v2\/comments?post=2675"}],"version-history":[{"count":7,"href":"https:\/\/laurentlessard.com\/bookproofs\/wp-json\/wp\/v2\/posts\/2675\/revisions"}],"predecessor-version":[{"id":2677,"href":"https:\/\/laurentlessard.com\/bookproofs\/wp-json\/wp\/v2\/posts\/2675\/revisions\/2677"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/laurentlessard.com\/bookproofs\/wp-json\/wp\/v2\/media\/2681"}],"wp:attachment":[{"href":"https:\/\/laurentlessard.com\/bookproofs\/wp-json\/wp\/v2\/media?parent=2675"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/laurentlessard.com\/bookproofs\/wp-json\/wp\/v2\/categories?post=2675"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/laurentlessard.com\/bookproofs\/wp-json\/wp\/v2\/tags?post=2675"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}