<p><div><div><div><div data-width="100" data-show-faces="false" data-send="true" data-layout="button_count" data-height="21" data-href="https://www.r-bloggers.com/a-grim-knight-contd/"></div></div><div><a data-url="https://www.r-bloggers.com/a-grim-knight-contd/" data-counturl="https://www.r-bloggers.com/a-grim-knight-contd/" data-count="horizontal" data-text="a grim knight [cont’d]" class="twitter-share-button" data-via="rbloggers" href="https://twitter.com/share"></a></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://xianblog.wordpress.com/2016/10/20/a-grim-knight-contd/"> R – Xi'an's Og</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p><a target="_blank" rel="nofollow" href="http://www.deadzebra.com/tag/chess/"><img height="302" alt="" width="403" src="https://i1.wp.com/www.deadzebra.com/wp-content/uploads/2014/03/LastKnight_DZ_3Quarter-500x375.jpg"></a></p>
<p><strong>A</strong>s discussed in the previous entry, there are two interpretations to this question from <a target="_blank" rel="nofollow" href="http://fivethirtyeight.com/features/how-about-a-nice-game-of-chess/">The Riddler:</a></p>
<blockquote>
<p><span><em>“…how long is the longest path a knight can travel on a standard 8-by-8 board without letting the path intersect itself?”</em></span></p>
</blockquote>
<p><a target="_blank" rel="nofollow" href="https://i0.wp.com/xianblog.files.wordpress.com/2016/10/riddlerechck.jpg?ssl=1"><img alt="riddlerechck" class="wp-image-31757" src="https://i0.wp.com/xianblog.files.wordpress.com/2016/10/riddlerechck.jpg?resize=380%2C380&ssl=1" data-recalc-dims="1"></a>as to what constitutes a path. As a (terrible) chess player, I would opt for the version on the previous post, the knight moving two steps in one direction and one in the other (or vice-versa). But one can consider instead the graph of the moves of that knight, as in the above picture. And since I could not let the problem go I also wrote an R code (as clumsy as the previous one!) to explore at random (with some minimal degree of annealing) the maximum length of a self-avoiding knight canter. <a target="_blank" rel="nofollow" href="https://i2.wp.com/xianblog.files.wordpress.com/2016/10/riddlerechk.jpg?ssl=1"><img alt="riddlerechk" class="wp-image-31760" src="https://i2.wp.com/xianblog.files.wordpress.com/2016/10/riddlerechk.jpg?resize=329%2C329&ssl=1" data-recalc-dims="1"></a>The maximal length I found this way is 32 (I first erased the resulting path by mistake but then recovered it by re-running the code a few times), although I also came by hand to a spiralling solution with a length of 33.</p>
<p><a target="_blank" rel="nofollow" href="https://i1.wp.com/xianblog.files.wordpress.com/2016/10/riddlerechck2.jpg?ssl=1"><img alt="riddlerechck" class="wp-image-31781" src="https://i1.wp.com/xianblog.files.wordpress.com/2016/10/riddlerechck2.jpg?resize=336%2C336&ssl=1" data-recalc-dims="1"></a>Running the R code longer however led to a path of length 34, while the exact solution to the riddle is 35, as provided by <a target="_blank" rel="nofollow" href="http://fivethirtyeight.com/features/can-you-survive-this-deadly-board-game/">the Riddler</a> (and earlier in many forms, including Martin Gardner’s and Donald Knuth’s).</p>
<p><a target="_blank" rel="nofollow" href="http://amzn.to/2e8nwMa"><img alt="" src="https://i2.wp.com/tinselcreation.files.wordpress.com/2015/02/7th-seal-chess.png?resize=403%2C259&ssl=1" data-recalc-dims="1"></a><em>[An unexpected side-effect of this riddle was ending up watching half of Bergman’s Seventh Seal in Swedish…]</em></p>
<p>Filed under: <a target="_blank" rel="nofollow" href="https://xianblog.wordpress.com/category/books/">Books</a>, <a target="_blank" rel="nofollow" href="https://xianblog.wordpress.com/category/kids/">Kids</a>, <a target="_blank" rel="nofollow" href="https://xianblog.wordpress.com/category/pictures/">pictures</a>, <a target="_blank" rel="nofollow" href="https://xianblog.wordpress.com/category/statistics/r-statistics/">R</a>, <a target="_blank" rel="nofollow" href="https://xianblog.wordpress.com/category/statistics/">Statistics</a> Tagged: <a target="_blank" rel="nofollow" href="https://xianblog.wordpress.com/tag/chess/">chess</a>, <a target="_blank" rel="nofollow" href="https://xianblog.wordpress.com/tag/donald-knuth/">Donald Knuth</a>, <a target="_blank" rel="nofollow" href="https://xianblog.wordpress.com/tag/ingmar-bergman/">Ingmar Bergman</a>, <a target="_blank" rel="nofollow" href="https://xianblog.wordpress.com/tag/knight/">knight</a>, <a target="_blank" rel="nofollow" href="https://xianblog.wordpress.com/tag/martin-gardner/">Martin Gardner</a>, <a target="_blank" rel="nofollow" href="https://xianblog.wordpress.com/tag/self-avoiding-random-walk/">self-avoiding random walk</a>, <a target="_blank" rel="nofollow" href="https://xianblog.wordpress.com/tag/the-riddler/">The Riddler</a>, <a target="_blank" rel="nofollow" href="https://xianblog.wordpress.com/tag/the-seventh-seal/">The Seventh Seal</a> <a target="_blank" rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/xianblog.wordpress.com/31756/"><img alt="" src="http://feeds.wordpress.com/1.0/comments/xianblog.wordpress.com/31756/" border="0"></a> <img alt="" src="https://i1.wp.com/pixel.wp.com/b.gif?resize=1%2C1&ssl=1" border="0" data-recalc-dims="1"></p>
<p><div><div><div><div data-width="55" data-show-faces="false" data-send="true" data-layout="box_count" data-height="62" data-href="https://www.r-bloggers.com/a-grim-knight-contd/"></div></div><div><a data-url="https://www.r-bloggers.com/a-grim-knight-contd/" data-counturl="https://www.r-bloggers.com/a-grim-knight-contd/" data-count="vertical" data-text="a grim knight [cont’d]" class="twitter-share-button" data-via="rbloggers" href="https://twitter.com/share"></a></div><div></div></div><div></div></div>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="https://xianblog.wordpress.com/2016/10/20/a-grim-knight-contd/"> R – Xi'an's Og</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a title="The R Project for Statistical Computing" rel="nofollow" href="https://www.r-project.org/">R</a> news and <a title="R tutorials" rel="nofollow" href="https://www.r-bloggers.com/?s=tutorial">tutorials</a> on topics such as: <a title="Data science" rel="nofollow" href="https://www.r-bloggers.com/?s=data%20science">Data science</a>, <a title="Big Data" rel="nofollow" href="https://www.r-bloggers.com/?s=Big%20Data">Big Data, <a title="R jobs" rel="nofollow" href="https://www.r-users.com/">R jobs</a>, visualization (<a title="ggplot and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/?s=ggplot2">ggplot2</a>, <a title="Boxplots using lattice and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/?s=boxplot">Boxplots</a>, <a title="Maps and gis" rel="nofollow" href="https://www.r-bloggers.com/?s=map">maps</a>, <a title="Animation in R" rel="nofollow" href="https://www.r-bloggers.com/?s=animation">animation</a>), programming (<a title="RStudio IDE for R" rel="nofollow" href="https://www.r-bloggers.com/?s=RStudio">RStudio</a>, <a title="Sweave and literate programming" rel="nofollow" href="https://www.r-bloggers.com/?s=sweave">Sweave</a>, <a title="LaTeX in R" rel="nofollow" href="https://www.r-bloggers.com/?s=LaTeX">LaTeX</a>, <a title="SQL and databases" rel="nofollow" href="https://www.r-bloggers.com/?s=SQL">SQL</a>, <a title="Eclipse IDE for R" rel="nofollow" href="https://www.r-bloggers.com/?s=eclipse">Eclipse</a>, <a title="git and github, Version Control System" rel="nofollow" href="https://www.r-bloggers.com/?s=git">git</a>, <a title="Large data in R using Hadoop" rel="nofollow" href="https://www.r-bloggers.com/?s=hadoop">hadoop</a>, <a title="Web Scraping of google, facebook, yahoo, twitter and more using R" rel="nofollow" href="https://www.r-bloggers.com/?s=Web+Scraping">Web Scraping</a>) statistics (<a title="Regressions and ANOVA analysis tutorials" rel="nofollow" href="https://www.r-bloggers.com/?s=regression">regression</a>, <a title="principal component analysis tutorial" rel="nofollow" href="https://www.r-bloggers.com/?s=PCA">PCA</a>, <a title="Time series" rel="nofollow" href="https://www.r-bloggers.com/?s=time+series">time series</a>, <a title="finance trading" rel="nofollow" href="https://www.r-bloggers.com/?s=trading">trading</a>) and more...
<img height="1" alt="" width="1" src="http://feeds.feedburner.com/~r/RBloggers/~4/8UJHxU65RWE"></a></div>