diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..bf2c235
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,90 @@
+
+# Created by https://www.gitignore.io/api/swift,macos
+
+### macOS ###
+*.DS_Store
+.AppleDouble
+.LSOverride
+
+# Icon must end with two \r
+Icon
+
+# Thumbnails
+._*
+
+# Files that might appear in the root of a volume
+.DocumentRevisions-V100
+.fseventsd
+.Spotlight-V100
+.TemporaryItems
+.Trashes
+.VolumeIcon.icns
+.com.apple.timemachine.donotpresent
+
+# Directories potentially created on remote AFP share
+.AppleDB
+.AppleDesktop
+Network Trash Folder
+Temporary Items
+.apdisk
+
+### Swift ###
+# Xcode
+#
+# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
+
+## Build generated
+build/
+DerivedData/
+
+## Various settings
+*.pbxuser
+!default.pbxuser
+*.mode1v3
+!default.mode1v3
+*.mode2v3
+!default.mode2v3
+*.perspectivev3
+!default.perspectivev3
+xcuserdata/
+
+## Other
+*.moved-aside
+*.xccheckout
+*.xcscmblueprint
+
+## Obj-C/Swift specific
+*.hmap
+*.ipa
+*.dSYM.zip
+*.dSYM
+
+## Playgrounds
+timeline.xctimeline
+playground.xcworkspace
+
+# Swift Package Manager
+#
+# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
+# Packages/
+# Package.pins
+.build/
+
+# CocoaPods - Refactored to standalone file
+
+# Carthage - Refactored to standalone file
+
+# fastlane
+#
+# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
+# screenshots whenever they are needed.
+# For more information about the recommended setup visit:
+# https://docs.fastlane.tools/best-practices/source-control/#source-control
+
+fastlane/report.xml
+fastlane/Preview.html
+fastlane/screenshots
+fastlane/test_output
+
+
+# End of https://www.gitignore.io/api/swift,macos
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..761c39d
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2018 Nikita Dolmatov
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..6962300
--- /dev/null
+++ b/README.md
@@ -0,0 +1,2 @@
+# millipede-swift :bug:
+Simple Swift version of [getmillipede](https://github.com/getmillipede/).
diff --git a/millipede.playground/Contents.swift b/millipede.playground/Contents.swift
new file mode 100644
index 0000000..28ffa53
--- /dev/null
+++ b/millipede.playground/Contents.swift
@@ -0,0 +1,37 @@
+
+/*
+ * Animated model of a centipede
+ * Created by Nikita Dolmatov on July 2017
+ */
+
+import Foundation
+
+var millipede = ""
+var pos = 0
+
+func print_body_segment(size: Int) {
+ for _ in 0...size {
+ millipede += " "
+ }
+ millipede += "╚═(███)═╝\n"
+}
+
+func get_offset_from(_ pos: Int, for idx: Int) -> Int {
+ return Int(round(5 * sin(Double(idx + pos)/3) + 5))
+}
+
+func print_millipede(size: Int, toPos pos: Int) {
+
+ millipede = String(repeating: " ", count: get_offset_from(pos, for: 1))
+ millipede += "╚⊙ ⊙╝\n"
+
+ for idx in 1...size {
+ let offset = get_offset_from(pos, for: idx)
+ print_body_segment(size: offset)
+ }
+}
+
+while (true) {
+ pos += 1
+ print_millipede(size: 20, toPos: pos)
+}
diff --git a/millipede.playground/contents.xcplayground b/millipede.playground/contents.xcplayground
new file mode 100644
index 0000000..1d80b10
--- /dev/null
+++ b/millipede.playground/contents.xcplayground
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/millipede.xcodeproj/project.pbxproj b/millipede.xcodeproj/project.pbxproj
deleted file mode 100644
index 35dc06c..0000000
--- a/millipede.xcodeproj/project.pbxproj
+++ /dev/null
@@ -1,243 +0,0 @@
-// !$*UTF8*$!
-{
- archiveVersion = 1;
- classes = {
- };
- objectVersion = 46;
- objects = {
-
-/* Begin PBXBuildFile section */
- 1490B4D71B66521700E9E860 /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1490B4D61B66521700E9E860 /* main.swift */; };
-/* End PBXBuildFile section */
-
-/* Begin PBXCopyFilesBuildPhase section */
- 1490B4D11B66521700E9E860 /* CopyFiles */ = {
- isa = PBXCopyFilesBuildPhase;
- buildActionMask = 2147483647;
- dstPath = /usr/share/man/man1/;
- dstSubfolderSpec = 0;
- files = (
- );
- runOnlyForDeploymentPostprocessing = 1;
- };
-/* End PBXCopyFilesBuildPhase section */
-
-/* Begin PBXFileReference section */
- 1490B4D31B66521700E9E860 /* millipede */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = millipede; sourceTree = BUILT_PRODUCTS_DIR; };
- 1490B4D61B66521700E9E860 /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = ""; };
-/* End PBXFileReference section */
-
-/* Begin PBXFrameworksBuildPhase section */
- 1490B4D01B66521700E9E860 /* Frameworks */ = {
- isa = PBXFrameworksBuildPhase;
- buildActionMask = 2147483647;
- files = (
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
-/* End PBXFrameworksBuildPhase section */
-
-/* Begin PBXGroup section */
- 1490B4CA1B66521600E9E860 = {
- isa = PBXGroup;
- children = (
- 1490B4D51B66521700E9E860 /* millipede */,
- 1490B4D41B66521700E9E860 /* Products */,
- );
- sourceTree = "";
- };
- 1490B4D41B66521700E9E860 /* Products */ = {
- isa = PBXGroup;
- children = (
- 1490B4D31B66521700E9E860 /* millipede */,
- );
- name = Products;
- sourceTree = "";
- };
- 1490B4D51B66521700E9E860 /* millipede */ = {
- isa = PBXGroup;
- children = (
- 1490B4D61B66521700E9E860 /* main.swift */,
- );
- path = millipede;
- sourceTree = "";
- };
-/* End PBXGroup section */
-
-/* Begin PBXNativeTarget section */
- 1490B4D21B66521700E9E860 /* millipede */ = {
- isa = PBXNativeTarget;
- buildConfigurationList = 1490B4DA1B66521700E9E860 /* Build configuration list for PBXNativeTarget "millipede" */;
- buildPhases = (
- 1490B4CF1B66521700E9E860 /* Sources */,
- 1490B4D01B66521700E9E860 /* Frameworks */,
- 1490B4D11B66521700E9E860 /* CopyFiles */,
- );
- buildRules = (
- );
- dependencies = (
- );
- name = millipede;
- productName = millipede;
- productReference = 1490B4D31B66521700E9E860 /* millipede */;
- productType = "com.apple.product-type.tool";
- };
-/* End PBXNativeTarget section */
-
-/* Begin PBXProject section */
- 1490B4CB1B66521600E9E860 /* Project object */ = {
- isa = PBXProject;
- attributes = {
- LastUpgradeCheck = 0640;
- ORGANIZATIONNAME = "Arnaud Chong";
- TargetAttributes = {
- 1490B4D21B66521700E9E860 = {
- CreatedOnToolsVersion = 6.4;
- };
- };
- };
- buildConfigurationList = 1490B4CE1B66521600E9E860 /* Build configuration list for PBXProject "millipede" */;
- compatibilityVersion = "Xcode 3.2";
- developmentRegion = English;
- hasScannedForEncodings = 0;
- knownRegions = (
- en,
- );
- mainGroup = 1490B4CA1B66521600E9E860;
- productRefGroup = 1490B4D41B66521700E9E860 /* Products */;
- projectDirPath = "";
- projectRoot = "";
- targets = (
- 1490B4D21B66521700E9E860 /* millipede */,
- );
- };
-/* End PBXProject section */
-
-/* Begin PBXSourcesBuildPhase section */
- 1490B4CF1B66521700E9E860 /* Sources */ = {
- isa = PBXSourcesBuildPhase;
- buildActionMask = 2147483647;
- files = (
- 1490B4D71B66521700E9E860 /* main.swift in Sources */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
-/* End PBXSourcesBuildPhase section */
-
-/* Begin XCBuildConfiguration section */
- 1490B4D81B66521700E9E860 /* Debug */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- ALWAYS_SEARCH_USER_PATHS = NO;
- CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
- CLANG_CXX_LIBRARY = "libc++";
- CLANG_ENABLE_MODULES = YES;
- CLANG_ENABLE_OBJC_ARC = YES;
- CLANG_WARN_BOOL_CONVERSION = YES;
- CLANG_WARN_CONSTANT_CONVERSION = YES;
- CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
- CLANG_WARN_EMPTY_BODY = YES;
- CLANG_WARN_ENUM_CONVERSION = YES;
- CLANG_WARN_INT_CONVERSION = YES;
- CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
- CLANG_WARN_UNREACHABLE_CODE = YES;
- CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
- COPY_PHASE_STRIP = NO;
- DEBUG_INFORMATION_FORMAT = dwarf;
- ENABLE_STRICT_OBJC_MSGSEND = YES;
- GCC_C_LANGUAGE_STANDARD = gnu99;
- GCC_DYNAMIC_NO_PIC = NO;
- GCC_NO_COMMON_BLOCKS = YES;
- GCC_OPTIMIZATION_LEVEL = 0;
- GCC_PREPROCESSOR_DEFINITIONS = (
- "DEBUG=1",
- "$(inherited)",
- );
- GCC_SYMBOLS_PRIVATE_EXTERN = NO;
- GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
- GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
- GCC_WARN_UNDECLARED_SELECTOR = YES;
- GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
- GCC_WARN_UNUSED_FUNCTION = YES;
- GCC_WARN_UNUSED_VARIABLE = YES;
- MACOSX_DEPLOYMENT_TARGET = 10.10;
- MTL_ENABLE_DEBUG_INFO = YES;
- ONLY_ACTIVE_ARCH = YES;
- SDKROOT = macosx;
- SWIFT_OPTIMIZATION_LEVEL = "-Onone";
- };
- name = Debug;
- };
- 1490B4D91B66521700E9E860 /* Release */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- ALWAYS_SEARCH_USER_PATHS = NO;
- CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
- CLANG_CXX_LIBRARY = "libc++";
- CLANG_ENABLE_MODULES = YES;
- CLANG_ENABLE_OBJC_ARC = YES;
- CLANG_WARN_BOOL_CONVERSION = YES;
- CLANG_WARN_CONSTANT_CONVERSION = YES;
- CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
- CLANG_WARN_EMPTY_BODY = YES;
- CLANG_WARN_ENUM_CONVERSION = YES;
- CLANG_WARN_INT_CONVERSION = YES;
- CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
- CLANG_WARN_UNREACHABLE_CODE = YES;
- CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
- COPY_PHASE_STRIP = NO;
- DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
- ENABLE_NS_ASSERTIONS = NO;
- ENABLE_STRICT_OBJC_MSGSEND = YES;
- GCC_C_LANGUAGE_STANDARD = gnu99;
- GCC_NO_COMMON_BLOCKS = YES;
- GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
- GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
- GCC_WARN_UNDECLARED_SELECTOR = YES;
- GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
- GCC_WARN_UNUSED_FUNCTION = YES;
- GCC_WARN_UNUSED_VARIABLE = YES;
- MACOSX_DEPLOYMENT_TARGET = 10.10;
- MTL_ENABLE_DEBUG_INFO = NO;
- SDKROOT = macosx;
- };
- name = Release;
- };
- 1490B4DB1B66521700E9E860 /* Debug */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- PRODUCT_NAME = "$(TARGET_NAME)";
- };
- name = Debug;
- };
- 1490B4DC1B66521700E9E860 /* Release */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- PRODUCT_NAME = "$(TARGET_NAME)";
- };
- name = Release;
- };
-/* End XCBuildConfiguration section */
-
-/* Begin XCConfigurationList section */
- 1490B4CE1B66521600E9E860 /* Build configuration list for PBXProject "millipede" */ = {
- isa = XCConfigurationList;
- buildConfigurations = (
- 1490B4D81B66521700E9E860 /* Debug */,
- 1490B4D91B66521700E9E860 /* Release */,
- );
- defaultConfigurationIsVisible = 0;
- defaultConfigurationName = Release;
- };
- 1490B4DA1B66521700E9E860 /* Build configuration list for PBXNativeTarget "millipede" */ = {
- isa = XCConfigurationList;
- buildConfigurations = (
- 1490B4DB1B66521700E9E860 /* Debug */,
- 1490B4DC1B66521700E9E860 /* Release */,
- );
- defaultConfigurationIsVisible = 0;
- };
-/* End XCConfigurationList section */
- };
- rootObject = 1490B4CB1B66521600E9E860 /* Project object */;
-}
diff --git a/millipede.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/millipede.xcodeproj/project.xcworkspace/contents.xcworkspacedata
deleted file mode 100644
index dcef4cb..0000000
--- a/millipede.xcodeproj/project.xcworkspace/contents.xcworkspacedata
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
diff --git a/millipede.xcodeproj/xcuserdata/shine.xcuserdatad/xcschemes/millipede.xcscheme b/millipede.xcodeproj/xcuserdata/shine.xcuserdatad/xcschemes/millipede.xcscheme
deleted file mode 100644
index 10655da..0000000
--- a/millipede.xcodeproj/xcuserdata/shine.xcuserdatad/xcschemes/millipede.xcscheme
+++ /dev/null
@@ -1,88 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/millipede.xcodeproj/xcuserdata/shine.xcuserdatad/xcschemes/xcschememanagement.plist b/millipede.xcodeproj/xcuserdata/shine.xcuserdatad/xcschemes/xcschememanagement.plist
deleted file mode 100644
index 349b938..0000000
--- a/millipede.xcodeproj/xcuserdata/shine.xcuserdatad/xcschemes/xcschememanagement.plist
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
- SchemeUserState
-
- millipede.xcscheme
-
- orderHint
- 0
-
-
- SuppressBuildableAutocreation
-
- 1490B4D21B66521700E9E860
-
- primary
-
-
-
-
-
diff --git a/millipede/main.swift b/millipede/main.swift
deleted file mode 100644
index accd24c..0000000
--- a/millipede/main.swift
+++ /dev/null
@@ -1,33 +0,0 @@
-//
-// main.swift
-// millipede
-//
-// Created by Arnaud Chong on 27/07/2015.
-// Copyright (c) 2015 Arnaud Chong. All rights reserved.
-//
-
-import Foundation
-
-let offsets = [2, 1, 0, 1, 2, 3, 4, 4, 3]
-
-func print_body(size: Int) {
- for _ in 0...size {
- print(" ")
- }
- println("╚═(███)═╝")
-}
-
-func print_millipede(size: Int) {
- println(" ╚⊙ ⊙╝")
- for idx in 1...size {
- print_body(offsets[idx % offsets.count])
- }
-}
-
-if Process.arguments.count < 2 {
- print_millipede(20)
-}
-else {
- print_millipede(Process.arguments[1].toInt()!)
-}
-