From 5db321b691979162107181e0d18c911008163b8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B8=D1=85=D0=B0=D0=B8=D0=BB=20=D0=9A=D0=B0=D0=BF?= =?UTF-8?q?=D0=B5=D0=BB=D1=8C=D0=BA=D0=BE?= Date: Tue, 26 Mar 2024 23:05:29 +0300 Subject: [PATCH] d --- Swift/Memory.Aux.swift | 14 -------------- Swift/main.swift | 1 - gen-Swift | 5 +---- Swift/Memory.Test.swift => main.swift | 17 +++++++++++++++++ 4 files changed, 18 insertions(+), 19 deletions(-) delete mode 100644 Swift/Memory.Aux.swift delete mode 100644 Swift/main.swift rename Swift/Memory.Test.swift => main.swift (53%) diff --git a/Swift/Memory.Aux.swift b/Swift/Memory.Aux.swift deleted file mode 100644 index 4d28373..0000000 --- a/Swift/Memory.Aux.swift +++ /dev/null @@ -1,14 +0,0 @@ -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 -} diff --git a/Swift/main.swift b/Swift/main.swift deleted file mode 100644 index a19c5a7..0000000 --- a/Swift/main.swift +++ /dev/null @@ -1 +0,0 @@ -print(test_memory_generateConstPlayfield()) diff --git a/gen-Swift b/gen-Swift index 4f436fb..0fb55ff 100755 --- a/gen-Swift +++ b/gen-Swift @@ -1,4 +1 @@ -swiftc -o test_memory_Swift \ - Swift/Memory.Aux.swift \ - Swift/Memory.Test.swift \ - Swift/main.swift +swiftc -o test_memory_Swift main.swift diff --git a/Swift/Memory.Test.swift b/main.swift similarity index 53% rename from Swift/Memory.Test.swift rename to main.swift index 53e5d4d..602a87e 100644 --- a/Swift/Memory.Test.swift +++ b/main.swift @@ -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())