{ "cells": [ { "cell_type": "markdown", "metadata": { "nbpresent": { "id": "8665323c-88ae-4b1f-b444-cc793f3f1ee9" } }, "source": [ "# Table des matières\n", "* [1. Agrégation externe de mathématiques, texte d’exercice diffusé en 2012](#1.-Agrégation-externe-de-mathématiques,-texte-d’exercice-diffusé-en-2012)\n", "\t* [1.1 Épreuve de modélisation, option informatique](#1.1-Épreuve-de-modélisation,-option-informatique)\n", "\t* [1.2 *Proposition* d'implémentation, en [Python 3](https://docs.python.org/3/)](#1.2-*Proposition*-d'implémentation,-en-[Python-3]%28https://docs.python.org/3/%29)\n", "\t\t* [1.2.1 Pour [l'option informatique (D)](http://www.dit.ens-rennes.fr/agregation-option-d/programme-de-l-option-informatique-de-l-agregation-de-mathematiques-48358.kjsp) de l'[agrégation de mathématiques](http://agreg.org/) (en France).](#1.2.1-Pour-[l'option-informatique-%28D%29]%28http://www.dit.ens-rennes.fr/agregation-option-d/programme-de-l-option-informatique-de-l-agregation-de-mathematiques-48358.kjsp%29-de-l'[agrégation-de-mathématiques]%28http://agreg.org/%29-%28en-France%29.)\n", "\t* [1.3 Dépendances et importation de modules](#1.3-Dépendances-et-importation-de-modules)\n", "\t* [1.4 Jeux de Nim](#1.4-Jeux-de-Nim)\n", "\t\t* [1.4.1 Représentation des configurations](#1.4.1-Représentation-des-configurations)\n", "\t\t* [1.4.2 Fonction de Sprague-Grundy pour le jeu de Nim](#1.4.2-Fonction-de-Sprague-Grundy-pour-le-jeu-de-Nim)\n", "\t\t* [1.4.3 Déterminer un coup à jouer selon une stratégie gagnante (s'il y en a une)](#1.4.3-Déterminer-un-coup-à-jouer-selon-une-stratégie-gagnante-%28s'il-y-en-a-une%29)\n", "\t\t\t* [1.4.3.1 Stratégie optimale](#1.4.3.1-Stratégie-optimale)\n", "\t\t* [1.4.4 Stratégie stupide](#1.4.4-Stratégie-stupide)\n", "\t\t* [1.4.5 Un bonus : *simulation du jeu*](#1.4.5-Un-bonus-:-*simulation-du-jeu*)\n", "\t\t* [1.4.6 Configuration aléatoire](#1.4.6-Configuration-aléatoire)\n", "\t* [1.5 Conclusion](#1.5-Conclusion)\n", "\t* [1.6 Attention :](#1.6-Attention-:)\n" ] }, { "cell_type": "markdown", "metadata": { "nbpresent": { "id": "80efd6af-aa36-4653-af45-45dd5430e97a" } }, "source": [ "# 1. Agrégation externe de mathématiques, texte d’exercice diffusé en 2012" ] }, { "cell_type": "markdown", "metadata": { "nbpresent": { "id": "e6840e52-e9af-4576-be75-eef19e2fb36e" } }, "source": [ "## 1.1 Épreuve de modélisation, option informatique" ] }, { "cell_type": "markdown", "metadata": { "nbpresent": { "id": "cf863e8e-e2e5-4202-ab7a-5d608c00c6d6" } }, "source": [ "> - Ce [notebook Jupyter](http://jupyter.org/) est une correction [non officielle](https://github.com/Naereen/notebooks/tree/master/agreg) d'un texte de modélisation pour l'option informatique de l'agrégation externe de mathématiques.\n", "> - Il s'agit du texte [public2012-D3](http://agreg.org/Textes/public2012-D3.pdf).\n", "> - Cette tentative de correction partielle a été rédigée par [Lilian Besson](http://perso.crans.org/besson/) ([sur GitHub ?](https://github.com/Naereen/), [sur Bitbucket ?](https://bitbucket.org/lbesson)), et [est open-source](https://github.com/Naereen/notebooks/blob/master/agreg/public2012_D3.ipynb).\n", "\n", "> #### Feedbacks?\n", "> - Vous avez trouvé un bug ? → [Signalez-le moi svp !](https://github.com/Naereen/notebooks/issues/new), merci d'avance.\n", "> - Vous avez une question ? → [Posez la svp !](https://github.com/Naereen/ama.fr) [![Ask Me Anything](https://img.shields.io/badge/ask%20me-anything-1abc9c.svg)](https://github.com/Naereen/ama.fr)\n", "\n", "----" ] }, { "cell_type": "markdown", "metadata": { "nbpresent": { "id": "cbe9f7b3-4ddf-4fde-8f88-83cd2fcf7bc6" } }, "source": [ "## 1.2 *Proposition* d'implémentation, en [Python 3](https://docs.python.org/3/)" ] }, { "cell_type": "markdown", "metadata": { "nbpresent": { "id": "83b4858a-609e-4ad5-a6ab-02e6b010358a" } }, "source": [ "### 1.2.1 Pour [l'option informatique (D)](http://www.dit.ens-rennes.fr/agregation-option-d/programme-de-l-option-informatique-de-l-agregation-de-mathematiques-48358.kjsp) de l'[agrégation de mathématiques](http://agreg.org/) (en France)." ] }, { "cell_type": "markdown", "metadata": { "nbpresent": { "id": "69081a37-0b19-4e34-8e0c-5e6d1485bb4f" } }, "source": [ "**Attention** : ce document ne prétend pas être LA correction du texte, mais **un exemple de solution**.\n", "\n", "----" ] }, { "cell_type": "markdown", "metadata": { "nbpresent": { "id": "d79a9ab6-1f33-4dda-95ac-0cbf80a79492" } }, "source": [ "## 1.3 Dépendances et importation de modules" ] }, { "cell_type": "code", "execution_count": 89, "metadata": { "collapsed": true, "nbpresent": { "id": "b7f9b828-4e2f-49de-a1bf-c927460b13bb" } }, "outputs": [], "source": [ "import numpy as np\n", "import numpy.random as random\n", "import matplotlib.pyplot as plt" ] }, { "cell_type": "markdown", "metadata": { "nbpresent": { "id": "19ad5a59-07d8-4b50-b889-58ba76436999" } }, "source": [ "## 1.4 Jeux de Nim" ] }, { "cell_type": "markdown", "metadata": { "nbpresent": { "id": "cf05d68c-b582-478e-b7cd-82336799c37b" } }, "source": [ "### 1.4.1 Représentation des configurations" ] }, { "cell_type": "markdown", "metadata": { "nbpresent": { "id": "f59de950-48d1-4309-a813-fa6ec8abd126" } }, "source": [ "On va d'abord écrire une fonction toute simple qui affiche une configuration, en mode texte.\n", "Si on a le temps, on en fera une qui affiche joliment dans une fenêtre graphique (avec [matplotlib](http://www.matplotlib.org))." ] }, { "cell_type": "code", "execution_count": 80, "metadata": { "collapsed": true, "nbpresent": { "id": "10693603-8e92-427e-a827-2f8aa4894b65" } }, "outputs": [], "source": [ "def print_nim(configuration):\n", " \"\"\" Affiche une configuration, donnée sous forme d'une liste d'entiers. \"\"\"\n", " for i, nb in enumerate(configuration):\n", " print(i, ':', '!' * nb)" ] }, { "cell_type": "markdown", "metadata": { "nbpresent": { "id": "7e19760c-d8be-4ffc-ad22-2e4a1dc9ae2d" } }, "source": [ "On peut définir et afficher deux exemples de configuration d'un jeu de Nim, venant de la figure 1." ] }, { "cell_type": "code", "execution_count": 81, "metadata": { "collapsed": false, "nbpresent": { "id": "8ac43c98-538f-43e2-9454-a4f44a64bf66" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "0 : !\n", "1 : !!!\n", "2 : !!!!!\n" ] } ], "source": [ "a = [1, 3, 5]\n", "print_nim(a)" ] }, { "cell_type": "code", "execution_count": 82, "metadata": { "collapsed": false, "nbpresent": { "id": "eb821882-cbe2-4fa3-abc9-7dffbec50bb1" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "0 : !\n", "1 : !!!\n", "2 : !!\n" ] } ], "source": [ "b = [1, 3, 2]\n", "print_nim(b)" ] }, { "cell_type": "markdown", "metadata": { "nbpresent": { "id": "eddea330-32da-4b66-b9d1-fb680fd13cc2" } }, "source": [ "### 1.4.2 Fonction de Sprague-Grundy pour le jeu de Nim" ] }, { "cell_type": "markdown", "metadata": { "nbpresent": { "id": "86f9a6d8-d62f-4788-9f40-7fd07fd20cac" } }, "source": [ "Elle est donnée par le corollaire 1. en page 6/7 du texte.\n", "On a besoin du **xor** (*\"ou exclusif\"*, cf [cette page](https://fr.wikipedia.org/wiki/Fonction_OU_exclusif)), obtenu en Python avec l'opérateur ``^`` :\n", "\n", "$$ \\gamma(\\mathrm{Nim}(x_1, \\dots, x_k)) := \\bigoplus_{i=1}^{k} x_i = x_1 \\oplus \\dots \\oplus x_k. $$" ] }, { "cell_type": "markdown", "metadata": { "nbpresent": { "id": "448ee783-37c8-4b97-bdaa-c3750ad3bc8e" } }, "source": [ "Petit rappel sur cette fonction **xor** :" ] }, { "cell_type": "code", "execution_count": 59, "metadata": { "collapsed": false, "nbpresent": { "id": "0db7b551-c727-4d7a-9386-00573d20f55a" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "False XOR False = False ^ False = False\n", "False XOR True = False ^ True = True\n", " True XOR False = True ^ False = True\n", " True XOR True = True ^ True = False\n" ] } ], "source": [ "from itertools import product\n", "\n", "for b1, b2 in product([False, True], repeat=2):\n", " print(\"{!s:>5} XOR {!s:>5} = {!s:>5} ^ {!s:>5} = {!s:>5}\".format(b1, b2, b1, b2, b1 ^ b2))\n", "# Ce morceau de code est un peu fancy mais concis et joli, cf. https://pyformat.info/#string_pad_align" ] }, { "cell_type": "markdown", "metadata": { "nbpresent": { "id": "4ce0e53e-2c21-44b3-9a92-00e4bd2a7c5b" } }, "source": [ "D'apres le corollaire 1., il suffit d'appliquer un **xor** à chaque valeur du tableau pour calculer $\\gamma$ :" ] }, { "cell_type": "code", "execution_count": 60, "metadata": { "collapsed": false, "nbpresent": { "id": "136251b3-ab4b-4f77-b886-d4f0065cb17c" } }, "outputs": [], "source": [ "def gamma(configuration):\n", " \"\"\" Fonction gamma de Sprague-Grundy pour le jeu de Nim. \"\"\"\n", " resultat = 0\n", " for nb in configuration:\n", " resultat = (resultat ^ nb) % 2 # On reste binaire\n", " return resultat" ] }, { "cell_type": "code", "execution_count": 61, "metadata": { "collapsed": false, "nbpresent": { "id": "30455ed2-bc6e-42e8-8fa8-3330bd2ccff8" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Gamma(a) = 1\n", "Gamma(b) = 0\n" ] } ], "source": [ "print(\"Gamma(a) =\", gamma(a))\n", "print(\"Gamma(b) =\", gamma(b))" ] }, { "cell_type": "markdown", "metadata": { "nbpresent": { "id": "e150e425-da06-4df4-9a3c-2c47dfb26d66" } }, "source": [ "### 1.4.3 Déterminer un coup à jouer selon une stratégie gagnante (s'il y en a une)" ] }, { "cell_type": "markdown", "metadata": { "nbpresent": { "id": "c84c0feb-8dfa-4909-878d-9799ae030c83" } }, "source": [ "On suit l'algorithme proposé par le texte, qui utilise la fonction $\\gamma$ sur la configuration pour savoir s'il y a une stratégie ou non (d'après la proposition 5.), et ensuite si elle existe on doit trouver un coup qui ammene $\\gamma$ à 0.\n", "\n", "On a d'abord besoin d'une exception pour signaler s'il n'y a pas de stratégie gagnante, et du calcul du nombre minimal d'allumette à enlever." ] }, { "cell_type": "code", "execution_count": 62, "metadata": { "collapsed": true, "nbpresent": { "id": "92ae3f84-ea4e-470c-bb08-1006e0f38065" } }, "outputs": [], "source": [ "class PasDeStratGagnante(Exception):\n", " \"\"\" Exception renvoyée s'il n'y a pas de stratégie gagnante. \"\"\"\n", " pass" ] }, { "cell_type": "code", "execution_count": 63, "metadata": { "collapsed": true, "nbpresent": { "id": "363eccaa-1afe-4b06-a87a-0330c4a18a5c" } }, "outputs": [], "source": [ "def tronquer(n):\n", " \"\"\" Calcule le nombre minimum d'allumette à enlever.\"\"\"\n", " return 2 ** int(np.floor(np.log2(n)))" ] }, { "cell_type": "code", "execution_count": 64, "metadata": { "collapsed": false, "nbpresent": { "id": "162ed450-39e8-4aa9-aa49-8ac883a8ccae" } }, "outputs": [ { "data": { "text/plain": [ "4" ] }, "execution_count": 64, "metadata": {}, "output_type": "execute_result" } ], "source": [ "tronquer(5) # = 4" ] }, { "cell_type": "code", "execution_count": 65, "metadata": { "collapsed": false, "nbpresent": { "id": "a34d6e8b-2834-4102-b10e-c745cd740ad0" } }, "outputs": [ { "data": { "text/plain": [ "8" ] }, "execution_count": 65, "metadata": {}, "output_type": "execute_result" } ], "source": [ "tronquer(13) # = 8" ] }, { "cell_type": "markdown", "metadata": { "nbpresent": { "id": "4c9a79c3-e905-43d4-922b-273f5ce8f08e" } }, "source": [ "#### 1.4.3.1 Stratégie optimale" ] }, { "cell_type": "code", "execution_count": 168, "metadata": { "collapsed": true, "nbpresent": { "id": "daaa9f44-9b08-4684-952d-22a1a6f4841b" } }, "outputs": [], "source": [ "def optimal(configuration, joueur=0):\n", " \"\"\" Essaie de trouver un coup à jouer pour le joueur 0 ou 1, et renvoit la configuration modifiée.\"\"\"\n", " g = gamma(configuration)\n", " if g == 0:\n", " print(\"Il n'y a pas de stratégie gagnante !\")\n", " raise PasDeStratGagnante # On quitte\n", " print(\"Il y a une stratégie gagnante... Trouvons la !\")\n", " # On chercher le coup à jouer : la ligne la plus longue...\n", " position_max = 0 # est d'indice position_max\n", " nb_max = configuration[0] # et a nb_max allumette(s)\n", " for j, nb in enumerate(configuration):\n", " if nb > nb_max:\n", " position_max = j\n", " nb_max = nb\n", " a_enlever = tronquer(nb_max)\n", " # On applique ce coup\n", " print(\"Le joueur courant\", joueur, \"a choisis de retirer\", a_enlever, \"allumettes à la rangée numéro\", position_max)\n", " nouvelle_configuration = configuration[:]\n", " nouvelle_configuration[position_max] -= a_enlever\n", " return nouvelle_configuration" ] }, { "cell_type": "markdown", "metadata": { "nbpresent": { "id": "6819c0da-b0a4-4d20-8538-c51029d310ef" } }, "source": [ "On peut tester cette fonction sur nos deux configuration a et b :" ] }, { "cell_type": "code", "execution_count": 169, "metadata": { "collapsed": false, "nbpresent": { "id": "289bbbde-c04a-44cc-9f2b-d8078689dc12" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "0 : !\n", "1 : !!!\n", "2 : !!!!!\n", "Il y a une stratégie gagnante... Trouvons la !\n", "Le joueur courant 0 a choisis de retirer 4 allumettes à la rangée numéro 2\n", "0 : !\n", "1 : !!!\n", "2 : !\n" ] } ], "source": [ "print_nim(a)\n", "print_nim(optimal(a, joueur=0)) # Ça joue" ] }, { "cell_type": "code", "execution_count": 170, "metadata": { "collapsed": false, "nbpresent": { "id": "df6d464c-0acd-4fb5-bb94-173731a8f4e5" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "0 : !\n", "1 : !!!\n", "2 : !!\n", "Il n'y a pas de stratégie gagnante !\n" ] }, { "ename": "PasDeStratGagnante", "evalue": "", "output_type": "error", "traceback": [ "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[1;31mPasDeStratGagnante\u001b[0m Traceback (most recent call last)", "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[0mprint_nim\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mb\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 2\u001b[1;33m \u001b[0mprint_nim\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0moptimal\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mb\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mjoueur\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;36m0\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;31m# Pas de stratégie gagnante ici !\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", "\u001b[1;32m\u001b[0m in \u001b[0;36moptimal\u001b[1;34m(configuration, joueur)\u001b[0m\n\u001b[0;32m 4\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mg\u001b[0m \u001b[1;33m==\u001b[0m \u001b[1;36m0\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 5\u001b[0m \u001b[0mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"Il n'y a pas de stratégie gagnante !\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 6\u001b[1;33m \u001b[1;32mraise\u001b[0m \u001b[0mPasDeStratGagnante\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 7\u001b[0m \u001b[0mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"Il y a une stratégie gagnante... Trouvons la !\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 8\u001b[0m \u001b[1;31m# On chercher le coup à jouer : la ligne la plus longue...\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", "\u001b[1;31mPasDeStratGagnante\u001b[0m: " ] } ], "source": [ "print_nim(b)\n", "print_nim(optimal(b, joueur=0)) # Pas de stratégie gagnante ici !" ] }, { "cell_type": "markdown", "metadata": { "nbpresent": { "id": "2a6fa42f-7d63-4d18-8d99-61b59300e758" } }, "source": [ "### 1.4.4 Stratégie stupide" ] }, { "cell_type": "markdown", "metadata": { "nbpresent": { "id": "ae123988-e05c-4962-a923-d92f53e3a67a" } }, "source": [ "Dans le but de comparer cette fonction qui implémente une stratégie optimale, on implémente aussi une stratégie complétement aléatoire (\"Dummy player\")." ] }, { "cell_type": "code", "execution_count": 145, "metadata": { "collapsed": true, "nbpresent": { "id": "8b7c4576-e48a-47e4-897b-9c30c25cacfc" } }, "outputs": [], "source": [ "def stupide(configuration, joueur=0):\n", " \"\"\" Choisit un coup aléatoire (uniforme) pour le joueur 0 ou 1, et renvoit la configuration modifiée.\"\"\"\n", " # On choisit le coup à jouer : ligne random, nb d'allumette(s) random...\n", " lignes_non_vides = [i for i, c in enumerate(configuration) if c > 0]\n", " position_random = random.choice(lignes_non_vides)\n", " print(\"Le joueur\", joueur, \"aléatoire uniforme a choisis de regarder la ligne\", position_random)\n", " total = configuration[position_random]\n", " a_enlever = random.randint(1, 1 + total)\n", " print(\"Le joueur\", joueur, \"aléatoire uniforme a choisis de retirer\", a_enlever, \"allumettes parmi les\", total, \"disponibles\")\n", " # On applique ce coup\n", " nouvelle_configuration = configuration[:]\n", " nouvelle_configuration[position_random] -= a_enlever\n", " return nouvelle_configuration" ] }, { "cell_type": "markdown", "metadata": { "nbpresent": { "id": "17e8c9d2-cf6c-403d-a027-e9bf5929ecd4" } }, "source": [ "On peut ainsi faire un exemple de début de partie entre deux joueurs \"stupides\" :" ] }, { "cell_type": "code", "execution_count": 146, "metadata": { "collapsed": false, "nbpresent": { "id": "8f97c94d-d881-46d8-abd4-d33345c84b86" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "0 : !\n", "1 : !!!\n", "2 : !!!!!\n", "Le joueur 0 aléatoire uniforme a choisis de regarder la ligne 0\n", "Le joueur 0 aléatoire uniforme a choisis de retirer 1 allumettes parmi les 1 disponibles\n", "0 : \n", "1 : !!!\n", "2 : !!!!!\n", "Le joueur 1 aléatoire uniforme a choisis de regarder la ligne 2\n", "Le joueur 1 aléatoire uniforme a choisis de retirer 1 allumettes parmi les 5 disponibles\n", "0 : \n", "1 : !!!\n", "2 : !!!!\n", "Le joueur 0 aléatoire uniforme a choisis de regarder la ligne 2\n", "Le joueur 0 aléatoire uniforme a choisis de retirer 4 allumettes parmi les 4 disponibles\n", "0 : \n", "1 : !!!\n", "2 : \n" ] } ], "source": [ "random.seed(0) # Assure la reproductibilité des résultats.\n", "a0 = a # Debut du jeu\n", "print_nim(a0)\n", "a1 = stupide(a0, joueur=0)\n", "print_nim(a1)\n", "a2 = stupide(a1, joueur=1)\n", "print_nim(a2)\n", "a3 = stupide(a2, joueur=0)\n", "print_nim(a3)\n", "# ... etc" ] }, { "cell_type": "markdown", "metadata": { "nbpresent": { "id": "d3d98d0a-7fca-4eb8-9b29-3d944285b417" } }, "source": [ "On peut aussi faire le meme exemple de début de partie entre un joueur \"optimal\" et un joueur \"stupide\" :" ] }, { "cell_type": "code", "execution_count": 171, "metadata": { "collapsed": false, "nbpresent": { "id": "b5543c2e-513e-489c-8095-e8b8b54c0a70" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "0 : !\n", "1 : !!!\n", "2 : !!!!!\n", "Il y a une stratégie gagnante... Trouvons la !\n", "Le joueur courant 0 a choisis de retirer 4 allumettes à la rangée numéro 2\n", "0 : !\n", "1 : !!!\n", "2 : !\n", "Le joueur 1 aléatoire uniforme a choisis de regarder la ligne 0\n", "Le joueur 1 aléatoire uniforme a choisis de retirer 1 allumettes parmi les 1 disponibles\n", "0 : \n", "1 : !!!\n", "2 : !\n" ] } ], "source": [ "random.seed(0) # Assure la reproductibilité des résultats.\n", "a0 = a # Debut du jeu\n", "print_nim(a0)\n", "a1 = optimal(a0, joueur=0)\n", "print_nim(a1)\n", "a2 = stupide(a1, joueur=1)\n", "print_nim(a2)\n", "# ... etc" ] }, { "cell_type": "markdown", "metadata": { "nbpresent": { "id": "a0b821ed-abc4-434e-be42-c708c30115d4" } }, "source": [ "### 1.4.5 Un bonus : *simulation du jeu*" ] }, { "cell_type": "markdown", "metadata": { "nbpresent": { "id": "5ea7ac1e-13d3-4e17-adf5-7086fefb5029" } }, "source": [ "Maintenant qu'on dispose d'un joueur stupide et d'un joueur optimal, on peut rapidement coder une petite fonction qui les fera s'affronter (même si c'est un peu cruel envers le pauvre joueur \"stupide\" purement aléatoire !)." ] }, { "cell_type": "code", "execution_count": 148, "metadata": { "collapsed": true, "nbpresent": { "id": "f6bd1dcb-e787-4a1d-bc2d-27b8e55eb188" } }, "outputs": [], "source": [ "class Perdu(Exception):\n", " \"\"\" Représente le joueur numero i qui a perdu.\"\"\"\n", " def __init__(self, numero):\n", " self.numero = numero\n", "\n", " def __str__(self):\n", " return \"Le joueur {} a perdu !\".format(self.numero)" ] }, { "cell_type": "markdown", "metadata": { "nbpresent": { "id": "c239a550-89bb-4891-9631-b9f5322ccb7f" } }, "source": [ "La fonction ``simule`` va jouer la partie, en partant de la configuration donnée, en commençant par le joueur ``numero`` et pour un certain nombre de coups joués (``nb_coups``).\n", "Si on ne donne pas ce nombre de coups, le nombre total d'allumette est utilisé (sachant qu'une partie se termine souvent par une exception ``PasDeStratGagnante`` lorsque le joueur optimal ne peut plus gagner)." ] }, { "cell_type": "code", "execution_count": 172, "metadata": { "collapsed": true, "nbpresent": { "id": "df011f6a-f1d9-437f-8eea-bd28b3669baa" } }, "outputs": [], "source": [ "def simule(configuration, numero=0, nb_coups=None):\n", " \"\"\" Simule le jeu de Nim, alternant un joeur malin et un joueur stupide. \"\"\"\n", " config = configuration[:] # On ne change pas la liste donnee en argument !\n", " # Si on n'a pas donne le nb de coups max, on calcule une borne :\n", " if nb_coups is None:\n", " nb_coups = sum(configuration)\n", " print(\"Début de la simulation pour maximum\", nb_coups, \"coups.\")\n", " # On lance la simulation\n", " for coup in range(1, 1 + nb_coups):\n", " print(\"\\n# Tour numéro\", coup)\n", " print_nim(config)\n", " # On perd si on ne peut plus enlever d'allumettes\n", " if sum(config) == 0:\n", " raise Perdu(numero)\n", " else:\n", " if numero == 0: # Joueur malin\n", " config = optimal(config, joueur=numero)\n", " else: # Joueur stupide\n", " config = stupide(config, joueur=numero)\n", " # Joueur suivant\n", " numero = int(not numero) # 0 -> 1, 1 -> 0\n", " # A la fin, la configuration finale est renvoyée.\n", " return config" ] }, { "cell_type": "markdown", "metadata": { "nbpresent": { "id": "0528cf19-31f3-4987-8085-4abecd57742e" } }, "source": [ "On peut finalement implementer une jolie fonction qui simule en partant du joueur ``0`` (comme le vrai jeu de Nim) et interprète l'exception renvoyée pour afficher l'issue du jeu :" ] }, { "cell_type": "code", "execution_count": 173, "metadata": { "collapsed": false, "nbpresent": { "id": "81fd70ee-3660-4f0b-a36a-27d15ad5ad58" } }, "outputs": [], "source": [ "def nim(configuration):\n", " try:\n", " simule(configuration)\n", " except PasDeStratGagnante:\n", " print(\"==> Blocage car le joueur 0 n'a pas pu trouver de coup gagnant, il déclare forfait (le pleutre !).\")\n", " except Perdu as e:\n", " print(\"==> Le joueur\", e.numero, \"a perdu.\")" ] }, { "cell_type": "code", "execution_count": 118, "metadata": { "collapsed": false, "nbpresent": { "id": "00c319e5-82e6-44e4-9efd-a7be52b81781" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Début de la simulation pour maximum 9 coups.\n", "\n", "# Tour numéro 1\n", "0 : !\n", "1 : !!!\n", "2 : !!!!!\n", "Il y a une stratégie gagnante... Trouvons la !\n", "Le joueur courant 0 choisis de retirer 4 allumettes à la rangée numéro 2\n", "\n", "# Tour numéro 2\n", "0 : !\n", "1 : !!!\n", "2 : !\n", "Le joueur 1 aléatoire uniforme a choisis de regarder la ligne 1\n", "Le joueur 1 aléatoire uniforme a choisis de retirer 2 allumettes parmi les 3 disponibles\n", "\n", "# Tour numéro 3\n", "0 : !\n", "1 : !\n", "2 : !\n", "Il y a une stratégie gagnante... Trouvons la !\n", "Le joueur courant 0 choisis de retirer 1 allumettes à la rangée numéro 0\n", "\n", "# Tour numéro 4\n", "0 : \n", "1 : !\n", "2 : !\n", "Le joueur 1 aléatoire uniforme a choisis de regarder la ligne 2\n", "Le joueur 1 aléatoire uniforme a choisis de retirer 1 allumettes parmi les 1 disponibles\n", "\n", "# Tour numéro 5\n", "0 : \n", "1 : !\n", "2 : \n", "Il y a une stratégie gagnante... Trouvons la !\n", "Le joueur courant 0 choisis de retirer 1 allumettes à la rangée numéro 1\n", "\n", "# Tour numéro 6\n", "0 : \n", "1 : \n", "2 : \n", "==> Le joueur 1 a perdu.\n" ] } ], "source": [ "nim(a)" ] }, { "cell_type": "code", "execution_count": 174, "metadata": { "collapsed": false, "nbpresent": { "id": "dc9063f4-4023-4bfb-9d40-eb1fe5c295bd" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Début de la simulation pour maximum 6 coups.\n", "\n", "# Tour numéro 1\n", "0 : !\n", "1 : !!!\n", "2 : !!\n", "Il n'y a pas de stratégie gagnante !\n", "==> Blocage car le joueur 0 n'a pas pu trouver de coup gagnant, il déclare forfait (le pleutre !).\n" ] } ], "source": [ "nim(b)" ] }, { "cell_type": "markdown", "metadata": { "nbpresent": { "id": "9e65335c-5c93-4e8f-aa08-278b5c0ab664" } }, "source": [ "### 1.4.6 Configuration aléatoire" ] }, { "cell_type": "markdown", "metadata": { "nbpresent": { "id": "5e625979-f0ce-49cf-8c17-cf3abeab3eaa" } }, "source": [ "On peut écrire une fonction qui génére une configuration aléatoire, et ensuite lancer notre simulation ``nim()`` dessus, pour voir ce que ça donne sur une configuration plus grande." ] }, { "cell_type": "code", "execution_count": 175, "metadata": { "collapsed": true, "nbpresent": { "id": "6b1e5b84-b0bd-4d54-8344-05c8ae378ee6" } }, "outputs": [], "source": [ "def config_aleatoire(nb_ligne, nb_max_allumette):\n", " \"\"\" Configuration aléatoire, chaque ligne est uniformément tirée dans [1, nb_max_allumette] (bornes incluses).\"\"\"\n", " return list(random.randint(1, 1 + nb_max_allumette, nb_ligne))" ] }, { "cell_type": "code", "execution_count": 184, "metadata": { "collapsed": false, "nbpresent": { "id": "6201894f-4ca4-4f3f-b3a9-88498f1f50e4" }, "scrolled": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Configuration random c :\n", "0 : !!!!\n", "1 : !\n", "2 : !!\n", "3 : !!!!\n", "Début de la simulation pour maximum 11 coups.\n", "\n", "# Tour numéro 1\n", "0 : !!!!\n", "1 : !\n", "2 : !!\n", "3 : !!!!\n", "Il y a une stratégie gagnante... Trouvons la !\n", "Le joueur courant 0 a choisis de retirer 4 allumettes à la rangée numéro 0\n", "\n", "# Tour numéro 2\n", "0 : \n", "1 : !\n", "2 : !!\n", "3 : !!!!\n", "Le joueur 1 aléatoire uniforme a choisis de regarder la ligne 2\n", "Le joueur 1 aléatoire uniforme a choisis de retirer 2 allumettes parmi les 2 disponibles\n", "\n", "# Tour numéro 3\n", "0 : \n", "1 : !\n", "2 : \n", "3 : !!!!\n", "Il y a une stratégie gagnante... Trouvons la !\n", "Le joueur courant 0 a choisis de retirer 4 allumettes à la rangée numéro 3\n", "\n", "# Tour numéro 4\n", "0 : \n", "1 : !\n", "2 : \n", "3 : \n", "Le joueur 1 aléatoire uniforme a choisis de regarder la ligne 1\n", "Le joueur 1 aléatoire uniforme a choisis de retirer 1 allumettes parmi les 1 disponibles\n", "\n", "# Tour numéro 5\n", "0 : \n", "1 : \n", "2 : \n", "3 : \n", "==> Le joueur 0 a perdu.\n" ] } ], "source": [ "c = config_aleatoire(4, 4)\n", "print(\"Configuration random c :\")\n", "print_nim(c)\n", "nim(c)" ] }, { "cell_type": "markdown", "metadata": { "nbpresent": { "id": "2d3e0dc0-974a-46c7-8e15-bfdc9aa8ab8c" } }, "source": [ "*Oui, c'est la honte, le joueur 0 (qui utilise une stratégie optimale) vient de perdre en 5 coups face à un joueur aléatoire...*" ] }, { "cell_type": "markdown", "metadata": { "nbpresent": { "id": "fd923b60-835c-49b9-a185-bd2e80396f1c" } }, "source": [ "----" ] }, { "cell_type": "markdown", "metadata": { "nbpresent": { "id": "f8a48446-d37b-4e33-b1ef-8e38604faaf6" } }, "source": [ "## 1.5 Conclusion" ] }, { "cell_type": "markdown", "metadata": { "nbpresent": { "id": "1dba3138-41e1-4306-9378-a7bb432a89f4" } }, "source": [ "C'est tout ce que j'avais eu le temps d'implémenter durant les 4h de préparation (c'est un des textes que j'avais préparé en juin 2014, dans les \"vraies\" conditions en oraux blanc, à l'ENS Cachan, et le code initial était en OCaml mais je n'ai rien changé à part la conversion en Python3).\n", "\n", "Quelques remarques :\n", "\n", "- durant l'épreuve de modélisation, vous êtes libres de faire ce que vous voulez, la seule partie requise est dans le paragraphe **Exercice de programmation** (ici, il s'agissait d'implémenter une fonction similaire à ``optimal()`` (cf. plus haut).\n", "- les quelques développements supplémentaires traites ci-dessus (stratégie stupide, configuration aléatoire, simulation de jeu), ne sont qu'une suggestion de ce qui pouvait être fait sur ce texte,\n", "- d'autres suggestions sont possibles, si vous avez des idées, [envoyez-moi vos notebooks !](https://github.com/Naereen/notebooks/pulls)" ] }, { "cell_type": "markdown", "metadata": { "nbpresent": { "id": "37c9ef70-c88b-449d-95ee-75da42d3b33a" } }, "source": [ "## 1.6 Attention :" ] }, { "cell_type": "markdown", "metadata": { "nbpresent": { "id": "1b8a2fe9-e46b-436a-b5fc-a69a02798587" } }, "source": [ "Les 40 minutes de passage au tableau ne doivent PAS être uniquement consacrée à la présentation de vos expériences sur l'ordinateur !\n", "\n", "Il faut aussi :\n", "\n", "- faire une introduction générale (citer des mots clés),\n", "- présenter le plan de votre présentation,\n", "- introduire les notations, les objectifs et les résultats donnés par le texte,\n", "- prouver ou exposer des développements **theoriques** personnels (à choisir parmi la liste proposée, mais pas seulement),\n", "- etc." ] }, { "cell_type": "markdown", "metadata": { "nbpresent": { "id": "a73ae3f5-f62b-4103-a2cc-b0e6bea925a0" } }, "source": [ "----\n", "\n", "> *C'est tout pour aujourd'hui les amis !*\n", "> [Allez voir d'autres notebooks](https://github.com/Naereen/notebooks/tree/master/agreg) si vous voulez." ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.4.3+" }, "nbpresent": { "slides": { "002526c4-e14c-4a61-91e8-126126671605": { "id": "002526c4-e14c-4a61-91e8-126126671605", "prev": "d4bfa84d-b3bf-4648-88f6-98797ac8a03f", "regions": { "99c45e66-ecfc-48c4-92a9-dc63cb673d63": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "6b1e5b84-b0bd-4d54-8344-05c8ae378ee6", "part": "whole" }, "id": "99c45e66-ecfc-48c4-92a9-dc63cb673d63" } } }, "00832e6c-e5a7-4998-97ce-d469185641d4": { "id": "00832e6c-e5a7-4998-97ce-d469185641d4", "prev": "cd92ba84-bf79-42db-bd39-250d56a5a7bf", "regions": { "f0a004dc-80ca-4946-9fc3-1aacacb6de72": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "00c319e5-82e6-44e4-9efd-a7be52b81781", "part": "whole" }, "id": "f0a004dc-80ca-4946-9fc3-1aacacb6de72" } } }, "05b8946b-7af7-4075-ac5b-48ff9559845f": { "id": "05b8946b-7af7-4075-ac5b-48ff9559845f", "prev": "eb4e7132-507e-4c38-863c-99e872bf4471", "regions": { "de9ce5c8-3496-4ac7-8945-595ef2df1191": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "f6bd1dcb-e787-4a1d-bc2d-27b8e55eb188", "part": "whole" }, "id": "de9ce5c8-3496-4ac7-8945-595ef2df1191" } } }, "0a8cb36a-849b-46b1-a8a4-358c6f08414c": { "id": "0a8cb36a-849b-46b1-a8a4-358c6f08414c", "prev": "95f8c700-4527-4464-9e21-d0d56b9586fa", "regions": { "a61150fb-76e3-43a4-a4ae-f1bf05809653": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "448ee783-37c8-4b97-bdaa-c3750ad3bc8e", "part": "whole" }, "id": "a61150fb-76e3-43a4-a4ae-f1bf05809653" } } }, "10e2c709-d7f1-4666-b08d-a37ac3f5694c": { "id": "10e2c709-d7f1-4666-b08d-a37ac3f5694c", "prev": "f97325ef-3acd-4f70-9670-762af77a4710", "regions": { "8fd2f863-9b31-42a9-8f90-832b6b816b8f": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "f59de950-48d1-4309-a813-fa6ec8abd126", "part": "whole" }, "id": "8fd2f863-9b31-42a9-8f90-832b6b816b8f" } } }, "14696312-a4c0-4b25-9ee9-ffc8c7886ef5": { "id": "14696312-a4c0-4b25-9ee9-ffc8c7886ef5", "prev": "b79228d5-5c8d-45ce-a50e-b94dc05ea44c", "regions": { "d8b8a643-0627-43a1-b814-d694c6e5db40": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "a73ae3f5-f62b-4103-a2cc-b0e6bea925a0", "part": "whole" }, "id": "d8b8a643-0627-43a1-b814-d694c6e5db40" } } }, "1599d9f0-86d9-41d6-adcf-0fbf95c9be06": { "id": "1599d9f0-86d9-41d6-adcf-0fbf95c9be06", "prev": "97bb0dab-4db3-43be-886e-137a70bfe748", "regions": { "392bf50d-3d54-4d8a-8a5d-42bfeb1d9761": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "fd923b60-835c-49b9-a185-bd2e80396f1c", "part": "whole" }, "id": "392bf50d-3d54-4d8a-8a5d-42bfeb1d9761" } } }, "19f377f5-7782-40af-9b3a-64ba65b8b348": { "id": "19f377f5-7782-40af-9b3a-64ba65b8b348", "prev": "55e53a2b-58ea-46a9-86d2-204bb7aca494", "regions": { "61d0b218-029b-4724-923f-7f3ad76fff67": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "e150e425-da06-4df4-9a3c-2c47dfb26d66", "part": "whole" }, "id": "61d0b218-029b-4724-923f-7f3ad76fff67" } } }, "1a7e1e37-caa4-46cb-b2cf-a7d893b7d992": { "id": "1a7e1e37-caa4-46cb-b2cf-a7d893b7d992", "prev": "f085c321-3a10-46b0-a24d-bdfb23836ba2", "regions": { "b5023ac1-972c-4619-abad-17da77ca826e": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "8f97c94d-d881-46d8-abd4-d33345c84b86", "part": "whole" }, "id": "b5023ac1-972c-4619-abad-17da77ca826e" } } }, "1eb4be61-cbec-4c23-a586-cc8313d97cc3": { "id": "1eb4be61-cbec-4c23-a586-cc8313d97cc3", "prev": "ba811ffd-8153-4aab-9bfd-2eb808e54cec", "regions": { "a0c76e95-414c-4a51-b83c-d3ab7a225356": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "363eccaa-1afe-4b06-a87a-0330c4a18a5c", "part": "whole" }, "id": "a0c76e95-414c-4a51-b83c-d3ab7a225356" } } }, "1ee63729-d401-45be-82eb-f2b038a3f2f0": { "id": "1ee63729-d401-45be-82eb-f2b038a3f2f0", "prev": "f6e0c9b8-4cf1-439a-ab5b-fcc2611c4dc3", "regions": { "3c65d2ab-cda8-476e-9485-d66918c65a01": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "9e65335c-5c93-4e8f-aa08-278b5c0ab664", "part": "whole" }, "id": "3c65d2ab-cda8-476e-9485-d66918c65a01" } } }, "26984cc2-9fff-47c1-b8c4-da1933ae7876": { "id": "26984cc2-9fff-47c1-b8c4-da1933ae7876", "prev": "8b13e1d8-59bd-43c4-b936-c6ac63c86e83", "regions": { "8386571c-2974-4b4c-af98-b616eca37884": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "2a6fa42f-7d63-4d18-8d99-61b59300e758", "part": "whole" }, "id": "8386571c-2974-4b4c-af98-b616eca37884" } } }, "2993c16d-a310-432f-b58d-51bb242cf0c2": { "id": "2993c16d-a310-432f-b58d-51bb242cf0c2", "prev": "1a7e1e37-caa4-46cb-b2cf-a7d893b7d992", "regions": { "e52484f3-dbcb-4e26-856b-62737dfe3bde": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "d3d98d0a-7fca-4eb8-9b29-3d944285b417", "part": "whole" }, "id": "e52484f3-dbcb-4e26-856b-62737dfe3bde" } } }, "2b67a0c2-9945-441c-bdf5-b676d38dc5de": { "id": "2b67a0c2-9945-441c-bdf5-b676d38dc5de", "prev": "c12932f1-3e56-4d60-bc3d-b766584b923e", "regions": { "2e32c2c4-caf0-4445-8b77-934ee444c722": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "daaa9f44-9b08-4684-952d-22a1a6f4841b", "part": "whole" }, "id": "2e32c2c4-caf0-4445-8b77-934ee444c722" } } }, "2f4c7c22-a7c8-453e-8f80-535ffe4627eb": { "id": "2f4c7c22-a7c8-453e-8f80-535ffe4627eb", "prev": "9aedb5db-a2c1-4d10-adb5-75f88795f16c", "regions": { "1539ddb7-a721-4943-b575-c98720ce92b2": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "e6840e52-e9af-4576-be75-eef19e2fb36e", "part": "whole" }, "id": "1539ddb7-a721-4943-b575-c98720ce92b2" } } }, "307ab713-ca2c-4471-b89d-c4f88fa35f35": { "id": "307ab713-ca2c-4471-b89d-c4f88fa35f35", "prev": "002526c4-e14c-4a61-91e8-126126671605", "regions": { "638cf8cf-2398-412e-8992-0b056ce9b1a2": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "6201894f-4ca4-4f3f-b3a9-88498f1f50e4", "part": "whole" }, "id": "638cf8cf-2398-412e-8992-0b056ce9b1a2" } } }, "3ff9883b-71d1-4a41-b1f5-9087b716c773": { "id": "3ff9883b-71d1-4a41-b1f5-9087b716c773", "prev": "19f377f5-7782-40af-9b3a-64ba65b8b348", "regions": { "5cbd3522-f691-4150-8efd-3e6a839c1efb": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "c84c0feb-8dfa-4909-878d-9799ae030c83", "part": "whole" }, "id": "5cbd3522-f691-4150-8efd-3e6a839c1efb" } } }, "4f330095-823c-4d5d-a10b-19a6ef13c29b": { "id": "4f330095-823c-4d5d-a10b-19a6ef13c29b", "prev": "b1a331f1-470d-4754-97a1-3e1680c67862", "regions": { "dd0eea2c-cb76-4799-81d2-e466512b3f1a": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "37c9ef70-c88b-449d-95ee-75da42d3b33a", "part": "whole" }, "id": "dd0eea2c-cb76-4799-81d2-e466512b3f1a" } } }, "51456c8d-c7f9-43f3-8d3b-89b29da35dfa": { "id": "51456c8d-c7f9-43f3-8d3b-89b29da35dfa", "prev": "7e6a0e2e-8c0c-47b0-924e-1476adfc3ec9", "regions": { "681683e9-9b91-40c0-b6d7-030ef2da1187": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "a0b821ed-abc4-434e-be42-c708c30115d4", "part": "whole" }, "id": "681683e9-9b91-40c0-b6d7-030ef2da1187" } } }, "533f6f0b-aa68-4e53-9f1d-0cfea5f693d2": { "id": "533f6f0b-aa68-4e53-9f1d-0cfea5f693d2", "prev": "1eb4be61-cbec-4c23-a586-cc8313d97cc3", "regions": { "9bf3256f-562e-47bc-8b26-1c08cb19d439": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "162ed450-39e8-4aa9-aa49-8ac883a8ccae", "part": "whole" }, "id": "9bf3256f-562e-47bc-8b26-1c08cb19d439" } } }, "55e53a2b-58ea-46a9-86d2-204bb7aca494": { "id": "55e53a2b-58ea-46a9-86d2-204bb7aca494", "prev": "c54d74b5-6fb2-4ab1-8784-9fafa14c1b71", "regions": { "0a237456-9143-4434-a922-aa4dbb12742c": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "30455ed2-bc6e-42e8-8fa8-3330bd2ccff8", "part": "whole" }, "id": "0a237456-9143-4434-a922-aa4dbb12742c" } } }, "567bcaaa-fefb-4434-9051-07c81ed4b243": { "id": "567bcaaa-fefb-4434-9051-07c81ed4b243", "prev": "533f6f0b-aa68-4e53-9f1d-0cfea5f693d2", "regions": { "776666cd-1c90-41fd-bbd0-7e9af236ca91": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "a34d6e8b-2834-4102-b10e-c745cd740ad0", "part": "whole" }, "id": "776666cd-1c90-41fd-bbd0-7e9af236ca91" } } }, "59c69c99-552c-4125-a0ee-5544426c4484": { "id": "59c69c99-552c-4125-a0ee-5544426c4484", "prev": null, "regions": { "f9d90823-5986-45c3-b686-4ce6f99642c7": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "8665323c-88ae-4b1f-b444-cc793f3f1ee9", "part": "whole" }, "id": "f9d90823-5986-45c3-b686-4ce6f99642c7" } } }, "63d76698-d35b-4e98-96a5-67b6598aec26": { "id": "63d76698-d35b-4e98-96a5-67b6598aec26", "prev": "76b8bf67-cfad-4c5f-aa78-87331787bc4c", "regions": { "e2bf1ef9-ed3f-426f-8e59-f70f3c81c1cf": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "cbe9f7b3-4ddf-4fde-8f88-83cd2fcf7bc6", "part": "whole" }, "id": "e2bf1ef9-ed3f-426f-8e59-f70f3c81c1cf" } } }, "6caaacd0-47d1-41bd-a22d-e2efe28ec828": { "id": "6caaacd0-47d1-41bd-a22d-e2efe28ec828", "prev": "97fcb1ac-e44f-4568-aa35-bdaadeff7085", "regions": { "7fe1c94e-379e-47d6-9588-b6a75ab8d6ec": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "4ce0e53e-2c21-44b3-9a92-00e4bd2a7c5b", "part": "whole" }, "id": "7fe1c94e-379e-47d6-9588-b6a75ab8d6ec" } } }, "7528841a-ab73-485f-81a7-1c1fc4955b52": { "id": "7528841a-ab73-485f-81a7-1c1fc4955b52", "prev": "c4d93d28-6aec-426f-9c9c-9ee0a59a06c4", "regions": { "a63ab7dd-13b6-4d83-bff7-b3e56586dd58": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "d79a9ab6-1f33-4dda-95ac-0cbf80a79492", "part": "whole" }, "id": "a63ab7dd-13b6-4d83-bff7-b3e56586dd58" } } }, "76b8bf67-cfad-4c5f-aa78-87331787bc4c": { "id": "76b8bf67-cfad-4c5f-aa78-87331787bc4c", "prev": "2f4c7c22-a7c8-453e-8f80-535ffe4627eb", "regions": { "86c861e7-b5d5-4e1a-af04-4b9de558eb6e": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "cf863e8e-e2e5-4202-ab7a-5d608c00c6d6", "part": "whole" }, "id": "86c861e7-b5d5-4e1a-af04-4b9de558eb6e" } } }, "76ec6531-9ec8-42bc-92bc-57d503df5027": { "id": "76ec6531-9ec8-42bc-92bc-57d503df5027", "prev": "d82267a5-0d32-48a9-b327-c5199dd0ce43", "regions": { "aa2afeb1-86ee-46bc-9a1e-bb4057ce6418": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "8ac43c98-538f-43e2-9454-a4f44a64bf66", "part": "whole" }, "id": "aa2afeb1-86ee-46bc-9a1e-bb4057ce6418" } } }, "7b748b34-33e1-41bc-9dd1-9d4990503d0b": { "id": "7b748b34-33e1-41bc-9dd1-9d4990503d0b", "prev": "2b67a0c2-9945-441c-bdf5-b676d38dc5de", "regions": { "ec72c542-f172-4044-a486-c6cd871904e2": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "6819c0da-b0a4-4d20-8538-c51029d310ef", "part": "whole" }, "id": "ec72c542-f172-4044-a486-c6cd871904e2" } } }, "7e6a0e2e-8c0c-47b0-924e-1476adfc3ec9": { "id": "7e6a0e2e-8c0c-47b0-924e-1476adfc3ec9", "prev": "2993c16d-a310-432f-b58d-51bb242cf0c2", "regions": { "83e70f89-b654-48ca-a3af-0fa3c3af7f32": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "b5543c2e-513e-489c-8095-e8b8b54c0a70", "part": "whole" }, "id": "83e70f89-b654-48ca-a3af-0fa3c3af7f32" } } }, "84193d52-640a-45de-8004-5f2a5df77156": { "id": "84193d52-640a-45de-8004-5f2a5df77156", "prev": "f2a25084-b055-4337-a93d-afe8e834233e", "regions": { "78bfee77-fbb2-494e-81db-0916f40eac19": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "eddea330-32da-4b66-b9d1-fb680fd13cc2", "part": "whole" }, "id": "78bfee77-fbb2-494e-81db-0916f40eac19" } } }, "87ec06f2-176d-4ad2-aa6f-8efaa720de83": { "id": "87ec06f2-176d-4ad2-aa6f-8efaa720de83", "prev": "05b8946b-7af7-4075-ac5b-48ff9559845f", "regions": { "c7159e0c-fe3d-4101-896e-b6ffeb885758": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "c239a550-89bb-4891-9631-b9f5322ccb7f", "part": "whole" }, "id": "c7159e0c-fe3d-4101-896e-b6ffeb885758" } } }, "8b13e1d8-59bd-43c4-b936-c6ac63c86e83": { "id": "8b13e1d8-59bd-43c4-b936-c6ac63c86e83", "prev": "bf692b86-f8d6-4b5b-a7fe-b2c544989142", "regions": { "98d31450-2829-45c8-8002-1d380a983c5a": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "df6d464c-0acd-4fb5-bb94-173731a8f4e5", "part": "whole" }, "id": "98d31450-2829-45c8-8002-1d380a983c5a" } } }, "8c021dda-212d-470f-9fdd-245915a00f5e": { "id": "8c021dda-212d-470f-9fdd-245915a00f5e", "prev": "b40ab732-fb1e-4a4f-bc40-93e2ba410749", "regions": { "e5521bad-762b-4691-b8e5-4fe230af6380": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "19ad5a59-07d8-4b50-b889-58ba76436999", "part": "whole" }, "id": "e5521bad-762b-4691-b8e5-4fe230af6380" } } }, "8dc15949-896c-41f6-a7d9-85177f7452a9": { "id": "8dc15949-896c-41f6-a7d9-85177f7452a9", "prev": "afc6e90f-96dd-4197-8410-768a15203d95", "regions": { "2adae511-0fb0-4609-8964-c12ebfdbb683": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "0528cf19-31f3-4987-8085-4abecd57742e", "part": "whole" }, "id": "2adae511-0fb0-4609-8964-c12ebfdbb683" } } }, "93658ecc-3fb9-42f6-adb2-28a5194a7497": { "id": "93658ecc-3fb9-42f6-adb2-28a5194a7497", "prev": "63d76698-d35b-4e98-96a5-67b6598aec26", "regions": { "0455d45e-789b-4dc7-b612-29a0647f1290": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "83b4858a-609e-4ad5-a6ab-02e6b010358a", "part": "whole" }, "id": "0455d45e-789b-4dc7-b612-29a0647f1290" } } }, "95f8c700-4527-4464-9e21-d0d56b9586fa": { "id": "95f8c700-4527-4464-9e21-d0d56b9586fa", "prev": "84193d52-640a-45de-8004-5f2a5df77156", "regions": { "c5bef0e9-57d9-4e1a-86d3-f280c74e29ec": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "86f9a6d8-d62f-4788-9f40-7fd07fd20cac", "part": "whole" }, "id": "c5bef0e9-57d9-4e1a-86d3-f280c74e29ec" } } }, "97bb0dab-4db3-43be-886e-137a70bfe748": { "id": "97bb0dab-4db3-43be-886e-137a70bfe748", "prev": "307ab713-ca2c-4471-b89d-c4f88fa35f35", "regions": { "7cd2b0bd-7abe-4b4a-8aa2-972ef813144e": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "2d3e0dc0-974a-46c7-8e15-bfdc9aa8ab8c", "part": "whole" }, "id": "7cd2b0bd-7abe-4b4a-8aa2-972ef813144e" } } }, "97fcb1ac-e44f-4568-aa35-bdaadeff7085": { "id": "97fcb1ac-e44f-4568-aa35-bdaadeff7085", "prev": "0a8cb36a-849b-46b1-a8a4-358c6f08414c", "regions": { "098c9b2f-cc18-4c7c-b9c9-d06e306b5237": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "0db7b551-c727-4d7a-9386-00573d20f55a", "part": "whole" }, "id": "098c9b2f-cc18-4c7c-b9c9-d06e306b5237" } } }, "9aedb5db-a2c1-4d10-adb5-75f88795f16c": { "id": "9aedb5db-a2c1-4d10-adb5-75f88795f16c", "prev": "59c69c99-552c-4125-a0ee-5544426c4484", "regions": { "fad03c96-4c95-45fe-b408-c60f1163982c": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "80efd6af-aa36-4653-af45-45dd5430e97a", "part": "whole" }, "id": "fad03c96-4c95-45fe-b408-c60f1163982c" } } }, "aef5beba-f509-4b7f-9ce0-d5e2c72c0784": { "id": "aef5beba-f509-4b7f-9ce0-d5e2c72c0784", "prev": "1599d9f0-86d9-41d6-adcf-0fbf95c9be06", "regions": { "b12d2d49-3275-4405-998a-e0b214c2dbed": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "f8a48446-d37b-4e33-b1ef-8e38604faaf6", "part": "whole" }, "id": "b12d2d49-3275-4405-998a-e0b214c2dbed" } } }, "afc6e90f-96dd-4197-8410-768a15203d95": { "id": "afc6e90f-96dd-4197-8410-768a15203d95", "prev": "87ec06f2-176d-4ad2-aa6f-8efaa720de83", "regions": { "090ec2d1-bd8d-479c-be17-6f390fa41d24": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "df011f6a-f1d9-437f-8eea-bd28b3669baa", "part": "whole" }, "id": "090ec2d1-bd8d-479c-be17-6f390fa41d24" } } }, "b1a331f1-470d-4754-97a1-3e1680c67862": { "id": "b1a331f1-470d-4754-97a1-3e1680c67862", "prev": "aef5beba-f509-4b7f-9ce0-d5e2c72c0784", "regions": { "963c6366-0d5e-47bd-b28b-265c7f6a3ac2": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "1dba3138-41e1-4306-9378-a7bb432a89f4", "part": "whole" }, "id": "963c6366-0d5e-47bd-b28b-265c7f6a3ac2" } } }, "b40ab732-fb1e-4a4f-bc40-93e2ba410749": { "id": "b40ab732-fb1e-4a4f-bc40-93e2ba410749", "prev": "7528841a-ab73-485f-81a7-1c1fc4955b52", "regions": { "a49bb3f3-03cc-4039-8f6c-f49fe8cfa0f9": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "b7f9b828-4e2f-49de-a1bf-c927460b13bb", "part": "whole" }, "id": "a49bb3f3-03cc-4039-8f6c-f49fe8cfa0f9" } } }, "b79228d5-5c8d-45ce-a50e-b94dc05ea44c": { "id": "b79228d5-5c8d-45ce-a50e-b94dc05ea44c", "prev": "4f330095-823c-4d5d-a10b-19a6ef13c29b", "regions": { "133cb6fa-f59f-4c4d-99b8-1636ef79f583": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "1b8a2fe9-e46b-436a-b5fc-a69a02798587", "part": "whole" }, "id": "133cb6fa-f59f-4c4d-99b8-1636ef79f583" } } }, "ba811ffd-8153-4aab-9bfd-2eb808e54cec": { "id": "ba811ffd-8153-4aab-9bfd-2eb808e54cec", "prev": "3ff9883b-71d1-4a41-b1f5-9087b716c773", "regions": { "caa46a56-3dff-415a-a165-7073140b7221": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "92ae3f84-ea4e-470c-bb08-1006e0f38065", "part": "whole" }, "id": "caa46a56-3dff-415a-a165-7073140b7221" } } }, "bf692b86-f8d6-4b5b-a7fe-b2c544989142": { "id": "bf692b86-f8d6-4b5b-a7fe-b2c544989142", "prev": "7b748b34-33e1-41bc-9dd1-9d4990503d0b", "regions": { "6681f0dc-f2e2-4cb7-801c-1e39bdfbf152": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "289bbbde-c04a-44cc-9f2b-d8078689dc12", "part": "whole" }, "id": "6681f0dc-f2e2-4cb7-801c-1e39bdfbf152" } } }, "c12932f1-3e56-4d60-bc3d-b766584b923e": { "id": "c12932f1-3e56-4d60-bc3d-b766584b923e", "prev": "567bcaaa-fefb-4434-9051-07c81ed4b243", "regions": { "812864a3-1a3b-4776-a8bb-d9ad8bac4622": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "4c9a79c3-e905-43d4-922b-273f5ce8f08e", "part": "whole" }, "id": "812864a3-1a3b-4776-a8bb-d9ad8bac4622" } } }, "c4d93d28-6aec-426f-9c9c-9ee0a59a06c4": { "id": "c4d93d28-6aec-426f-9c9c-9ee0a59a06c4", "prev": "93658ecc-3fb9-42f6-adb2-28a5194a7497", "regions": { "48e46cf3-1a4c-4be2-a6f7-1be225c61c9e": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "69081a37-0b19-4e34-8e0c-5e6d1485bb4f", "part": "whole" }, "id": "48e46cf3-1a4c-4be2-a6f7-1be225c61c9e" } } }, "c54d74b5-6fb2-4ab1-8784-9fafa14c1b71": { "id": "c54d74b5-6fb2-4ab1-8784-9fafa14c1b71", "prev": "6caaacd0-47d1-41bd-a22d-e2efe28ec828", "regions": { "31e3a518-7096-4c68-98ba-698347bb8533": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "136251b3-ab4b-4f77-b886-d4f0065cb17c", "part": "whole" }, "id": "31e3a518-7096-4c68-98ba-698347bb8533" } } }, "cd92ba84-bf79-42db-bd39-250d56a5a7bf": { "id": "cd92ba84-bf79-42db-bd39-250d56a5a7bf", "prev": "8dc15949-896c-41f6-a7d9-85177f7452a9", "regions": { "ad50824d-95b7-4919-91b6-bc7fb40bf7e7": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "81fd70ee-3660-4f0b-a36a-27d15ad5ad58", "part": "whole" }, "id": "ad50824d-95b7-4919-91b6-bc7fb40bf7e7" } } }, "d4bfa84d-b3bf-4648-88f6-98797ac8a03f": { "id": "d4bfa84d-b3bf-4648-88f6-98797ac8a03f", "prev": "1ee63729-d401-45be-82eb-f2b038a3f2f0", "regions": { "73aa87eb-de5c-47e8-bfd5-ee8fda0ebf85": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "5e625979-f0ce-49cf-8c17-cf3abeab3eaa", "part": "whole" }, "id": "73aa87eb-de5c-47e8-bfd5-ee8fda0ebf85" } } }, "d82267a5-0d32-48a9-b327-c5199dd0ce43": { "id": "d82267a5-0d32-48a9-b327-c5199dd0ce43", "prev": "d9c4e892-2ff6-43e5-99a5-9493775301e2", "regions": { "09aa0bd2-b147-4df3-8913-42f5c3f624a9": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "7e19760c-d8be-4ffc-ad22-2e4a1dc9ae2d", "part": "whole" }, "id": "09aa0bd2-b147-4df3-8913-42f5c3f624a9" } } }, "d96ac105-d765-4d8a-9368-61baf560b972": { "id": "d96ac105-d765-4d8a-9368-61baf560b972", "prev": "de01660f-ff2c-4654-8889-033abee72238", "regions": { "819d0af3-08c8-4406-897d-2a40155cc52e": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "8b7c4576-e48a-47e4-897b-9c30c25cacfc", "part": "whole" }, "id": "819d0af3-08c8-4406-897d-2a40155cc52e" } } }, "d9c4e892-2ff6-43e5-99a5-9493775301e2": { "id": "d9c4e892-2ff6-43e5-99a5-9493775301e2", "prev": "10e2c709-d7f1-4666-b08d-a37ac3f5694c", "regions": { "03d6791c-3abf-4b02-a39d-b5193d9aae82": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "10693603-8e92-427e-a827-2f8aa4894b65", "part": "whole" }, "id": "03d6791c-3abf-4b02-a39d-b5193d9aae82" } } }, "de01660f-ff2c-4654-8889-033abee72238": { "id": "de01660f-ff2c-4654-8889-033abee72238", "prev": "26984cc2-9fff-47c1-b8c4-da1933ae7876", "regions": { "f809aae8-88cd-43ea-92a5-4342b394c7cb": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "ae123988-e05c-4962-a923-d92f53e3a67a", "part": "whole" }, "id": "f809aae8-88cd-43ea-92a5-4342b394c7cb" } } }, "eb4e7132-507e-4c38-863c-99e872bf4471": { "id": "eb4e7132-507e-4c38-863c-99e872bf4471", "prev": "51456c8d-c7f9-43f3-8d3b-89b29da35dfa", "regions": { "58a9a3d0-10e1-4757-9b49-4deece445c54": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "5ea7ac1e-13d3-4e17-adf5-7086fefb5029", "part": "whole" }, "id": "58a9a3d0-10e1-4757-9b49-4deece445c54" } } }, "f085c321-3a10-46b0-a24d-bdfb23836ba2": { "id": "f085c321-3a10-46b0-a24d-bdfb23836ba2", "prev": "d96ac105-d765-4d8a-9368-61baf560b972", "regions": { "41cd8786-0aaa-4a5f-bb7c-187994ea67e0": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "17e8c9d2-cf6c-403d-a027-e9bf5929ecd4", "part": "whole" }, "id": "41cd8786-0aaa-4a5f-bb7c-187994ea67e0" } } }, "f2a25084-b055-4337-a93d-afe8e834233e": { "id": "f2a25084-b055-4337-a93d-afe8e834233e", "prev": "76ec6531-9ec8-42bc-92bc-57d503df5027", "regions": { "42d99c2b-3607-4b91-9706-7d061096f5e2": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "eb821882-cbe2-4fa3-abc9-7dffbec50bb1", "part": "whole" }, "id": "42d99c2b-3607-4b91-9706-7d061096f5e2" } } }, "f6e0c9b8-4cf1-439a-ab5b-fcc2611c4dc3": { "id": "f6e0c9b8-4cf1-439a-ab5b-fcc2611c4dc3", "prev": "00832e6c-e5a7-4998-97ce-d469185641d4", "regions": { "abe10d5a-437b-4167-82f8-32b852ed6756": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "dc9063f4-4023-4bfb-9d40-eb1fe5c295bd", "part": "whole" }, "id": "abe10d5a-437b-4167-82f8-32b852ed6756" } } }, "f97325ef-3acd-4f70-9670-762af77a4710": { "id": "f97325ef-3acd-4f70-9670-762af77a4710", "prev": "8c021dda-212d-470f-9fdd-245915a00f5e", "regions": { "77095459-a8bc-410e-b725-f5b5fe4b6567": { "attrs": { "height": 0.8, "width": 0.8, "x": 0.1, "y": 0.1 }, "content": { "cell": "cf05d68c-b582-478e-b7cd-82336799c37b", "part": "whole" }, "id": "77095459-a8bc-410e-b725-f5b5fe4b6567" } } } }, "themes": {} } }, "nbformat": 4, "nbformat_minor": 0 }