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

15 行
248B

  1. func memory_generateConstPlayfield(
  2. _ n: Int
  3. ) -> [Int: Int] {
  4. var idGroups = [Int: Int]()
  5. var id = 0
  6. for gid in stride(from: 0, to: n, by: 1) {
  7. idGroups[id] = gid
  8. id += 1
  9. idGroups[id] = gid
  10. id += 1
  11. }
  12. return idGroups
  13. }