From b085a350796c75527a32f089ca4817404f2044a9 Mon Sep 17 00:00:00 2001 From: rherrmannr Date: Tue, 18 Feb 2020 14:06:05 +0100 Subject: [PATCH 1/6] removed sys imports, updated sgen, update to python 3, added src & srcgen folder --- org.yakindu.sct.examples.trafficlight.python/.pydevproject | 6 +++++- .../model/TrafficLightCtrl.sgen | 4 ---- org.yakindu.sct.examples.trafficlight.python/src/main.py | 3 --- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/org.yakindu.sct.examples.trafficlight.python/.pydevproject b/org.yakindu.sct.examples.trafficlight.python/.pydevproject index 40e9f40a..7e2ecafa 100644 --- a/org.yakindu.sct.examples.trafficlight.python/.pydevproject +++ b/org.yakindu.sct.examples.trafficlight.python/.pydevproject @@ -1,5 +1,9 @@ Default -python 2.7 +python interpreter + +/${PROJECT_DIR_NAME}/src +/${PROJECT_DIR_NAME}/src-gen + diff --git a/org.yakindu.sct.examples.trafficlight.python/model/TrafficLightCtrl.sgen b/org.yakindu.sct.examples.trafficlight.python/model/TrafficLightCtrl.sgen index b9a74383..ffb56a92 100644 --- a/org.yakindu.sct.examples.trafficlight.python/model/TrafficLightCtrl.sgen +++ b/org.yakindu.sct.examples.trafficlight.python/model/TrafficLightCtrl.sgen @@ -10,9 +10,5 @@ GeneratorModel for yakindu::python { feature GeneralFeatures { DefaultTimer = true } - - feature Naming { - basePackage = "traffic.light" - } } } \ No newline at end of file diff --git a/org.yakindu.sct.examples.trafficlight.python/src/main.py b/org.yakindu.sct.examples.trafficlight.python/src/main.py index b5e6a5a7..7955ed57 100644 --- a/org.yakindu.sct.examples.trafficlight.python/src/main.py +++ b/org.yakindu.sct.examples.trafficlight.python/src/main.py @@ -15,9 +15,6 @@ file, activate `General Feature -> DefaultRuntime` in your SGen file. """ # statemachine -import sys, os -path_to_statemachine = '../src-gen/traffic/light/TrafficLightCtrl' -sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), path_to_statemachine))) from trafficlightctrl.trafficlightctrl_statemachine import TrafficLightCtrl from trafficlightctrl.timer.sct_timer import Timer From 82b911b38c51a2b0166daad1e8f3c613d1ede95c Mon Sep 17 00:00:00 2001 From: rherrmannr Date: Tue, 18 Feb 2020 14:08:55 +0100 Subject: [PATCH 2/6] renamed as pro project --- .../.gitignore | 0 .../.project | 2 +- .../.pydevproject | 0 .../images/TrafficLightCtrl.png | Bin .../images/trafficLightGui.png | Bin .../images/traffic_light_python.jpg | Bin .../index.html | 0 .../metadata.json | 0 .../model/TrafficLightCtrl.sct | 0 .../model/TrafficLightCtrl.sgen | 2 +- .../src/main.py | 0 .../src/traffic_scene.py | 0 12 files changed, 2 insertions(+), 2 deletions(-) rename {org.yakindu.sct.examples.trafficlight.python => com.yakindu.sct.examples.trafficlight.python}/.gitignore (100%) rename {org.yakindu.sct.examples.trafficlight.python => com.yakindu.sct.examples.trafficlight.python}/.project (92%) rename {org.yakindu.sct.examples.trafficlight.python => com.yakindu.sct.examples.trafficlight.python}/.pydevproject (100%) rename {org.yakindu.sct.examples.trafficlight.python => com.yakindu.sct.examples.trafficlight.python}/images/TrafficLightCtrl.png (100%) rename {org.yakindu.sct.examples.trafficlight.python => com.yakindu.sct.examples.trafficlight.python}/images/trafficLightGui.png (100%) rename {org.yakindu.sct.examples.trafficlight.python => com.yakindu.sct.examples.trafficlight.python}/images/traffic_light_python.jpg (100%) rename {org.yakindu.sct.examples.trafficlight.python => com.yakindu.sct.examples.trafficlight.python}/index.html (100%) rename {org.yakindu.sct.examples.trafficlight.python => com.yakindu.sct.examples.trafficlight.python}/metadata.json (100%) rename {org.yakindu.sct.examples.trafficlight.python => com.yakindu.sct.examples.trafficlight.python}/model/TrafficLightCtrl.sct (100%) rename {org.yakindu.sct.examples.trafficlight.python => com.yakindu.sct.examples.trafficlight.python}/model/TrafficLightCtrl.sgen (74%) rename {org.yakindu.sct.examples.trafficlight.python => com.yakindu.sct.examples.trafficlight.python}/src/main.py (100%) rename {org.yakindu.sct.examples.trafficlight.python => com.yakindu.sct.examples.trafficlight.python}/src/traffic_scene.py (100%) diff --git a/org.yakindu.sct.examples.trafficlight.python/.gitignore b/com.yakindu.sct.examples.trafficlight.python/.gitignore similarity index 100% rename from org.yakindu.sct.examples.trafficlight.python/.gitignore rename to com.yakindu.sct.examples.trafficlight.python/.gitignore diff --git a/org.yakindu.sct.examples.trafficlight.python/.project b/com.yakindu.sct.examples.trafficlight.python/.project similarity index 92% rename from org.yakindu.sct.examples.trafficlight.python/.project rename to com.yakindu.sct.examples.trafficlight.python/.project index 54f4a3ac..d777e890 100644 --- a/org.yakindu.sct.examples.trafficlight.python/.project +++ b/com.yakindu.sct.examples.trafficlight.python/.project @@ -1,6 +1,6 @@ - org.yakindu.sct.examples.trafficlight.python + com.yakindu.sct.examples.trafficlight.python diff --git a/org.yakindu.sct.examples.trafficlight.python/.pydevproject b/com.yakindu.sct.examples.trafficlight.python/.pydevproject similarity index 100% rename from org.yakindu.sct.examples.trafficlight.python/.pydevproject rename to com.yakindu.sct.examples.trafficlight.python/.pydevproject diff --git a/org.yakindu.sct.examples.trafficlight.python/images/TrafficLightCtrl.png b/com.yakindu.sct.examples.trafficlight.python/images/TrafficLightCtrl.png similarity index 100% rename from org.yakindu.sct.examples.trafficlight.python/images/TrafficLightCtrl.png rename to com.yakindu.sct.examples.trafficlight.python/images/TrafficLightCtrl.png diff --git a/org.yakindu.sct.examples.trafficlight.python/images/trafficLightGui.png b/com.yakindu.sct.examples.trafficlight.python/images/trafficLightGui.png similarity index 100% rename from org.yakindu.sct.examples.trafficlight.python/images/trafficLightGui.png rename to com.yakindu.sct.examples.trafficlight.python/images/trafficLightGui.png diff --git a/org.yakindu.sct.examples.trafficlight.python/images/traffic_light_python.jpg b/com.yakindu.sct.examples.trafficlight.python/images/traffic_light_python.jpg similarity index 100% rename from org.yakindu.sct.examples.trafficlight.python/images/traffic_light_python.jpg rename to com.yakindu.sct.examples.trafficlight.python/images/traffic_light_python.jpg diff --git a/org.yakindu.sct.examples.trafficlight.python/index.html b/com.yakindu.sct.examples.trafficlight.python/index.html similarity index 100% rename from org.yakindu.sct.examples.trafficlight.python/index.html rename to com.yakindu.sct.examples.trafficlight.python/index.html diff --git a/org.yakindu.sct.examples.trafficlight.python/metadata.json b/com.yakindu.sct.examples.trafficlight.python/metadata.json similarity index 100% rename from org.yakindu.sct.examples.trafficlight.python/metadata.json rename to com.yakindu.sct.examples.trafficlight.python/metadata.json diff --git a/org.yakindu.sct.examples.trafficlight.python/model/TrafficLightCtrl.sct b/com.yakindu.sct.examples.trafficlight.python/model/TrafficLightCtrl.sct similarity index 100% rename from org.yakindu.sct.examples.trafficlight.python/model/TrafficLightCtrl.sct rename to com.yakindu.sct.examples.trafficlight.python/model/TrafficLightCtrl.sct diff --git a/org.yakindu.sct.examples.trafficlight.python/model/TrafficLightCtrl.sgen b/com.yakindu.sct.examples.trafficlight.python/model/TrafficLightCtrl.sgen similarity index 74% rename from org.yakindu.sct.examples.trafficlight.python/model/TrafficLightCtrl.sgen rename to com.yakindu.sct.examples.trafficlight.python/model/TrafficLightCtrl.sgen index ffb56a92..0bb0c0f8 100644 --- a/org.yakindu.sct.examples.trafficlight.python/model/TrafficLightCtrl.sgen +++ b/com.yakindu.sct.examples.trafficlight.python/model/TrafficLightCtrl.sgen @@ -3,7 +3,7 @@ GeneratorModel for yakindu::python { statechart TrafficLightCtrl { feature Outlet { - targetProject = "org.yakindu.sct.examples.trafficlight.python" + targetProject = "com.yakindu.sct.examples.trafficlight.python" targetFolder = "src-gen" } diff --git a/org.yakindu.sct.examples.trafficlight.python/src/main.py b/com.yakindu.sct.examples.trafficlight.python/src/main.py similarity index 100% rename from org.yakindu.sct.examples.trafficlight.python/src/main.py rename to com.yakindu.sct.examples.trafficlight.python/src/main.py diff --git a/org.yakindu.sct.examples.trafficlight.python/src/traffic_scene.py b/com.yakindu.sct.examples.trafficlight.python/src/traffic_scene.py similarity index 100% rename from org.yakindu.sct.examples.trafficlight.python/src/traffic_scene.py rename to com.yakindu.sct.examples.trafficlight.python/src/traffic_scene.py From dfc75e5b7b6f21e7accdd104b9465dad19a8cd4f Mon Sep 17 00:00:00 2001 From: rherrmannr Date: Tue, 18 Feb 2020 14:11:15 +0100 Subject: [PATCH 3/6] updated json to pro --- com.yakindu.sct.examples.trafficlight.python/metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com.yakindu.sct.examples.trafficlight.python/metadata.json b/com.yakindu.sct.examples.trafficlight.python/metadata.json index 0e89a372..39a5729e 100644 --- a/com.yakindu.sct.examples.trafficlight.python/metadata.json +++ b/com.yakindu.sct.examples.trafficlight.python/metadata.json @@ -6,7 +6,7 @@ "author": "Norbert Lang", "organization": "itemis AG", "license": "Creative Commons Attribution 4.0 International (CC BY 4.0)", - "category": ["open source", + "category": ["professional", "advanced" ], "dependencies": [ From ad4a926c78d837bc1c3c03e0b247239c8bb79709 Mon Sep 17 00:00:00 2001 From: rherrmannr Date: Tue, 18 Feb 2020 14:12:41 +0100 Subject: [PATCH 4/6] updated python pi example --- .../.gitignore | 0 .../.project | 2 +- .../.pydevproject | 0 .../images/TrafficLightCtrl.png | Bin .../images/rpi_circuit.svg | 0 .../images/traffic_light_python_rasp.jpg | Bin .../index.html | 0 .../metadata.json | 5 ++--- .../model/TrafficLightCtrl.sct | 0 .../model/TrafficLightCtrl.sgen | 4 ++-- .../src/main.py | 0 .../src/trafficscene.py | 0 .../src/trafficscene2.py | 0 13 files changed, 5 insertions(+), 6 deletions(-) rename {org.yakindu.sct.examples.trafficlight.python.raspberry => com.yakindu.sct.examples.trafficlight.python.raspberry}/.gitignore (100%) rename {org.yakindu.sct.examples.trafficlight.python.raspberry => com.yakindu.sct.examples.trafficlight.python.raspberry}/.project (91%) rename {org.yakindu.sct.examples.trafficlight.python.raspberry => com.yakindu.sct.examples.trafficlight.python.raspberry}/.pydevproject (100%) rename {org.yakindu.sct.examples.trafficlight.python.raspberry => com.yakindu.sct.examples.trafficlight.python.raspberry}/images/TrafficLightCtrl.png (100%) rename {org.yakindu.sct.examples.trafficlight.python.raspberry => com.yakindu.sct.examples.trafficlight.python.raspberry}/images/rpi_circuit.svg (100%) rename {org.yakindu.sct.examples.trafficlight.python.raspberry => com.yakindu.sct.examples.trafficlight.python.raspberry}/images/traffic_light_python_rasp.jpg (100%) rename {org.yakindu.sct.examples.trafficlight.python.raspberry => com.yakindu.sct.examples.trafficlight.python.raspberry}/index.html (100%) rename {org.yakindu.sct.examples.trafficlight.python.raspberry => com.yakindu.sct.examples.trafficlight.python.raspberry}/metadata.json (89%) rename {org.yakindu.sct.examples.trafficlight.python.raspberry => com.yakindu.sct.examples.trafficlight.python.raspberry}/model/TrafficLightCtrl.sct (100%) rename {org.yakindu.sct.examples.trafficlight.python.raspberry => com.yakindu.sct.examples.trafficlight.python.raspberry}/model/TrafficLightCtrl.sgen (79%) rename {org.yakindu.sct.examples.trafficlight.python.raspberry => com.yakindu.sct.examples.trafficlight.python.raspberry}/src/main.py (100%) rename {org.yakindu.sct.examples.trafficlight.python.raspberry => com.yakindu.sct.examples.trafficlight.python.raspberry}/src/trafficscene.py (100%) rename {org.yakindu.sct.examples.trafficlight.python.raspberry => com.yakindu.sct.examples.trafficlight.python.raspberry}/src/trafficscene2.py (100%) diff --git a/org.yakindu.sct.examples.trafficlight.python.raspberry/.gitignore b/com.yakindu.sct.examples.trafficlight.python.raspberry/.gitignore similarity index 100% rename from org.yakindu.sct.examples.trafficlight.python.raspberry/.gitignore rename to com.yakindu.sct.examples.trafficlight.python.raspberry/.gitignore diff --git a/org.yakindu.sct.examples.trafficlight.python.raspberry/.project b/com.yakindu.sct.examples.trafficlight.python.raspberry/.project similarity index 91% rename from org.yakindu.sct.examples.trafficlight.python.raspberry/.project rename to com.yakindu.sct.examples.trafficlight.python.raspberry/.project index 9d916f93..040bd9ff 100644 --- a/org.yakindu.sct.examples.trafficlight.python.raspberry/.project +++ b/com.yakindu.sct.examples.trafficlight.python.raspberry/.project @@ -1,6 +1,6 @@ - org.yakindu.sct.examples.trafficlight.python.raspberry + com.yakindu.sct.examples.trafficlight.python.raspberry diff --git a/org.yakindu.sct.examples.trafficlight.python.raspberry/.pydevproject b/com.yakindu.sct.examples.trafficlight.python.raspberry/.pydevproject similarity index 100% rename from org.yakindu.sct.examples.trafficlight.python.raspberry/.pydevproject rename to com.yakindu.sct.examples.trafficlight.python.raspberry/.pydevproject diff --git a/org.yakindu.sct.examples.trafficlight.python.raspberry/images/TrafficLightCtrl.png b/com.yakindu.sct.examples.trafficlight.python.raspberry/images/TrafficLightCtrl.png similarity index 100% rename from org.yakindu.sct.examples.trafficlight.python.raspberry/images/TrafficLightCtrl.png rename to com.yakindu.sct.examples.trafficlight.python.raspberry/images/TrafficLightCtrl.png diff --git a/org.yakindu.sct.examples.trafficlight.python.raspberry/images/rpi_circuit.svg b/com.yakindu.sct.examples.trafficlight.python.raspberry/images/rpi_circuit.svg similarity index 100% rename from org.yakindu.sct.examples.trafficlight.python.raspberry/images/rpi_circuit.svg rename to com.yakindu.sct.examples.trafficlight.python.raspberry/images/rpi_circuit.svg diff --git a/org.yakindu.sct.examples.trafficlight.python.raspberry/images/traffic_light_python_rasp.jpg b/com.yakindu.sct.examples.trafficlight.python.raspberry/images/traffic_light_python_rasp.jpg similarity index 100% rename from org.yakindu.sct.examples.trafficlight.python.raspberry/images/traffic_light_python_rasp.jpg rename to com.yakindu.sct.examples.trafficlight.python.raspberry/images/traffic_light_python_rasp.jpg diff --git a/org.yakindu.sct.examples.trafficlight.python.raspberry/index.html b/com.yakindu.sct.examples.trafficlight.python.raspberry/index.html similarity index 100% rename from org.yakindu.sct.examples.trafficlight.python.raspberry/index.html rename to com.yakindu.sct.examples.trafficlight.python.raspberry/index.html diff --git a/org.yakindu.sct.examples.trafficlight.python.raspberry/metadata.json b/com.yakindu.sct.examples.trafficlight.python.raspberry/metadata.json similarity index 89% rename from org.yakindu.sct.examples.trafficlight.python.raspberry/metadata.json rename to com.yakindu.sct.examples.trafficlight.python.raspberry/metadata.json index 2854a5c8..fcf4745f 100644 --- a/org.yakindu.sct.examples.trafficlight.python.raspberry/metadata.json +++ b/com.yakindu.sct.examples.trafficlight.python.raspberry/metadata.json @@ -6,11 +6,10 @@ "author": "Norbert Lang", "organization": "itemis AG", "license": "Creative Commons Attribution 4.0 International (CC BY 4.0)", - "category": ["labs", - "open source", + "category": ["professional", "embedded" ], - "dependencies": [ + "dependencies": ["professional", { "updateSite": "http://updates.yakindu.com/statecharts/labs", "features": ["org.yakindu.sct.generator.python.feature.feature.group"] diff --git a/org.yakindu.sct.examples.trafficlight.python.raspberry/model/TrafficLightCtrl.sct b/com.yakindu.sct.examples.trafficlight.python.raspberry/model/TrafficLightCtrl.sct similarity index 100% rename from org.yakindu.sct.examples.trafficlight.python.raspberry/model/TrafficLightCtrl.sct rename to com.yakindu.sct.examples.trafficlight.python.raspberry/model/TrafficLightCtrl.sct diff --git a/org.yakindu.sct.examples.trafficlight.python.raspberry/model/TrafficLightCtrl.sgen b/com.yakindu.sct.examples.trafficlight.python.raspberry/model/TrafficLightCtrl.sgen similarity index 79% rename from org.yakindu.sct.examples.trafficlight.python.raspberry/model/TrafficLightCtrl.sgen rename to com.yakindu.sct.examples.trafficlight.python.raspberry/model/TrafficLightCtrl.sgen index 0c97be6b..dca65263 100644 --- a/org.yakindu.sct.examples.trafficlight.python.raspberry/model/TrafficLightCtrl.sgen +++ b/com.yakindu.sct.examples.trafficlight.python.raspberry/model/TrafficLightCtrl.sgen @@ -3,7 +3,7 @@ GeneratorModel for yakindu::python { statechart TrafficLightCtrl { feature Outlet { - targetProject = "org.yakindu.sct.examples.trafficlight.python.raspberry" + targetProject = "com.yakindu.sct.examples.trafficlight.python.raspberry" targetFolder = "src-gen" } @@ -15,4 +15,4 @@ GeneratorModel for yakindu::python { DefaultTimer = true } } -} \ No newline at end of file +} diff --git a/org.yakindu.sct.examples.trafficlight.python.raspberry/src/main.py b/com.yakindu.sct.examples.trafficlight.python.raspberry/src/main.py similarity index 100% rename from org.yakindu.sct.examples.trafficlight.python.raspberry/src/main.py rename to com.yakindu.sct.examples.trafficlight.python.raspberry/src/main.py diff --git a/org.yakindu.sct.examples.trafficlight.python.raspberry/src/trafficscene.py b/com.yakindu.sct.examples.trafficlight.python.raspberry/src/trafficscene.py similarity index 100% rename from org.yakindu.sct.examples.trafficlight.python.raspberry/src/trafficscene.py rename to com.yakindu.sct.examples.trafficlight.python.raspberry/src/trafficscene.py diff --git a/org.yakindu.sct.examples.trafficlight.python.raspberry/src/trafficscene2.py b/com.yakindu.sct.examples.trafficlight.python.raspberry/src/trafficscene2.py similarity index 100% rename from org.yakindu.sct.examples.trafficlight.python.raspberry/src/trafficscene2.py rename to com.yakindu.sct.examples.trafficlight.python.raspberry/src/trafficscene2.py From a2042258c0520d206dc672df51606eb557580e49 Mon Sep 17 00:00:00 2001 From: rherrmannr Date: Tue, 18 Feb 2020 14:15:45 +0100 Subject: [PATCH 5/6] fix --- .../metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com.yakindu.sct.examples.trafficlight.python.raspberry/metadata.json b/com.yakindu.sct.examples.trafficlight.python.raspberry/metadata.json index fcf4745f..778ef1f6 100644 --- a/com.yakindu.sct.examples.trafficlight.python.raspberry/metadata.json +++ b/com.yakindu.sct.examples.trafficlight.python.raspberry/metadata.json @@ -9,7 +9,7 @@ "category": ["professional", "embedded" ], - "dependencies": ["professional", + "dependencies": [ { "updateSite": "http://updates.yakindu.com/statecharts/labs", "features": ["org.yakindu.sct.generator.python.feature.feature.group"] From 8b0210a34ab7322a1d10b2c7ec37bdc99da08a9d Mon Sep 17 00:00:00 2001 From: rherrmannr Date: Fri, 28 Feb 2020 12:10:52 +0100 Subject: [PATCH 6/6] Python Pong example --- com.yakindu.sct.examples.pong.python/.project | 29 ++ .../.pydevproject | 8 + .../code_gen.sgen | 10 + com.yakindu.sct.examples.pong.python/main.py | 58 +++ .../pong/__init__.py | 0 .../pong/__pycache__/__init__.cpython-36.pyc | Bin 0 -> 172 bytes .../pong/__pycache__/pong_game.cpython-36.pyc | Bin 0 -> 2764 bytes .../pong/__pycache__/pong_ui.cpython-36.pyc | Bin 0 -> 1896 bytes .../pong/pong_game.py | 75 ++++ .../pong/pong_ui.py | 44 ++ .../pong_npc.png | Bin 0 -> 29482 bytes .../pong_npc.sct | 401 ++++++++++++++++++ .../pong_npc/__init__.py | 6 + .../__pycache__/__init__.cpython-36.pyc | Bin 0 -> 252 bytes .../pong_npc_statemachine.cpython-36.pyc | Bin 0 -> 13323 bytes ...npc_statemachine_interfaces.cpython-36.pyc | Bin 0 -> 2303 bytes .../pong_npc/pong_npc_statemachine.py | 352 +++++++++++++++ .../pong_npc_statemachine_interfaces.py | 68 +++ .../pong_npc/timer/__init__.py | 6 + 19 files changed, 1057 insertions(+) create mode 100644 com.yakindu.sct.examples.pong.python/.project create mode 100644 com.yakindu.sct.examples.pong.python/.pydevproject create mode 100644 com.yakindu.sct.examples.pong.python/code_gen.sgen create mode 100644 com.yakindu.sct.examples.pong.python/main.py create mode 100644 com.yakindu.sct.examples.pong.python/pong/__init__.py create mode 100644 com.yakindu.sct.examples.pong.python/pong/__pycache__/__init__.cpython-36.pyc create mode 100644 com.yakindu.sct.examples.pong.python/pong/__pycache__/pong_game.cpython-36.pyc create mode 100644 com.yakindu.sct.examples.pong.python/pong/__pycache__/pong_ui.cpython-36.pyc create mode 100644 com.yakindu.sct.examples.pong.python/pong/pong_game.py create mode 100644 com.yakindu.sct.examples.pong.python/pong/pong_ui.py create mode 100644 com.yakindu.sct.examples.pong.python/pong_npc.png create mode 100644 com.yakindu.sct.examples.pong.python/pong_npc.sct create mode 100644 com.yakindu.sct.examples.pong.python/pong_npc/__init__.py create mode 100644 com.yakindu.sct.examples.pong.python/pong_npc/__pycache__/__init__.cpython-36.pyc create mode 100644 com.yakindu.sct.examples.pong.python/pong_npc/__pycache__/pong_npc_statemachine.cpython-36.pyc create mode 100644 com.yakindu.sct.examples.pong.python/pong_npc/__pycache__/pong_npc_statemachine_interfaces.cpython-36.pyc create mode 100644 com.yakindu.sct.examples.pong.python/pong_npc/pong_npc_statemachine.py create mode 100644 com.yakindu.sct.examples.pong.python/pong_npc/pong_npc_statemachine_interfaces.py create mode 100644 com.yakindu.sct.examples.pong.python/pong_npc/timer/__init__.py diff --git a/com.yakindu.sct.examples.pong.python/.project b/com.yakindu.sct.examples.pong.python/.project new file mode 100644 index 00000000..5fab0d43 --- /dev/null +++ b/com.yakindu.sct.examples.pong.python/.project @@ -0,0 +1,29 @@ + + + com.yakindu.sct.examples.pong.python + + + + + + org.eclipse.xtext.ui.shared.xtextBuilder + + + + + org.python.pydev.PyDevBuilder + + + + + org.yakindu.sct.builder.SCTBuilder + + + + + + org.python.pydev.pythonNature + org.eclipse.xtext.ui.shared.xtextNature + org.yakindu.sct.builder.SCTNature + + diff --git a/com.yakindu.sct.examples.pong.python/.pydevproject b/com.yakindu.sct.examples.pong.python/.pydevproject new file mode 100644 index 00000000..ad74947d --- /dev/null +++ b/com.yakindu.sct.examples.pong.python/.pydevproject @@ -0,0 +1,8 @@ + + + +/${PROJECT_DIR_NAME} + +python interpreter +Default + diff --git a/com.yakindu.sct.examples.pong.python/code_gen.sgen b/com.yakindu.sct.examples.pong.python/code_gen.sgen new file mode 100644 index 00000000..1458223d --- /dev/null +++ b/com.yakindu.sct.examples.pong.python/code_gen.sgen @@ -0,0 +1,10 @@ +GeneratorModel for yakindu::python { + + statechart pong_npc { + + feature Outlet { + targetProject = "com.yakindu.sct.examples.pong.python" + targetFolder = "" + } + } +} \ No newline at end of file diff --git a/com.yakindu.sct.examples.pong.python/main.py b/com.yakindu.sct.examples.pong.python/main.py new file mode 100644 index 00000000..e8b4d2cc --- /dev/null +++ b/com.yakindu.sct.examples.pong.python/main.py @@ -0,0 +1,58 @@ +import pygame +from pong.pong_ui import PongUI +from pong.pong_game import PongGame +from pong_npc.pong_npc_statemachine import Pong_npc + +if __name__ == "__main__": + pong_game = PongGame() + ui = PongUI(pygame, pong_game) + pong_npc = Pong_npc() + pong_npc.init() + pong_npc.enter() + + def loop(): + pressed_up_w = False + pressed_down_w = False + while True: + for event in pygame.event.get(): + if event.type is pygame.QUIT: + return False + if event.type is pygame.KEYDOWN: + if event.key is pygame.K_w: + pong_game.move(pong_game.UP, pong_game.PLAYER_ONE) + pressed_up_w = True + if event.key is pygame.K_s: + pong_game.move(pong_game.DOWN, pong_game.PLAYER_ONE) + pressed_down_w = True + + keys = pygame.key.get_pressed() + if pressed_up_w: + pressed_up_w = False + else: + if keys[pygame.K_w]: + pong_game.move(pong_game.UP, pong_game.PLAYER_ONE) + + if pressed_down_w: + pressed_down_w = False + else: + if keys[pygame.K_s]: + pong_game.move(pong_game.DOWN, pong_game.PLAYER_ONE) + + pong_npc.sci_ball.direction = pong_game.ball_direction + pong_npc.sci_ball.position = pong_game.ball_pos[1] + PongUI.BALL_RADIUS/2 + pong_npc.sci_player.position = pong_game.player2_position + PongUI.PLAYER_HEIGHT / 2 + + print(pong_npc.sci_player.position) + + pong_npc.run_cycle() + + if(pong_npc.sci_interface.is_raised_up()): + pong_game.move(pong_game.UP, pong_game.PLAYER_TWO) + if(pong_npc.sci_interface.is_raised_down()): + pong_game.move(pong_game.DOWN, pong_game.PLAYER_TWO) + + pong_game.update_ball() + ui.update() + + loop() + pygame.quit() diff --git a/com.yakindu.sct.examples.pong.python/pong/__init__.py b/com.yakindu.sct.examples.pong.python/pong/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/com.yakindu.sct.examples.pong.python/pong/__pycache__/__init__.cpython-36.pyc b/com.yakindu.sct.examples.pong.python/pong/__pycache__/__init__.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e4c69287c9226f05895f468c30c08938b379cd0d GIT binary patch literal 172 zcmXr!<>mUaJv5F12p)q77+?f49Dul(1xTbY1T$zd`mJOr0tq9CUy=G5`MIh3MH#6@ zMY)N2dHRu#-kyFgq4B}aApt@D`UUxU>H5j}xq6j}*_nAMrFzB5C3>k9iMa(isl|E) ol_eSZd3s<)U?M&~GcU6wJ{~A@i^C>2KczG$)edB3F%UBV04?e+0RR91 literal 0 HcmV?d00001 diff --git a/com.yakindu.sct.examples.pong.python/pong/__pycache__/pong_game.cpython-36.pyc b/com.yakindu.sct.examples.pong.python/pong/__pycache__/pong_game.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b95de175e958267f2198bbfbedb1d0c563b97302 GIT binary patch literal 2764 zcmZuz-ER{|5Z}EoU+i-}AS3|_v=UM=t&)}^m8uAlLIRdvJdvVUO@7%ph zOCs}R{s10$sQS!9`^MjMPgVOAseeIV%5V1Ua|k(WcV}mIXJ==AGwZLa)$*GMKm7D> zg|UCwiBAW8A1%3sPB6jStixT-iPqX$M|X8a>utj|9x-7E^Cc5zUvo{NZ?c+ojD4)e zGiyDLn%gU&N(WK68_Q0;L89TOfw+&B{D>}KE*H$z1b20zxrWf8&TuVZx+P(`wkQev zC3DBbm?&c`i;8eCRzy{dV|2uXn8a8WQ{o)PadBQuW1J8dVA4!xlP!<@PT*<>U1*Pg zjgC2vJtiYEQ-;mGG&9=4ZrUI=eIzl^9-t*p(50-!`|Jhp@gDOu)$6GNt||Cs*5``0 zghq5z!v2{c%pNbTJbJv9+0XoTn>J+T zhGL8>h6rWQP{)+j+>e^=Aj|2b8w8@JWkwRTcipKEEc=tm8JPc{yRa8`f(5x3NZIkD zXyNJN_poH!+kCLKzOlB@MI06yacBO}-wz{kFrPHi`QW+V>9&JpzI&MN#nHT4RCHbw zaf2wcJui&H)bqx1QbHZ$Hn;G*s>Y+KVU*{GD;tDn`e>x4qWK$$9wO9Y`&=XaSOU0ERr`EhFEN^S{pdq{#&T^+1y~(Db^{)Ki+QfhNeYk~Col zG=Z-)Sqd9k{kRPKYNf2azPk8yX~SEqFJ+U@VkrXYHR5(VOaKLmyk(iTy`C9}bG=x+ zwX-H2+ONwCv|_A?s%z!oQGv?4Sz2Lq;$H%y5&|IOmw1_vQ`3gjQMGU^tv%bRcd)m| z1;@2!3g^xUZ4=y-w=^_;jvR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~Jff<*N zi@@$RyuAaidGkGaKqm_>dJ|XykKqvkoNgorG2`K1WB9(_QL0Uh;J167{O%hS^ xbAsFJH?0|6V8lyGS#r7c-tQW&>y};9v)q!l?SLV&zt5R+zs-;Io%RST_8%fBmZksz literal 0 HcmV?d00001 diff --git a/com.yakindu.sct.examples.pong.python/pong/pong_game.py b/com.yakindu.sct.examples.pong.python/pong/pong_game.py new file mode 100644 index 00000000..49b476b5 --- /dev/null +++ b/com.yakindu.sct.examples.pong.python/pong/pong_game.py @@ -0,0 +1,75 @@ +from pong.pong_ui import PongUI +from random import uniform +import math + + +class PongGame: + UP = 'up' + DOWN = 'down' + PLAYER_ONE = 1 + PLAYER_TWO = 2 + RIGHT = 'right' + LEFT = 'left' + + def __init__(self): + starting_position = PongUI.get_starting_position() + self.player1_position = starting_position + self.player2_position = starting_position + self.ball_pos = [int((PongUI.WINDOW_WIDTH / 2.)), int(PongUI.WINDOW_HEIGHT / 2)] + self.ball_direction = self.RIGHT + self.ball_angle = 0 + self.ball_speed = 20 + + def move(self, direction, player): + if player == self.PLAYER_ONE and not self.border_collision(self.player1_position, direction): + if direction == self.UP: + self.player1_position -= 10 + if direction == self.DOWN: + self.player1_position += 10 + + if player == self.PLAYER_TWO and not self.border_collision(self.player2_position, direction): + if direction == self.UP: + self.player2_position -= 10 + if direction == self.DOWN: + self.player2_position += 10 + + def border_collision(self, position, direction): + if position == 0 and direction == self.UP: + return True + if position == PongUI.WINDOW_HEIGHT - PongUI.PLAYER_HEIGHT and direction == self.DOWN: + return True + return False + + def check_for_collisions(self): + if self.ball_pos[1] - PongUI.BALL_RADIUS <= 0 or self.ball_pos[1] + PongUI.BALL_RADIUS >= PongUI.WINDOW_HEIGHT: + self.ball_angle *= -1 + if self.ball_direction == self.RIGHT: + if self.player2_position <= self.ball_pos[1] <= self.player2_position + PongUI.PLAYER_HEIGHT: + if PongUI.WINDOW_WIDTH - PongUI.PLAYER_OFFSET >= self.ball_pos[0] >= \ + PongUI.WINDOW_WIDTH - PongUI.PLAYER_OFFSET - PongUI.PLAYER_WIDTH: + self.ball_direction = self.LEFT + self.update_angle_after_hit() + + if self.ball_direction == self.LEFT: + if self.player1_position <= self.ball_pos[1] <= self.player1_position + PongUI.PLAYER_HEIGHT: + if PongUI.PLAYER_OFFSET <= self.ball_pos[0] <= PongUI.PLAYER_OFFSET + PongUI.PLAYER_WIDTH: + self.ball_direction = self.RIGHT + self.update_angle_after_hit() + + def update_angle_after_hit(self): + self.ball_angle = int(uniform(-30, 30)) + + def update_ball(self): + self.check_for_collisions() + angle_r = math.radians(self.ball_angle) + dx = int(math.cos(angle_r) * self.ball_speed) + dy = int(math.sin(angle_r) * self.ball_speed) + if self.ball_direction == self.RIGHT: + self.ball_pos[0] = self.ball_pos[0] + dx + self.ball_pos[1] = self.ball_pos[1] - dy + if self.ball_direction == self.LEFT: + self.ball_pos[0] = self.ball_pos[0] - dx + self.ball_pos[1] = self.ball_pos[1] + dy + + def restart(self): + self.__init__() diff --git a/com.yakindu.sct.examples.pong.python/pong/pong_ui.py b/com.yakindu.sct.examples.pong.python/pong/pong_ui.py new file mode 100644 index 00000000..291ac1d6 --- /dev/null +++ b/com.yakindu.sct.examples.pong.python/pong/pong_ui.py @@ -0,0 +1,44 @@ +class PongUI: + WHITE = (255, 255, 255) + BLACK = (0, 0, 0) + WINDOW_WIDTH = 1200 + WINDOW_HEIGHT = 700 + PLAYER_WIDTH = 20 + PLAYER_HEIGHT = 100 + PLAYER_OFFSET = 100 + BALL_RADIUS = 20 + SIZE = (WINDOW_WIDTH, WINDOW_HEIGHT) + + def __init__(self, pygame, pong_game): + self.pygame = pygame + self.window = pygame.display.set_mode(self.SIZE) + self.timer = pygame.time.Clock() + self.pong_game = pong_game + self.rect_player1 = None + self.rect_player2 = None + + def draw_player(self): + self.rect_player1 = (self.PLAYER_OFFSET - self.PLAYER_WIDTH/2, self.pong_game.player1_position, self.PLAYER_WIDTH, self.PLAYER_HEIGHT) + self.pygame.draw.rect(self.window, self.WHITE, self.rect_player1) + + self.rect_player2 = ( + self.WINDOW_WIDTH - self.PLAYER_OFFSET - self.PLAYER_WIDTH/2, self.pong_game.player2_position, self.PLAYER_WIDTH, + self.PLAYER_HEIGHT) + self.pygame.draw.rect(self.window, self.WHITE, self.rect_player2) + + def draw_ball(self): + self.pygame.draw.circle(self.window, self.WHITE, self.pong_game.ball_pos, self.BALL_RADIUS) + + @staticmethod + def get_starting_position(): + return PongUI.WINDOW_HEIGHT / 2 - PongUI.PLAYER_HEIGHT / 2 + + def update(self): + self.window.fill(self.BLACK) + self.draw_player() + self.draw_ball() + self.pygame.display.update() + self.timer.tick(30) + + def restart(self): + self.__init__() diff --git a/com.yakindu.sct.examples.pong.python/pong_npc.png b/com.yakindu.sct.examples.pong.python/pong_npc.png new file mode 100644 index 0000000000000000000000000000000000000000..237845bbb1e04f79b13ae76ea4b968a606fb7feb GIT binary patch literal 29482 zcmce;c{r5q`#-K-N#&_1Yo)zxA+k*?l~AdaH7SxU+f3GJu~e2x3sXWRR6-j2Fp4yl zVX_-z2r-x~+YGaQuY2&+^L{_?&++@~cXS*vw|lPpy3Xr7U+3#wuKUh$OEc*u@=GKn zB&3fVK6p|>VgW`%V(w|lh2YB1kCzuoNcfE$Ik@lCwGKK(`st%fDX?(In4_kdvVTp{ z2SyPN+DI}n)gF1|$#cF$gX6&a@_UDBv#J86H>CxiOzQWEyeNxIcPrFM(cS*-w8z4y zYZVvjtkPMq{?NL>(K%aQQF4*p+1-!3A6F9|Ygd1G`Z%aNuZ>qzN-U)sb#jb36BQ=* z{weFfUdTVYQ#PjNj~|KKoub+o{PP<0={5Th+UvjXe&ZBD`j?xz|G(e7eHlhXs}xEB z@k&SppU#USjYL%P`!(i3pP$*BmcNYHLFjsa$($=-A(ulJB@8!?4y4Gs;-&aK%aP(M z*OmSX!e}ape|O$3{vnAGkFdg3YWA0T(Dm!HcflV;k`6>Ief=iI-irlxRYGDf+Uw%< zcjxI6;u~tyM0{$~ub%3rS0~a>T3A?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SQcFb}i%CWHyfC$?1a+-!leZ}T;PmW$ z!=9?#!HTegC}uY{wNkgCGtnduE@K(@ediW)tz46#Zbs^H4dd(*U4Cz@V$>QsPYNc` ziobV3{6wDMRv>{e?oNf5$}MK4&C%H1D>vYXn^Y~kdu3QMSHWi%@sA8A{F1fg=c()eU@z#)Oy6#fNn9eJm;_&P##is z{=9scjUs6sh<8_LQ&Uw%zhyq>hBh#+ zX*x@+4q<0+Kb>x++>{B%L;k4DQv4~wr^?X&n>!p+D=#=a9eS)-*YY(ji_u?*Le?iP z{O&~=8|=!c@7IJV>6nj2diJNr8OnI}@f;_hnj z?!0E60=8vVoe;Y0z4f|edog{s+E~~Q~ zb~*>Jp#h%=SWRLU8!pQ$gm8Fo8gL@Yw&DDjeZ6Cd-3(`MG9qRGST_MgCjyj5KQf_! zJz#$$UIsr{YqE#GUC=dM4*MLjyr~E57bZt#c;Hw$Xcl`v{nhjX_8JMSsRs}ts2uh= z#Vkl?-)RiL-GosUhqqn`FHtrDPt8DsxNzec!G%AO5+Yx+^;4 jvls1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/com.yakindu.sct.examples.pong.python/pong_npc/__init__.py b/com.yakindu.sct.examples.pong.python/pong_npc/__init__.py new file mode 100644 index 00000000..25f977a9 --- /dev/null +++ b/com.yakindu.sct.examples.pong.python/pong_npc/__init__.py @@ -0,0 +1,6 @@ + +""" + +Empty file that initializes the package it is contained in. + +""" diff --git a/com.yakindu.sct.examples.pong.python/pong_npc/__pycache__/__init__.cpython-36.pyc b/com.yakindu.sct.examples.pong.python/pong_npc/__pycache__/__init__.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..62f9ac16307653bacbea62f7637f4927e2f2a6e4 GIT binary patch literal 252 zcmX|+%}PTt5QTHQ&=Tl71YC8KfNqOF*diiSX%(uA4j~zPLvMb#Nx|DU>MM2YE4Xsy z+%6pW4#S+oFmp8;@r$3;`hhX_P5f6y-7S%aB$jJxJI+LQV$*S?#LqnJ#EvD!ieuWbl}A~$1BU-tqC^dq zGo)=14hmGoy?0UIURqPs4->EguLe z)>O{x$Y;u#O}(sdX3JTWDU_|}Hpj|is`7zCIU4(sLSs8x*&y|vQZ)X8v6RwZRHQ}K zo49v<*;;m*ws0!-V#YK0{fkPy?iDz}^b+7RG)u<;56}sE8Sq(p zg-!w;4EFGYkII65R$oO?T*Hz*p%m-2*&BEA$EAYxF671~^Bb({}*psf=0uu4mk7IIEVkRc&7? z3D zQ`u1-E0)^SB+N8*3A4?dgkz+l)*x+FrOW|tnI{ctfpnzfltns0Ii!=#DHlI zL=A21W_8XiFIU*ezW#{kmP0WG4++}$mjE$m6~G-dlk%);%;p= z9@wtMt!%D5scjYL_53`C6F>Z`0ciw#Uxyn54){ix}G58ojBk(a%@{K1VCPyc9fX~oOkT3%TAXiaoUDzBls~)NNf` z&mh$wtCy88r$2+zt!H`fcGqvF4v~~a>R5u#WZ}eZC2Op zDtNLgYn!!ATbyD2iYAMzd^I#H4w==u4ShwK{Qy?Sg+coljpdz&SboboXek7^qe}S&IEI1sO`yUez;vUH*6Sre&pO7Lk7IX{A}dK zj6XX+lrtmwuYk{)(n|aG$`f|iv26m=8|D`_Oj{)T=KY$0bz{~;cS6o{gHuKGe#?;* z&J{C03k#o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1fg1x$)#G&u8;rF_QZ{5=F9k3TF%K?h7GghQ}K)yZS`>B>XEy_8Df^2b@R~ z?w`T+=HzS-G6NgH(uv!qJ)|?iJ2I%lo|(Lg*eLyTha0=7)>YnF{Mt2+8VE?haYWEe9?Bvmk*ga(whyE zkCD%fSz?a$^F^Ivp7Ccda8H z79SHWm5hIV(!ehA41NIbno-63=mty}t~rWaui5y;yGdW&cYEB8$V??MP(lnY+A$~B?5%DHQt@WR87rDX^x`78aiWU{oW zF{jJiI1cb+?l~?qknmbq{!auWr)$PxW75bOS^RQ_j`Wa`K^i`s3x7It{-Yb?Xp=X_ zI_jp3XN)QN+i&cb-znxj<6%WOxC`i(&8^^nR3vVC`*+>>;<_s@z{@M|@}j$cxm~yM gKV$qG>5O?ANuF`ppX7Jh63C0UhBl!d&?dBh0&THtVgLXD literal 0 HcmV?d00001 diff --git a/com.yakindu.sct.examples.pong.python/pong_npc/__pycache__/pong_npc_statemachine_interfaces.cpython-36.pyc b/com.yakindu.sct.examples.pong.python/pong_npc/__pycache__/pong_npc_statemachine_interfaces.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..79319e6af15321f2e0c7a43d62bae9b27b3f0c86 GIT binary patch literal 2303 zcmbVNQE$^Q5O&h6O|!P!7=sBR6lp@D5=tdNLPCIshCmZiL2O8{2P_l2G>|62P6w;@ z#{LM8{H46|7kJ`{J7;au(pG4#eD*nK-+kYm?YqsUv-A7y`yUlTev#4-bg~Ogq2T0* zJSW`X<{9DUck{>qt->wPEYM8QR(KV(DrgnZYTO3R2F>F21JZUzXZukqWRLkmxm@&u zNN_iZ+_W!Tm9kX0exJ$I9mHIOp5q+CeDMD(TqcDpMIwa~u!=iOxk@BV>YYQTlu)p% z4_GEY6Gpqx)HVn~jtoF)a^tANOL^B@9@>@mz^YzKHlm0@xVJ_pM!`GJ>{pK_{K0W$t7G2;4%p*1slx7a4khfuo;|8T)hAce) zQlpf|KBaPHjIO{bkq3#a*w8d9cEvLF%!LwVW2hfk7>;)S&5`os1WL^hw8d<05UkG4 zIt(~DB{Y{%6FN_AGqaOe1(@-y&I2iY9JUQvfd#Xe5bRZG8WS<9#%N<4TA4vv#kDmQ z$bhV)SV)uuUoSx`h{Bl*5#?YsNytuw9Nk<-Rc^D8EDT^wR!);4S7B}mEjx%nmzFWw zEW)@rEm*5Ja8s-%T|YQ8pO#(tGXJ3S6*%y4h4C8nRc`Y-^fm7ARp@Qr;7#c3yag!N zvL?o@&pTdcqg%@uoSd+QBrdKvbC_fnkH0P}GY=pYWp-sMvI(j4uOY0yQ}XG&zzw+u z`uxmgjX+V!0wp*dCil?gc?z#hJ1m<`Ih~v@T{1>~zJN@#dk8L9cl{{}xdoGOTd)4KX6O1yy zz|8Kmwy9~BO9EK;L%}4Chba}u@V@D%zbLL7(}BzyciYb53vB}cNxZ$}CW^}_woo8j zC83{$7RL$0xrlF~<@sO5&N<-%5Mwt#QN5ewaT`kFgdM-nEw5 Ja$1en>R)t`+av%0 literal 0 HcmV?d00001 diff --git a/com.yakindu.sct.examples.pong.python/pong_npc/pong_npc_statemachine.py b/com.yakindu.sct.examples.pong.python/pong_npc/pong_npc_statemachine.py new file mode 100644 index 00000000..03114065 --- /dev/null +++ b/com.yakindu.sct.examples.pong.python/pong_npc/pong_npc_statemachine.py @@ -0,0 +1,352 @@ +# Implementation of statechart pong_npc_statemachine. + +import warnings +# implemented interfaces: +from .pong_npc_statemachine_interfaces import SCI_Internal +from .pong_npc_statemachine_interfaces import SCI_ball, SCI_player, SCI_Interface +# to store states: +from enum import Enum + +class Pong_npc: + + """ + + Implementation of the state machine 'Pong_npc'. + + """ + + def __init__(self): + """ Declares all necessary variables including list of states, histories etc. + """ + self.sci_internal = SCI_Internal() + self.sci_ball = SCI_ball() + self.sci_player = SCI_player() + self.sci_interface = SCI_Interface() + self.initialized = False + self.state_vector = [None] * 1 + self.next_state_index = None + # internal scope variables: + self.RIGHT = "right" + self.LEFT = "left" + self.MIDDLE = 350 + # enumeration of all states: + self.State = Enum('State', '\ + main_region_ball_moves_left,\ + main_region_ball_moves_left_r1_go_to_the_middle,\ + main_region_ball_moves_right,\ + main_region_ball_moves_right_r1_wait,\ + main_region_ball_moves_right_r1_go_to_the_ball,\ + main_region_ball_moves_right_r1_go_to_the_ball_r1_down,\ + main_region_ball_moves_right_r1_go_to_the_ball_r1_up,\ + null_state') + + def init(self): + """ Initializes the state machine by checking the timer, + initializing states and clearing events. + """ + self.initialized = True + for state_index in range(1): + self.state_vector[state_index] = self.State.null_state + self._clear_events() + self._clear_out_events() + self.sci_ball.position = 0.0 + self.sci_ball.direction = "" + self.sci_player.position = 0.0 + + def enter(self): + if self.initialized is not True: + raise ValueError( + 'The state machine needs to be initialized first by calling the init() function.') + self.enter_sequence_main_region_default() + + def exit(self): + """ Exit the the state machine. + """ + self.exit_sequence_main_region() + + def is_active(self): + """ @see IStatemachine#is_active() + """ + return (self.state_vector[0] is not self.State.null_state) + + def is_final(self): + """Always returns 'false' since this state machine can never become final. + @see IStatemachine#is_final() + """ + return False + + def _clear_events(self): + """ Resets incoming events (time events included). + """ + + def _clear_out_events(self): + """ Resets outgoing events. + """ + self.sci_interface.clear_out_events() + + def is_state_active(self, state): + """ Returns True if the given state is currently active otherwise false. + """ + s = state.name + if s == 'main_region_ball_moves_left_r1_go_to_the_middle': + return self.state_vector[0] == self.State.main_region_ball_moves_left_r1_go_to_the_middle + elif s == 'main_region_ball_moves_left': + return (self.state_vector[0].value >= self.State.main_region_ball_moves_left.value)\ + and (self.state_vector[0].value <= self.State.main_region_ball_moves_left_r1_go_to_the_middle.value) + elif s == 'main_region_ball_moves_right': + return (self.state_vector[0].value >= self.State.main_region_ball_moves_right.value)\ + and (self.state_vector[0].value <= self.State.main_region_ball_moves_right_r1_go_to_the_ball_r1_up.value) + elif s == 'main_region_ball_moves_right_r1_wait': + return self.state_vector[0] == self.State.main_region_ball_moves_right_r1_wait + elif s == 'main_region_ball_moves_right_r1_go_to_the_ball': + return (self.state_vector[0].value >= self.State.main_region_ball_moves_right_r1_go_to_the_ball.value)\ + and (self.state_vector[0].value <= self.State.main_region_ball_moves_right_r1_go_to_the_ball_r1_up.value) + elif s == 'main_region_ball_moves_right_r1_go_to_the_ball_r1_down': + return self.state_vector[0] == self.State.main_region_ball_moves_right_r1_go_to_the_ball_r1_down + elif s == 'main_region_ball_moves_right_r1_go_to_the_ball_r1_up': + return self.state_vector[0] == self.State.main_region_ball_moves_right_r1_go_to_the_ball_r1_up + else: + return False + + def enter_sequence_main_region_ball_moves_left_default(self): + self.enter_sequence_main_region_ball_moves_left_r1_default() + + def enter_sequence_main_region_ball_moves_left_r1_go_to_the_middle_default(self): + self.next_state_index = 0 + self.state_vector[0] = self.State.main_region_ball_moves_left_r1_go_to_the_middle + self.state_vector_changed = True + + def enter_sequence_main_region_ball_moves_right_default(self): + self.enter_sequence_main_region_ball_moves_right_r1_default() + + def enter_sequence_main_region_ball_moves_right_r1_wait_default(self): + self.next_state_index = 0 + self.state_vector[0] = self.State.main_region_ball_moves_right_r1_wait + self.state_vector_changed = True + + def enter_sequence_main_region_ball_moves_right_r1_go_to_the_ball_default(self): + self.enter_sequence_main_region_ball_moves_right_r1_go_to_the_ball_r1_default() + + def enter_sequence_main_region_ball_moves_right_r1_go_to_the_ball_r1_down_default(self): + self.next_state_index = 0 + self.state_vector[0] = self.State.main_region_ball_moves_right_r1_go_to_the_ball_r1_down + self.state_vector_changed = True + + def enter_sequence_main_region_ball_moves_right_r1_go_to_the_ball_r1_up_default(self): + self.next_state_index = 0 + self.state_vector[0] = self.State.main_region_ball_moves_right_r1_go_to_the_ball_r1_up + self.state_vector_changed = True + + def enter_sequence_main_region_default(self): + self.react_main_region__entry_default() + + def enter_sequence_main_region_ball_moves_left_r1_default(self): + self.react_main_region_ball_moves_left_r1__entry_default() + + def enter_sequence_main_region_ball_moves_right_r1_default(self): + self.react_main_region_ball_moves_right_r1__entry_default() + + def enter_sequence_main_region_ball_moves_right_r1_go_to_the_ball_r1_default(self): + self.react_main_region_ball_moves_right_r1_go_to_the_ball_r1__entry_default() + + def exit_sequence_main_region_ball_moves_left(self): + self.exit_sequence_main_region_ball_moves_left_r1() + + def exit_sequence_main_region_ball_moves_left_r1_go_to_the_middle(self): + self.next_state_index = 0 + self.state_vector[0] = self.State.null_state + + def exit_sequence_main_region_ball_moves_right(self): + self.exit_sequence_main_region_ball_moves_right_r1() + + def exit_sequence_main_region_ball_moves_right_r1_wait(self): + self.next_state_index = 0 + self.state_vector[0] = self.State.null_state + + def exit_sequence_main_region_ball_moves_right_r1_go_to_the_ball(self): + self.exit_sequence_main_region_ball_moves_right_r1_go_to_the_ball_r1() + + def exit_sequence_main_region_ball_moves_right_r1_go_to_the_ball_r1_down(self): + self.next_state_index = 0 + self.state_vector[0] = self.State.null_state + + def exit_sequence_main_region_ball_moves_right_r1_go_to_the_ball_r1_up(self): + self.next_state_index = 0 + self.state_vector[0] = self.State.null_state + + def exit_sequence_main_region(self): + state = self.state_vector[0].name + if state == 'main_region_ball_moves_left_r1_go_to_the_middle': + self.exit_sequence_main_region_ball_moves_left_r1_go_to_the_middle() + elif state == 'main_region_ball_moves_right_r1_wait': + self.exit_sequence_main_region_ball_moves_right_r1_wait() + elif state == 'main_region_ball_moves_right_r1_go_to_the_ball_r1_down': + self.exit_sequence_main_region_ball_moves_right_r1_go_to_the_ball_r1_down() + elif state == 'main_region_ball_moves_right_r1_go_to_the_ball_r1_up': + self.exit_sequence_main_region_ball_moves_right_r1_go_to_the_ball_r1_up() + + def exit_sequence_main_region_ball_moves_left_r1(self): + state = self.state_vector[0].name + if state == 'main_region_ball_moves_left_r1_go_to_the_middle': + self.exit_sequence_main_region_ball_moves_left_r1_go_to_the_middle() + + def exit_sequence_main_region_ball_moves_right_r1(self): + state = self.state_vector[0].name + if state == 'main_region_ball_moves_right_r1_wait': + self.exit_sequence_main_region_ball_moves_right_r1_wait() + elif state == 'main_region_ball_moves_right_r1_go_to_the_ball_r1_down': + self.exit_sequence_main_region_ball_moves_right_r1_go_to_the_ball_r1_down() + elif state == 'main_region_ball_moves_right_r1_go_to_the_ball_r1_up': + self.exit_sequence_main_region_ball_moves_right_r1_go_to_the_ball_r1_up() + + def exit_sequence_main_region_ball_moves_right_r1_go_to_the_ball_r1(self): + state = self.state_vector[0].name + if state == 'main_region_ball_moves_right_r1_go_to_the_ball_r1_down': + self.exit_sequence_main_region_ball_moves_right_r1_go_to_the_ball_r1_down() + elif state == 'main_region_ball_moves_right_r1_go_to_the_ball_r1_up': + self.exit_sequence_main_region_ball_moves_right_r1_go_to_the_ball_r1_up() + + def react_main_region__entry_default(self): + self.enter_sequence_main_region_ball_moves_left_default() + + def react_main_region_ball_moves_left_r1__entry_default(self): + self.enter_sequence_main_region_ball_moves_left_r1_go_to_the_middle_default() + + def react_main_region_ball_moves_right_r1__entry_default(self): + self.enter_sequence_main_region_ball_moves_right_r1_wait_default() + + def react_main_region_ball_moves_right_r1_go_to_the_ball_r1__entry_default(self): + self.enter_sequence_main_region_ball_moves_right_r1_go_to_the_ball_r1_up_default() + + def react(self): + return False + + + def main_region_ball_moves_left_react(self, try_transition): + did_transition = try_transition + + if try_transition: + if (self.react()) == False: + if ((self.RIGHT is None) if (self.sci_ball.direction is None) else (self.sci_ball.direction == self.RIGHT)): + self.exit_sequence_main_region_ball_moves_left() + self.enter_sequence_main_region_ball_moves_right_default() + else: + did_transition = False + + return did_transition + + + def main_region_ball_moves_left_r1_go_to_the_middle_react(self, try_transition): + did_transition = try_transition + + if try_transition: + if (self.main_region_ball_moves_left_react(try_transition)) == False: + if self.sci_player.position < self.MIDDLE: + self.exit_sequence_main_region_ball_moves_left_r1_go_to_the_middle() + self.sci_interface.raise_down() + self.enter_sequence_main_region_ball_moves_left_r1_go_to_the_middle_default() + elif self.sci_player.position > self.MIDDLE: + self.exit_sequence_main_region_ball_moves_left_r1_go_to_the_middle() + self.sci_interface.raise_up() + self.enter_sequence_main_region_ball_moves_left_r1_go_to_the_middle_default() + else: + did_transition = False + + return did_transition + + + def main_region_ball_moves_right_react(self, try_transition): + did_transition = try_transition + + if try_transition: + if (self.react()) == False: + if ((self.LEFT is None) if (self.sci_ball.direction is None) else (self.sci_ball.direction == self.LEFT)): + self.exit_sequence_main_region_ball_moves_right() + self.enter_sequence_main_region_ball_moves_left_default() + else: + did_transition = False + + return did_transition + + + def main_region_ball_moves_right_r1_wait_react(self, try_transition): + did_transition = try_transition + + if try_transition: + if (self.main_region_ball_moves_right_react(try_transition)) == False: + if self.sci_player.position != self.sci_ball.position: + self.exit_sequence_main_region_ball_moves_right_r1_wait() + self.enter_sequence_main_region_ball_moves_right_r1_go_to_the_ball_default() + else: + did_transition = False + + return did_transition + + + def main_region_ball_moves_right_r1_go_to_the_ball_react(self, try_transition): + did_transition = try_transition + + if try_transition: + if (self.main_region_ball_moves_right_react(try_transition)) == False: + if self.sci_player.position == self.sci_ball.position: + self.exit_sequence_main_region_ball_moves_right_r1_go_to_the_ball() + self.enter_sequence_main_region_ball_moves_right_r1_wait_default() + else: + did_transition = False + + return did_transition + + + def main_region_ball_moves_right_r1_go_to_the_ball_r1_down_react(self, try_transition): + did_transition = try_transition + + if try_transition: + if (self.main_region_ball_moves_right_r1_go_to_the_ball_react(try_transition)) == False: + if self.sci_player.position > self.sci_ball.position: + self.exit_sequence_main_region_ball_moves_right_r1_go_to_the_ball_r1_down() + self.enter_sequence_main_region_ball_moves_right_r1_go_to_the_ball_r1_up_default() + else: + did_transition = False + + if (did_transition) == False: + self.sci_interface.raise_down() + + return did_transition + + + def main_region_ball_moves_right_r1_go_to_the_ball_r1_up_react(self, try_transition): + did_transition = try_transition + + if try_transition: + if (self.main_region_ball_moves_right_r1_go_to_the_ball_react(try_transition)) == False: + if self.sci_player.position < self.sci_ball.position: + self.exit_sequence_main_region_ball_moves_right_r1_go_to_the_ball_r1_up() + self.enter_sequence_main_region_ball_moves_right_r1_go_to_the_ball_r1_down_default() + else: + did_transition = False + + if (did_transition) == False: + self.sci_interface.raise_up() + + return did_transition + + + def run_cycle(self): + """ Starts a cycle in the state machine. + """ + if self.initialized is not True: + raise ValueError( + 'The state machine needs to be initialized first by calling the init() function.') + self._clear_out_events() + self.next_state_index = 0 + while self.next_state_index < len(self.state_vector): + if self.state_vector[self.next_state_index].name == 'main_region_ball_moves_left_r1_go_to_the_middle' : + self.main_region_ball_moves_left_r1_go_to_the_middle_react(True) + elif self.state_vector[self.next_state_index].name == 'main_region_ball_moves_right_r1_wait' : + self.main_region_ball_moves_right_r1_wait_react(True) + elif self.state_vector[self.next_state_index].name == 'main_region_ball_moves_right_r1_go_to_the_ball_r1_down' : + self.main_region_ball_moves_right_r1_go_to_the_ball_r1_down_react(True) + elif self.state_vector[self.next_state_index].name == 'main_region_ball_moves_right_r1_go_to_the_ball_r1_up' : + self.main_region_ball_moves_right_r1_go_to_the_ball_r1_up_react(True) + self.next_state_index += 1 + self._clear_events() diff --git a/com.yakindu.sct.examples.pong.python/pong_npc/pong_npc_statemachine_interfaces.py b/com.yakindu.sct.examples.pong.python/pong_npc/pong_npc_statemachine_interfaces.py new file mode 100644 index 00000000..424669f8 --- /dev/null +++ b/com.yakindu.sct.examples.pong.python/pong_npc/pong_npc_statemachine_interfaces.py @@ -0,0 +1,68 @@ +"""Interfaces defined in the state chart model. + +The interfaces defined in the state chart model are represented +as separate classes. + +""" + +class SCI_Internal: + + """ Implementation of the Internal interface. + """ + + def __init__(self): + # init done by state machine class itself. + pass + + +class SCI_ball: + + """Implementation of scope sci_ball. + """ + + def __init__(self): + self.position = None + self.direction = None + + + + +class SCI_player: + + """Implementation of scope sci_player. + """ + + def __init__(self): + self.position = None + + + + +class SCI_Interface: + + """Implementation of scope sci_interface. + """ + + def __init__(self): + self.up = None + self.down = None + + + + def is_raised_up(self): + return self.up + + def raise_up(self): + self.up = True + + def is_raised_down(self): + return self.down + + def raise_down(self): + self.down = True + + def clear_out_events(self): + self.up = False + self.down = False + + diff --git a/com.yakindu.sct.examples.pong.python/pong_npc/timer/__init__.py b/com.yakindu.sct.examples.pong.python/pong_npc/timer/__init__.py new file mode 100644 index 00000000..25f977a9 --- /dev/null +++ b/com.yakindu.sct.examples.pong.python/pong_npc/timer/__init__.py @@ -0,0 +1,6 @@ + +""" + +Empty file that initializes the package it is contained in. + +"""