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.

37 lines
644B

  1. // L4: Function.
  2. std::map<int, int> memory_generateConstPlayfield(n: int) {
  3. idGroups: std::map<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. str test_memory_generateConstPlayfield() {
  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())