From f08c7bfd6d3631d75083b8d14fb2c427be7b2a9d Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Wed, 30 Sep 2015 11:54:55 +0200 Subject: Add the first robot problem --- robot/common.py | 9 ++++++++ robot/en.py | 7 ++++++ robot/problems/introduction/forward/common.py | 33 +++++++++++++++++++++++++++ robot/problems/introduction/forward/en.py | 24 +++++++++++++++++++ robot/problems/introduction/forward/sl.py | 23 +++++++++++++++++++ robot/sl.py | 7 ++++++ 6 files changed, 103 insertions(+) create mode 100644 robot/common.py create mode 100644 robot/en.py create mode 100644 robot/problems/introduction/forward/common.py create mode 100644 robot/problems/introduction/forward/en.py create mode 100644 robot/problems/introduction/forward/sl.py create mode 100644 robot/sl.py (limited to 'robot') diff --git a/robot/common.py b/robot/common.py new file mode 100644 index 0000000..bbe3c14 --- /dev/null +++ b/robot/common.py @@ -0,0 +1,9 @@ +# coding=utf-8 + +from server.hints import Hint, HintSequence + +hint_type = { +} + +def hint(program, solved_problems): + return [] diff --git a/robot/en.py b/robot/en.py new file mode 100644 index 0000000..f296516 --- /dev/null +++ b/robot/en.py @@ -0,0 +1,7 @@ +# coding=utf-8 + +name = 'Robot' +description = 'Introductory Robot course.' + +hint = { +} diff --git a/robot/problems/introduction/forward/common.py b/robot/problems/introduction/forward/common.py new file mode 100644 index 0000000..5023d7f --- /dev/null +++ b/robot/problems/introduction/forward/common.py @@ -0,0 +1,33 @@ +# coding=utf-8 + +from server.hints import Hint + +id = 202 +group = 'introduction' +number = 1 +visible = True + +solution = '''\ +import time +from ev3dev import * +from mindstorms_widgets import mindstorms_widgets + +robot = mindstorms_widgets() +robot.connect_motor('left') +robot.connect_motor('right') + +robot.move_steering('on', power=50) +time.sleep(3) +robot.move_steering('off', brake_at_end=True) +''' + +hint_type = { + 'ev3dev': Hint('ev3dev'), + 'mindWidgets': Hint('mindWidgets'), +} + +def test(program): + return False, [] + +def hint(program): + return [] diff --git a/robot/problems/introduction/forward/en.py b/robot/problems/introduction/forward/en.py new file mode 100644 index 0000000..d943867 --- /dev/null +++ b/robot/problems/introduction/forward/en.py @@ -0,0 +1,24 @@ +# coding=utf-8 + +id = 202 +name = 'Forward' +slug = 'Forward' + +description = '''\ +

Robot should drive forward in a straight line and stop after three +seconds.

+''' + +plan = [] + +hint = { + 'ev3dev': '''\ +

To work with the robot you should import the ev3dev module: +from ev3dev import *.

+''', + + 'mindWidgets': '''\ +

To work with the robot you should import the mindstorms_widgets module: +from mindstorms_widgets import mindstorms_widgets.

+''', +} diff --git a/robot/problems/introduction/forward/sl.py b/robot/problems/introduction/forward/sl.py new file mode 100644 index 0000000..98f3a8d --- /dev/null +++ b/robot/problems/introduction/forward/sl.py @@ -0,0 +1,23 @@ +# coding=utf-8 + +id = 202 +name = 'Naprej' +slug = 'Naprej' + +description = '''\ +

Robot naj pelje naravnost naprej in se po treh sekundah ustavi.

+''' + +plan = [] + +hint = { + 'ev3dev': '''\ +

Za delo z robotom moramo uvoziti modul ev3dev: +from ev3dev import *.

+''', + + 'mindWidgets': '''\ +

Za delo z robotom moramo uvoziti modul mindstorms_widgets: +from mindstorms_widgets import mindstorms_widgets.

+''', +} diff --git a/robot/sl.py b/robot/sl.py new file mode 100644 index 0000000..2a45d0f --- /dev/null +++ b/robot/sl.py @@ -0,0 +1,7 @@ +# coding=utf-8 + +name = 'Robot' +description = 'Uvodni tečaj za robota.' + +hint = { +} -- cgit v1.2.1