Research portable Memory game | Исследовать портируемую игру Память
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
596B

  1. # L4: Function.
  2. def memory_generateConstPlayfield(
  3. n: int
  4. ) -> dict[int, int]:
  5. idGroups: dict[int, int] = { }
  6. id = 0
  7. for gid in range(0, n):
  8. idGroups[id] = gid
  9. id += 1
  10. idGroups[id] = gid
  11. id += 1
  12. #}
  13. return idGroups
  14. #}
  15. # L20: Test.
  16. def test_memory_generateConstPlayfield(
  17. ) -> str:
  18. idGroups = memory_generateConstPlayfield(2)
  19. if (
  20. len(idGroups) == 4 and
  21. idGroups[0] == 0 and
  22. idGroups[1] == 0 and
  23. idGroups[2] == 1 and
  24. idGroups[3] == 1
  25. ):
  26. return "OK: memory_generateConstPlayfield"
  27. #}
  28. return "ERR: memory_generateConstPlayfield"
  29. #}