From 9127286601ac338580ddf22e07273d9d47b2a975 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B8=D1=85=D0=B0=D0=B8=D0=BB=20=D0=9A=D0=B0=D0=BF?= =?UTF-8?q?=D0=B5=D0=BB=D1=8C=D0=BA=D0=BE?= Date: Wed, 27 Mar 2024 22:25:59 +0300 Subject: [PATCH] d --- gen-Python | 2 ++ main.py | 38 ++++++++++++++++++++++++++++++++++++++ main.swift | 2 +- 3 files changed, 41 insertions(+), 1 deletion(-) create mode 100755 gen-Python create mode 100644 main.py diff --git a/gen-Python b/gen-Python new file mode 100755 index 0000000..44f45f4 --- /dev/null +++ b/gen-Python @@ -0,0 +1,2 @@ +echo "python3 main.py" > test_memory_Python +chmod +x test_memory_Python diff --git a/main.py b/main.py new file mode 100644 index 0000000..2934776 --- /dev/null +++ b/main.py @@ -0,0 +1,38 @@ + + + +# L4: Function. + +def memory_generateConstPlayfield( + n: int +) -> dict[int, int]: + idGroups: dict[int, int] = { } + id = 0 + for gid in range(0, n): + idGroups[id] = gid + id += 1 + idGroups[id] = gid + id += 1 + #} + return idGroups +#} + +# L20: Test. + +def test_memory_generateConstPlayfield() -> str: + idGroups = memory_generateConstPlayfield(2) + if ( + len(idGroups) == 4 and + idGroups[0] == 0 and + idGroups[1] == 0 and + idGroups[2] == 1 and + idGroups[3] == 1 + ): + return "OK: memory_generateConstPlayfield" + #} + return "ERR: memory_generateConstPlayfield" +#} + +# L36: Run. + +print(test_memory_generateConstPlayfield()) diff --git a/main.swift b/main.swift index 3a584d8..604156f 100644 --- a/main.swift +++ b/main.swift @@ -1,7 +1,7 @@ -// L4: Function +// L4: Function. func memory_generateConstPlayfield( _ n: Int