Research-quality code for studying 2048. The code in this repo backs what will be a series of blog posts:
Blog post: https://jdlm.info/articles/2017/08/05/markov-chain-2048.html
Files:
bin/markov_chain
--- generates most of the datadata/markov_chain/plot.R
--- scripts to create the plots
Blog post: https://jdlm.info/articles/2017/09/17/counting-states-combinatorics-2048.html
Files:
bin/combinatorics
--- generates the databin/combinatorics_summary
--- aggregation for the blog postdata/combinatorics/plot_layers.R
--- plot for the layer state countsdata/combinatorics/plot_totals.R
--- plot for the total state counts
Blog post: https://jdlm.info/articles/2017/12/10/counting-states-enumeration-2048.html
Files:
bin/enumeration
--- utilitiesdata/enumeration/enumeration.Rmd
--- plotsext/twenty48/layer_builder.hpp
--- main enumeration classext/twenty48/state.hpp
--- main state class for bit bashing
Blog post: https://jdlm.info/articles/2018/03/18/markov-decision-process-2048.html
Files:
bin/explore_2x2_mdp
--- figures (via graphviz/dot)js
--- optimal policy player widgetsbin/pack_policy
--- compact policies for delivery to browserlib/twenty48/layer_solver.rb
/ext/twenty48/layer_solver.hpp
--- the solver code
(The MIT License)
Copyright (c) 2016-2018 John Lees-Miller
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.