Research portable Memory game | Исследовать портируемую игру Память
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

37 行
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())