├── api ├── tests │ ├── task_5_2_1 │ │ ├── test_3.ans │ │ ├── test_6.ans │ │ ├── test_6.pl │ │ ├── test_2.pl │ │ ├── test_1.pl │ │ ├── test_2.ans │ │ ├── test_3.pl │ │ ├── test_4.ans │ │ ├── test_4.pl │ │ ├── test_5.ans │ │ ├── test_5.pl │ │ ├── test_7.ans │ │ ├── test_1.ans │ │ ├── test_7.pl │ │ └── description.md │ ├── task_5_2_2 │ │ ├── test_2.ans │ │ ├── test_2.pl │ │ ├── test_3.pl │ │ ├── test_1.ans │ │ ├── test_1.pl │ │ ├── test_3.ans │ │ └── description.md │ ├── task_5_5_1 │ │ ├── test_3.ans │ │ ├── test_1.ans │ │ ├── test_2.ans │ │ ├── test_2.pl │ │ ├── test_3.pl │ │ ├── test_1.pl │ │ └── description.md │ ├── task_5_5_2 │ │ ├── test_2.ans │ │ ├── test_2.pl │ │ ├── test_4.pl │ │ ├── test_1.ans │ │ ├── test_4.ans │ │ ├── test_3.pl │ │ ├── test_3.ans │ │ ├── test_1.pl │ │ └── description.md │ ├── task_5_5_4 │ │ ├── test_2.ans │ │ ├── test_6.ans │ │ ├── test_1.ans │ │ ├── test_3.ans │ │ ├── test_4.ans │ │ ├── test_5.pl │ │ ├── test_4.pl │ │ ├── test_2.pl │ │ ├── test_6.pl │ │ ├── test_1.pl │ │ ├── test_3.pl │ │ ├── test_5.ans │ │ └── description.md │ ├── task_5_5_5 │ │ ├── test_2.ans │ │ ├── test_3.ans │ │ ├── test_5.ans │ │ ├── test_6.ans │ │ ├── test_7.ans │ │ ├── test_3.pl │ │ ├── test_4.pl │ │ ├── test_5.pl │ │ ├── test_1.ans │ │ ├── test_4.ans │ │ ├── test_2.pl │ │ ├── test_6.pl │ │ ├── test_7.pl │ │ ├── test_1.pl │ │ └── description.md │ ├── task_5_5_6 │ │ ├── test_2.ans │ │ ├── test_5.ans │ │ ├── test_1.ans │ │ ├── test_3.ans │ │ ├── test_3.pl │ │ ├── test_4.ans │ │ ├── test_6.ans │ │ ├── test_7.ans │ │ ├── test_4.pl │ │ ├── test_5.pl │ │ ├── test_2.pl │ │ ├── test_1.pl │ │ ├── test_6.pl │ │ ├── test_7.pl │ │ └── description.md │ ├── task_5_5_7 │ │ ├── test_3.ans │ │ ├── test_1.ans │ │ ├── test_2.ans │ │ ├── test_4.ans │ │ ├── test_5.pl │ │ ├── test_4.pl │ │ ├── test_5.ans │ │ ├── test_2.pl │ │ ├── test_3.pl │ │ ├── test_1.pl │ │ └── description.md │ ├── task_5_5_8 │ │ ├── test_3.ans │ │ ├── test_5.pl │ │ ├── test_2.ans │ │ ├── test_6.pl │ │ ├── test_5.ans │ │ ├── test_6.ans │ │ ├── test_1.ans │ │ ├── test_1.pl │ │ ├── test_2.pl │ │ ├── test_3.pl │ │ ├── test_7.ans │ │ ├── test_7.pl │ │ ├── test_4.pl │ │ ├── test_4.ans │ │ └── description.md │ ├── task_5_5_9 │ │ ├── test_2.ans │ │ ├── test_4.ans │ │ ├── test_7.ans │ │ ├── test_3.pl │ │ ├── test_1.ans │ │ ├── test_2.pl │ │ ├── test_3.ans │ │ ├── test_4.pl │ │ ├── test_5.ans │ │ ├── test_6.ans │ │ ├── test_1.pl │ │ ├── test_5.pl │ │ ├── test_6.pl │ │ ├── test_7.pl │ │ └── description.md │ ├── task_5_6_1 │ │ ├── test_1.ans │ │ ├── test_3.ans │ │ ├── test_6.ans │ │ ├── test_2.ans │ │ ├── test_4.ans │ │ ├── test_5.ans │ │ ├── test_1.pl │ │ ├── test_2.pl │ │ ├── test_3.pl │ │ ├── test_4.pl │ │ ├── test_5.pl │ │ ├── test_6.pl │ │ └── description.md │ ├── task_5_6_2 │ │ ├── test_1.ans │ │ ├── test_3.ans │ │ ├── test_2.ans │ │ ├── test_4.pl │ │ ├── test_5.pl │ │ ├── test_2.pl │ │ ├── test_4.ans │ │ ├── test_5.ans │ │ ├── test_3.pl │ │ ├── test_1.pl │ │ └── description.md │ ├── task_6_2_2 │ │ ├── test_2.ans │ │ ├── test_3.ans │ │ ├── test_1.pl │ │ ├── test_1.ans │ │ ├── test_2.pl │ │ ├── test_3.pl │ │ ├── test_5.ans │ │ ├── test_5.pl │ │ ├── test_4.ans │ │ ├── test_4.pl │ │ ├── shared_consult_data.pl │ │ └── description.md │ ├── task_6_2_4 │ │ ├── test_7.ans │ │ ├── test_4.pl │ │ ├── test_7.pl │ │ ├── test_5.pl │ │ ├── test_1.ans │ │ ├── test_2.ans │ │ ├── test_3.ans │ │ ├── test_4.ans │ │ ├── test_8.ans │ │ ├── test_1.pl │ │ ├── test_5.ans │ │ ├── test_6.ans │ │ ├── test_6.pl │ │ ├── test_8.pl │ │ ├── shared_consult_data.pl │ │ ├── test_2.pl │ │ ├── test_3.pl │ │ └── description.md │ ├── task_7_2_1 │ │ ├── test_4.ans │ │ ├── test_1.pl │ │ ├── test_3.pl │ │ ├── test_4.pl │ │ ├── test_5.pl │ │ ├── test_2.pl │ │ ├── test_5.ans │ │ ├── test_1.ans │ │ ├── test_2.ans │ │ ├── test_3.ans │ │ └── description.md │ ├── task_7_2_2 │ │ ├── test_5.ans │ │ ├── test_4.ans │ │ ├── test_3.ans │ │ ├── test_2.ans │ │ ├── test_3.pl │ │ ├── test_1.pl │ │ ├── test_2.pl │ │ ├── test_5.pl │ │ ├── test_4.pl │ │ ├── test_1.py │ │ ├── test_2.py │ │ ├── description.md │ │ └── common.py │ ├── task_7_2_3 │ │ ├── test_3.ans │ │ ├── test_4.ans │ │ ├── test_2.ans │ │ ├── test_1.ans │ │ ├── test_1.pl │ │ ├── test_2.pl │ │ ├── test_4.pl │ │ ├── test_5.ans │ │ ├── test_5.pl │ │ ├── test_3.pl │ │ └── description.md │ ├── task_7_4_1 │ │ ├── test_2.ans │ │ ├── test_3.ans │ │ ├── test_4.ans │ │ ├── test_8.ans │ │ ├── test_4.pl │ │ ├── test_5.pl │ │ ├── test_1.ans │ │ ├── test_5.ans │ │ ├── test_7.ans │ │ ├── test_1.pl │ │ ├── test_2.pl │ │ ├── test_3.pl │ │ ├── test_6.ans │ │ ├── test_6.pl │ │ ├── test_7.pl │ │ ├── test_8.pl │ │ ├── shared_consult_data.pl │ │ └── description.md │ ├── task_7_4_2 │ │ ├── test_3.ans │ │ ├── test_5.ans │ │ ├── test_7.ans │ │ ├── test_9.ans │ │ ├── test_8.pl │ │ ├── test_2.ans │ │ ├── test_6.ans │ │ ├── test_8.ans │ │ ├── test_7.pl │ │ ├── shared_consult_data.pl │ │ ├── test_4.ans │ │ ├── test_4.pl │ │ ├── test_6.pl │ │ ├── test_9.pl │ │ ├── test_5.pl │ │ ├── test_1.ans │ │ ├── test_1.pl │ │ ├── test_3.pl │ │ ├── test_2.pl │ │ └── description.md │ ├── task_7_4_3 │ │ ├── test_6.ans │ │ ├── test_1.ans │ │ ├── test_2.ans │ │ ├── test_3.ans │ │ ├── test_4.ans │ │ ├── test_8.ans │ │ ├── shared_consult_data.pl │ │ ├── test_5.ans │ │ ├── test_7.ans │ │ ├── test_1.pl │ │ ├── test_3.pl │ │ ├── test_2.pl │ │ ├── test_4.pl │ │ ├── test_5.pl │ │ ├── test_6.pl │ │ ├── test_7.pl │ │ ├── test_8.pl │ │ └── description.md │ ├── task_5_1 │ │ ├── test_11.ans │ │ ├── test_12.ans │ │ ├── test_14.ans │ │ ├── test_15.ans │ │ ├── test_17.ans │ │ ├── test_2.ans │ │ ├── test_20.ans │ │ ├── test_5.ans │ │ ├── test_6.ans │ │ ├── test_7.ans │ │ ├── test_9.ans │ │ ├── test_10.pl │ │ ├── test_11.pl │ │ ├── test_12.pl │ │ ├── test_13.pl │ │ ├── test_19.pl │ │ ├── test_2.pl │ │ ├── test_3.pl │ │ ├── test_7.pl │ │ ├── test_1.pl │ │ ├── test_10.ans │ │ ├── test_13.ans │ │ ├── test_14.pl │ │ ├── test_15.pl │ │ ├── test_16.pl │ │ ├── test_17.pl │ │ ├── test_18.ans │ │ ├── test_18.pl │ │ ├── test_20.pl │ │ ├── test_3.ans │ │ ├── test_4.ans │ │ ├── test_4.pl │ │ ├── test_5.pl │ │ ├── test_6.pl │ │ ├── test_9.pl │ │ ├── test_8.ans │ │ ├── test_8.pl │ │ ├── test_1.ans │ │ ├── test_19.ans │ │ ├── test_16.ans │ │ ├── shared_consult_data.pl │ │ └── description.md │ ├── task_5_5_3 │ │ ├── test_2.ans │ │ ├── test_1.ans │ │ ├── test_3.ans │ │ ├── test_4.ans │ │ ├── test_1.pl │ │ ├── test_2.pl │ │ ├── test_3.pl │ │ ├── test_4.pl │ │ └── description.md │ ├── task_7_5_1+2 │ │ ├── test_2.ans │ │ ├── test_6.ans │ │ ├── test_1.ans │ │ ├── test_3.ans │ │ ├── test_4.ans │ │ ├── test_5.ans │ │ ├── test_7.ans │ │ ├── test_8.ans │ │ ├── test_8.pl │ │ ├── test_1.pl │ │ ├── test_2.pl │ │ ├── test_6.pl │ │ ├── test_3.pl │ │ ├── test_5.pl │ │ ├── test_7.pl │ │ ├── test_4.pl │ │ └── description.md │ ├── task_6_1_2 │ │ ├── test_1.pl │ │ ├── test_1.ans │ │ ├── test_2.pl │ │ ├── test_4.ans │ │ ├── test_4.pl │ │ ├── test_6.ans │ │ ├── test_6.pl │ │ ├── test_2.ans │ │ ├── test_3.ans │ │ ├── test_3.pl │ │ ├── shared_consult_data.pl │ │ ├── test_5.ans │ │ ├── test_5.pl │ │ ├── test_7.ans │ │ ├── test_7.pl │ │ └── description.md │ ├── task_6_2_3 │ │ ├── test_5.pl │ │ ├── test_1.ans │ │ ├── test_2.ans │ │ ├── test_3.ans │ │ ├── test_4.ans │ │ ├── test_5.ans │ │ ├── test_6.ans │ │ ├── test_6.pl │ │ ├── test_7.ans │ │ ├── test_7.pl │ │ ├── shared_consult_data.pl │ │ ├── test_1.pl │ │ ├── test_2.pl │ │ ├── test_3.pl │ │ ├── test_4.pl │ │ └── description.md │ ├── task_6_2_5 │ │ ├── test_1.pl │ │ ├── test_2.pl │ │ ├── test_3.pl │ │ ├── test_4.pl │ │ ├── test_5.pl │ │ ├── test_6.pl │ │ ├── test_2.ans │ │ ├── test_5.ans │ │ ├── test_6.ans │ │ ├── test_3.ans │ │ ├── shared_consult_data.pl │ │ ├── test_1.ans │ │ ├── test_4.ans │ │ └── description.md │ ├── task_6_2_6 │ │ ├── test_1.pl │ │ ├── test_2.pl │ │ ├── test_3.pl │ │ ├── test_4.pl │ │ ├── test_7.pl │ │ ├── test_8.pl │ │ ├── test_1.ans │ │ ├── test_4.ans │ │ ├── test_5.pl │ │ ├── test_6.ans │ │ ├── test_6.pl │ │ ├── test_7.ans │ │ ├── test_8.ans │ │ ├── test_2.ans │ │ ├── test_3.ans │ │ ├── test_5.ans │ │ ├── shared_consult_data.pl │ │ └── description.md │ ├── task_6_1_1 │ │ ├── test_7.pl │ │ ├── test_7.ans │ │ ├── test_1.ans │ │ ├── test_1.pl │ │ ├── test_4.ans │ │ ├── test_4.pl │ │ ├── test_6.ans │ │ ├── test_6.pl │ │ ├── shared_consult_data.pl │ │ ├── test_2.ans │ │ ├── test_2.pl │ │ ├── test_3.ans │ │ ├── test_3.pl │ │ ├── test_5.ans │ │ ├── test_5.pl │ │ └── description.md │ ├── task_6_1_3 │ │ ├── test_6.pl │ │ ├── test_1.ans │ │ ├── test_4.ans │ │ ├── test_4.pl │ │ ├── test_5.ans │ │ ├── test_5.pl │ │ ├── test_6.ans │ │ ├── test_8.ans │ │ ├── test_1.pl │ │ ├── test_2.ans │ │ ├── test_3.ans │ │ ├── test_3.pl │ │ ├── test_7.ans │ │ ├── shared_consult_data.pl │ │ ├── test_7.pl │ │ ├── test_8.pl │ │ ├── test_2.pl │ │ └── description.md │ ├── task_6_2_1 │ │ ├── test_1.ans │ │ ├── test_1.pl │ │ ├── test_2.ans │ │ ├── test_3.ans │ │ ├── test_4.ans │ │ ├── test_5.ans │ │ ├── test_2.pl │ │ ├── test_3.pl │ │ ├── shared_consult_data.pl │ │ ├── test_4.pl │ │ ├── test_5.pl │ │ └── description.md │ ├── task_7_5_3 │ │ ├── test_1.ans │ │ ├── test_2.ans │ │ ├── test_3.ans │ │ ├── test_4.ans │ │ ├── shared_consult_data.pl │ │ ├── test_5.ans │ │ ├── test_6.ans │ │ ├── test_7.ans │ │ ├── test_8.ans │ │ ├── test_1.pl │ │ ├── test_3.pl │ │ ├── test_2.pl │ │ ├── test_4.pl │ │ ├── test_5.pl │ │ ├── test_6.pl │ │ ├── test_7.pl │ │ ├── test_8.pl │ │ └── description.md │ └── task_7_5_4 │ │ ├── test_1.ans │ │ ├── test_2.ans │ │ ├── test_3.ans │ │ ├── test_4.ans │ │ ├── test_5.ans │ │ ├── test_2.pl │ │ ├── test_1.pl │ │ ├── test_3.pl │ │ ├── test_5.pl │ │ ├── test_4.pl │ │ └── description.md ├── examples │ ├── task_7_5_4.pl │ ├── task_5_5_1.pl │ ├── task_5_5_2.pl │ ├── task_5_2_1.pl │ ├── task_5_2_2.pl │ ├── task_7_2_1.pl │ ├── task_6_2_1.hl │ ├── task_6_2_3.pl │ ├── task_6_2_2.pl │ ├── task_5_5_3.pl │ ├── task_7_4_1.pl │ ├── task_7_4_2.pl │ ├── task_6_1_3.pl │ ├── task_5_5_7.pl │ ├── task_5_5_6.pl │ ├── task_7_5_1+2.pl │ ├── task_6_1_2.pl │ ├── task_7_2_2.pl │ ├── task_6_2_4.pl │ ├── task_6_2_1.pl │ ├── task_7_2_3.pl │ ├── task_6_1_1.pl │ ├── task_5_5_8.pl │ ├── task_5_1.pl │ ├── task_6_2_5.pl │ ├── task_5_5_4.pl │ ├── task_5_5_5.pl │ ├── task_5_5_9.pl │ ├── task_6_2_6.pl │ ├── task_5_6_1.pl │ ├── task_7_4_3.pl │ ├── task_5_6_2.pl │ └── task_7_5_3.pl ├── submit.sh ├── wsgi.py ├── submit_and_execute.sh ├── requirements.txt ├── execute.sh ├── settings.py ├── test_prolog_program.j2 ├── Dockerfile ├── testlib │ └── errorcheck.py ├── translator.py ├── api.py └── prolog_parsing.py ├── .gitignore ├── react-frontend ├── public │ ├── favicon.ico │ ├── manifest.json │ └── index.html ├── src │ ├── style.css │ ├── index.js │ ├── Themes.js │ ├── TaskDescription.js │ ├── Header.js │ ├── ExecutionResults.js │ ├── CodeForm.js │ └── App.js ├── Dockerfile ├── .gitignore └── package.json ├── docker-compose.yml └── README.md /api/tests/task_5_2_1/test_3.ans: -------------------------------------------------------------------------------- 1 | no -------------------------------------------------------------------------------- /api/tests/task_5_2_1/test_6.ans: -------------------------------------------------------------------------------- 1 | no -------------------------------------------------------------------------------- /api/tests/task_5_2_2/test_2.ans: -------------------------------------------------------------------------------- 1 | no -------------------------------------------------------------------------------- /api/tests/task_5_5_1/test_3.ans: -------------------------------------------------------------------------------- 1 | no -------------------------------------------------------------------------------- /api/tests/task_5_5_2/test_2.ans: -------------------------------------------------------------------------------- 1 | no -------------------------------------------------------------------------------- /api/tests/task_5_5_4/test_2.ans: -------------------------------------------------------------------------------- 1 | no -------------------------------------------------------------------------------- /api/tests/task_5_5_4/test_6.ans: -------------------------------------------------------------------------------- 1 | no -------------------------------------------------------------------------------- /api/tests/task_5_5_5/test_2.ans: -------------------------------------------------------------------------------- 1 | no -------------------------------------------------------------------------------- /api/tests/task_5_5_5/test_3.ans: -------------------------------------------------------------------------------- 1 | no -------------------------------------------------------------------------------- /api/tests/task_5_5_5/test_5.ans: -------------------------------------------------------------------------------- 1 | no -------------------------------------------------------------------------------- /api/tests/task_5_5_5/test_6.ans: -------------------------------------------------------------------------------- 1 | no -------------------------------------------------------------------------------- /api/tests/task_5_5_5/test_7.ans: -------------------------------------------------------------------------------- 1 | no -------------------------------------------------------------------------------- /api/tests/task_5_5_6/test_2.ans: -------------------------------------------------------------------------------- 1 | no -------------------------------------------------------------------------------- /api/tests/task_5_5_6/test_5.ans: -------------------------------------------------------------------------------- 1 | no -------------------------------------------------------------------------------- /api/tests/task_5_5_7/test_3.ans: -------------------------------------------------------------------------------- 1 | no -------------------------------------------------------------------------------- /api/tests/task_5_5_8/test_3.ans: -------------------------------------------------------------------------------- 1 | no -------------------------------------------------------------------------------- /api/tests/task_5_5_9/test_2.ans: -------------------------------------------------------------------------------- 1 | no -------------------------------------------------------------------------------- /api/tests/task_5_5_9/test_4.ans: -------------------------------------------------------------------------------- 1 | no -------------------------------------------------------------------------------- /api/tests/task_5_5_9/test_7.ans: -------------------------------------------------------------------------------- 1 | no -------------------------------------------------------------------------------- /api/tests/task_5_6_1/test_1.ans: -------------------------------------------------------------------------------- 1 | no -------------------------------------------------------------------------------- /api/tests/task_5_6_1/test_3.ans: -------------------------------------------------------------------------------- 1 | no -------------------------------------------------------------------------------- /api/tests/task_5_6_1/test_6.ans: -------------------------------------------------------------------------------- 1 | no -------------------------------------------------------------------------------- /api/tests/task_5_6_2/test_1.ans: -------------------------------------------------------------------------------- 1 | no -------------------------------------------------------------------------------- /api/tests/task_5_6_2/test_3.ans: -------------------------------------------------------------------------------- 1 | no -------------------------------------------------------------------------------- /api/tests/task_6_2_2/test_2.ans: -------------------------------------------------------------------------------- 1 | no -------------------------------------------------------------------------------- /api/tests/task_6_2_2/test_3.ans: -------------------------------------------------------------------------------- 1 | no -------------------------------------------------------------------------------- /api/tests/task_6_2_4/test_7.ans: -------------------------------------------------------------------------------- 1 | no -------------------------------------------------------------------------------- /api/tests/task_7_2_1/test_4.ans: -------------------------------------------------------------------------------- 1 | no -------------------------------------------------------------------------------- /api/tests/task_7_2_2/test_5.ans: -------------------------------------------------------------------------------- 1 | no -------------------------------------------------------------------------------- /api/tests/task_7_2_3/test_3.ans: -------------------------------------------------------------------------------- 1 | no -------------------------------------------------------------------------------- /api/tests/task_7_2_3/test_4.ans: -------------------------------------------------------------------------------- 1 | no -------------------------------------------------------------------------------- /api/tests/task_7_4_1/test_2.ans: -------------------------------------------------------------------------------- 1 | no -------------------------------------------------------------------------------- /api/tests/task_7_4_1/test_3.ans: -------------------------------------------------------------------------------- 1 | no -------------------------------------------------------------------------------- /api/tests/task_7_4_1/test_4.ans: -------------------------------------------------------------------------------- 1 | no -------------------------------------------------------------------------------- /api/tests/task_7_4_1/test_8.ans: -------------------------------------------------------------------------------- 1 | no -------------------------------------------------------------------------------- /api/tests/task_7_4_2/test_3.ans: -------------------------------------------------------------------------------- 1 | no -------------------------------------------------------------------------------- /api/tests/task_7_4_2/test_5.ans: -------------------------------------------------------------------------------- 1 | no -------------------------------------------------------------------------------- /api/tests/task_7_4_2/test_7.ans: -------------------------------------------------------------------------------- 1 | no -------------------------------------------------------------------------------- /api/tests/task_7_4_2/test_9.ans: -------------------------------------------------------------------------------- 1 | no -------------------------------------------------------------------------------- /api/tests/task_7_4_3/test_6.ans: -------------------------------------------------------------------------------- 1 | no -------------------------------------------------------------------------------- /api/tests/task_5_1/test_11.ans: -------------------------------------------------------------------------------- 1 | no 2 | -------------------------------------------------------------------------------- /api/tests/task_5_1/test_12.ans: -------------------------------------------------------------------------------- 1 | no 2 | -------------------------------------------------------------------------------- /api/tests/task_5_1/test_14.ans: -------------------------------------------------------------------------------- 1 | no 2 | -------------------------------------------------------------------------------- /api/tests/task_5_1/test_15.ans: -------------------------------------------------------------------------------- 1 | no 2 | -------------------------------------------------------------------------------- /api/tests/task_5_1/test_17.ans: -------------------------------------------------------------------------------- 1 | no 2 | -------------------------------------------------------------------------------- /api/tests/task_5_1/test_2.ans: -------------------------------------------------------------------------------- 1 | no 2 | -------------------------------------------------------------------------------- /api/tests/task_5_1/test_20.ans: -------------------------------------------------------------------------------- 1 | no 2 | -------------------------------------------------------------------------------- /api/tests/task_5_1/test_5.ans: -------------------------------------------------------------------------------- 1 | no 2 | -------------------------------------------------------------------------------- /api/tests/task_5_1/test_6.ans: -------------------------------------------------------------------------------- 1 | no 2 | -------------------------------------------------------------------------------- /api/tests/task_5_1/test_7.ans: -------------------------------------------------------------------------------- 1 | no 2 | -------------------------------------------------------------------------------- /api/tests/task_5_1/test_9.ans: -------------------------------------------------------------------------------- 1 | no 2 | -------------------------------------------------------------------------------- /api/tests/task_5_5_3/test_2.ans: -------------------------------------------------------------------------------- 1 | no 2 | -------------------------------------------------------------------------------- /api/tests/task_7_5_1+2/test_2.ans: -------------------------------------------------------------------------------- 1 | no -------------------------------------------------------------------------------- /api/tests/task_7_5_1+2/test_6.ans: -------------------------------------------------------------------------------- 1 | no -------------------------------------------------------------------------------- /api/tests/task_5_2_1/test_6.pl: -------------------------------------------------------------------------------- 1 | my_list(foo). -------------------------------------------------------------------------------- /api/tests/task_7_2_1/test_1.pl: -------------------------------------------------------------------------------- 1 | max(1, 2, X). -------------------------------------------------------------------------------- /api/tests/task_7_2_1/test_3.pl: -------------------------------------------------------------------------------- 1 | max(7, 7, X). -------------------------------------------------------------------------------- /api/tests/task_7_2_1/test_4.pl: -------------------------------------------------------------------------------- 1 | max(1, 7, 1). -------------------------------------------------------------------------------- /api/tests/task_7_2_1/test_5.pl: -------------------------------------------------------------------------------- 1 | max(1, 7, 7). -------------------------------------------------------------------------------- /api/examples/task_7_5_4.pl: -------------------------------------------------------------------------------- 1 | % not implemented :( -------------------------------------------------------------------------------- /api/tests/task_5_2_1/test_2.pl: -------------------------------------------------------------------------------- 1 | my_list([a,X]). -------------------------------------------------------------------------------- /api/tests/task_5_5_2/test_2.pl: -------------------------------------------------------------------------------- 1 | my_tail([], []). -------------------------------------------------------------------------------- /api/tests/task_5_5_2/test_4.pl: -------------------------------------------------------------------------------- 1 | my_tail([1], []). -------------------------------------------------------------------------------- /api/tests/task_5_5_5/test_3.pl: -------------------------------------------------------------------------------- 1 | my_less([], []). -------------------------------------------------------------------------------- /api/tests/task_5_5_5/test_4.pl: -------------------------------------------------------------------------------- 1 | my_less([], [1]). -------------------------------------------------------------------------------- /api/tests/task_5_5_5/test_5.pl: -------------------------------------------------------------------------------- 1 | my_less([1], []). -------------------------------------------------------------------------------- /api/tests/task_5_5_8/test_5.pl: -------------------------------------------------------------------------------- 1 | my_reverse(R, []). -------------------------------------------------------------------------------- /api/tests/task_5_5_9/test_3.pl: -------------------------------------------------------------------------------- 1 | my_period([], []). -------------------------------------------------------------------------------- /api/tests/task_6_1_2/test_1.pl: -------------------------------------------------------------------------------- 1 | single([], L2). -------------------------------------------------------------------------------- /api/tests/task_6_2_2/test_1.pl: -------------------------------------------------------------------------------- 1 | my_sum([], 0). -------------------------------------------------------------------------------- /api/tests/task_6_2_3/test_5.pl: -------------------------------------------------------------------------------- 1 | my_mult([], 1, Y). -------------------------------------------------------------------------------- /api/tests/task_6_2_4/test_4.pl: -------------------------------------------------------------------------------- 1 | most_oft([1], X). -------------------------------------------------------------------------------- /api/tests/task_6_2_4/test_7.pl: -------------------------------------------------------------------------------- 1 | most_oft([], X). -------------------------------------------------------------------------------- /api/tests/task_6_2_5/test_1.pl: -------------------------------------------------------------------------------- 1 | my_prime(L, 20). -------------------------------------------------------------------------------- /api/tests/task_6_2_5/test_2.pl: -------------------------------------------------------------------------------- 1 | my_prime(L, 2). -------------------------------------------------------------------------------- /api/tests/task_6_2_5/test_3.pl: -------------------------------------------------------------------------------- 1 | my_prime(L, 10). -------------------------------------------------------------------------------- /api/tests/task_6_2_5/test_4.pl: -------------------------------------------------------------------------------- 1 | my_prime(L, 100). -------------------------------------------------------------------------------- /api/tests/task_6_2_5/test_5.pl: -------------------------------------------------------------------------------- 1 | my_prime(L, 1). -------------------------------------------------------------------------------- /api/tests/task_6_2_5/test_6.pl: -------------------------------------------------------------------------------- 1 | my_prime(L, -100). -------------------------------------------------------------------------------- /api/tests/task_6_2_6/test_1.pl: -------------------------------------------------------------------------------- 1 | gcd(5, 5, GCD). -------------------------------------------------------------------------------- /api/tests/task_6_2_6/test_2.pl: -------------------------------------------------------------------------------- 1 | gcd(60, 15, GCD). -------------------------------------------------------------------------------- /api/tests/task_6_2_6/test_3.pl: -------------------------------------------------------------------------------- 1 | gcd(15, 60, GCD). -------------------------------------------------------------------------------- /api/tests/task_6_2_6/test_4.pl: -------------------------------------------------------------------------------- 1 | gcd(7, 11, GCD). -------------------------------------------------------------------------------- /api/tests/task_6_2_6/test_7.pl: -------------------------------------------------------------------------------- 1 | gcd(36, -63, GCD). -------------------------------------------------------------------------------- /api/tests/task_6_2_6/test_8.pl: -------------------------------------------------------------------------------- 1 | gcd(-36, 63, GCD). -------------------------------------------------------------------------------- /api/tests/task_7_2_1/test_2.pl: -------------------------------------------------------------------------------- 1 | max(13, 4, X). -------------------------------------------------------------------------------- /api/tests/task_7_4_1/test_4.pl: -------------------------------------------------------------------------------- 1 | my_max([], X). -------------------------------------------------------------------------------- /api/tests/task_7_4_1/test_5.pl: -------------------------------------------------------------------------------- 1 | my_max([1], X). -------------------------------------------------------------------------------- /api/tests/task_7_4_2/test_8.pl: -------------------------------------------------------------------------------- 1 | max_occur([], []). -------------------------------------------------------------------------------- /api/examples/task_5_5_1.pl: -------------------------------------------------------------------------------- 1 | my_head([X|_], X). 2 | -------------------------------------------------------------------------------- /api/tests/task_5_1/test_10.pl: -------------------------------------------------------------------------------- 1 | is_father(kolya). 2 | -------------------------------------------------------------------------------- /api/tests/task_5_1/test_11.pl: -------------------------------------------------------------------------------- 1 | is_father(vlad). 2 | -------------------------------------------------------------------------------- /api/tests/task_5_1/test_12.pl: -------------------------------------------------------------------------------- 1 | is_father(sasha). 2 | -------------------------------------------------------------------------------- /api/tests/task_5_1/test_13.pl: -------------------------------------------------------------------------------- 1 | brother(max, vlad). 2 | -------------------------------------------------------------------------------- /api/tests/task_5_1/test_19.pl: -------------------------------------------------------------------------------- 1 | descendant(X, max). 2 | -------------------------------------------------------------------------------- /api/tests/task_5_1/test_2.pl: -------------------------------------------------------------------------------- 1 | parent(vasya, dima). 2 | -------------------------------------------------------------------------------- /api/tests/task_5_1/test_3.pl: -------------------------------------------------------------------------------- 1 | parent(dima, kolya). 2 | -------------------------------------------------------------------------------- /api/tests/task_5_1/test_7.pl: -------------------------------------------------------------------------------- 1 | parent(dima, dima). 2 | -------------------------------------------------------------------------------- /api/tests/task_5_2_1/test_1.pl: -------------------------------------------------------------------------------- 1 | my_list([a,b,c]). 2 | -------------------------------------------------------------------------------- /api/tests/task_5_2_1/test_2.ans: -------------------------------------------------------------------------------- 1 | Result = [[_]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_5_2_1/test_3.pl: -------------------------------------------------------------------------------- 1 | my_list('.'(a, b)). -------------------------------------------------------------------------------- /api/tests/task_5_2_1/test_4.ans: -------------------------------------------------------------------------------- 1 | Result = [[]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_5_2_1/test_4.pl: -------------------------------------------------------------------------------- 1 | my_list([1, 2, 3|[]]). -------------------------------------------------------------------------------- /api/tests/task_5_2_1/test_5.ans: -------------------------------------------------------------------------------- 1 | Result = [[]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_5_2_1/test_5.pl: -------------------------------------------------------------------------------- 1 | my_list([1|[2, 3]]). -------------------------------------------------------------------------------- /api/tests/task_5_2_1/test_7.ans: -------------------------------------------------------------------------------- 1 | Result = [[]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_5_2_2/test_2.pl: -------------------------------------------------------------------------------- 1 | my_elem(4, [1, 2, 3]). -------------------------------------------------------------------------------- /api/tests/task_5_2_2/test_3.pl: -------------------------------------------------------------------------------- 1 | my_elem(X, [a,b,c]). -------------------------------------------------------------------------------- /api/tests/task_5_5_1/test_1.ans: -------------------------------------------------------------------------------- 1 | Result = [[1]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_5_5_1/test_2.ans: -------------------------------------------------------------------------------- 1 | Result = [[]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_5_5_1/test_2.pl: -------------------------------------------------------------------------------- 1 | my_head([1,2,3], 1). -------------------------------------------------------------------------------- /api/tests/task_5_5_1/test_3.pl: -------------------------------------------------------------------------------- 1 | my_head([1,2,3], 2). -------------------------------------------------------------------------------- /api/tests/task_5_5_2/test_1.ans: -------------------------------------------------------------------------------- 1 | Result = [[]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_5_5_2/test_4.ans: -------------------------------------------------------------------------------- 1 | Result = [[]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_5_5_4/test_1.ans: -------------------------------------------------------------------------------- 1 | Result = [[]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_5_5_4/test_3.ans: -------------------------------------------------------------------------------- 1 | Result = [[]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_5_5_4/test_4.ans: -------------------------------------------------------------------------------- 1 | Result = [[]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_5_5_4/test_5.pl: -------------------------------------------------------------------------------- 1 | my_sublist([1,2], X). -------------------------------------------------------------------------------- /api/tests/task_5_5_5/test_1.ans: -------------------------------------------------------------------------------- 1 | Result = [[]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_5_5_5/test_4.ans: -------------------------------------------------------------------------------- 1 | Result = [[]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_5_5_6/test_1.ans: -------------------------------------------------------------------------------- 1 | Result = [[]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_5_5_6/test_3.ans: -------------------------------------------------------------------------------- 1 | Result = [[]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_5_5_6/test_3.pl: -------------------------------------------------------------------------------- 1 | my_subset([], [1,2,3]). -------------------------------------------------------------------------------- /api/tests/task_5_5_6/test_4.ans: -------------------------------------------------------------------------------- 1 | Result = [[]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_5_5_6/test_6.ans: -------------------------------------------------------------------------------- 1 | Result = [[]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_5_5_6/test_7.ans: -------------------------------------------------------------------------------- 1 | Result = [[]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_5_5_7/test_1.ans: -------------------------------------------------------------------------------- 1 | Result = [[]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_5_5_7/test_2.ans: -------------------------------------------------------------------------------- 1 | Result = [[]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_5_5_8/test_2.ans: -------------------------------------------------------------------------------- 1 | Result = [[]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_5_5_8/test_6.pl: -------------------------------------------------------------------------------- 1 | my_reverse(R, [1]). -------------------------------------------------------------------------------- /api/tests/task_5_5_9/test_1.ans: -------------------------------------------------------------------------------- 1 | Result = [[]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_5_5_9/test_2.pl: -------------------------------------------------------------------------------- 1 | my_period([], [1,2,3]). -------------------------------------------------------------------------------- /api/tests/task_5_5_9/test_3.ans: -------------------------------------------------------------------------------- 1 | Result = [[]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_5_5_9/test_4.pl: -------------------------------------------------------------------------------- 1 | my_period([1, 2], []). -------------------------------------------------------------------------------- /api/tests/task_5_5_9/test_5.ans: -------------------------------------------------------------------------------- 1 | Result = [[]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_5_5_9/test_6.ans: -------------------------------------------------------------------------------- 1 | Result = [[]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_5_6_1/test_2.ans: -------------------------------------------------------------------------------- 1 | Result = [[]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_5_6_1/test_4.ans: -------------------------------------------------------------------------------- 1 | Result = [[]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_5_6_1/test_5.ans: -------------------------------------------------------------------------------- 1 | Result = [[]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_5_6_2/test_2.ans: -------------------------------------------------------------------------------- 1 | Result = [[]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_6_1_1/test_7.pl: -------------------------------------------------------------------------------- 1 | make_ordered([], L). -------------------------------------------------------------------------------- /api/tests/task_6_1_3/test_6.pl: -------------------------------------------------------------------------------- 1 | common([], [], L3). -------------------------------------------------------------------------------- /api/tests/task_6_2_2/test_1.ans: -------------------------------------------------------------------------------- 1 | Result = [[]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_6_2_2/test_2.pl: -------------------------------------------------------------------------------- 1 | my_sum([], 3). 2 | -------------------------------------------------------------------------------- /api/tests/task_6_2_2/test_3.pl: -------------------------------------------------------------------------------- 1 | my_sum([1, 2, 3], 4). -------------------------------------------------------------------------------- /api/tests/task_6_2_2/test_5.ans: -------------------------------------------------------------------------------- 1 | Result = [[]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_6_2_2/test_5.pl: -------------------------------------------------------------------------------- 1 | my_sum([1, 2, 3], 6). -------------------------------------------------------------------------------- /api/tests/task_6_2_3/test_1.ans: -------------------------------------------------------------------------------- 1 | Result = [[3]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_6_2_3/test_2.ans: -------------------------------------------------------------------------------- 1 | Result = [[2]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_6_2_3/test_3.ans: -------------------------------------------------------------------------------- 1 | Result = [[1]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_6_2_3/test_4.ans: -------------------------------------------------------------------------------- 1 | Result = [[0]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_6_2_3/test_5.ans: -------------------------------------------------------------------------------- 1 | Result = [[0]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_6_2_3/test_6.ans: -------------------------------------------------------------------------------- 1 | Result = [[1]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_6_2_3/test_6.pl: -------------------------------------------------------------------------------- 1 | my_mult([1], 1, Y). -------------------------------------------------------------------------------- /api/tests/task_6_2_3/test_7.ans: -------------------------------------------------------------------------------- 1 | Result = [[5]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_6_2_4/test_5.pl: -------------------------------------------------------------------------------- 1 | most_oft([2, 3, 1], X). -------------------------------------------------------------------------------- /api/tests/task_6_2_6/test_1.ans: -------------------------------------------------------------------------------- 1 | Result = [[5]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_6_2_6/test_4.ans: -------------------------------------------------------------------------------- 1 | Result = [[1]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_6_2_6/test_5.pl: -------------------------------------------------------------------------------- 1 | gcd(12350, 98760, GCD). -------------------------------------------------------------------------------- /api/tests/task_6_2_6/test_6.ans: -------------------------------------------------------------------------------- 1 | Result = [[9]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_6_2_6/test_6.pl: -------------------------------------------------------------------------------- 1 | gcd(-36, -63, GCD). -------------------------------------------------------------------------------- /api/tests/task_6_2_6/test_7.ans: -------------------------------------------------------------------------------- 1 | Result = [[9]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_6_2_6/test_8.ans: -------------------------------------------------------------------------------- 1 | Result = [[9]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_7_2_1/test_5.ans: -------------------------------------------------------------------------------- 1 | Result = [[]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_7_2_2/test_4.ans: -------------------------------------------------------------------------------- 1 | Result = [[]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_7_2_3/test_2.ans: -------------------------------------------------------------------------------- 1 | Result = [[]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_7_4_1/test_1.ans: -------------------------------------------------------------------------------- 1 | Result = [[3]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_7_4_1/test_5.ans: -------------------------------------------------------------------------------- 1 | Result = [[1]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_7_4_1/test_7.ans: -------------------------------------------------------------------------------- 1 | Result = [[]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_7_4_2/test_2.ans: -------------------------------------------------------------------------------- 1 | Result = [[]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_7_4_2/test_6.ans: -------------------------------------------------------------------------------- 1 | Result = [[]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_7_4_2/test_8.ans: -------------------------------------------------------------------------------- 1 | Result = [[]] 2 | yes -------------------------------------------------------------------------------- /api/examples/task_5_5_2.pl: -------------------------------------------------------------------------------- 1 | my_tail([_|X], X). 2 | 3 | -------------------------------------------------------------------------------- /api/tests/task_5_1/test_1.pl: -------------------------------------------------------------------------------- 1 | parent(dima, ZzZzzZ). 2 | -------------------------------------------------------------------------------- /api/tests/task_5_1/test_10.ans: -------------------------------------------------------------------------------- 1 | Result = [[]] 2 | yes 3 | -------------------------------------------------------------------------------- /api/tests/task_5_1/test_13.ans: -------------------------------------------------------------------------------- 1 | Result = [[]] 2 | yes 3 | -------------------------------------------------------------------------------- /api/tests/task_5_1/test_14.pl: -------------------------------------------------------------------------------- 1 | brother(nastya, maria). 2 | -------------------------------------------------------------------------------- /api/tests/task_5_1/test_15.pl: -------------------------------------------------------------------------------- 1 | brother(kolya, max). 2 | -------------------------------------------------------------------------------- /api/tests/task_5_1/test_16.pl: -------------------------------------------------------------------------------- 1 | descendant(X, dima). 2 | -------------------------------------------------------------------------------- /api/tests/task_5_1/test_17.pl: -------------------------------------------------------------------------------- 1 | descendant(dima, kolya). 2 | -------------------------------------------------------------------------------- /api/tests/task_5_1/test_18.ans: -------------------------------------------------------------------------------- 1 | Result = [[]] 2 | yes 3 | -------------------------------------------------------------------------------- /api/tests/task_5_1/test_18.pl: -------------------------------------------------------------------------------- 1 | descendant(max, dima). 2 | -------------------------------------------------------------------------------- /api/tests/task_5_1/test_20.pl: -------------------------------------------------------------------------------- 1 | descendant(dima, vlad). 2 | -------------------------------------------------------------------------------- /api/tests/task_5_1/test_3.ans: -------------------------------------------------------------------------------- 1 | Result = [[]] 2 | yes 3 | -------------------------------------------------------------------------------- /api/tests/task_5_1/test_4.ans: -------------------------------------------------------------------------------- 1 | Result = [[]] 2 | yes 3 | -------------------------------------------------------------------------------- /api/tests/task_5_1/test_4.pl: -------------------------------------------------------------------------------- 1 | parent(maria, kolya). 2 | -------------------------------------------------------------------------------- /api/tests/task_5_1/test_5.pl: -------------------------------------------------------------------------------- 1 | parent(kolya, maria). 2 | -------------------------------------------------------------------------------- /api/tests/task_5_1/test_6.pl: -------------------------------------------------------------------------------- 1 | parent(sasha, kolya). 2 | -------------------------------------------------------------------------------- /api/tests/task_5_1/test_9.pl: -------------------------------------------------------------------------------- 1 | grandfather(kolya, vlad). 2 | -------------------------------------------------------------------------------- /api/tests/task_5_2_1/test_1.ans: -------------------------------------------------------------------------------- 1 | Result = [[]] 2 | yes 3 | -------------------------------------------------------------------------------- /api/tests/task_5_2_2/test_1.ans: -------------------------------------------------------------------------------- 1 | Result = [[]] 2 | yes 3 | -------------------------------------------------------------------------------- /api/tests/task_5_2_2/test_1.pl: -------------------------------------------------------------------------------- 1 | my_elem(2, [1, 2, 3]). 2 | -------------------------------------------------------------------------------- /api/tests/task_5_5_1/test_1.pl: -------------------------------------------------------------------------------- 1 | my_head([1,2,3], X). 2 | -------------------------------------------------------------------------------- /api/tests/task_5_5_2/test_3.pl: -------------------------------------------------------------------------------- 1 | my_tail([1, 2, 3, 4], X). -------------------------------------------------------------------------------- /api/tests/task_5_5_3/test_1.ans: -------------------------------------------------------------------------------- 1 | Result = [[]] 2 | yes 3 | -------------------------------------------------------------------------------- /api/tests/task_5_5_3/test_3.ans: -------------------------------------------------------------------------------- 1 | Result = [[]] 2 | yes 3 | -------------------------------------------------------------------------------- /api/tests/task_5_5_3/test_4.ans: -------------------------------------------------------------------------------- 1 | Result = [[]] 2 | yes 3 | -------------------------------------------------------------------------------- /api/tests/task_5_5_4/test_4.pl: -------------------------------------------------------------------------------- 1 | my_sublist([1,2,3,4,5], []). -------------------------------------------------------------------------------- /api/tests/task_5_5_5/test_2.pl: -------------------------------------------------------------------------------- 1 | my_less([1, 2, 3], [1, 2]). -------------------------------------------------------------------------------- /api/tests/task_5_5_6/test_4.pl: -------------------------------------------------------------------------------- 1 | my_subset([1,2,3], [1,2,3]). -------------------------------------------------------------------------------- /api/tests/task_5_5_6/test_5.pl: -------------------------------------------------------------------------------- 1 | my_subset([1,2,3], [4,5,6]). -------------------------------------------------------------------------------- /api/tests/task_5_5_7/test_4.ans: -------------------------------------------------------------------------------- 1 | Result = [[[3]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_5_5_7/test_5.pl: -------------------------------------------------------------------------------- 1 | my_concat(X, [1, 2], [3]). -------------------------------------------------------------------------------- /api/tests/task_5_5_8/test_5.ans: -------------------------------------------------------------------------------- 1 | Result = [[[]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_5_5_8/test_6.ans: -------------------------------------------------------------------------------- 1 | Result = [[[1]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_5_6_1/test_1.pl: -------------------------------------------------------------------------------- 1 | my_less([1,1,0], [1,1,0]). -------------------------------------------------------------------------------- /api/tests/task_5_6_1/test_2.pl: -------------------------------------------------------------------------------- 1 | my_less([1,0,0], [1,1,0]). -------------------------------------------------------------------------------- /api/tests/task_5_6_1/test_3.pl: -------------------------------------------------------------------------------- 1 | my_less([1,1,0], [1,0,0]). -------------------------------------------------------------------------------- /api/tests/task_5_6_1/test_4.pl: -------------------------------------------------------------------------------- 1 | my_less([1,0], [1,0,0]). -------------------------------------------------------------------------------- /api/tests/task_5_6_1/test_5.pl: -------------------------------------------------------------------------------- 1 | my_less([0,0,0,1], [1,0,0]). -------------------------------------------------------------------------------- /api/tests/task_5_6_2/test_4.pl: -------------------------------------------------------------------------------- 1 | my_sum([1,1,1], [1,1,1], Z). -------------------------------------------------------------------------------- /api/tests/task_5_6_2/test_5.pl: -------------------------------------------------------------------------------- 1 | my_sum([1,0,0], [1,0], Z). -------------------------------------------------------------------------------- /api/tests/task_6_1_1/test_7.ans: -------------------------------------------------------------------------------- 1 | Result = [[[]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_6_1_2/test_1.ans: -------------------------------------------------------------------------------- 1 | Result = [[[]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_6_1_2/test_2.pl: -------------------------------------------------------------------------------- 1 | single([1, 2, 3, 4], L2). -------------------------------------------------------------------------------- /api/tests/task_6_1_2/test_4.ans: -------------------------------------------------------------------------------- 1 | Result = [[[1]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_6_1_2/test_4.pl: -------------------------------------------------------------------------------- 1 | single([1, 1, 1, 1], L2). -------------------------------------------------------------------------------- /api/tests/task_6_1_2/test_6.ans: -------------------------------------------------------------------------------- 1 | Result = [[[0,1]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_6_1_2/test_6.pl: -------------------------------------------------------------------------------- 1 | single([0, 1, 0, 1], L2). -------------------------------------------------------------------------------- /api/tests/task_6_1_3/test_1.ans: -------------------------------------------------------------------------------- 1 | Result = [[[]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_6_1_3/test_4.ans: -------------------------------------------------------------------------------- 1 | Result = [[[]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_6_1_3/test_4.pl: -------------------------------------------------------------------------------- 1 | common([], [1, 2, 3], L3). -------------------------------------------------------------------------------- /api/tests/task_6_1_3/test_5.ans: -------------------------------------------------------------------------------- 1 | Result = [[[]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_6_1_3/test_5.pl: -------------------------------------------------------------------------------- 1 | common([1, 2, 3], [], L3). -------------------------------------------------------------------------------- /api/tests/task_6_1_3/test_6.ans: -------------------------------------------------------------------------------- 1 | Result = [[[]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_6_1_3/test_8.ans: -------------------------------------------------------------------------------- 1 | Result = [[[2,1]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_6_2_1/test_1.ans: -------------------------------------------------------------------------------- 1 | Result = [[0]] 2 | yes 3 | -------------------------------------------------------------------------------- /api/tests/task_6_2_1/test_1.pl: -------------------------------------------------------------------------------- 1 | my_length([], Length). 2 | -------------------------------------------------------------------------------- /api/tests/task_6_2_1/test_2.ans: -------------------------------------------------------------------------------- 1 | Result = [[3]] 2 | yes 3 | -------------------------------------------------------------------------------- /api/tests/task_6_2_1/test_3.ans: -------------------------------------------------------------------------------- 1 | Result = [[2]] 2 | yes 3 | -------------------------------------------------------------------------------- /api/tests/task_6_2_1/test_4.ans: -------------------------------------------------------------------------------- 1 | Result = [[4]] 2 | yes 3 | -------------------------------------------------------------------------------- /api/tests/task_6_2_1/test_5.ans: -------------------------------------------------------------------------------- 1 | Result = [[20]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_6_2_2/test_4.ans: -------------------------------------------------------------------------------- 1 | Result = [[15]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_6_2_2/test_4.pl: -------------------------------------------------------------------------------- 1 | my_sum([4, 5, 1, 2, 3], X). -------------------------------------------------------------------------------- /api/tests/task_6_2_4/test_1.ans: -------------------------------------------------------------------------------- 1 | Result = [[[1]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_6_2_4/test_2.ans: -------------------------------------------------------------------------------- 1 | Result = [[[3,1]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_6_2_4/test_3.ans: -------------------------------------------------------------------------------- 1 | Result = [[[3]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_6_2_4/test_4.ans: -------------------------------------------------------------------------------- 1 | Result = [[[1]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_6_2_4/test_8.ans: -------------------------------------------------------------------------------- 1 | Result = [[[1]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_6_2_5/test_2.ans: -------------------------------------------------------------------------------- 1 | Result = [[[2]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_6_2_5/test_5.ans: -------------------------------------------------------------------------------- 1 | Result = [[[]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_6_2_5/test_6.ans: -------------------------------------------------------------------------------- 1 | Result = [[[]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_6_2_6/test_2.ans: -------------------------------------------------------------------------------- 1 | Result = [[15]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_6_2_6/test_3.ans: -------------------------------------------------------------------------------- 1 | Result = [[15]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_6_2_6/test_5.ans: -------------------------------------------------------------------------------- 1 | Result = [[10]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_7_2_1/test_1.ans: -------------------------------------------------------------------------------- 1 | Result = [[2]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_7_2_1/test_2.ans: -------------------------------------------------------------------------------- 1 | Result = [[13]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_7_2_1/test_3.ans: -------------------------------------------------------------------------------- 1 | Result = [[7]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_7_2_2/test_3.ans: -------------------------------------------------------------------------------- 1 | Result = [[[]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_7_4_1/test_1.pl: -------------------------------------------------------------------------------- 1 | my_max([1, 2, 3, 2], X). -------------------------------------------------------------------------------- /api/tests/task_7_4_1/test_2.pl: -------------------------------------------------------------------------------- 1 | my_max([1, 2, 3, 2], 2). -------------------------------------------------------------------------------- /api/tests/task_7_4_1/test_3.pl: -------------------------------------------------------------------------------- 1 | my_max([1, 2, 3, 2], 1). -------------------------------------------------------------------------------- /api/tests/task_7_4_1/test_6.ans: -------------------------------------------------------------------------------- 1 | Result = [[-1]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_7_4_1/test_6.pl: -------------------------------------------------------------------------------- 1 | my_max([-1, -2, -3, -4], X). -------------------------------------------------------------------------------- /api/tests/task_7_4_1/test_7.pl: -------------------------------------------------------------------------------- 1 | my_max([4, 1, 3, 2], 4). -------------------------------------------------------------------------------- /api/tests/task_7_4_1/test_8.pl: -------------------------------------------------------------------------------- 1 | my_max([1, 2, 3, 4], 5). -------------------------------------------------------------------------------- /api/tests/task_7_4_2/test_7.pl: -------------------------------------------------------------------------------- 1 | max_occur([], ["abcd"]). -------------------------------------------------------------------------------- /api/tests/task_7_5_1+2/test_1.ans: -------------------------------------------------------------------------------- 1 | Result = [[]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_7_5_1+2/test_3.ans: -------------------------------------------------------------------------------- 1 | Result = [[]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_7_5_1+2/test_4.ans: -------------------------------------------------------------------------------- 1 | Result = [[]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_7_5_1+2/test_5.ans: -------------------------------------------------------------------------------- 1 | Result = [[]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_7_5_1+2/test_7.ans: -------------------------------------------------------------------------------- 1 | Result = [[]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_7_5_1+2/test_8.ans: -------------------------------------------------------------------------------- 1 | Result = [[]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_5_1/test_8.ans: -------------------------------------------------------------------------------- 1 | Result = [[dima]] 2 | yes 3 | -------------------------------------------------------------------------------- /api/tests/task_5_1/test_8.pl: -------------------------------------------------------------------------------- 1 | grandfather(Person, vlad). 2 | -------------------------------------------------------------------------------- /api/tests/task_5_2_2/test_3.ans: -------------------------------------------------------------------------------- 1 | Result = [[a],[b],[c]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_5_5_2/test_3.ans: -------------------------------------------------------------------------------- 1 | Result = [[[2,3,4]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_5_5_3/test_1.pl: -------------------------------------------------------------------------------- 1 | my_prefix([1,2,3], [1, 2]). 2 | -------------------------------------------------------------------------------- /api/tests/task_5_5_3/test_2.pl: -------------------------------------------------------------------------------- 1 | my_prefix([1,2,3], [3]). 2 | -------------------------------------------------------------------------------- /api/tests/task_5_5_3/test_3.pl: -------------------------------------------------------------------------------- 1 | my_prefix([1,2,3], [1,2,3]). 2 | -------------------------------------------------------------------------------- /api/tests/task_5_5_3/test_4.pl: -------------------------------------------------------------------------------- 1 | my_prefix([1,2,3], [1]). 2 | -------------------------------------------------------------------------------- /api/tests/task_5_5_4/test_2.pl: -------------------------------------------------------------------------------- 1 | my_sublist([1,2,3,4,5], [6,7]). -------------------------------------------------------------------------------- /api/tests/task_5_5_4/test_6.pl: -------------------------------------------------------------------------------- 1 | my_sublist([1,2,3,4,5], [1,3,5]). -------------------------------------------------------------------------------- /api/tests/task_5_5_5/test_6.pl: -------------------------------------------------------------------------------- 1 | my_less([1, 2, 3], [1, 2, 3]). -------------------------------------------------------------------------------- /api/tests/task_5_5_5/test_7.pl: -------------------------------------------------------------------------------- 1 | my_less([1, 2, 3], [4, 5, 6]). -------------------------------------------------------------------------------- /api/tests/task_5_5_6/test_2.pl: -------------------------------------------------------------------------------- 1 | my_subset([1,2,3,4], [1,2,3]). -------------------------------------------------------------------------------- /api/tests/task_5_5_7/test_4.pl: -------------------------------------------------------------------------------- 1 | my_concat([1, 2, 3], [1, 2], X). -------------------------------------------------------------------------------- /api/tests/task_5_5_7/test_5.ans: -------------------------------------------------------------------------------- 1 | Result = [[[1,2,3]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_5_5_8/test_1.ans: -------------------------------------------------------------------------------- 1 | Result = [[[3,2,1]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_5_5_8/test_1.pl: -------------------------------------------------------------------------------- 1 | my_reverse(R, [1, 2, 3]). 2 | -------------------------------------------------------------------------------- /api/tests/task_5_5_8/test_2.pl: -------------------------------------------------------------------------------- 1 | my_reverse([1, 2, 3], [3, 2, 1]). -------------------------------------------------------------------------------- /api/tests/task_5_5_8/test_3.pl: -------------------------------------------------------------------------------- 1 | my_reverse([1, 2, 3], [2, 3, 1]). -------------------------------------------------------------------------------- /api/tests/task_5_5_9/test_1.pl: -------------------------------------------------------------------------------- 1 | my_period([1,2,3], [1,2,3]). 2 | -------------------------------------------------------------------------------- /api/tests/task_5_6_1/test_6.pl: -------------------------------------------------------------------------------- 1 | my_less([1,0,0,0,1], [1,0,0]). -------------------------------------------------------------------------------- /api/tests/task_5_6_2/test_2.pl: -------------------------------------------------------------------------------- 1 | my_sum([1,1], [0,1,1], [1,1,0]). -------------------------------------------------------------------------------- /api/tests/task_5_6_2/test_4.ans: -------------------------------------------------------------------------------- 1 | Result = [[[1,1,1,0]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_5_6_2/test_5.ans: -------------------------------------------------------------------------------- 1 | Result = [[[1,1,0]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_6_1_1/test_1.ans: -------------------------------------------------------------------------------- 1 | Result = [[[1,2,5,8,9]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_6_1_1/test_1.pl: -------------------------------------------------------------------------------- 1 | make_ordered([5, 2, 8, 1, 9], L). -------------------------------------------------------------------------------- /api/tests/task_6_1_1/test_4.ans: -------------------------------------------------------------------------------- 1 | Result = [[[0,0,0,0,0]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_6_1_1/test_4.pl: -------------------------------------------------------------------------------- 1 | make_ordered([0, 0, 0, 0, 0], L). -------------------------------------------------------------------------------- /api/tests/task_6_1_1/test_6.ans: -------------------------------------------------------------------------------- 1 | Result = [[[0,0,0,1]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_6_1_1/test_6.pl: -------------------------------------------------------------------------------- 1 | make_ordered([1, 0, 0, 0], L). -------------------------------------------------------------------------------- /api/tests/task_6_1_2/test_2.ans: -------------------------------------------------------------------------------- 1 | Result = [[[1,2,3,4]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_6_1_2/test_3.ans: -------------------------------------------------------------------------------- 1 | Result = [[[1,2,4,3]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_6_1_2/test_3.pl: -------------------------------------------------------------------------------- 1 | single([1, 2, 3, 2, 4, 3], L2). -------------------------------------------------------------------------------- /api/tests/task_6_1_3/test_1.pl: -------------------------------------------------------------------------------- 1 | common([1, 2, 3], [4, 5, 6], L3). -------------------------------------------------------------------------------- /api/tests/task_6_1_3/test_2.ans: -------------------------------------------------------------------------------- 1 | Result = [[[3,4,5]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_6_1_3/test_3.ans: -------------------------------------------------------------------------------- 1 | Result = [[[1,2,3]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_6_1_3/test_3.pl: -------------------------------------------------------------------------------- 1 | common([1, 2, 3], [1, 2, 3], L3). -------------------------------------------------------------------------------- /api/tests/task_6_1_3/test_7.ans: -------------------------------------------------------------------------------- 1 | Result = [[[1,2,3]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_6_2_1/test_2.pl: -------------------------------------------------------------------------------- 1 | my_length([1,2,3], Length). 2 | -------------------------------------------------------------------------------- /api/tests/task_6_2_1/test_3.pl: -------------------------------------------------------------------------------- 1 | my_length([1,2], Length). 2 | -------------------------------------------------------------------------------- /api/tests/task_6_2_3/test_7.pl: -------------------------------------------------------------------------------- 1 | my_mult([1, 1, 1, 1, 1], 1, Y). -------------------------------------------------------------------------------- /api/tests/task_6_2_4/test_1.pl: -------------------------------------------------------------------------------- 1 | most_oft([1, 2, 3, 1, 2, 1], X). -------------------------------------------------------------------------------- /api/tests/task_6_2_4/test_5.ans: -------------------------------------------------------------------------------- 1 | Result = [[[3,2,1]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_6_2_4/test_6.ans: -------------------------------------------------------------------------------- 1 | Result = [[[3,2,1]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_6_2_4/test_6.pl: -------------------------------------------------------------------------------- 1 | most_oft([1, 2, 3, 3, 2, 1], X). -------------------------------------------------------------------------------- /api/tests/task_6_2_4/test_8.pl: -------------------------------------------------------------------------------- 1 | most_oft([1, 1, 1, 1, 1, 1], X). -------------------------------------------------------------------------------- /api/tests/task_6_2_5/test_3.ans: -------------------------------------------------------------------------------- 1 | Result = [[[2,3,5,7]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_7_2_2/test_2.ans: -------------------------------------------------------------------------------- 1 | Result = [[[1,5,3,17]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_7_2_2/test_3.pl: -------------------------------------------------------------------------------- 1 | common([1, 5, 3, 7, 17], [], R). -------------------------------------------------------------------------------- /api/tests/task_7_2_3/test_1.ans: -------------------------------------------------------------------------------- 1 | Result = [[[5,7,9]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_7_2_3/test_1.pl: -------------------------------------------------------------------------------- 1 | nonsquare([1, 3, 5, 7, 9], R). -------------------------------------------------------------------------------- /api/tests/task_7_4_3/test_1.ans: -------------------------------------------------------------------------------- 1 | Result = [[[[1,2,3,4]]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_7_4_3/test_2.ans: -------------------------------------------------------------------------------- 1 | Result = [[[[1,2,3]]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_7_4_3/test_3.ans: -------------------------------------------------------------------------------- 1 | Result = [[[[1,2]]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_7_4_3/test_4.ans: -------------------------------------------------------------------------------- 1 | Result = [[[[1,2,4,6]]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_7_4_3/test_8.ans: -------------------------------------------------------------------------------- 1 | Result = [[[[3,5,4,6]]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_7_5_3/test_1.ans: -------------------------------------------------------------------------------- 1 | Result = [[[[1,2,3,4]]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_7_5_3/test_2.ans: -------------------------------------------------------------------------------- 1 | Result = [[[[1,2,3]]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_7_5_3/test_3.ans: -------------------------------------------------------------------------------- 1 | Result = [[[[1,2]]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_7_5_3/test_4.ans: -------------------------------------------------------------------------------- 1 | Result = [[[[1,2,4,6]]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_7_5_4/test_1.ans: -------------------------------------------------------------------------------- 1 | Result = [[[[1,2,3,4]]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_7_5_4/test_2.ans: -------------------------------------------------------------------------------- 1 | Result = [[[[1,2,1,2]]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_5_1/test_1.ans: -------------------------------------------------------------------------------- 1 | Result = [[kolya],[vasya]] 2 | yes 3 | -------------------------------------------------------------------------------- /api/tests/task_5_2_1/test_7.pl: -------------------------------------------------------------------------------- 1 | my_list('.'(a, '.'(b, '.'(c, [])))). -------------------------------------------------------------------------------- /api/tests/task_5_5_2/test_1.pl: -------------------------------------------------------------------------------- 1 | my_tail([1, 2, 3, 4], [2, 3, 4]). 2 | -------------------------------------------------------------------------------- /api/tests/task_5_5_4/test_1.pl: -------------------------------------------------------------------------------- 1 | my_sublist([1,2,3,4,5], [3,4]). 2 | -------------------------------------------------------------------------------- /api/tests/task_5_5_4/test_3.pl: -------------------------------------------------------------------------------- 1 | my_sublist([1,2,3,4,5], [1,2,3,4,5]). -------------------------------------------------------------------------------- /api/tests/task_5_5_5/test_1.pl: -------------------------------------------------------------------------------- 1 | my_less([1, 2, 3], [1, 2, 3, 4]). 2 | -------------------------------------------------------------------------------- /api/tests/task_5_5_6/test_1.pl: -------------------------------------------------------------------------------- 1 | my_subset([1,2,3], [1,2,3,4,5]). 2 | -------------------------------------------------------------------------------- /api/tests/task_5_5_6/test_6.pl: -------------------------------------------------------------------------------- 1 | my_subset([1,2,1], [1,2,3,1,4,5]). -------------------------------------------------------------------------------- /api/tests/task_5_5_6/test_7.pl: -------------------------------------------------------------------------------- 1 | my_subset([1,2,1], [1,2,3,4,4,5]). -------------------------------------------------------------------------------- /api/tests/task_5_5_7/test_2.pl: -------------------------------------------------------------------------------- 1 | my_concat([1, 2, 3], [], [1, 2, 3]). -------------------------------------------------------------------------------- /api/tests/task_5_5_7/test_3.pl: -------------------------------------------------------------------------------- 1 | my_concat([1, 2, 3, 4], [1, 2], [4]). -------------------------------------------------------------------------------- /api/tests/task_5_5_8/test_7.ans: -------------------------------------------------------------------------------- 1 | Result = [[[2,9,5,1,4,1,3]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_5_5_8/test_7.pl: -------------------------------------------------------------------------------- 1 | my_reverse(R, [3, 1, 4, 1, 5, 9, 2]). -------------------------------------------------------------------------------- /api/tests/task_5_5_9/test_5.pl: -------------------------------------------------------------------------------- 1 | my_period([1,2,3,1,2,3], [1,2,3]). -------------------------------------------------------------------------------- /api/tests/task_5_6_2/test_3.pl: -------------------------------------------------------------------------------- 1 | my_sum([1,1,1], [1,1,1], [1,1,0]). -------------------------------------------------------------------------------- /api/tests/task_6_1_1/shared_consult_data.pl: -------------------------------------------------------------------------------- 1 | not(X) :- \+ X. 2 | 3 | -------------------------------------------------------------------------------- /api/tests/task_6_1_1/test_2.ans: -------------------------------------------------------------------------------- 1 | Result = [[[-9,-8,-5,-2,-1]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_6_1_1/test_2.pl: -------------------------------------------------------------------------------- 1 | make_ordered([-5, -2, -8, -1, -9], L). -------------------------------------------------------------------------------- /api/tests/task_6_1_1/test_3.ans: -------------------------------------------------------------------------------- 1 | Result = [[[-2,-1,5,8,9]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_6_1_1/test_3.pl: -------------------------------------------------------------------------------- 1 | make_ordered([5, -2, 8, -1, 9], L). -------------------------------------------------------------------------------- /api/tests/task_6_1_1/test_5.ans: -------------------------------------------------------------------------------- 1 | Result = [[[-3,-1,0,1,1]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_6_1_1/test_5.pl: -------------------------------------------------------------------------------- 1 | make_ordered([1, 0, 1, -1, -3], L). -------------------------------------------------------------------------------- /api/tests/task_6_1_2/shared_consult_data.pl: -------------------------------------------------------------------------------- 1 | not(X) :- \+ X. 2 | 3 | -------------------------------------------------------------------------------- /api/tests/task_6_1_2/test_5.ans: -------------------------------------------------------------------------------- 1 | Result = [[[-1,-2,-4,-3]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_6_1_2/test_5.pl: -------------------------------------------------------------------------------- 1 | single([-1, -2, -3, -2, -4, -3], L2). -------------------------------------------------------------------------------- /api/tests/task_6_1_2/test_7.ans: -------------------------------------------------------------------------------- 1 | Result = [[[6,5,4,3,2,1]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_6_1_3/shared_consult_data.pl: -------------------------------------------------------------------------------- 1 | not(X) :- \+ X. 2 | 3 | -------------------------------------------------------------------------------- /api/tests/task_6_2_1/shared_consult_data.pl: -------------------------------------------------------------------------------- 1 | not(X) :- \+ X. 2 | 3 | -------------------------------------------------------------------------------- /api/tests/task_6_2_1/test_4.pl: -------------------------------------------------------------------------------- 1 | my_length([1,2,3,5], Length). 2 | -------------------------------------------------------------------------------- /api/tests/task_6_2_2/shared_consult_data.pl: -------------------------------------------------------------------------------- 1 | not(X) :- \+ X. 2 | 3 | -------------------------------------------------------------------------------- /api/tests/task_6_2_3/shared_consult_data.pl: -------------------------------------------------------------------------------- 1 | not(X) :- \+ X. 2 | 3 | -------------------------------------------------------------------------------- /api/tests/task_6_2_3/test_1.pl: -------------------------------------------------------------------------------- 1 | my_mult([1, 2, 3, 1, 2, 1], 1, Y). -------------------------------------------------------------------------------- /api/tests/task_6_2_3/test_2.pl: -------------------------------------------------------------------------------- 1 | my_mult([1, 2, 3, 1, 2, 1], 2, Y). -------------------------------------------------------------------------------- /api/tests/task_6_2_3/test_3.pl: -------------------------------------------------------------------------------- 1 | my_mult([1, 2, 3, 1, 2, 1], 3, Y). -------------------------------------------------------------------------------- /api/tests/task_6_2_3/test_4.pl: -------------------------------------------------------------------------------- 1 | my_mult([1, 2, 3, 1, 2, 1], 4, Y). -------------------------------------------------------------------------------- /api/tests/task_6_2_4/shared_consult_data.pl: -------------------------------------------------------------------------------- 1 | not(X) :- \+ X. 2 | 3 | -------------------------------------------------------------------------------- /api/tests/task_6_2_4/test_2.pl: -------------------------------------------------------------------------------- 1 | most_oft([1, 2, 3, 1, 2, 1, 3, 3], X). -------------------------------------------------------------------------------- /api/tests/task_6_2_5/shared_consult_data.pl: -------------------------------------------------------------------------------- 1 | not(X) :- \+ X. 2 | 3 | -------------------------------------------------------------------------------- /api/tests/task_6_2_6/shared_consult_data.pl: -------------------------------------------------------------------------------- 1 | not(X) :- \+ X. 2 | 3 | -------------------------------------------------------------------------------- /api/tests/task_7_2_2/test_1.pl: -------------------------------------------------------------------------------- 1 | common([1, 5, 3], [5, 4, 3, 2, 1], R). -------------------------------------------------------------------------------- /api/tests/task_7_2_3/test_2.pl: -------------------------------------------------------------------------------- 1 | nonsquare([1, 3, 5, 7, 9], [5, 7, 9]). -------------------------------------------------------------------------------- /api/tests/task_7_2_3/test_4.pl: -------------------------------------------------------------------------------- 1 | nonsquare([1, 3, 5, 7, 9], [7, 9]). -------------------------------------------------------------------------------- /api/tests/task_7_2_3/test_5.ans: -------------------------------------------------------------------------------- 1 | Result = [[[11,8,81,49,5]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_7_4_1/shared_consult_data.pl: -------------------------------------------------------------------------------- 1 | not(X) :- \+ X. 2 | 3 | -------------------------------------------------------------------------------- /api/tests/task_7_4_2/shared_consult_data.pl: -------------------------------------------------------------------------------- 1 | not(X) :- \+ X. 2 | 3 | -------------------------------------------------------------------------------- /api/tests/task_7_4_2/test_4.ans: -------------------------------------------------------------------------------- 1 | Result = [[[[97,98,99,100]]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_7_4_3/shared_consult_data.pl: -------------------------------------------------------------------------------- 1 | not(X) :- \+ X. 2 | 3 | -------------------------------------------------------------------------------- /api/tests/task_7_5_3/shared_consult_data.pl: -------------------------------------------------------------------------------- 1 | not(X) :- \+ X. 2 | 3 | -------------------------------------------------------------------------------- /api/tests/task_7_5_4/test_3.ans: -------------------------------------------------------------------------------- 1 | Result = [[[[1,2,3,4,5]]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_7_5_4/test_4.ans: -------------------------------------------------------------------------------- 1 | Result = [[[[1,2,3,4,5,6]]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_7_5_4/test_5.ans: -------------------------------------------------------------------------------- 1 | Result = [[[[1,2,3,4,1,2]]]] 2 | yes -------------------------------------------------------------------------------- /api/examples/task_5_2_1.pl: -------------------------------------------------------------------------------- 1 | my_list([]). 2 | my_list([_|T]) :- my_list(T). -------------------------------------------------------------------------------- /api/tests/task_5_1/test_19.ans: -------------------------------------------------------------------------------- 1 | Result = [[nastya],[sasha]] 2 | yes 3 | -------------------------------------------------------------------------------- /api/tests/task_5_5_7/test_1.pl: -------------------------------------------------------------------------------- 1 | my_concat([1, 2, 3], [1, 2], [3]). 2 | -------------------------------------------------------------------------------- /api/tests/task_5_6_2/test_1.pl: -------------------------------------------------------------------------------- 1 | my_sum([1,1,0], [1,1,0], [1,1,0]). 2 | -------------------------------------------------------------------------------- /api/tests/task_6_1_3/test_7.pl: -------------------------------------------------------------------------------- 1 | common([1, 2, 3, 5], [3, 7, 1, 2], L3). -------------------------------------------------------------------------------- /api/tests/task_6_1_3/test_8.pl: -------------------------------------------------------------------------------- 1 | common([4, 5, 2, 6, 1], [1, 2, 8, 7], L3). -------------------------------------------------------------------------------- /api/tests/task_6_2_5/test_1.ans: -------------------------------------------------------------------------------- 1 | Result = [[[2,3,5,7,11,13,17,19]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_7_4_2/test_4.pl: -------------------------------------------------------------------------------- 1 | max_occur(["a", "ab", "abc", "abcd"], L). -------------------------------------------------------------------------------- /api/tests/task_7_4_3/test_5.ans: -------------------------------------------------------------------------------- 1 | Result = [[[[1,2,5],[1,3,5]]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_7_4_3/test_7.ans: -------------------------------------------------------------------------------- 1 | Result = [[[[5,3,1],[5,2,1]]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_7_5_3/test_5.ans: -------------------------------------------------------------------------------- 1 | Result = [[[[1,2,5],[1,3,5]]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_7_5_3/test_6.ans: -------------------------------------------------------------------------------- 1 | Result = [[[[2,1,3],[2,5,3]]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_7_5_3/test_7.ans: -------------------------------------------------------------------------------- 1 | Result = [[[[5,3,1],[5,2,1]]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_7_5_3/test_8.ans: -------------------------------------------------------------------------------- 1 | Result = [[[[3,5,4,6],[3,2,4,6]]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_5_5_4/test_5.ans: -------------------------------------------------------------------------------- 1 | Result = [[[]],[[1]],[[1,2]],[[2]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_5_5_9/test_6.pl: -------------------------------------------------------------------------------- 1 | my_period([1,2,3,1,2,3,1,2,3,1,2,3], [1,2,3]). -------------------------------------------------------------------------------- /api/tests/task_5_5_9/test_7.pl: -------------------------------------------------------------------------------- 1 | my_period([1,2,3,1,2,1,2,3,1,2,3], [1,2,3]). -------------------------------------------------------------------------------- /api/tests/task_6_1_2/test_7.pl: -------------------------------------------------------------------------------- 1 | single([1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1], L2). -------------------------------------------------------------------------------- /api/tests/task_6_1_3/test_2.pl: -------------------------------------------------------------------------------- 1 | common([1, 2, 3, 4, 5], [3, 4, 5, 6, 7], L3). -------------------------------------------------------------------------------- /api/tests/task_6_2_4/test_3.pl: -------------------------------------------------------------------------------- 1 | most_oft([1, 2, 3, 1, 2, 1, 3, 3, 3, 3], X). -------------------------------------------------------------------------------- /api/tests/task_7_2_3/test_5.pl: -------------------------------------------------------------------------------- 1 | nonsquare([1, 11, 3, 8, 81, 3, 7, 49, 5, 9], R). -------------------------------------------------------------------------------- /api/tests/task_7_4_2/test_6.pl: -------------------------------------------------------------------------------- 1 | max_occur(["a", "ab", "abc", "abcd"], ["abcd"]). -------------------------------------------------------------------------------- /api/tests/task_7_4_3/test_1.pl: -------------------------------------------------------------------------------- 1 | short_path(1, 4, [[1, 2], [2, 3], [3, 4]], P). -------------------------------------------------------------------------------- /api/tests/task_7_4_3/test_3.pl: -------------------------------------------------------------------------------- 1 | short_path(1, 2, [[1, 2], [2, 3], [3, 4]], P). -------------------------------------------------------------------------------- /api/tests/task_5_5_8/test_4.pl: -------------------------------------------------------------------------------- 1 | my_reverse(R, [1, a, 3.14, 'hello', [1, 2, 3], 1]). -------------------------------------------------------------------------------- /api/tests/task_7_2_2/test_2.pl: -------------------------------------------------------------------------------- 1 | common([1, 5, 3, 7, 17], [5, 4, 17, 3, 2, 1], R). -------------------------------------------------------------------------------- /api/tests/task_7_2_3/test_3.pl: -------------------------------------------------------------------------------- 1 | nonsquare([1, 11, 3, 7, 49, 5, 9], [5, 7, 49, 81]). -------------------------------------------------------------------------------- /api/tests/task_7_5_1+2/test_8.pl: -------------------------------------------------------------------------------- 1 | reach([a,b,c,d],[[a,b],[b,c],[c,a],[b,d]], a, d). -------------------------------------------------------------------------------- /api/tests/task_7_5_4/test_2.pl: -------------------------------------------------------------------------------- 1 | color([1, 2, 3, 4], [[1, 2], [2, 3], [3, 4]], C2). -------------------------------------------------------------------------------- /api/examples/task_5_2_2.pl: -------------------------------------------------------------------------------- 1 | my_elem(X, [X|_]). 2 | my_elem(X, [_|T]) :- my_elem(X, T). -------------------------------------------------------------------------------- /api/examples/task_7_2_1.pl: -------------------------------------------------------------------------------- 1 | max(X, Y, Z) :- X > Y, !, Z is X. 2 | max(_, Y, Z) :- Z is Y. -------------------------------------------------------------------------------- /api/tests/task_7_2_2/test_5.pl: -------------------------------------------------------------------------------- 1 | common([1, 5, 3, 7, 17], [5, 4, 17, 3, 2, 1], [5, 3, 17]). -------------------------------------------------------------------------------- /api/tests/task_7_4_2/test_9.pl: -------------------------------------------------------------------------------- 1 | max_occur(["a", "ab", "abc", "abcd"], ["abcd", "cdef"]). -------------------------------------------------------------------------------- /api/tests/task_7_5_1+2/test_1.pl: -------------------------------------------------------------------------------- 1 | reach([1, 2, 3, 4], [[1, 2], [2, 3], [3, 4]], 1, 4). -------------------------------------------------------------------------------- /api/tests/task_7_5_1+2/test_2.pl: -------------------------------------------------------------------------------- 1 | reach([1, 2, 3, 4], [[1, 2], [2, 3], [3, 4]], 4, 1). -------------------------------------------------------------------------------- /api/tests/task_7_5_1+2/test_6.pl: -------------------------------------------------------------------------------- 1 | reach([1, 2, 3, 4], [[1, 2], [2, 3], [3, 4]], 1, 5). -------------------------------------------------------------------------------- /api/tests/task_7_5_4/test_1.pl: -------------------------------------------------------------------------------- 1 | color([1, 2, 3, 4], [[1, 2], [2, 3], [3, 4], [4, 1]], C1). -------------------------------------------------------------------------------- /api/submit.sh: -------------------------------------------------------------------------------- 1 | curl \ 2 | -F "submission=@"$1 \ 3 | http://localhost:3001/submit \ 4 | -------------------------------------------------------------------------------- /api/tests/task_5_5_8/test_4.ans: -------------------------------------------------------------------------------- 1 | Result = [[[1,[1,2,3],hello,3.1400000000000001,a,1]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_7_2_2/test_4.pl: -------------------------------------------------------------------------------- 1 | common([1, 5, 3, 7, 17], [5, 4, 17, 3, 2, 1], [1, 5, 3, 17]). -------------------------------------------------------------------------------- /api/tests/task_7_4_2/test_5.pl: -------------------------------------------------------------------------------- 1 | max_occur(["a", "ab", "abc", "abcd"], ["ab", "abc", "abcd"]). -------------------------------------------------------------------------------- /api/tests/task_7_5_1+2/test_3.pl: -------------------------------------------------------------------------------- 1 | reach([1, 2, 3, 4], [[1, 2], [2, 3], [3, 4], [4, 1]], 4, 1). -------------------------------------------------------------------------------- /api/tests/task_7_5_1+2/test_5.pl: -------------------------------------------------------------------------------- 1 | reach([1, 2, 3, 4], [[1, 2], [2, 3], [3, 4], [4, 1]], 1, 4). -------------------------------------------------------------------------------- /api/tests/task_7_5_1+2/test_7.pl: -------------------------------------------------------------------------------- 1 | reach([1, 2, 3, 4], [[1, 2], [2, 3], [3, 4], [4, 4]], 4, 4). -------------------------------------------------------------------------------- /api/tests/task_7_5_3/test_1.pl: -------------------------------------------------------------------------------- 1 | short_path([1, 2, 3, 4], [[1, 2], [2, 3], [3, 4]], 1, 4, P). -------------------------------------------------------------------------------- /api/tests/task_7_5_3/test_3.pl: -------------------------------------------------------------------------------- 1 | short_path([1, 2, 3, 4], [[1, 2], [2, 3], [3, 4]], 1, 2, P). -------------------------------------------------------------------------------- /api/wsgi.py: -------------------------------------------------------------------------------- 1 | from api import app 2 | 3 | if __name__ == "__main__": 4 | app.run() 5 | -------------------------------------------------------------------------------- /api/submit_and_execute.sh: -------------------------------------------------------------------------------- 1 | ./submit.sh $2 2>/dev/null | jq .submission_id | xargs ./execute.sh $1 2 | -------------------------------------------------------------------------------- /api/tests/task_5_1/test_16.ans: -------------------------------------------------------------------------------- 1 | Result = [[kolya],[max],[nastya],[sasha],[vasya],[vlad]] 2 | yes 3 | -------------------------------------------------------------------------------- /api/tests/task_7_4_3/test_2.pl: -------------------------------------------------------------------------------- 1 | short_path(1, 3, [[1, 2], [2, 4], [4, 3], [2, 1], [2, 3], [3, 4]], P). -------------------------------------------------------------------------------- /api/tests/task_7_5_1+2/test_4.pl: -------------------------------------------------------------------------------- 1 | reach([1, 2, 3, 4, 5], [[1, 2], [1, 3], [2, 4], [3, 4], [4, 5]], 1, 5). -------------------------------------------------------------------------------- /api/examples/task_6_2_1.hl: -------------------------------------------------------------------------------- 1 | my_length(nil, 0); 2 | my_length(A.L, Length) <- my_length(L, Y), Length is Y + 1; -------------------------------------------------------------------------------- /api/examples/task_6_2_3.pl: -------------------------------------------------------------------------------- 1 | my_mult(L, X, Y) :- 2 | findall(X, member(X, L), Xs), 3 | length(Xs, Y). -------------------------------------------------------------------------------- /api/tests/task_7_4_3/test_4.pl: -------------------------------------------------------------------------------- 1 | short_path(1, 6, [[1, 2], [1, 3], [2, 4], [2, 5], [3, 5], [4, 5], [4, 6]], P). -------------------------------------------------------------------------------- /api/tests/task_7_4_3/test_5.pl: -------------------------------------------------------------------------------- 1 | short_path(1, 5, [[1, 2], [1, 3], [2, 4], [2, 5], [3, 5], [4, 5], [4, 6]], P). -------------------------------------------------------------------------------- /api/tests/task_7_4_3/test_6.pl: -------------------------------------------------------------------------------- 1 | short_path(2, 3, [[1, 2], [1, 3], [2, 4], [2, 5], [3, 5], [4, 5], [4, 6]], P). -------------------------------------------------------------------------------- /api/tests/task_7_4_3/test_7.pl: -------------------------------------------------------------------------------- 1 | short_path(5, 1, [[2, 1], [3, 1], [2, 4], [5, 3], [5, 2], [4, 5], [4, 6]], P). -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | api/submissions 2 | .idea 3 | venv 4 | **/__pycache__ 5 | react-frontend/package-lock.json 6 | .env -------------------------------------------------------------------------------- /api/tests/task_6_2_1/test_5.pl: -------------------------------------------------------------------------------- 1 | my_length([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], Length). -------------------------------------------------------------------------------- /api/tests/task_7_4_2/test_1.ans: -------------------------------------------------------------------------------- 1 | Result = [[[[113,117,105,99,107],[98,114,111,119,110],[106,117,109,112,115]]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_7_5_3/test_2.pl: -------------------------------------------------------------------------------- 1 | short_path([1, 2, 3, 4], [[1, 2], [2, 4], [4, 3], [2, 1], [2, 3], [3, 4]], 1, 3, P). -------------------------------------------------------------------------------- /api/tests/task_7_5_4/test_3.pl: -------------------------------------------------------------------------------- 1 | color([1, 2, 3, 4, 5], [[1, 2], [1, 3], [1, 4], [1, 5], [2, 3], [3, 4], [4, 5]], C3). -------------------------------------------------------------------------------- /api/examples/task_6_2_2.pl: -------------------------------------------------------------------------------- 1 | my_sum([], 0). 2 | my_sum([Head|Tail], Sum) :- 3 | my_sum(Tail, Sum1), 4 | Sum is Head + Sum1. -------------------------------------------------------------------------------- /api/tests/task_6_2_5/test_4.ans: -------------------------------------------------------------------------------- 1 | Result = [[[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97]]] 2 | yes -------------------------------------------------------------------------------- /api/tests/task_7_4_2/test_1.pl: -------------------------------------------------------------------------------- 1 | max_occur(["the", "quick", "brown", "fox", "jumps", "over", "the", "lazy", "dog"], LongestWords). -------------------------------------------------------------------------------- /api/tests/task_7_5_3/test_4.pl: -------------------------------------------------------------------------------- 1 | short_path([1, 2, 3, 4, 5, 6], [[1, 2], [1, 3], [2, 4], [2, 5], [3, 5], [4, 5], [4, 6]], 1, 6, P). -------------------------------------------------------------------------------- /api/tests/task_7_5_3/test_5.pl: -------------------------------------------------------------------------------- 1 | short_path([1, 2, 3, 4, 5, 6], [[1, 2], [1, 3], [2, 4], [2, 5], [3, 5], [4, 5], [4, 6]], 1, 5, P). -------------------------------------------------------------------------------- /api/tests/task_7_5_3/test_6.pl: -------------------------------------------------------------------------------- 1 | short_path([1, 2, 3, 4, 5, 6], [[1, 2], [1, 3], [2, 4], [2, 5], [3, 5], [4, 5], [4, 6]], 2, 3, P). -------------------------------------------------------------------------------- /api/tests/task_7_5_3/test_7.pl: -------------------------------------------------------------------------------- 1 | short_path([1, 2, 3, 4, 5, 6], [[2, 1], [3, 1], [2, 4], [5, 3], [5, 2], [4, 5], [4, 6]], 5, 1, P). -------------------------------------------------------------------------------- /api/tests/task_7_4_2/test_3.pl: -------------------------------------------------------------------------------- 1 | max_occur(["the", "quick", "brown", "fox", "jumps", "over", "the", "lazy", "dog"], ["quick", "brown"]). -------------------------------------------------------------------------------- /react-frontend/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m-danya/prolog-testing-system/HEAD/react-frontend/public/favicon.ico -------------------------------------------------------------------------------- /api/examples/task_5_5_3.pl: -------------------------------------------------------------------------------- 1 | my_prefix(L, []). 2 | my_prefix([A|L], [A|[]]). 3 | my_prefix([A|L1], [A|L2]) :- my_prefix(L1, L2). 4 | 5 | -------------------------------------------------------------------------------- /api/examples/task_7_4_1.pl: -------------------------------------------------------------------------------- 1 | my_max([X], X). 2 | my_max([X|Xs], M) :- my_max(Xs, M), M >= X. 3 | my_max([X|Xs], X) :- my_max(Xs, M), M < X. -------------------------------------------------------------------------------- /api/tests/task_7_5_4/test_5.pl: -------------------------------------------------------------------------------- 1 | color([1, 2, 3, 4, 5, 6], [[1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [2, 3], [3, 4], [4, 5], [5, 6]], C5). -------------------------------------------------------------------------------- /api/tests/task_7_4_2/test_2.pl: -------------------------------------------------------------------------------- 1 | max_occur(["the", "quick", "brown", "fox", "jumps", "over", "the", "lazy", "dog"], ["quick", "brown", "jumps"]). -------------------------------------------------------------------------------- /api/tests/task_7_4_3/test_8.pl: -------------------------------------------------------------------------------- 1 | short_path(3, 6, [[1, 2], [1, 3], [2, 4], [2, 5], [3, 5], [5, 2], [5, 3], [5, 5], [2, 3], [5, 4], [4, 6]], P). -------------------------------------------------------------------------------- /api/tests/task_7_5_4/test_4.pl: -------------------------------------------------------------------------------- 1 | color([1, 2, 3, 4, 5, 6], [[1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [2, 3], [3, 4], [4, 5], [5, 6], [6, 2]], C4). -------------------------------------------------------------------------------- /api/examples/task_7_4_2.pl: -------------------------------------------------------------------------------- 1 | max_occur(L1, L2) :- 2 | findall(X, (member(X, L1), not((member(Y, L1), length(Y, N), length(X, N1), N > N1))), L2). -------------------------------------------------------------------------------- /api/requirements.txt: -------------------------------------------------------------------------------- 1 | Flask==2.2.2 2 | flask_cors==3.0.10 3 | flask_restful==0.3.9 4 | Jinja2==3.1.2 5 | regex==2022.10.31 6 | Werkzeug==2.2.2 7 | -------------------------------------------------------------------------------- /api/examples/task_6_1_3.pl: -------------------------------------------------------------------------------- 1 | common(L1, L2, L3) :- 2 | findall(X, (member(X, L1), member(X, L2)), L3). % надо бы написать тут чет умное вместо этого -------------------------------------------------------------------------------- /api/examples/task_5_5_7.pl: -------------------------------------------------------------------------------- 1 | my_concat([A|X], [A|Y], Z) :- my_concat(X, Y, Z). 2 | my_concat([A|X], [], [A|Z]) :- my_concat(X, [], Z). 3 | my_concat([], [], []). -------------------------------------------------------------------------------- /api/tests/task_7_5_3/test_8.pl: -------------------------------------------------------------------------------- 1 | short_path([1, 2, 3, 4, 5, 6], [[1, 2], [1, 3], [2, 4], [2, 5], [3, 5], [5, 2], [5, 3], [5, 5], [2, 3], [5, 4], [4, 6]], 3, 6, P). -------------------------------------------------------------------------------- /react-frontend/src/style.css: -------------------------------------------------------------------------------- 1 | .Mui-disabled { 2 | background-color: #1976d2 !important; 3 | } 4 | 5 | .MuiCircularProgress-colorPrimary { 6 | color: #ffffff !important; 7 | } -------------------------------------------------------------------------------- /api/examples/task_5_5_6.pl: -------------------------------------------------------------------------------- 1 | my_subset([], _). 2 | my_subset([X|Xs], Y) :- member(X, Y), my_subset(Xs, Y). % мы все равно уже писали аналог member, почему бые го не использовать 3 | 4 | -------------------------------------------------------------------------------- /api/execute.sh: -------------------------------------------------------------------------------- 1 | curl \ 2 | -H "Content-Type: application/json" \ 3 | -d '{"type": "gprolog", "task": "'$1'", "submission_id": "'$2'"}' \ 4 | http://localhost:3001/execute 5 | 6 | -------------------------------------------------------------------------------- /api/settings.py: -------------------------------------------------------------------------------- 1 | from pathlib import Path 2 | 3 | SUBMISSIONS_DIRECTORY = Path("submissions") 4 | TESTS_DIRECTORY = Path("tests") 5 | EXECUTION_TIMEOUT_VALUE = 2 6 | TEST_EXTS = [".ans", ".py"] 7 | -------------------------------------------------------------------------------- /api/tests/task_7_2_2/test_1.py: -------------------------------------------------------------------------------- 1 | from common import test 2 | 3 | expected = {1, 3, 5} 4 | 5 | 6 | def test_result(output_lines, test_number): 7 | return test(output_lines, test_number, expected) 8 | -------------------------------------------------------------------------------- /api/tests/task_7_2_2/test_2.py: -------------------------------------------------------------------------------- 1 | from common import test 2 | 3 | expected = {1, 3, 5, 17} 4 | 5 | 6 | def test_result(output_lines, test_number): 7 | return test(output_lines, test_number, expected) 8 | -------------------------------------------------------------------------------- /react-frontend/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:18.12.1-alpine 2 | WORKDIR /app 3 | COPY package.json /app/package.json 4 | RUN npm install 5 | COPY . /app 6 | EXPOSE ${FRONTEND_PORT} 7 | CMD export PORT=${FRONTEND_PORT} && npm start -------------------------------------------------------------------------------- /api/examples/task_7_5_1+2.pl: -------------------------------------------------------------------------------- 1 | reach(V, E, X, Y) :- member(X, V), member(Y, V), reach_(E, X, Y). 2 | 3 | reach_([[X, Y]|_], X, Y). 4 | reach_([[X, Z]|T], X, Y) :- reach_(T, Z, Y). 5 | reach_([[_, _]|T], X, Y) :- reach_(T, X, Y). -------------------------------------------------------------------------------- /api/test_prolog_program.j2: -------------------------------------------------------------------------------- 1 | cat {{ test_file }} | sed --expression='s/^\(.*\)\.$/setof\({{ variables_list }},\1, Result\)\./g' | gprolog --consult-file {{ shared_consult_data_file }} --consult-file {{ submission_file }}; exit 0 -------------------------------------------------------------------------------- /api/examples/task_6_1_2.pl: -------------------------------------------------------------------------------- 1 | single([], []). % тоже надо чет поумнее и более соответсвующее заданию, но я надо спешить 2 | single([H|T], L2) :- member(H, T), single(T, L2). 3 | single([H|T], [H|L2]) :- \+ member(H, T), single(T, L2). -------------------------------------------------------------------------------- /api/examples/task_7_2_2.pl: -------------------------------------------------------------------------------- 1 | common([], _, []). 2 | common([H1|T], L2, [H2|R]) :- elem(H1, L2), !, common(T, L2, R), H2 is H1. 3 | common([_|T], L2, R) :- common(T, L2, R). 4 | 5 | 6 | elem(X, [X|_]). 7 | elem(X, [_|T]) :- elem(X, T). -------------------------------------------------------------------------------- /api/tests/task_5_5_1/description.md: -------------------------------------------------------------------------------- 1 | ## Упражнение 5.5.1 2 | Построить логические программы, описывающие следующие свойства и 3 | отношения на множестве списков. 4 | 5 | 1. `my_head(L, X):` Заголовком списка L является элемент X; 6 | -------------------------------------------------------------------------------- /api/tests/task_5_5_2/description.md: -------------------------------------------------------------------------------- 1 | ## Упражнение 5.5.2 2 | Построить логические программы, описывающие следующие свойства и 3 | отношения на множестве списков. 4 | 5 | 2. `my_tail(L, X):` Хвостом списка L является список X; 6 | -------------------------------------------------------------------------------- /api/tests/task_5_5_5/description.md: -------------------------------------------------------------------------------- 1 | ## Упражнение 5.5.5 2 | Построить логические программы, описывающие следующие свойства и 3 | отношения на множестве списков. 4 | 5 | 5. `my_less(X, Y):` Длина списка X меньше длины списка Y ; 6 | -------------------------------------------------------------------------------- /api/tests/task_7_4_1/description.md: -------------------------------------------------------------------------------- 1 | ## Упражнение 7.4.1 2 | 3 | Используя оператор not, написать логические программы решения следующих задач 4 | 5 | 1. Вычисления максимального элемента списка L. 6 | Запрос `? my_max(L, x)`. 7 | -------------------------------------------------------------------------------- /api/tests/task_5_5_4/description.md: -------------------------------------------------------------------------------- 1 | ## Упражнение 5.5.4 2 | Построить логические программы, описывающие следующие свойства и 3 | отношения на множестве списков. 4 | 5 | 4. `my_sublist(L, X):` Список X является подсписком списка L; 6 | -------------------------------------------------------------------------------- /api/tests/task_6_2_1/description.md: -------------------------------------------------------------------------------- 1 | ## Упражнение 6.2.1 2 | 3 | Используя оператор вычисления значений, построить логические программы, решающие следующие задачи. 4 | 5 | 1. Вычислить длину X списка L. 6 | Запрос `my_length(L, X);` 7 | -------------------------------------------------------------------------------- /api/tests/task_7_2_1/description.md: -------------------------------------------------------------------------------- 1 | ## Упражнение 7.2.1 2 | 3 | Используя оператор отсечения написать программы решения следующих 4 | задач: 5 | 6 | 1. Вычисления наибольшего числа R из двух чисел X, Y. 7 | Запрос `? max(X, Y, R)`. 8 | -------------------------------------------------------------------------------- /api/tests/task_5_5_3/description.md: -------------------------------------------------------------------------------- 1 | ## Упражнение 5.5.3 2 | Построить логические программы, описывающие следующие свойства и 3 | отношения на множестве списков. 4 | 5 | 3. `my_prefix(L, X):` Префиксом (начальным подсписком) списка L является список X; 6 | -------------------------------------------------------------------------------- /api/tests/task_5_5_6/description.md: -------------------------------------------------------------------------------- 1 | ## Упражнение 5.5.6 2 | Построить логические программы, описывающие следующие свойства и 3 | отношения на множестве списков. 4 | 5 | 6. `my_subset(X, Y):` Список X состоит только из элементов, содержащихся в списке Y ; 6 | -------------------------------------------------------------------------------- /api/tests/task_6_2_2/description.md: -------------------------------------------------------------------------------- 1 | ## Упражнение 6.2.2 2 | 3 | Используя оператор вычисления значений, построить логические программы, решающие следующие задачи. 4 | 5 | 2. Вычислить сумму X элементов целочисленного списка L; 6 | Запрос `my_sum(L, X);` 7 | -------------------------------------------------------------------------------- /api/tests/task_6_2_3/description.md: -------------------------------------------------------------------------------- 1 | ## Упражнение 6.2.3 2 | 3 | Используя оператор вычисления значений, построить логические программы, решающие следующие задачи. 4 | 5 | 3. Вычислить кратность Y вхождения элемента X в список L; 6 | Запрос `my_mult(L, X, Y);` 7 | -------------------------------------------------------------------------------- /api/tests/task_6_2_6/description.md: -------------------------------------------------------------------------------- 1 | ## Упражнение 6.2.6 2 | 3 | Используя оператор вычисления значений, построить логические программы, решающие следующие задачи. 4 | 5 | 6. Вычислить наибольший общий делитель Z двух целых чисел X и Y ; 6 | Запрос `gcd(X, Y, Z);` 7 | -------------------------------------------------------------------------------- /api/tests/task_7_2_2/description.md: -------------------------------------------------------------------------------- 1 | ## Упражнение 7.2.2 2 | 3 | Используя оператор отсечения написать программы решения следующих 4 | задач: 5 | 6 | 2. Вычисления пересечения L3 множеств L1 и L2, представленных бесповторными списками. 7 | Запрос `? common(L1 , L2 , L3)`. 8 | -------------------------------------------------------------------------------- /api/examples/task_6_2_4.pl: -------------------------------------------------------------------------------- 1 | most_oft(L, Xs) :- 2 | setof(C-E, (member(E, L), my_mult(L, E, C)), Cs), 3 | reverse(Cs, Rs), 4 | Rs = [C-_|_], 5 | findall(E, member(C-E, Rs), Xs). 6 | 7 | my_mult(L, X, Y) :- 8 | findall(X, member(X, L), Xs), 9 | length(Xs, Y). -------------------------------------------------------------------------------- /api/tests/task_5_5_7/description.md: -------------------------------------------------------------------------------- 1 | ## Упражнение 5.5.7 2 | Построить логические программы, описывающие следующие свойства и 3 | отношения на множестве списков. 4 | 5 | 7. `my_concat(X, Y, Z)`: Список X является конкатенацией (последовательным соединением) 6 | списков Y и Z; 7 | -------------------------------------------------------------------------------- /api/tests/task_6_2_5/description.md: -------------------------------------------------------------------------------- 1 | ## Упражнение 6.2.5 2 | 3 | Используя оператор вычисления значений, построить логические программы, решающие следующие задачи. 4 | 5 | 5. Вычислить список всех простых чисел, не превосходящих заданного числа X; 6 | Запрос `my_prime(L, X);` 7 | -------------------------------------------------------------------------------- /api/examples/task_6_2_1.pl: -------------------------------------------------------------------------------- 1 | my_length(List, Length) :- 2 | list(List), 3 | my_length(List, 0, Length). 4 | 5 | my_length([_|Tail], Accumulator, Length) :- 6 | NewAccumulator is Accumulator + 1, 7 | my_length(Tail, NewAccumulator, Length). 8 | 9 | my_length([], Length, Length). -------------------------------------------------------------------------------- /api/tests/task_6_1_1/description.md: -------------------------------------------------------------------------------- 1 | ## Упражнение 6.1.1 2 | 3 | Используя встроенные предикаты равенства, неравенства и сравнения 4 | чисел, написать логические программы решения следующих задач 5 | 6 | 1. Упорядочить целочисленный список L1. 7 | Запрос `? make_ordered(L1 , L2)`. 8 | -------------------------------------------------------------------------------- /api/tests/task_7_2_3/description.md: -------------------------------------------------------------------------------- 1 | ## Упражнение 7.2.3 2 | 3 | Используя оператор отсечения написать программы решения следующих 4 | задач: 5 | 6 | 3. Вычисления всех элементов целочисленного списка L1, квадраты которых не содержатся в этом списке. 7 | Запрос `? nonsquare(L1 , L2)`. 8 | -------------------------------------------------------------------------------- /api/tests/task_7_4_2/description.md: -------------------------------------------------------------------------------- 1 | ## Упражнение 7.4.2 2 | 3 | Используя оператор not, написать логические программы решения следующих задач 4 | 5 | 2. Вычисления списка самого длинного слова в тексте L. 6 | Запрос `? max_occur(L1 , L2)`. 7 | 8 | 9 | **Важно! Текст представлен в виде списка слов.** -------------------------------------------------------------------------------- /api/tests/task_7_5_4/description.md: -------------------------------------------------------------------------------- 1 | ## Упражнение 7.5.4 2 | 3 | Представляя граф G посредством пары списков, — списка вершин V и 4 | списка ребер E, — написать логические программы решения теоретико-графовых задач. 5 | 6 | 4. Для заданного графа G построить наименьшую его правильную раскраску. 7 | -------------------------------------------------------------------------------- /api/examples/task_7_2_3.pl: -------------------------------------------------------------------------------- 1 | nonsquare(L1, L2) :- nonsquare_(L1, L1, L2). 2 | 3 | nonsquare_([], _, []). 4 | nonsquare_([X|R1], L, R2) :- Z is X * X, elem(Z, L), !, nonsquare_(R1, L, R2). 5 | nonsquare_([X|R1], L, [X|R2]) :- nonsquare_(R1, L, R2). 6 | 7 | 8 | elem(X, [X|_]). 9 | elem(X, [_|T]) :- elem(X, T). -------------------------------------------------------------------------------- /api/tests/task_5_5_9/description.md: -------------------------------------------------------------------------------- 1 | ## Упражнение 5.5.9 2 | Построить логические программы, описывающие следующие свойства и 3 | отношения на множестве списков. 4 | 5 | 9. `my_period(X, Y):` Список X является периодической последовательностью, полученной в 6 | результате многократного повторения списка Y ; 7 | -------------------------------------------------------------------------------- /api/tests/task_7_4_3/description.md: -------------------------------------------------------------------------------- 1 | ## Упражнение 7.4.3 2 | 3 | Используя оператор not, написать логические программы решения следующих задач 4 | 5 | 3. Вычисления кратчайшего пути между двумя вершинами в ориентированном графе, 6 | представленном списком дуг Γ. 7 | Запрос `? short_path(v1 , v2 , Γ, L)`. 8 | -------------------------------------------------------------------------------- /react-frontend/src/index.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import ReactDOM from "react-dom/client"; 3 | import App from "./App"; 4 | 5 | const root = ReactDOM.createRoot(document.getElementById("root")); 6 | root.render( 7 | 8 | 9 | 10 | ); 11 | -------------------------------------------------------------------------------- /api/tests/task_6_2_4/description.md: -------------------------------------------------------------------------------- 1 | ## Упражнение 6.2.4 2 | 3 | Используя оператор вычисления значений, построить логические программы, решающие следующие задачи. 4 | 5 | 4. Вычислить самый распространенный элемент X в списке L; 6 | Запрос `most_oft(L, X);` 7 | 8 | **Важно! Если их несколько - выведите в порядке убывания.** 9 | -------------------------------------------------------------------------------- /api/tests/task_5_6_1/description.md: -------------------------------------------------------------------------------- 1 | ## Упражнение 5.6.1 2 | 3 | Натуральные числа X и Y представлены в двоичной системе счисления и их двоичные записи представлены в виде списков. Построить логические программы, 4 | описывающие следующие отношения на множестве натуральных чисел. 5 | 6 | 1. `my_less(X, Y):` Число X меньше числа Y; 7 | -------------------------------------------------------------------------------- /api/tests/task_5_6_2/description.md: -------------------------------------------------------------------------------- 1 | ## Упражнение 5.6.2 2 | 3 | Натуральные числа X и Y представлены в двоичной системе счисления и их двоичные записи представлены в виде списков. Построить логические программы, 4 | описывающие следующие отношения на множестве натуральных чисел. 5 | 6 | 2. `my_sum(X, Y, Z):` Число Z равно сумме чисел X и Y; 7 | -------------------------------------------------------------------------------- /api/examples/task_6_1_1.pl: -------------------------------------------------------------------------------- 1 | make_ordered(L1, L2) :- 2 | my_sort(L1, L2). 3 | 4 | my_sort([], []). 5 | my_sort([X|Xs], Sorted) :- 6 | my_sort(Xs, SortedTail), 7 | insert(X, SortedTail, Sorted). 8 | 9 | insert(X, [Y|Ys], [Y|Zs]) :- X > Y, insert(X, Ys, Zs). 10 | insert(X, [Y|Ys], [X,Y|Ys]) :- X =< Y. 11 | insert(X, [], [X]). 12 | -------------------------------------------------------------------------------- /api/tests/task_5_2_2/description.md: -------------------------------------------------------------------------------- 1 | ## Упражнение 5.2.2 2 | Создайте логическую программу, описывающую следующие свойства термов: 3 | 4 | `my_elem(X, Y)` — "X является элементом списка Y" 5 | 6 | Выяснить, каково множество правильных ответов на следующие запросы, обращенные к построенным программам: 7 | 1. `? my_elem(X,a.b.c.nil)` 8 | 2. `? my_elem(a,X)` 9 | -------------------------------------------------------------------------------- /api/tests/task_7_5_3/description.md: -------------------------------------------------------------------------------- 1 | ## Упражнение 7.5.3 2 | 3 | Представляя граф G посредством пары списков, — списка вершин V и 4 | списка ребер E, — написать логические программы решения теоретико-графовых задач. 5 | 6 | 3. Для заданного графа G и пары вершин x, y построить кратчайший путь, соединяющий 7 | x и y. Запрос `? short_path(V, E, x, y, L)`. 8 | -------------------------------------------------------------------------------- /api/tests/task_5_5_8/description.md: -------------------------------------------------------------------------------- 1 | ## Упражнение 5.5.8 2 | Построить логические программы, описывающие следующие свойства и 3 | отношения на множестве списков. 4 | 5 | 8. `my_reverse(X, Y):` Список X является обращением списка Y , т. е. X состоит из тех же 6 | элементов, что и список Y , но в списке X эти элементы следуют друг за другом в 7 | обратном порядке; 8 | -------------------------------------------------------------------------------- /api/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:3 2 | 3 | WORKDIR /app 4 | COPY . /app 5 | 6 | RUN apt update &&\ 7 | apt install gprolog -y &&\ 8 | pip install -r requirements.txt &&\ 9 | pip install gunicorn uwsgi 10 | 11 | EXPOSE ${BACKEND_PORT} 12 | CMD gunicorn --bind 0.0.0.0:${BACKEND_PORT} --certfile=${SSL_CRT_FILE} --keyfile=${SSL_KEY_FILE} wsgi:app run 13 | -------------------------------------------------------------------------------- /api/examples/task_5_5_8.pl: -------------------------------------------------------------------------------- 1 | my_reverse([], []). 2 | my_reverse(R, [H|T]) :- 3 | my_reverse_loop(R, T, [H]). 4 | 5 | my_reverse_loop(R, [], R). 6 | my_reverse_loop(R, [H|T], Acc) :- 7 | my_reverse_loop(R, T, [H|Acc]). 8 | 9 | % есть еще более понятная версия с append 10 | % my_reverse([], []). 11 | % my_reverse(R, [H|T]) :- my_reverse(RT, T), append(RT, [H], R). -------------------------------------------------------------------------------- /api/examples/task_5_1.pl: -------------------------------------------------------------------------------- 1 | parent(X, Y) :- mother(X, Y). 2 | parent(X, Y) :- father(X, Y). 3 | grandfather(X, Y) :- father(Z, Y), father(X, Z). 4 | is_father(X) :- father(X, Z). 5 | brother(X, Y) :- parent(Z, X), parent(Z, Y), man(X). 6 | descendant(X, Y) :- parent(Y, X). 7 | % descendant(X, Y) :- descendant(Z, Y), parent(Z, X). 8 | descendant(X, Y) :- parent(Z, X), descendant(Z, Y). 9 | -------------------------------------------------------------------------------- /api/tests/task_5_1/shared_consult_data.pl: -------------------------------------------------------------------------------- 1 | man(vasya). 2 | man(kolya). 3 | man(dima). 4 | man(vlad). 5 | man(max). 6 | woman(maria). 7 | woman(sasha). 8 | woman(nastya). 9 | father(dima, vasya). 10 | father(dima, kolya). 11 | father(kolya, vlad). 12 | father(kolya, max). 13 | father(max, sasha). 14 | mother(maria, kolya). 15 | mother(sasha, nastya). 16 | married(dima, maria). 17 | -------------------------------------------------------------------------------- /api/tests/task_5_2_1/description.md: -------------------------------------------------------------------------------- 1 | ## Упражнение 5.2.1 2 | Создайте логическую программу, описывающую следующие свойства термов: 3 | 4 | `my_list(X)` — "X является списком". 5 | 6 | Выяснить, каково множество правильных ответов на следующие запросы, обращенные к построенным программам: 7 | 8 | 1. `? my_list(a.b.c.nil)` 9 | 2. `? my_list(a.X.nil)` 10 | 3. `? my_list(a.b)` 11 | -------------------------------------------------------------------------------- /api/examples/task_6_2_5.pl: -------------------------------------------------------------------------------- 1 | my_prime(L, X) :- 2 | findall(N, (between(2, X, N), is_prime(N)), L). 3 | 4 | is_prime(2). 5 | is_prime(3). 6 | is_prime(P) :- 7 | integer(P), 8 | P > 3, 9 | P mod 2 =\= 0, 10 | \+ has_factor(P, 3). 11 | 12 | has_factor(N, L) :- N mod L =:= 0. 13 | has_factor(N, L) :- 14 | L * L < N, 15 | L2 is L + 2, 16 | has_factor(N, L2). -------------------------------------------------------------------------------- /api/examples/task_5_5_4.pl: -------------------------------------------------------------------------------- 1 | my_sublist(L, X) :- 2 | append(_, Suffix, L), 3 | prefix(X, Suffix). 4 | prefix([], _). 5 | prefix([H|PrefixTail], [H|InputTail]) :- 6 | prefix(PrefixTail, InputTail). 7 | 8 | % my_sublist(L, []). - не учитывает что списки должны сохранять порядок 9 | % my_sublist([A|G], [A|H]) :- my_sublist(G, H). 10 | % my_sublist([A|G], L) :- my_sublist(G, L). 11 | 12 | 13 | -------------------------------------------------------------------------------- /react-frontend/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "Prolog testing system", 3 | "name": "Prolog testing system", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | } 10 | ], 11 | "start_url": ".", 12 | "display": "standalone", 13 | "theme_color": "#000000", 14 | "background_color": "#ffffff" 15 | } 16 | -------------------------------------------------------------------------------- /api/tests/task_6_1_2/description.md: -------------------------------------------------------------------------------- 1 | ## Упражнение 6.1.2 2 | 3 | Используя встроенные предикаты равенства, неравенства и сравнения 4 | чисел, написать логические программы решения следующих задач 5 | 6 | 2. Построить бесповторный список L2, состоящий из всех элементов, содержащихся в списке L1. 7 | Запрос `? single(L1, L2)`. 8 | 9 | 10 | **Важно! Корректный вывод - в итоговый список включается последний встретившийся элемент.** -------------------------------------------------------------------------------- /api/tests/task_6_1_3/description.md: -------------------------------------------------------------------------------- 1 | ## Упражнение 6.1.3 2 | 3 | Используя встроенные предикаты равенства, неравенства и сравнения 4 | чисел, написать логические программы решения следующих задач 5 | 6 | 3. Построить бесповторный список L3, состоящий из всех элементов, содержащихся как в списке L1, так и в списке L2. 7 | Запрос `? common(L1, L2, L3)`. 8 | 9 | **Важно! Корректный вывод - в порядке расположения элементов в 1-м списке.** -------------------------------------------------------------------------------- /react-frontend/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env 17 | .env.local 18 | .env.development.local 19 | .env.test.local 20 | .env.production.local 21 | 22 | npm-debug.log* 23 | yarn-debug.log* 24 | yarn-error.log* 25 | -------------------------------------------------------------------------------- /api/testlib/errorcheck.py: -------------------------------------------------------------------------------- 1 | from typing import Optional 2 | 3 | 4 | def check_for_errors( 5 | output_lines: list[str], test_number: int, correct_lines: list[str] 6 | ) -> Optional[tuple[int, str, list[str], list[str]]]: 7 | if any("Fatal Error: TL" in line for line in output_lines): 8 | return test_number, "TL", output_lines, correct_lines 9 | if any("exception" in line for line in output_lines): 10 | return test_number, "RE", output_lines, correct_lines 11 | return None 12 | -------------------------------------------------------------------------------- /api/examples/task_5_5_5.pl: -------------------------------------------------------------------------------- 1 | my_length(List, Length) :- 2 | list(List), 3 | my_length(List, 0, Length). 4 | 5 | my_length([_|Tail], Accumulator, Length) :- 6 | NewAccumulator is Accumulator + 1, 7 | my_length(Tail, NewAccumulator, Length). 8 | 9 | my_length([], Length, Length). 10 | 11 | my_less(X, Y) :- my_length(X, N), my_length(Y, M), N < M. 12 | 13 | % без my_length но less or equal :( 14 | % my_less([], _). 15 | % my_less([_|Xs], [_|Ys]) :- my_less(Xs, Ys). 16 | % my_less([_|_], []) :- fail. 17 | -------------------------------------------------------------------------------- /api/examples/task_5_5_9.pl: -------------------------------------------------------------------------------- 1 | my_period(X, X). 2 | my_period(X, Y) :- 3 | Y = [], !, false. 4 | my_period(X, Y) :- 5 | append(Y, Y, P), 6 | my_prefix(X, P). 7 | 8 | my_prefix(L, []). 9 | my_prefix([A|L], [A|[]]). 10 | my_prefix([A|L1], [A|L2]) :- my_prefix(L1, L2). 11 | 12 | % то что внизу логично, но не работает 13 | % my_period(X, Y) :- append(Y, Y, P), my_period(X, Y, P). % ну в принципе можно использовать свой append 14 | % my_period(X, _, X). 15 | % my_period(X, Y, [_|T]) :- my_period(X, Y, T). 16 | 17 | -------------------------------------------------------------------------------- /api/tests/task_7_5_1+2/description.md: -------------------------------------------------------------------------------- 1 | ## Упражнения 7.5.1 и 7.5.2 2 | 3 | Представляя граф G посредством пары списков, — списка вершин V и 4 | списка ребер E, — написать логические программы решения теоретико-графовых задач. 5 | 6 | 1. Для заданного графа G и пары вершин x, y выяснить, существует ли путь, соединяющий 7 | x и y в G. Запрос `? reach(V, E, x, y)`. 8 | 9 | 2. **(включено в набор тестов)** Проверить выполнение программы для запроса `? reach(a.b.c.d.nil, (a.b.nil).(b.c.nil).(c.a.nil).(b.d.nil).nil, a, d)` 10 | 11 | -------------------------------------------------------------------------------- /api/examples/task_6_2_6.pl: -------------------------------------------------------------------------------- 1 | gcd(X, Y, Z) :- 2 | X < 0, 3 | Y >= 0, 4 | X1 is abs(X), 5 | gcd_(X1, Y, Z). 6 | 7 | gcd(X, Y, Z) :- 8 | Y < 0, 9 | X >= 0, 10 | Y1 is abs(Y), 11 | gcd_(X, Y1, Z). 12 | 13 | gcd(X, Y, Z) :- 14 | X < 0, 15 | Y < 0, 16 | X1 is abs(X), 17 | Y1 is abs(Y), 18 | gcd_(X1, Y1, Z). 19 | 20 | gcd(X, Y, Z) :- 21 | X >= 0, 22 | Y >= 0, 23 | gcd_(X, Y, Z). 24 | 25 | 26 | gcd_(X, Y, Z) :- X = Y, Z is X. 27 | gcd_(X, Y, Z) :- X < Y, Y1 is Y - X, gcd_(X, Y1, Z). 28 | gcd_(X, Y, Z) :- X > Y, gcd_(Y, X, Z). 29 | -------------------------------------------------------------------------------- /api/examples/task_5_6_1.pl: -------------------------------------------------------------------------------- 1 | my_less(X, Y) :- % я чет совсем не уверен в том что это норм решение 2 | bin_to_dec(X, XDec), 3 | bin_to_dec(Y, YDec), 4 | XDec < YDec. 5 | bin_to_dec([], 0). 6 | bin_to_dec([H|T], Decimal) :- 7 | bin_to_dec(T, Rest), 8 | my_length(T, Len), 9 | Decimal is (H * 2 ** Len) + Rest. 10 | 11 | my_length(List, Length) :- 12 | list(List), 13 | my_length(List, 0, Length). 14 | 15 | my_length([_|Tail], Accumulator, Length) :- 16 | NewAccumulator is Accumulator + 1, 17 | my_length(Tail, NewAccumulator, Length). 18 | 19 | my_length([], Length, Length). 20 | -------------------------------------------------------------------------------- /api/tests/task_5_1/description.md: -------------------------------------------------------------------------------- 1 | ## Упражнение 5.1 2 | 3 | Пусть реализованы следующие предикаты: 4 | - `man(X)` — является ли X мужчиной 5 | - `women(X)` — является ли X женщиной 6 | - `mother(X, Y)` — является ли X матерью Y 7 | - `father(X, Y)` — является ли X отцом Y 8 | - `married(X, Y)` — являются ли X и Y супругами 9 | 10 | Опишите 5 предикатов: 11 | - `parent(X, Y)` — является ли X родителем Y 12 | - `grandfather(X, Y)` — является ли X дедом Y 13 | - `is_father(X)` — является ли X чьим-то отцом 14 | - `brother(X, Y)` — является ли X братом Y 15 | - `descendant(X, Y)` — является ли X потомком Y 16 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | 3 | services: 4 | api: 5 | build: api/ 6 | network_mode: host 7 | environment: 8 | - BACKEND_PORT=${BACKEND_PORT} 9 | - SSL_CRT_FILE=${SSL_CRT_FILE} 10 | - SSL_KEY_FILE=${SSL_KEY_FILE} 11 | read_only: true 12 | tmpfs: 13 | - /app/submissions 14 | - /tmp 15 | 16 | react-frontend: 17 | build: react-frontend/ 18 | network_mode: host 19 | environment: 20 | - HTTPS=${HTTPS} 21 | - SSL_CRT_FILE=${SSL_CRT_FILE} 22 | - SSL_KEY_FILE=${SSL_KEY_FILE} 23 | - FRONTEND_PORT=${FRONTEND_PORT} 24 | - REACT_APP_BACKEND_URL=${REACT_APP_BACKEND_URL} 25 | - DISABLE_ESLINT_PLUGIN=true 26 | read_only: true 27 | tmpfs: 28 | - /tmp 29 | - /root/.npm -------------------------------------------------------------------------------- /react-frontend/src/Themes.js: -------------------------------------------------------------------------------- 1 | import { createTheme } from '@mui/material/styles'; 2 | 3 | let lightTheme = createTheme({ 4 | palette: { 5 | mode: 'light', 6 | }, 7 | }); 8 | 9 | lightTheme.typography.h3 = { 10 | ...lightTheme.typography.h3, 11 | fontSize: '1.0rem', 12 | '@media (min-width:500px)': { 13 | fontSize: '1.5rem', 14 | }, 15 | [lightTheme.breakpoints.up('md')]: { 16 | fontSize: '3.0rem', 17 | }, 18 | }; 19 | 20 | 21 | let darkTheme = createTheme({ 22 | palette: { 23 | mode: 'dark', 24 | }, 25 | }); 26 | 27 | darkTheme.typography.h3 = { 28 | ...darkTheme.typography.h3, 29 | fontSize: '1.0rem', 30 | '@media (min-width:500px)': { 31 | fontSize: '1.5rem', 32 | }, 33 | [darkTheme.breakpoints.up('md')]: { 34 | fontSize: '3.0rem', 35 | }, 36 | }; 37 | 38 | export { lightTheme, darkTheme }; 39 | -------------------------------------------------------------------------------- /api/examples/task_7_4_3.pl: -------------------------------------------------------------------------------- 1 | short_path(X, Y, E, P) :- 2 | bagof(T, short_path_(X, Y, E, T), Tmp), 3 | find_min_length_lists(Tmp, P). 4 | short_path_(X, Y, E, P) :- 5 | short_path(E, X, Y, [], P). 6 | 7 | short_path(_, X, X, _, [X]). 8 | short_path(E, X, Y, Visited, P) :- 9 | member([X, Z], E), 10 | not(member(Z, Visited)), 11 | short_path(E, Z, Y, [Z|Visited], P1), 12 | P = [X|P1]. 13 | 14 | min_length([], Min) :- Min is 999999999. 15 | min_length([H|T], Min) :- 16 | min_length(T, Min2), 17 | length(H, Len), 18 | (Len < Min2 -> Min = Len ; Min = Min2). 19 | 20 | min_length_lists([], _, []). 21 | min_length_lists([H|T], Min, [H|MinTail]) :- 22 | length(H, Len), 23 | Len =:= Min, 24 | min_length_lists(T, Min, MinTail). 25 | min_length_lists([H|T], Min, MinTail) :- 26 | length(H, Len), 27 | Len =\= Min, 28 | min_length_lists(T, Min, MinTail). 29 | 30 | find_min_length_lists(Lists, MinLists) :- 31 | min_length(Lists, Min), 32 | min_length_lists(Lists, Min, MinLists). -------------------------------------------------------------------------------- /api/tests/task_7_2_2/common.py: -------------------------------------------------------------------------------- 1 | import re 2 | from testlib.errorcheck import check_for_errors 3 | 4 | 5 | def build_correct_linse(expected): 6 | return [f"Result = [[[{','.join(str(expected))}]]]", "yes"] 7 | 8 | 9 | def test(output_lines, test_number, expected): 10 | correct_lines = build_correct_linse(expected) 11 | error = check_for_errors(output_lines, test_number, correct_lines) 12 | if error: 13 | return error 14 | 15 | # parsing a string "Result = [[[1,3,5,17]]]" 16 | p = re.compile(r"Result = \[\[\[(.*?)\]\]\]") 17 | results = p.search(output_lines[0]) 18 | if results is None or results.group(1) is None: 19 | return test_number, "WA: output mismatch", output_lines, correct_lines 20 | 21 | # answer is correct if it is a permutation of correct numbers 22 | nums = {int(s) for s in results.group(1).split(",")} 23 | if nums != expected: 24 | return test_number, "WA: output mismatch", output_lines, correct_lines 25 | return test_number, "OK", output_lines, correct_lines 26 | -------------------------------------------------------------------------------- /react-frontend/src/TaskDescription.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import ReactMarkdown from "react-markdown"; 3 | import InputLabel from "@mui/material/InputLabel"; 4 | import MenuItem from "@mui/material/MenuItem"; 5 | import FormControl from "@mui/material/FormControl"; 6 | import Select, { SelectChangeEvent } from "@mui/material/Select"; 7 | 8 | class TaskDescription extends React.Component { 9 | render() { 10 | return ( 11 |
12 | 13 | Задача 14 | 26 | 27 | 28 |
29 | ); 30 | } 31 | } 32 | 33 | export default TaskDescription; 34 | -------------------------------------------------------------------------------- /api/examples/task_5_6_2.pl: -------------------------------------------------------------------------------- 1 | pow(_, 0, 1). 2 | pow(X, Y, Z) :- 3 | Y > 0, 4 | Y1 is Y - 1, 5 | pow(X, Y1, Z1), 6 | Z is X * Z1. 7 | 8 | bin_to_dec([], 0). 9 | bin_to_dec([H|T], Decimal) :- 10 | bin_to_dec(T, Rest), 11 | my_length(T, Len), 12 | pow(2, Len, Z), 13 | Decimal is (H * Z) + Rest. 14 | 15 | my_reverse([], []). 16 | my_reverse([H|T], R) :- 17 | my_reverse_helper(T, R, [H]). 18 | 19 | my_reverse_helper([], R, R). 20 | my_reverse_helper([H|T], R, Acc) :- 21 | my_reverse_helper(T, R, [H|Acc]). 22 | 23 | my_length(List, Length) :- 24 | list(List), 25 | my_length(List, 0, Length). 26 | 27 | my_length([_|Tail], Accumulator, Length) :- 28 | NewAccumulator is Accumulator + 1, 29 | my_length(Tail, NewAccumulator, Length). 30 | 31 | my_length([], Length, Length). 32 | 33 | decimal_to_binary(0, [0]). 34 | decimal_to_binary(1, [1]). 35 | decimal_to_binary(N, L) :- 36 | N > 1, 37 | M is N // 2, 38 | R is N mod 2, 39 | decimal_to_binary(M, L1), 40 | append([R], L1, L). 41 | 42 | my_sum(X, Y, Z) :- 43 | bin_to_dec(X, XDec), 44 | bin_to_dec(Y, YDec), 45 | Sum is XDec + YDec, 46 | decimal_to_binary(Sum, Tmp), 47 | my_reverse(Tmp, Z). -------------------------------------------------------------------------------- /react-frontend/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-frontend", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "@emotion/react": "^11.10.5", 7 | "@emotion/styled": "^11.10.5", 8 | "@mui/icons-material": "^5.11.0", 9 | "@mui/lab": "^5.0.0-alpha.114", 10 | "@mui/material": "^5.11.1", 11 | "@testing-library/jest-dom": "^5.16.5", 12 | "@testing-library/react": "^13.4.0", 13 | "@testing-library/user-event": "^13.5.0", 14 | "axios": "^1.2.1", 15 | "dotenv": "^16.0.3", 16 | "react": "^18.2.0", 17 | "react-dom": "^18.2.0", 18 | "react-markdown": "^8.0.4", 19 | "react-scripts": "5.0.1", 20 | "web-vitals": "^2.1.4" 21 | }, 22 | "scripts": { 23 | "start": "react-scripts start", 24 | "build": "react-scripts build", 25 | "test": "react-scripts test", 26 | "eject": "react-scripts eject" 27 | }, 28 | "eslintConfig": { 29 | "extends": [ 30 | "react-app", 31 | "react-app/jest" 32 | ] 33 | }, 34 | "browserslist": { 35 | "production": [ 36 | ">0.2%", 37 | "not dead", 38 | "not op_mini all" 39 | ], 40 | "development": [ 41 | "last 1 chrome version", 42 | "last 1 firefox version", 43 | "last 1 safari version" 44 | ] 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /api/examples/task_7_5_3.pl: -------------------------------------------------------------------------------- 1 | short_path(V, E, X, Y, P) :- 2 | reverse_and_append(E, Tr), 3 | bagof(T, short_path_(V, Tr, X, Y, T), Tmp), 4 | find_min_length_lists(Tmp, Pr), 5 | remove_duplicates(Pr, P). 6 | short_path_(V, E, X, Y, P) :- 7 | short_path(V, E, X, Y, [], P). 8 | 9 | short_path(_, _, X, X, _, [X]). 10 | short_path(V, E, X, Y, Visited, P) :- 11 | member([X, Z], E), 12 | not(member(Z, Visited)), 13 | short_path(V, E, Z, Y, [Z|Visited], P1), 14 | P = [X|P1]. 15 | min_length([], Min) :- Min is 999999999. 16 | min_length([H|T], Min) :- 17 | min_length(T, Min2), 18 | length(H, Len), 19 | (Len < Min2 -> Min = Len ; Min = Min2). 20 | 21 | min_length_lists([], _, []). 22 | min_length_lists([H|T], Min, [H|MinTail]) :- 23 | length(H, Len), 24 | Len =:= Min, 25 | min_length_lists(T, Min, MinTail). 26 | min_length_lists([H|T], Min, MinTail) :- 27 | length(H, Len), 28 | Len =\= Min, 29 | min_length_lists(T, Min, MinTail). 30 | 31 | find_min_length_lists(Lists, MinLists) :- 32 | min_length(Lists, Min), 33 | min_length_lists(Lists, Min, MinLists). 34 | 35 | reverse_and_append([], []). 36 | reverse_and_append([H|T], R) :- 37 | reverse(H, Hr), 38 | reverse_and_append(T, Tr), 39 | append([H, Hr], Tr, R). 40 | 41 | remove_duplicates([], []). 42 | remove_duplicates([H|T], Result) :- 43 | member(H, T), 44 | !, 45 | remove_duplicates(T, Result). 46 | remove_duplicates([H|T], [H|Result]) :- 47 | remove_duplicates(T, Result). -------------------------------------------------------------------------------- /react-frontend/src/Header.js: -------------------------------------------------------------------------------- 1 | import React, {useState} from "react"; 2 | 3 | import Brightness4Icon from '@mui/icons-material/Brightness4'; 4 | import Brightness7Icon from '@mui/icons-material/Brightness7'; 5 | import Button from "@mui/material/Button"; 6 | import Grid from "@mui/material/Grid"; 7 | import IconButton from '@mui/material/IconButton'; 8 | import InfoIcon from "@mui/icons-material/Info"; 9 | import Typography from "@mui/material/Typography"; 10 | 11 | function Header(props) { 12 | const [isDarkMode, setIsDarkMode] = useState(false); 13 | return ( 14 |
15 | 16 | 17 | 18 | Prolog testing system 19 | 20 | 21 | 22 | 23 | 24 | { 28 | props.switchTheme() 29 | setIsDarkMode((prevIsDarkMode) => { return !prevIsDarkMode; }) 30 | }} 31 | > 32 | { isDarkMode ? : } 33 | 34 | 35 | 36 | 44 | 45 | 46 | 47 | 48 |
49 | ); 50 | } 51 | 52 | export default Header; 53 | -------------------------------------------------------------------------------- /api/translator.py: -------------------------------------------------------------------------------- 1 | import regex 2 | 3 | from settings import SUBMISSIONS_DIRECTORY 4 | 5 | 6 | def list_translate(s): 7 | s = "(" + s + ")" 8 | s = s.replace(".", ",") 9 | s = s.replace("(", "[").replace(")", "]") 10 | char_list = list(s) 11 | last_comma = None 12 | for i in range(len(char_list) - 1): 13 | if char_list[i] == ",": 14 | last_comma = i 15 | if char_list[i + 1] == "]" and last_comma is not None: 16 | char_list[last_comma] = "|" 17 | last_comma = None 18 | s = "".join(char_list) 19 | s = s.replace("|nil]", "]") 20 | if regex.match("\[+nil\]+", s): 21 | s = s[1:-1] 22 | s = s.replace("nil", "[]") 23 | return s 24 | 25 | 26 | def horn_to_prolog(clause): 27 | vars_or_lists = [] 28 | clause = replace_spec_symbols(clause) 29 | parenthesis = regex.findall("\((?:[^()]++|(?R))*+\)", clause) 30 | for par in parenthesis: 31 | vars_or_lists.extend(regex.split(",", par[1:-1])) 32 | vars_or_lists = [var for var in vars_or_lists if len(var) > 0] 33 | for var in vars_or_lists: 34 | if "nil" in var or "." in var: 35 | clause = clause.replace(var, list_translate(var.replace(" ", "")), 1) 36 | return clause 37 | 38 | 39 | def replace_spec_symbols(clause, type="HLP"): 40 | if type == "HLP": 41 | clause = clause.replace("<-", ":-").replace(";", ".").replace("?", "?-") 42 | return clause 43 | 44 | 45 | def translate(submission_id, type="HLP"): 46 | if type == "HLP": 47 | filename = SUBMISSIONS_DIRECTORY / (submission_id + ".pl") 48 | with open(filename, "r+") as horn_file: 49 | content = horn_file.read() 50 | lines = regex.findall("[\w\W]+?;", content) 51 | with open(filename, "w+") as horn_file: 52 | for clause in lines: 53 | print(horn_to_prolog(clause), file=horn_file) 54 | -------------------------------------------------------------------------------- /react-frontend/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 10 | 11 | 12 | 13 | 14 | 18 | 19 | 28 | Prolog testing system 29 | 30 | 31 | 32 |
33 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /react-frontend/src/ExecutionResults.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import Dialog from "@mui/material/Dialog"; 3 | import DialogActions from "@mui/material/DialogActions"; 4 | import DialogContent from "@mui/material/DialogContent"; 5 | import DialogTitle from "@mui/material/DialogTitle"; 6 | import Button from "@mui/material/Button"; 7 | import Typography from "@mui/material/Typography"; 8 | import Table from "@mui/material/Table"; 9 | import TableBody from "@mui/material/TableBody"; 10 | import TableCell from "@mui/material/TableCell"; 11 | import TableHead from "@mui/material/TableHead"; 12 | import TableRow from "@mui/material/TableRow"; 13 | 14 | class ExecutionResults extends React.Component { 15 | mapCode(lst) { 16 | return lst.map((line) => ( 17 | 22 | {line} 23 |
24 |
25 | )); 26 | } 27 | 28 | splitAndMapCode(str) { 29 | return this.mapCode(str.split("\n")); 30 | } 31 | 32 | render() { 33 | return ( 34 | 41 | 42 | Пройдено тестов: {this.props.data.filter((test) => test.result === "OK").length}/ 43 | {this.props.data.length} 44 | 45 | 46 | {this.props.data.length && this.props.data[0].test_consult_text != "—" && ( 47 |
48 | 49 | Для этой задачи по условию определены некоторые предикаты следующим образом: 50 | 51 | {this.splitAndMapCode(this.props.data[0].test_consult_text)} 52 |
53 | )} 54 | 55 | 56 | 57 | # 58 | Результат 59 | Содержание теста 60 | Вывод программы 61 | Корректный вывод 62 | 63 | 64 | 65 | {this.props.data.map((row) => ( 66 | 67 | {row.test_number} 68 | 74 | {row.result} 75 | 76 | {this.splitAndMapCode(row.test_text)} 77 | {this.mapCode(row.output_lines)} 78 | {this.mapCode(row.correct_lines)} 79 | 80 | ))} 81 | 82 |
83 |
84 | 85 | 88 | 89 |
90 | ); 91 | } 92 | } 93 | 94 | export default ExecutionResults; 95 | -------------------------------------------------------------------------------- /react-frontend/src/CodeForm.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import LoadingButton from "@mui/lab/LoadingButton"; 3 | import Button from "@mui/material/Button"; 4 | import TextField from "@mui/material/TextField"; 5 | 6 | import ClearIcon from "@mui/icons-material/Clear"; 7 | import SendIcon from "@mui/icons-material/Send"; 8 | import FileUploadIcon from "@mui/icons-material/FileUpload"; 9 | 10 | import InputLabel from "@mui/material/InputLabel"; 11 | import MenuItem from "@mui/material/MenuItem"; 12 | import FormControl from "@mui/material/FormControl"; 13 | import Select from "@mui/material/Select"; 14 | import Grid from "@mui/material/Grid"; 15 | import Stack from "@mui/material/Stack"; 16 | import CircularProgress from "@mui/material/CircularProgress"; 17 | 18 | import "./style.css"; 19 | 20 | class CodeForm extends React.Component { 21 | render() { 22 | return ( 23 |
24 | 30 | 31 |
32 | 33 | Язык 34 | 44 | 45 |
46 |
47 | 48 | 49 | 56 | 59 | 66 | } 69 | onClick={this.props.sendSubmission} 70 | loading={this.props.execution_is_loading} 71 | loadingIndicator={} 72 | > 73 | Протестировать 74 | 75 | 76 | 77 |
78 | 79 | 94 |
95 | ); 96 | } 97 | } 98 | 99 | export default CodeForm; 100 | -------------------------------------------------------------------------------- /api/api.py: -------------------------------------------------------------------------------- 1 | import argparse 2 | import os 3 | import traceback 4 | 5 | import werkzeug 6 | from flask import Flask 7 | from flask_cors import CORS, cross_origin 8 | from flask_restful import Api, Resource, reqparse 9 | from uuid import uuid4 10 | import jinja2 11 | 12 | from translator import translate 13 | from prolog_parsing import execute_on_tests 14 | from settings import * 15 | 16 | 17 | submit_parser = reqparse.RequestParser() 18 | submit_parser.add_argument( 19 | "submission", type=werkzeug.datastructures.FileStorage, location="files" 20 | ) 21 | 22 | execute_parser = reqparse.RequestParser() 23 | execute_parser.add_argument("type", type=str) 24 | execute_parser.add_argument("task", type=str) 25 | execute_parser.add_argument("submission_id", type=str) 26 | 27 | tasks_info_parser = reqparse.RequestParser() 28 | 29 | loader = jinja2.FileSystemLoader(searchpath="./") 30 | environment = jinja2.Environment(loader=loader) 31 | 32 | 33 | class Execute(Resource): 34 | @cross_origin() 35 | def post(self): 36 | try: 37 | args = execute_parser.parse_args() 38 | if args.type is None: 39 | args.type = "gprolog" 40 | if args.submission_id is None: 41 | return { 42 | "message": "You need to specify submission_id.", 43 | "status": 400, 44 | }, 400 45 | if ( 46 | SUBMISSIONS_DIRECTORY / (args.submission_id + ".pl") 47 | not in SUBMISSIONS_DIRECTORY.iterdir() 48 | ): 49 | return { 50 | "message": f"Submission with id {args.submission_id} was not found.", 51 | "status": 404, 52 | }, 404 53 | if args.task is None: 54 | return {"message": "You need to specify task", "status": 400}, 400 55 | if args.type not in ["gprolog", "HLP"]: 56 | return { 57 | "message": f"Argument type={args.type} is not valid", 58 | "status": 400, 59 | }, 400 60 | cmd_template = environment.get_template("test_prolog_program.j2") 61 | 62 | translate(args.submission_id, args.type) 63 | execution_result = execute_on_tests( 64 | args.submission_id, args.task, cmd_template 65 | ) 66 | 67 | os.remove(SUBMISSIONS_DIRECTORY / (args.submission_id + ".pl")) 68 | return { 69 | "message": "Successfully executed", 70 | "result": execution_result, 71 | "status": 200, 72 | }, 200 73 | except Exception as e: 74 | traceback.print_exc() 75 | return {"message": "Server error: %s" % e, "status": 500}, 500 76 | 77 | 78 | class Submit(Resource): 79 | @cross_origin() 80 | def post(self): 81 | try: 82 | args = submit_parser.parse_args() 83 | if args.submission is None: 84 | return { 85 | "message": "File of Prolog program is required", 86 | "status": 400, 87 | }, 400 88 | 89 | submission_id = str(uuid4()) 90 | args.submission.save(SUBMISSIONS_DIRECTORY / (submission_id + ".pl")) 91 | return { 92 | "submission_id": submission_id, 93 | "message": "Successfully submitted", 94 | "status": 200, 95 | }, 200 96 | except Exception as e: 97 | traceback.print_exc() 98 | return {"message": "Server error: %s" % e, "status": 500}, 500 99 | 100 | 101 | class TasksInfo(Resource): 102 | @cross_origin() 103 | def get(self): 104 | try: 105 | args = tasks_info_parser.parse_args() 106 | task_names = [] 107 | task_descriptions = [] 108 | # the tasks list is sorted by their names 109 | for task_dir in sorted(TESTS_DIRECTORY.glob("*")): 110 | task_names.append(task_dir.name) 111 | description_file = task_dir / "description.md" 112 | if description_file.exists(): 113 | with open(description_file) as f: 114 | task_descriptions.append(f.read()) 115 | else: 116 | task_descriptions.append( 117 | f"## {task_dir.name}\n\nNo description provided" 118 | ) 119 | return { 120 | "task_names": task_names, 121 | "task_descriptions": task_descriptions, 122 | "status": 200, 123 | }, 200 124 | except Exception as e: 125 | traceback.print_exc() 126 | return {"message": "Server error: %s" % e, "status": 500}, 500 127 | 128 | 129 | def parse_args(argv): 130 | parser = argparse.ArgumentParser(prog="prolog-testing-system") 131 | parser.add_argument( 132 | "--host", 133 | metavar="", 134 | type=str, 135 | default="127.0.0.1", 136 | help="Server hostname", 137 | ) 138 | parser.add_argument( 139 | "--port", "-p", metavar="", default=3001, type=int, help="Server port" 140 | ) 141 | try: 142 | args, args_list = parser.parse_known_args(argv) 143 | except argparse.ArgumentError: 144 | raise Exception("Failed to parse arguments. Exiting.") 145 | return args.host, args.port 146 | 147 | 148 | SUBMISSIONS_DIRECTORY.mkdir(exist_ok=True, parents=True) 149 | 150 | app = Flask(__name__) 151 | api = Api() 152 | api.add_resource(Submit, "/submit") 153 | api.add_resource(Execute, "/execute") 154 | api.add_resource(TasksInfo, "/tasks_info") 155 | app.config["MAX_CONTENT_LENGTH"] = 42 * 1024 # 42 Kb content size limit 156 | api.init_app(app) 157 | cors = CORS(app) 158 | 159 | 160 | def main(argv=None): 161 | host, port = parse_args(argv) 162 | app.run(port=port, host=host, debug=False, use_reloader=False) 163 | 164 | 165 | if __name__ == "__main__": 166 | main() 167 | -------------------------------------------------------------------------------- /api/prolog_parsing.py: -------------------------------------------------------------------------------- 1 | import dataclasses 2 | import os 3 | import re 4 | import signal 5 | import subprocess 6 | import importlib 7 | import sys 8 | 9 | from settings import * 10 | from dataclasses import dataclass 11 | 12 | 13 | @dataclass 14 | class TestResult: 15 | test_number: int 16 | # OK / RE / WA: output mismatch / WA: different number or lines / ... 17 | result: str 18 | output_lines: list[str] 19 | correct_lines: list[str] 20 | 21 | 22 | def execute_on_tests(submission_id, task, cmd_template): 23 | execution_result = [] 24 | for test_number, test_pl, test_ans in get_task_tests(task): 25 | test_consult_pl = test_pl.with_name("shared_consult_data.pl") 26 | with open(test_pl) as f: 27 | used_variables = set() 28 | for line in f: 29 | # find all used variables in this test to put them into 30 | # the `Template` argument of `setof` 31 | for used_variable in re.findall(r"\b[A-Z]\w*", line): 32 | used_variables.add(used_variable) 33 | run_submission_cmd = cmd_template.render( 34 | submission_file=SUBMISSIONS_DIRECTORY / (submission_id + ".pl"), 35 | test_file=test_pl, 36 | # optional file with initial data for all tests 37 | shared_consult_data_file=test_consult_pl, 38 | variables_list="[" + ",".join(used_variables) + "]", 39 | ) 40 | try: 41 | process = subprocess.Popen( 42 | run_submission_cmd, 43 | stdout=subprocess.PIPE, 44 | stderr=subprocess.STDOUT, 45 | shell=True, 46 | start_new_session=True, 47 | ) 48 | process.wait(timeout=EXECUTION_TIMEOUT_VALUE) 49 | output = process.stdout.read().decode() 50 | except subprocess.TimeoutExpired: 51 | output = "Fatal Error: TL" 52 | os.killpg(os.getpgid(process.pid), signal.SIGTERM) 53 | 54 | test_verdict = perform_test(output, test_ans, test_number) 55 | 56 | # add additional info 57 | with open(test_pl) as f: 58 | test_verdict["test_text"] = f.read() 59 | if test_consult_pl.exists(): 60 | with open(test_consult_pl) as f: 61 | test_verdict["test_consult_text"] = f.read() 62 | else: 63 | test_verdict["test_consult_text"] = "—" 64 | execution_result.append(test_verdict) 65 | return execution_result 66 | 67 | 68 | def parse_output(output_lines): 69 | output_lines = output_lines.split("\n") 70 | for line in output_lines: 71 | if "fatal error" in line.lower(): 72 | return ["exception: " + line] 73 | first_query_idx = next( 74 | i for i in range(len(output_lines)) if output_lines[i].startswith("|") 75 | ) 76 | # remove init lines 77 | output_lines = output_lines[first_query_idx:] 78 | # remove empty lines and query lines 79 | meaningful_lines = list(filter(lambda a: a and not a.startswith("|"), output_lines)) 80 | # remove "(1 ms)" in lines where it appears and spaces from both sides 81 | meaningful_lines = [ 82 | re.sub(r"\(\d+\s*m?s\)\s*", "", line).strip() for line in meaningful_lines 83 | ] 84 | return meaningful_lines 85 | 86 | 87 | def get_task_tests(task): 88 | tests = [] 89 | for test_pl in (TESTS_DIRECTORY / task).glob("test*.pl"): 90 | test_number = int(test_pl.name.replace("test_", "").replace(".pl", "")) 91 | 92 | test_basename = test_pl.name[: -(len(".pl"))] 93 | for ext in TEST_EXTS: 94 | test_ans = test_pl.with_name(test_basename + ext) 95 | if test_ans.exists(): 96 | tests.append((test_number, test_pl, test_ans)) 97 | break 98 | return sorted(tests) # sorted by test_number (int) 99 | 100 | 101 | def perform_test(output, test_ans, test_number): 102 | output_lines = parse_output(output) 103 | 104 | ext = test_ans.suffix.lower() 105 | if ext == ".ans": 106 | return test_string_equality(output_lines, test_ans, test_number) 107 | elif ext == ".py": 108 | return test_with_script(output_lines, test_ans, test_number) 109 | 110 | return TestResult( 111 | test_number, 112 | "IE: Incorrect test configuration, contact system admin.", 113 | output_lines, 114 | [], 115 | ) 116 | 117 | 118 | def test_with_script(output_lines, test_ans, test_number): 119 | test_ans_module = str(test_ans.stem).replace("/", ".") 120 | 121 | test_dir = str(test_ans.parent) 122 | 123 | try: 124 | sys.path.append(test_dir) 125 | 126 | test_module = importlib.import_module(test_ans_module) 127 | importlib.reload(test_module) # To load changes in tests during server running 128 | return dataclasses.asdict( 129 | TestResult(*test_module.test_result(output_lines, test_number)) 130 | ) 131 | finally: 132 | sys.path.remove(test_dir) 133 | 134 | 135 | def test_string_equality(output_lines, test_ans, test_number): 136 | with open(test_ans) as f: 137 | correct_lines = [line.strip() for line in f] 138 | test_verdict = dataclasses.asdict( 139 | get_test_verdict(output_lines, correct_lines, test_number) 140 | ) 141 | return test_verdict 142 | 143 | 144 | def get_test_verdict(output_lines, correct_lines, test_number): 145 | if any("Fatal Error: TL" in line for line in output_lines): 146 | return TestResult(test_number, "TL", output_lines, correct_lines) 147 | if any("exception" in line for line in output_lines): 148 | return TestResult(test_number, "RE", output_lines, correct_lines) 149 | if len(output_lines) != len(correct_lines): 150 | return TestResult( 151 | test_number, "WA: different number or lines", output_lines, correct_lines 152 | ) 153 | if set(output_lines) == set(correct_lines): 154 | return TestResult(test_number, "OK", output_lines, correct_lines) 155 | return TestResult(test_number, "WA: output mismatch", output_lines, correct_lines) 156 | -------------------------------------------------------------------------------- /react-frontend/src/App.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | import axios from "axios"; 4 | 5 | import Container from "@mui/material/Container"; 6 | import CssBaseline from '@mui/material/CssBaseline'; 7 | import Grid from "@mui/material/Grid"; 8 | import { createTheme, ThemeProvider } from '@mui/material/styles'; 9 | 10 | import CodeForm from "./CodeForm"; 11 | import ExecutionResults from "./ExecutionResults"; 12 | import Header from "./Header"; 13 | import TaskDescription from "./TaskDescription"; 14 | import { lightTheme, darkTheme } from "./Themes.js" 15 | 16 | const BACKEND_ADDRESS = process.env.REACT_APP_BACKEND_URL; 17 | const HLP_DEFAULT_CODE = `my_prefix(L, nil); 18 | my_prefix(A.L, A.nil); 19 | my_prefix(A.L1, A.L2) <- my_prefix(L1, L2);`; 20 | const PROLOG_DEFAULT_CODE = `my_prefix(L, []). 21 | my_prefix([A|L], [A|[]]). 22 | my_prefix([A|L1], [A|L2]) :- my_prefix(L1, L2).`; 23 | 24 | class App extends React.Component { 25 | constructor(props) { 26 | super(props); 27 | this.state = { 28 | task_names: [], 29 | task_descriptions: [], 30 | submission_text: HLP_DEFAULT_CODE, 31 | language: "HLP", 32 | selected_task_name: "", 33 | selected_task_description: "", 34 | is_execution_results_opened: false, 35 | execution_results_data: [], 36 | execution_is_loading: false, 37 | selectedTheme: lightTheme, 38 | }; 39 | this.sendSubmission = this.sendSubmission.bind(this); 40 | this.handleSubmissionTextChange = this.handleSubmissionTextChange.bind(this); 41 | this.handleLanguageChange = this.handleLanguageChange.bind(this); 42 | this.handleTaskNameChange = this.handleTaskNameChange.bind(this); 43 | this.getTasksInfo = this.getTasksInfo.bind(this); 44 | this.handleSubmissionTextClear = this.handleSubmissionTextClear.bind(this); 45 | this.handleSubmissionTextUpdateFromFile = this.handleSubmissionTextUpdateFromFile.bind(this); 46 | this.handleCloseResults = this.handleCloseResults.bind(this); 47 | this.handleThemeChange = this.handleThemeChange.bind(this); 48 | } 49 | 50 | componentDidMount() { 51 | this.getTasksInfo(); 52 | } 53 | 54 | handleSubmissionTextChange(event) { 55 | this.setState({ submission_text: event.target.value }); 56 | } 57 | 58 | handleSubmissionTextClear(_) { 59 | this.setState({ submission_text: "" }); 60 | } 61 | 62 | handleSubmissionTextUpdateFromFile(event) { 63 | event.preventDefault(); 64 | const reader = new FileReader(); 65 | reader.onload = async (event) => { 66 | this.setState({ 67 | submission_text: event.target.result, 68 | }); 69 | }; 70 | reader.readAsText(event.target.files[0]); 71 | } 72 | 73 | handleLanguageChange(event) { 74 | let new_language = event.target.value; 75 | let new_submission_text = this.state.submission_text; 76 | if (this.state.submission_text === HLP_DEFAULT_CODE && new_language === "gprolog") { 77 | new_submission_text = PROLOG_DEFAULT_CODE; 78 | } else if (this.state.submission_text === PROLOG_DEFAULT_CODE && new_language === "HLP") { 79 | new_submission_text = HLP_DEFAULT_CODE; 80 | } 81 | this.setState({ language: new_language, submission_text: new_submission_text }); 82 | } 83 | 84 | handleThemeChange(_) { 85 | this.setState((prevState, _) => { 86 | return { selectedTheme: prevState.selectedTheme === darkTheme ? lightTheme : darkTheme }; 87 | }) 88 | } 89 | 90 | handleTaskNameChange(event) { 91 | let selected_task_description = 92 | this.state.task_descriptions[this.state.task_names.indexOf(event.target.value)]; 93 | this.setState({ 94 | selected_task_name: event.target.value, 95 | selected_task_description: selected_task_description, 96 | }); 97 | } 98 | 99 | handleCloseResults() { 100 | this.setState({ 101 | is_execution_results_opened: false, 102 | }); 103 | } 104 | 105 | getTasksInfo() { 106 | axios({ 107 | method: "get", 108 | url: `${BACKEND_ADDRESS}/tasks_info`, 109 | }).then((response) => { 110 | this.setState( 111 | { 112 | task_names: response.data.task_names, 113 | task_descriptions: response.data.task_descriptions, 114 | }, 115 | () => { 116 | // select first available task by default 117 | this.handleTaskNameChange({ target: { value: this.state.task_names[0] } }); 118 | } 119 | ); 120 | }); 121 | } 122 | 123 | sendSubmission() { 124 | let submissionBlob = new Blob([this.state.submission_text], { 125 | type: "text/plain", 126 | }); 127 | let submit_formdata = new FormData(); 128 | submit_formdata.append("submission", submissionBlob, "submission.txt"); 129 | // step 1: submit a file 130 | axios({ 131 | method: "post", 132 | url: `${BACKEND_ADDRESS}/submit`, 133 | data: submit_formdata, 134 | headers: { "Content-Type": "multipart/form-data" }, 135 | }).then((submit_response) => { 136 | let submission_id = submit_response.data.submission_id; 137 | // step 2: run tests execution on it 138 | axios({ 139 | method: "post", 140 | url: `${BACKEND_ADDRESS}/execute`, 141 | data: { 142 | type: this.state.language, 143 | task: this.state.selected_task_name, 144 | submission_id: submission_id, 145 | }, 146 | headers: { "Content-Type": "application/json" }, 147 | }).then((execute_response) => { 148 | this.setState({ 149 | execution_results_data: execute_response.data.result, 150 | is_execution_results_opened: true, 151 | execution_is_loading: false, 152 | }); 153 | }); 154 | }); 155 | this.setState({ execution_is_loading: true }); 156 | } 157 | 158 | render() { 159 | return ( 160 | 161 | 162 | 163 | 168 | 169 | 170 |
173 | 174 | 175 | 181 | 182 | 183 | 193 | 194 | 195 | 196 | 197 | ); 198 | } 199 | } 200 | 201 | export default App; 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # prolog-testing-system 2 | 3 | ## Тестирующая система для программ на Prolog и ХЛП 4 | 5 | Система доступна по адресу ➡️ [https://prolog-contest.ru](https://prolog-contest.ru) ⬅️ 6 | 7 | **Как пользоваться**: выбрать задачу, написать код в окошке справа, выбрать язык (Prolog / ХЛП), отправить задачу на проверку, получить вердикт тестирующей системы с подробным выводом на всех тестах. 8 | 9 | Тестирующая система предназначена для самоподготовки студентов 3 потока 4 курса ВМК МГУ к экзамену по курсу "[Математическая логика и логическое программирование](https://mk.cs.msu.ru/index.php/%D0%9C%D0%B0%D1%82%D0%B5%D0%BC%D0%B0%D1%82%D0%B8%D1%87%D0%B5%D1%81%D0%BA%D0%B0%D1%8F_%D0%BB%D0%BE%D0%B3%D0%B8%D0%BA%D0%B0_%D0%B8_%D0%BB%D0%BE%D0%B3%D0%B8%D1%87%D0%B5%D1%81%D0%BA%D0%BE%D0%B5_%D0%BF%D1%80%D0%BE%D0%B3%D1%80%D0%B0%D0%BC%D0%BC%D0%B8%D1%80%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D0%B5_(3-%D0%B9_%D0%BF%D0%BE%D1%82%D0%BE%D0%BA))". 10 | Поскольку в курсе присутствует логическое программирование и существуют интерпретаторы языка Prolog, возникла идея создания 11 | системы автоматизированной проверки программ студентов на задачах из семинаров для полноценной поддержки "программистской" 12 | части курса. Для этого была проделана следующая работа: 13 | 14 | 1. Исследованы особенности работы интерпретатора `gprolog` языка Prolog 15 | 16 | Здесь требовалось требовалось осуществить вывод всех решений для запроса-теста (тестирующего предикат пользователя) с учётом произвольности количества 17 | переменных в запросе. Проблема была в том, что интерпретаторы Пролога выводят решения по одному, предлагая нажать ';' 18 | для вычисления и вывода очередного решения. Для решения этой проблемы был использован предикат `setof(+Template, +Goal, -Set)`, 19 | причём в качестве аргумента `Template` подаются все используемые в запросе переменные (их пришлось парсить из текста теста 20 | в `variables_list`, см. ниже). Результат ожидается в переменной `Result`. 21 | 22 | ```bash 23 | cat {{ test_file }} | sed --expression='s/^\(.*\)\.$/setof\({{ variables_list }},\1, Result\)\./g' 24 | ``` 25 | 26 | Таким образом, запрос `descendant(X, dima).` превращается в `setof({{ variables_list }},descendant(X, dima), Result).` = 27 | `setof([X],descendant(X, dima), Result).`, 28 | и ожидаемый ответ на такой запрос может быть таким: 29 | ``` 30 | Result = [[kolya],[max],[nastya],[sasha],[vasya],[vlad]] 31 | yes 32 | ``` 33 | 34 | Также в некоторых заданиях предлагается реализовать предикаты, опираясь на то, что некоторые предикаты уже 35 | реализованы (`father` и много других из 5.1, `not` из задач 7 семинара). Эти предикаты были реализованы в отдельном 36 | файле, общем для набора тестов: `shared_consult_data.pl`. 37 | 38 | 2. Реализована серверная часть на Python с использованием фреймворка Flask. 39 | 40 | Поскольку интерепретатор есть для языка Prolog, а в курсе изучаются программы на ХЛП (синтаксически схожем языке), 41 | для удобства пользователей был реализован транслятор с ХЛП на Prolog. Для этого потребовалось рассмотреть все различия 42 | используемых в курсе подмножеств этих языков, в том числе повозиться с обработкой списков. 43 | 44 | Бэкенд устойчив к различному роду ошибок, сообщает о проблемах в ответе на запрос, если что-то идёт не так. API 45 | спроектирован с заделом на возможное дальнейшее развитие. Код пару раз подвергался рефакторингу. 46 | 47 | 3. Реализована клиентская часть в виде React JS приложения. Интерфейс достаточно адаптивен и функционален. Условия задач 48 | рендерятся из markdown-а, результаты тестирования представлены в наглядном виде, есть возможность загрузки решения из файла. 49 | 50 | 5. Было подготовлено markdown-описание, **работающее решение и тесты для многих задач с семинаров курса**. [Источник задач](https://mk.cs.msu.ru/images/5/51/MatLog_tasks.pdf). 51 | 52 | 6. Для удобства пользователей система была развёрнута в виде сайта: [https://prolog-contest.ru](https://prolog-contest.ru). 53 | 54 | Предварительно backend и frontend части проекта были Docker-изованы для возможности лёгкого запуска на любом компьютере. (см. Delevopment notes) 55 | 56 | ### Если что-то не работает 57 | 58 | 1. Не используйте Wi-Fi ВМиКа (не шутка, реально не получается достучаться до бэкенда на 3001 порте нашего домена) 59 | 2. Проверьте, что написанная вами программа **синтаксически корректна** для выбранного языка (Prolog/ХЛП) 60 | 3. Продолжайте ботать матлог 61 | 4. Отдохните 10 минут и попробуйте снова 62 | 5. Если сайт лежит, или не подгружается список задач, пишите [сюда](https://t.me/m_danya_jpg) или [сюда](https://t.me/Sadimer). 63 | 64 | ### Содействие развитию проекта (contributing) 65 | 66 | Мы надеемся, что система будет полезна для подготовки к экзамену и приветствуем любой вклад в развитие проекта. 67 | Этот вклад может состоять в добавлении новых задач в систему, например из [расширенного сборника задач от авторов курса](https://mk.cs.msu.ru/images/8/8e/MatLog_exer.pdf). Для этого нужно сделать fork репозитория, добавить папку для каждой задачи в `api/tests` (+ решение 68 | в папку `api/examples`) аналогично тому, как это сделано сейчас, и сделать pull request. 69 | 70 | #### Ограничения при добавлении тестов: 71 | 1. Пожалуйста не используйте заглавные буквы в строках. Они могут быть интерпретированы как переменные. 72 | 2. Пожалуйста не используйте пробелы в тестовых строках (временно). Программы на ХЛП могут работать на них некорректно. 73 | 74 | При написании кода на Python используйте [black](https://pypi.org/project/black/). 75 | 76 | Если что-то непонятно, пишите [сюда](https://t.me/m_danya_jpg) или [сюда](https://t.me/Sadimer). 77 | 78 | ## Development notes (ENG) 79 | 80 | ### Running a setup with Docker (recommended) 81 | Run frontend+backend with Docker: 82 | ```bash 83 | 84 | # just filling in .env file, you can do it manually with any text editor 85 | echo 'REACT_APP_BACKEND_URL=http://127.0.0.1:3001 86 | BACKEND_PORT=3001 87 | FRONTEND_PORT=8080 88 | ' > .env 89 | 90 | docker-compose up --build -d 91 | ``` 92 | Then open `localhost:8080` in your browser. 93 | 94 | ### Running a setup without Docker 95 | 96 | Run the backend: 97 | ```bash 98 | sudo apt install gprolog python3-venv 99 | cd api 100 | python3 -m venv venv 101 | source venv/bin/activate 102 | pip install -r requirements.txt 103 | python api.py 104 | ``` 105 | 106 | Run the frontend: 107 | ```bash 108 | # 0. install nodejs (version >= 16) 109 | # 1. run this: 110 | cd react-frontend 111 | npm install 112 | REACT_APP_BACKEND_URL=http://localhost:3001 npm start 113 | ``` 114 | 115 | ### API description 116 | 117 | Currently, the pipeline is like this: 118 | 1) Submitting the `.pl` file to the system 119 | 2) Executing this program on a set of tests 120 | 121 | #### Submitting a program 122 | 123 | `http://127.0.0.1:3001/submit` with form field `'submission'` 124 | 125 | Response: 126 | ```json 127 | { 128 | "submission_id": "90c5b537-43f4-47e2-a1da-638a457c2b7f", 129 | "message": "Successfully submitted", 130 | "status": 200 131 | } 132 | ``` 133 | 134 | #### Executing a program on a set of tests 135 | 136 | `POST http://127.0.0.1:3001/execute` with args 137 | `{"type": "gprolog", "task": "task_2", "submission_id": 138 | "90c5b537-43f4-47e2-a1da-638a457c2b7f"}` 139 | 140 | Response: 141 | 142 | ```json 143 | { 144 | "message": "Successfully executed", 145 | "result": [ 146 | { 147 | "test_number": 1, 148 | "result": "WA: output mismatch", 149 | "output_lines": [ 150 | "Length = 1", 151 | "yes" 152 | ], 153 | "correct_lines": [ 154 | "Length = 0", 155 | "yes" 156 | ], 157 | "test_text": "...", 158 | "test_consult_text": "..." 159 | }, 160 | { 161 | "test_number": 2, 162 | "result": "OK", 163 | "output_lines": [ 164 | "Length = 3", 165 | "yes" 166 | ], 167 | "correct_lines": [ 168 | "Length = 3", 169 | "yes" 170 | ], 171 | "test_text": "...", 172 | "test_consult_text": "..." 173 | }, 174 | { 175 | "test_number": 3, 176 | "result": "TL", 177 | "output_lines": [], 178 | "correct_lines": [ 179 | "Length = 2", 180 | "yes" 181 | ], 182 | "test_text": "...", 183 | "test_consult_text": "..." 184 | }, 185 | { 186 | "test_number": 4, 187 | "result": "RE", 188 | "output_lines": [ 189 | "exception: Fatal Error: local stack overflow (size: 16384 Kb, reached: 16383 Kb, environment variable used: LOCALSZ)" 190 | ], 191 | "correct_lines": [ 192 | "Length = 4", 193 | "yes" 194 | ], 195 | "test_text": "...", 196 | "test_consult_text": "..." 197 | } 198 | ], 199 | "status": 200 200 | } 201 | 202 | ``` 203 | 204 | ### Submitting and executing programs without a frontend 205 | 206 | One can use `api/submit_and_execute.sh` script to submit and execute 207 | a solution like this: 208 | ```bash 209 | ./submit_and_execute.sh task_5_1 examples/task_5_1.pl 210 | ``` 211 | 212 | Also, `api/submit.sh` and `api/execute.sh` scripts are available: 213 | 214 | ```bash 215 | $ ./submit.sh path/to/my_program.pl 216 | { 217 | "submission_id": "2d666df2-20b5-42da-9303-279481677f57", 218 | "message": "Successfully submitted", 219 | "status": 200 220 | } 221 | $ ./execute.sh task_1 2d666df2-20b5-42da-9303-279481677f57 222 | { 223 | "message": "Successfully executed", 224 | "result": [ 225 | ...... 226 | ], 227 | "status": 200 228 | } 229 | 230 | ``` 231 | --------------------------------------------------------------------------------