From b357c5437f8694e2a272f6dcc31c3529d5f9e75e Mon Sep 17 00:00:00 2001 From: "Egli Adrian (IT-SCI-API-PFI)" <adrian.egli@sbb.ch> Date: Fri, 24 May 2019 23:13:42 +0200 Subject: [PATCH] bug fix in editor.py at agent rotate --- flatland/utils/editor.py | 3 ++- notebooks/Editor2.ipynb | 33 ++++++++++++--------------------- 2 files changed, 14 insertions(+), 22 deletions(-) diff --git a/flatland/utils/editor.py b/flatland/utils/editor.py index 0955788b..13ec977c 100644 --- a/flatland/utils/editor.py +++ b/flatland/utils/editor.py @@ -332,7 +332,8 @@ class Controller(object): for iAgent, agent in enumerate(self.model.env.agents_static): if agent is None: continue - agent.direction = (agent.direction + 1) % 4 + if iAgent == self.model.iSelectedAgent: + agent.direction = (agent.direction + 1) % 4 self.model.redraw() def restartAgents(self, event): diff --git a/notebooks/Editor2.ipynb b/notebooks/Editor2.ipynb index 4ac6e9db..22bc7074 100644 --- a/notebooks/Editor2.ipynb +++ b/notebooks/Editor2.ipynb @@ -9,18 +9,9 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 1, "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The autoreload extension is already loaded. To reload it, use:\n", - " %reload_ext autoreload\n" - ] - } - ], + "outputs": [], "source": [ "%load_ext autoreload\n", "%autoreload 2" @@ -28,7 +19,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 2, "metadata": {}, "outputs": [], "source": [ @@ -41,7 +32,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 3, "metadata": {}, "outputs": [ { @@ -63,7 +54,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 4, "metadata": {}, "outputs": [], "source": [ @@ -72,7 +63,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 5, "metadata": {}, "outputs": [ { @@ -106,7 +97,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 6, "metadata": { "scrolled": false }, @@ -114,7 +105,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "ece47ccd72af4638b61e9d93a66e9a57", + "model_id": "0f61a1b60a024112ace6ee136b49f20a", "version_major": 2, "version_minor": 0 }, @@ -132,7 +123,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 7, "metadata": { "scrolled": false }, @@ -140,7 +131,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "86207439e5a94055bb3d837028f195fc", + "model_id": "d3c56d6d214949e181e45330b00082f8", "version_major": 2, "version_minor": 0 }, @@ -159,7 +150,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 8, "metadata": {}, "outputs": [ { @@ -168,7 +159,7 @@ "(0, 0)" ] }, - "execution_count": 16, + "execution_count": 8, "metadata": {}, "output_type": "execute_result" } -- GitLab