|
|
@@ -1,3 +1,18 @@ |
|
|
|
func memory_generateConstPlayfield( |
|
|
|
_ n: Int |
|
|
|
) -> [Int: Int] { |
|
|
|
var idGroups = [Int: Int]() |
|
|
|
var id = 0 |
|
|
|
for gid in stride(from: 0, to: n, by: 1) { |
|
|
|
idGroups[id] = gid |
|
|
|
id += 1 |
|
|
|
idGroups[id] = gid |
|
|
|
id += 1 |
|
|
|
} |
|
|
|
|
|
|
|
return idGroups |
|
|
|
} |
|
|
|
|
|
|
|
func test_memory_generateConstPlayfield() -> String { |
|
|
|
let idGroups = memory_generateConstPlayfield(2) |
|
|
|
if ( |
|
|
@@ -12,3 +27,5 @@ func test_memory_generateConstPlayfield() -> String { |
|
|
|
|
|
|
|
return "ERR: memory_generateConstPlayfield" |
|
|
|
} |
|
|
|
|
|
|
|
print(test_memory_generateConstPlayfield()) |