From d1d7d1b58d303ed219f1ca623f94f120dcbd6868 Mon Sep 17 00:00:00 2001 From: Marcel D Date: Thu, 30 Mar 2023 20:24:03 +0200 Subject: [PATCH] improve neutral map algo --- jupyter/README.md | 15 +++++- jupyter/src/AoE-data.ipynb | 98 +++++++++++++++++++++++++++++++++++--- jupyter/src/drafts.py | 4 +- 3 files changed, 108 insertions(+), 9 deletions(-) diff --git a/jupyter/README.md b/jupyter/README.md index 3e38aba..639260d 100644 --- a/jupyter/README.md +++ b/jupyter/README.md @@ -14,10 +14,23 @@ docker run --name jupyter -d --rm \ -e NB_USER="marcelo" \ -e CHOWN_HOME=yes \ -w "/home/marcelo" \ - -v /mnt/c/Users/dechert/git/aoe2-data/jupyter/src:/home/marcelo/src \ + -v /mnt/c/Users/Marcelo/git/aoe2-data/jupyter/src:/home/marcelo/src \ jupyter/scipy-notebook:2023-03-27 ``` +Username agnostic command (does not work): +```bash +PATH_TO_JUPYTER_FOLDER="/mnt/c/Users/$(echo whoami)/git/aoe2-data/jupyter/src" docker run --name jupyter -d --rm \ + -p 8888:8888 \ + --user root \ + -e NB_USER="marcelo" \ + -e CHOWN_HOME=yes \ + -w "/home/marcelo" \ + -v ${PATH_TO_JUPYTER_FOLDER}:/home/marcelo/src \ + jupyter/scipy-notebook:2023-03-27 +``` + + `docker logs -f jupyter` to see the url with secret configuration: diff --git a/jupyter/src/AoE-data.ipynb b/jupyter/src/AoE-data.ipynb index ce570fa..cb202c3 100644 --- a/jupyter/src/AoE-data.ipynb +++ b/jupyter/src/AoE-data.ipynb @@ -9,7 +9,7 @@ }, "outputs": [], "source": [ - "%load_ext autoreload\n" + "%load_ext autoreload" ] }, { @@ -26,7 +26,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 4, "id": "a121cdfe-114a-4aae-b107-df891338dfcc", "metadata": { "tags": [] @@ -109,11 +109,97 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 10, "id": "7b337190-7887-40b7-9d10-b8039f5f2dfd", - "metadata": {}, - "outputs": [], - "source": [] + "metadata": { + "tags": [] + }, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
indexplayerexecutingPlayeractionTypechosenOptionIdisRandomlyChosenoffset
02HOSTHOSTpickKoalaFalse13973
13GUESTGUESTpickNordinselnFalse26925
28HOSTHOSTpickVier SeenFalse54947
\n", + "
" + ], + "text/plain": [ + " index player executingPlayer actionType chosenOptionId isRandomlyChosen \\\n", + "0 2 HOST HOST pick Koala False \n", + "1 3 GUEST GUEST pick Nordinseln False \n", + "2 8 HOST HOST pick Vier Seen False \n", + "\n", + " offset \n", + "0 13973 \n", + "1 26925 \n", + "2 54947 " + ] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "draft_picks.reset_index()" + ] } ], "metadata": { diff --git a/jupyter/src/drafts.py b/jupyter/src/drafts.py index a6cec3c..9b73952 100644 --- a/jupyter/src/drafts.py +++ b/jupyter/src/drafts.py @@ -23,5 +23,5 @@ def get_picked_maps(draft_json): # the last pick is the neutral map def neutral_map_as_string(draft_picks): - # print(draft_picks.tail(1)['chosenOptionId']) - return str(draft_picks.tail(1)['chosenOptionId'][8]) \ No newline at end of file + neutral_map = draft_picks.tail(1)['chosenOptionId'].values[0] + return neutral_map \ No newline at end of file