@jutge.org/toolkit 4.4.7 → 4.4.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/prompts/creators/create-statement-from-solution.tpl.txt +9 -0
- package/assets/prompts/funcs/creators/create-solution.tpl.txt +23 -0
- package/assets/prompts/funcs/creators/create-statement.tpl.txt +28 -0
- package/assets/prompts/funcs/creators/private-test-cases.tpl.txt +12 -0
- package/assets/prompts/funcs/creators/sample-test-cases.tpl.txt +16 -0
- package/assets/prompts/funcs/creators/sample.dt.tpl.txt +15 -0
- package/assets/prompts/funcs/examples/statement.tex +23 -0
- package/assets/prompts/funcs/proglangs/py.md +9 -0
- package/assets/prompts/io/examples/statement-coda.tex +7 -0
- package/dist/index.js +719 -464
- package/docs/getting-started-guide.md +6 -0
- package/docs/jutge-ai.md +1 -1
- package/package.json +16 -11
- package/toolkit/clean.ts +5 -4
- package/toolkit/convert.ts +3 -3
- package/toolkit/download.ts +16 -0
- package/toolkit/dummies.ts +219 -0
- package/toolkit/generate.ts +105 -13
- package/toolkit/index.ts +4 -0
- package/toolkit/lint.ts +4 -6
- package/toolkit/make.ts +3 -3
- package/toolkit/quiz.ts +3 -3
- package/docs/windows.md +0 -106
- /package/assets/prompts/{examples → funcs/examples}/statement-coda.tex +0 -0
- /package/assets/prompts/{creators → io/creators}/create-solution.tpl.txt +0 -0
- /package/assets/prompts/{creators → io/creators}/create-statement.tpl.txt +0 -0
- /package/assets/prompts/{creators → io/creators}/create-translation.tpl.txt +0 -0
- /package/assets/prompts/{creators → io/creators}/private-test-cases.txt +0 -0
- /package/assets/prompts/{creators → io/creators}/sample-test-cases.txt +0 -0
- /package/assets/prompts/{examples → io/examples}/statement.tex +0 -0
- /package/assets/prompts/{generators → io/generators}/efficiency.md +0 -0
- /package/assets/prompts/{generators → io/generators}/hard.md +0 -0
- /package/assets/prompts/{generators → io/generators}/random.md +0 -0
- /package/assets/prompts/{proglangs → io/proglangs}/cc.md +0 -0
- /package/assets/prompts/{proglangs → io/proglangs}/py.md +0 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
The following program is a solution to the problem. Write a problem statement in {{langName}} that describes what the program must do (input/output, constraints, task). Use the same LaTeX macros and structure as in the example.
|
|
2
|
+
|
|
3
|
+
{{#if userPrompt}}
|
|
4
|
+
Additional instructions from the user: {{userPrompt}}
|
|
5
|
+
|
|
6
|
+
{{/if}}
|
|
7
|
+
Program in {{proglangName}}:
|
|
8
|
+
|
|
9
|
+
{{solutionSource}}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
Now, write a solution in {{proglang}} to solve this problem.
|
|
2
|
+
|
|
3
|
+
Take these instructions into account:
|
|
4
|
+
|
|
5
|
+
- It must be written in an idiomatic way and only include relevant comments.
|
|
6
|
+
|
|
7
|
+
- The code must be efficient and handle all edge cases.
|
|
8
|
+
|
|
9
|
+
- The code should only write the required {{functions}} functions and any helper functions that are needed.
|
|
10
|
+
|
|
11
|
+
- The code should not execute any statement.
|
|
12
|
+
|
|
13
|
+
- The code should not define a main program or a main function.
|
|
14
|
+
|
|
15
|
+
- The code should not define global variables but may define global constants.
|
|
16
|
+
|
|
17
|
+
- The code must be well written and easy to understand to novices. It cannot use advanced constructs.
|
|
18
|
+
|
|
19
|
+
- The code does not have to check the preconditions stated in the problem statement.
|
|
20
|
+
|
|
21
|
+
- Do not use any non-standard libraries.
|
|
22
|
+
|
|
23
|
+
{{proglangPrompt}}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
You are to write the statement of a new {{proglang}} programming problem in {{language}}.
|
|
2
|
+
|
|
3
|
+
The statement must be written in LaTeX, using a few predefined macros.
|
|
4
|
+
Use LaTeX math syntax for formulas and variables.
|
|
5
|
+
Use \lstinline macros for inline code snippets.
|
|
6
|
+
Use dollars for inline maths and use \[ and \] for display maths.
|
|
7
|
+
Do not add input/output test cases in the statement.
|
|
8
|
+
Separate paragraphs by a blank line and \medskip macro.
|
|
9
|
+
|
|
10
|
+
Write in the style of programming contests like the ACM ICPC or Jutge.org.
|
|
11
|
+
|
|
12
|
+
Here is an example for an unrelated problem in English, follow its structure and macros:
|
|
13
|
+
|
|
14
|
+
{{latexExample}}
|
|
15
|
+
|
|
16
|
+
The title for the new problem is:
|
|
17
|
+
|
|
18
|
+
{{title}}
|
|
19
|
+
|
|
20
|
+
The theme of the new problem is:
|
|
21
|
+
|
|
22
|
+
{{theme}}
|
|
23
|
+
|
|
24
|
+
The functions that are requested in the new problem are:
|
|
25
|
+
|
|
26
|
+
{{functions}}
|
|
27
|
+
|
|
28
|
+
The headers of the functions must be written in {{proglang}}.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
Now, write a {{proglang}} program that serves to check the correctness and the efficiency of function {{function}}.
|
|
2
|
+
|
|
3
|
+
This program should be a sequence of print statements that call {{function}} with some inputs.
|
|
4
|
+
|
|
5
|
+
Some inputs should cover edge cases and some other inputs should be used to check the efficiency.
|
|
6
|
+
|
|
7
|
+
Do not include comments now.
|
|
8
|
+
|
|
9
|
+
Do not use loops.
|
|
10
|
+
|
|
11
|
+
Do not add any formatting, markdown or code fences.
|
|
12
|
+
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
Now, write a {{proglang}} program that serves as sample test cases of the {{functions}} functions.
|
|
2
|
+
|
|
3
|
+
This program should be a sequence of print statements that call each of the required functions
|
|
4
|
+
with some sample inputs.
|
|
5
|
+
|
|
6
|
+
Sample test cases must be written in {{proglang}} and follow the specification of the functions.
|
|
7
|
+
|
|
8
|
+
Sample test cases should be relatively small but cover interesting cases but not all edge cases.
|
|
9
|
+
|
|
10
|
+
If the problem statement features some examples, include them as part of the sample test cases.
|
|
11
|
+
|
|
12
|
+
Do not include comments now.
|
|
13
|
+
|
|
14
|
+
Separate the tests for each function with an empty line.
|
|
15
|
+
|
|
16
|
+
Do not add any formatting, markdown or code fences.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
Now, write a Python doctest with the same inputs as in this test cases:
|
|
2
|
+
|
|
3
|
+
{{sampleTests}}
|
|
4
|
+
|
|
5
|
+
Do not include comments now.
|
|
6
|
+
|
|
7
|
+
Separate the tests for each function with an empty line.
|
|
8
|
+
|
|
9
|
+
Do not add any formatting, markdown or code fences. Do not output empty lines.
|
|
10
|
+
|
|
11
|
+
Output should follow the format of Python doctests. For instance:
|
|
12
|
+
>>> factorial(5)
|
|
13
|
+
120
|
|
14
|
+
>>> factorial(0)
|
|
15
|
+
1
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
\Problem{Primes everywhere}
|
|
2
|
+
|
|
3
|
+
\UsePython
|
|
4
|
+
|
|
5
|
+
\Statement
|
|
6
|
+
|
|
7
|
+
Carla is a young girl who loves math. She is interested in prime numbers and wants some functions to help her in her mathematical musitations.
|
|
8
|
+
|
|
9
|
+
\medskip
|
|
10
|
+
|
|
11
|
+
\begin{enumerate}
|
|
12
|
+
|
|
13
|
+
\item Write a function \lstinline|is_prime(n: int) -> bool| that returns True if $n$ is a prime number, and False otherwise.
|
|
14
|
+
|
|
15
|
+
\item Write a function \lstinline|next_prime(n: int) -> int| that returns the smallest prime number greater than $n$.
|
|
16
|
+
|
|
17
|
+
\item Write a function \lstinline|count_primes(a: int, b: int) -> int| that returns the number of prime numbers between $a$ and $b$ inclusive.
|
|
18
|
+
|
|
19
|
+
\end{enumerate}
|
|
20
|
+
|
|
21
|
+
All given values by Carla are non-negative integers.
|
|
22
|
+
|
|
23
|
+
\SampleSession
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Additional guidelines for Python
|
|
2
|
+
|
|
3
|
+
- Use f-strings for string formatting when possible.
|
|
4
|
+
|
|
5
|
+
- Use type hints for function definitions. Do not use old-style type hints such as `List[int]` with `List` imported from `typing`, but use modern syntax such as `list[int]`.
|
|
6
|
+
|
|
7
|
+
- Ensure that the generated Python3 code follows best practices, including proper indentation, use of functions, use of docstrings, and adherence to PEP 8 style guidelines.
|
|
8
|
+
|
|
9
|
+
- Each function should be documented with a docstring.
|