|
123456789101112131415161718192021222324252627282930313233343536 |
-
-
-
- // L4: Function.
-
- std::map<int, int> memory_generateConstPlayfield(n: int) {
- idGroups: std::map<int, int> = { }
- id = 0
- for gid in range(0, n):
- idGroups[id] = gid
- id += 1
- idGroups[id] = gid
- id += 1
- }
- return idGroups
- }
-
- // L20: Test.
-
- str test_memory_generateConstPlayfield() {
- 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())
|