{"cells":[{"metadata":{},"cell_type":"markdown","source":"# \" *To play life you must have a fairly large checkerboard and a plentiful supply of flat counters of two colors. It is possible to work with pencil and graph paper but it is much easier, particularly for beginners, to use counters and a board.*”\n### — Martin Gardner, Scientific American (October 1970)","execution_count":null},{"metadata":{},"cell_type":"markdown","source":"# What is a cellular automaton?","execution_count":null},{"metadata":{},"cell_type":"markdown","source":"### A cellular automaton is a model of a system of “cell” objects with the following characteristics.\n1. ### The cells live on a grid. (We’ll see examples in both one and two dimensions in this chapter, though a cellular automaton can exist in any finite number of dimensions.)\n2. ### Each cell has a state. The number of state possibilities is typically finite. The simplest example has the two possibilities of 1 and 0 (otherwise referred to as “on” and “off” or “alive” and “dead”).\n3. ### Each cell has a neighborhood. This can be defined in any number of ways, but it is typically a list of adjacent cells.","execution_count":null},{"metadata":{},"cell_type":"markdown","source":"![](https://natureofcode.com/book/imgs/chapter07/ch07_01.png)","execution_count":null},{"metadata":{},"cell_type":"markdown","source":"### importing libraries","execution_count":null},{"metadata":{"trusted":true},"cell_type":"code","source":"import pandas as pd\nimport numpy as np","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"d629ff2d2480ee46fbb7e2d37f6b5fab8052498a","_cell_guid":"79c7e3d0-c299-4dcb-8224-4455121ee9b0","trusted":true},"cell_type":"code","source":"PATH = '../input/conways-reverse-game-of-life-2020/'","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"train_df = pd.read_csv(PATH + 'train.csv')\nsub = pd.read_csv(PATH + 'test.csv')","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"train_df.head()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"INIT_COLS = []\nSTOP_COLS = []\nREN_DICT = {}\nfor i in range(625):\n    INIT_COLS.append(f\"start_{i}\")\n    STOP_COLS.append(f\"stop_{i}\")\n    REN_DICT[f\"stop_{i}\"] = f\"start_{i}\"\n#=====\nsub = sub.rename(columns=REN_DICT) # swapping stopping columns as starting ones\nsub.drop(\"delta\", axis=1, inplace=True)\nsub.head()\n","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"sub.to_csv(\"submission.csv\", index=False)","execution_count":null,"outputs":[]}],"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat":4,"nbformat_minor":4}