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.

15 line
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. }