Research portable Memory game | Исследовать портируемую игру Память
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

37 líneas
649B

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