Research portable Memory game | Исследовать портируемую игру Память
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

39 linhas
653B

  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() -> str:
  17. idGroups = memory_generateConstPlayfield(2)
  18. if (
  19. len(idGroups) == 4 and
  20. idGroups[0] == 0 and
  21. idGroups[1] == 0 and
  22. idGroups[2] == 1 and
  23. idGroups[3] == 1
  24. ):
  25. return "OK: memory_generateConstPlayfield"
  26. #}
  27. return "ERR: memory_generateConstPlayfield"
  28. #}
  29. # L36: Run.
  30. print(test_memory_generateConstPlayfield())