summaryrefslogtreecommitdiff
path: root/kpov_judge/tasks/mock_entrance_exam
diff options
context:
space:
mode:
authorTimotej Lazar <timotej.lazar@fri.uni-lj.si>2018-10-13 21:58:29 +0200
committerTimotej Lazar <timotej.lazar@fri.uni-lj.si>2018-10-13 21:59:11 +0200
commite4e109c16ef27012157cb38cf6375c1ae4d2ef69 (patch)
treeff2350f8f769d92544202cb5d2149155aa1d04cb /kpov_judge/tasks/mock_entrance_exam
parentf2060d5143f5c4b14bfff723d238c497a0053f17 (diff)
parent5439f75ca2e1a38803a96853b6cac0ce5c9f58ce (diff)
Merge branch 'improve-web'
Store instructions in HTML and render with jinja2. Add i18n with gettext / pybabel. Improve styling.
Diffstat (limited to 'kpov_judge/tasks/mock_entrance_exam')
-rw-r--r--kpov_judge/tasks/mock_entrance_exam/task.py69
1 files changed, 38 insertions, 31 deletions
diff --git a/kpov_judge/tasks/mock_entrance_exam/task.py b/kpov_judge/tasks/mock_entrance_exam/task.py
index 906df97..ad51c2a 100644
--- a/kpov_judge/tasks/mock_entrance_exam/task.py
+++ b/kpov_judge/tasks/mock_entrance_exam/task.py
@@ -5,45 +5,50 @@
# - switch to a real SSH/SFTP client to properly handle filenames
instructions = {
- 'si': '''
-Postavite dva navidezna računalnika - SimpleArbiter in Student.
-Oba naj bosta povezana na internet. Poleg tega mora biti
-Student na naslovu {student_IP} dostopen s SimpleArbiter.
+ 'si': '''\
+<p>
+Postavite dva navidezna računalnika - <em>SimpleArbiter</em> in <em>Student</em>. Oba naj bosta povezana na internet. Poleg tega mora biti <em>Student</em> na naslovu {{student_IP}} dostopen s <em>SimpleArbiter</em>.
-Računajte, da se na Student ob zagonu zažene program {net_prog_name},
-ki vam spreminja nastavitve mrežne kartice.
+<p>
+Računajte, da se na <em>Student</em> ob zagonu zažene program {{net_prog_name}}, ki vam spreminja nastavitve mrežne kartice.
-V domačem imeniku uporabnika student obstaja program {P_c} v programskem jeziku C.
-Prevedite ga v program z imenom {P_executable}.
-Izvorna koda je namenoma pokvarjena tako, da so vanjo vrinjeni nepotrebni znaki.
-Pred prevajanjem jo morate popraviti.
+<p>
+V domačem imeniku uporabnika <code>student</code> obstaja program <code>{{P_c}}</code> v programskem jeziku C.
+Prevedite ga v program z imenom <code>{{P_executable}}</code>. Izvorna koda je namenoma pokvarjena tako, da so vanjo vrinjeni nepotrebni znaki. Pred prevajanjem jo morate popraviti.
-Napišite skripto ali program {P_script} v domačem imeniku uporabnika student, ki:
-- požene {P_executable} z argumentom "{arg_c}" in mu na standardni vhod pripelje vrednost spremenljivke {env_c}
-- vse, kar {P_executable} izpiše na stderr, spravi v datoteko {out_stderr_c}.
-- vse vrstice, ki jih {P_executable} izpiše na stdout in vsebujejo zaporedje znakov "ma", zapiše v {out_stdout_c}.
+<p>
+Napišite skripto ali program <code>{{P_script}}</code> v domačem imeniku uporabnika <code>student</code>, ki:
-Lastnik vseh ustvarjenih datotek mora biti uporabnik student.
-Gesla uporabnika student (vaje) ne smete spreminjati.''',
- 'en': '''Set up two virtual machines - SimpleArbiter and Student.
-Both should be connected to the Internet. Student should also be accessible
-from SimpleArbiter at the address {student_IP}.
+<ul>
+<li>požene <code>{{P_executable}}</code> z argumentom <code>"{{arg_c}}"</code> in mu na standardni vhod pripelje vrednost spremenljivke <code>{{env_c}}</code>;
+<li>vse, kar <code>{{P_executable}}</code> izpiše na stderr, spravi v datoteko <code>{{out_stderr_c}}</code>; in
+<li>vse vrstice, ki jih <code>{{P_executable}}</code> izpiše na stdout in vsebujejo zaporedje znakov <code>ma</code>, zapiše v <code>{{out_stdout_c}}</code>.
+</ul>
-Keep in mind that a program called {net_prog_name} starts on Student
-whenever Student boots. This program may change your network settings.
+<p>
+Lastnik vseh ustvarjenih datotek mora biti uporabnik <code>student</code>. Gesla uporabnika <code>student</code> (<code>vaje</code>) ne smete spreminjati.
+''',
+ 'en': '''\
+<p>
+Set up two virtual machines - <em>SimpleArbiter</em> and <em>Student</em>. Both should be connected to the internet. <em>Student</em> should also be accessible from <em>SimpleArbiter</em> at the address <code>{{student_IP}}</code>.
+
+<p>
+Keep in mind that a program called <code>{{net_prog_name}}</code> starts on <em>Student</em> on each boot. This program may change your network settings.
-There is a program called {P_c} in the home directory of student. Compile it
-into a program called {P_executable}. The source code is intentionally broken
-so that unneccessarry characters are inserted into the file. You have to fix
-the file before compiling.
+<p>
+There is a program called <code>{{P_c}}</code> in <code>student</code>’s home directory. Compile it into a program called <code>{{P_executable}}</code>. The source code is intentionally broken so that unneccessarry characters are inserted into the file. You have to fix the file before compiling.
-Also, write a script or program called {P_script} in the home directory of student.
-The script should:
-- run {P_executable} with the argument {arg_c} and pipe the value of the environment variable {env_c} into {P_executable}'s standard input.
-- redirect stderr of {P_executable} into a file called {out_stderr_c}.
-- save each line which {P_executable} outputs and which contains the character sequence "ma" into {out_stdout_c}.
+<p>
+Also, write a script or program called <code>{{P_script}}</code> in <code>student</code>’s home directory. The script should:
-The owner of all created files should be student. You are not allowed to change student's password (vaje).
+<ul>
+<li>run <code>{{P_executable}}</code> with the argument <code>{{arg_c}}</code> and pipe the value of the environment variable <code>{{env_c}}</code> into <code>{{P_executable}}</code>’s standard input;
+<li>redirect stderr of <code>{{P_executable}}</code> into a file called <code>{{out_stderr_c}}</code>; and
+<li>save each line which <code>{{P_executable}}</code> outputs and which contains the character sequence <code>ma</code> into <code>{{out_stdout_c}}</code>.
+</ul>
+
+<p>
+The owner of all created files should be <code>student</code>. You are not allowed to change <code>student</code>’s password (<code>vaje</code>).
''',
}
@@ -304,3 +309,5 @@ nohup {} &
exit 0
""".format(sh_path, task_params['net_prog_name']))
+
+ write_default_config(templates['simpleArbiter'], global_params)