Skip to content

Commit 09f1c69

Browse files
author
Guled
committed
Developing Genetic Algorithm code, as well as a demo
1 parent dc35211 commit 09f1c69

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1307
-191
lines changed

Example/MLKit.xcodeproj/project.pbxproj

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,16 @@
99
/* Begin PBXBuildFile section */
1010
16C9F55B9FB2BEAF643302B4 /* Pods_MLKit_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8829C99A800D59865185C8D0 /* Pods_MLKit_Example.framework */; };
1111
607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD51AFB9204008FA782 /* AppDelegate.swift */; };
12-
607FACD81AFB9204008FA782 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD71AFB9204008FA782 /* ViewController.swift */; };
1312
607FACDB1AFB9204008FA782 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 607FACD91AFB9204008FA782 /* Main.storyboard */; };
1413
607FACDD1AFB9204008FA782 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 607FACDC1AFB9204008FA782 /* Images.xcassets */; };
1514
607FACE01AFB9204008FA782 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */; };
1615
7D7064C9A3631B7752642915 /* Pods_MLKit_Tests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F7E553BF29858564109C95C /* Pods_MLKit_Tests.framework */; };
16+
9A2618FF1E6F1C5E006B9D6E /* GeneticSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A2618FD1E6F1C4E006B9D6E /* GeneticSpec.swift */; };
17+
9A5294461E6F22BA00506C2A /* GameScene.sks in Resources */ = {isa = PBXBuildFile; fileRef = 9A5294451E6F22BA00506C2A /* GameScene.sks */; };
18+
9A5294481E6F22C000506C2A /* GameScene.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A5294471E6F22C000506C2A /* GameScene.swift */; };
19+
9A52944A1E6F22C800506C2A /* GameViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A5294491E6F22C800506C2A /* GameViewController.swift */; };
20+
9A52944C1E6F232F00506C2A /* bird.atlas in Resources */ = {isa = PBXBuildFile; fileRef = 9A52944B1E6F232F00506C2A /* bird.atlas */; };
21+
9A5294501E6F44E200506C2A /* GeneticOperations.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A52944F1E6F44E200506C2A /* GeneticOperations.swift */; };
1722
9A54B3B81E5B5D6D0059B577 /* kc_house_data.csv in Resources */ = {isa = PBXBuildFile; fileRef = 9A54B3B71E5B5D6D0059B577 /* kc_house_data.csv */; };
1823
9A92AE061E6DB958000DBC84 /* LassoRegressionSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A92AE051E6DB958000DBC84 /* LassoRegressionSpec.swift */; };
1924
9A92AE081E6DB96B000DBC84 /* MLDataManagerSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A92AE071E6DB96B000DBC84 /* MLDataManagerSpec.swift */; };
@@ -55,7 +60,6 @@
5560
607FACD01AFB9204008FA782 /* MLKit_Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MLKit_Example.app; sourceTree = BUILT_PRODUCTS_DIR; };
5661
607FACD41AFB9204008FA782 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
5762
607FACD51AFB9204008FA782 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
58-
607FACD71AFB9204008FA782 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
5963
607FACDA1AFB9204008FA782 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
6064
607FACDC1AFB9204008FA782 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
6165
607FACDF1AFB9204008FA782 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = "<group>"; };
@@ -64,7 +68,13 @@
6468
65CE8F014155800F07E3652F /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = "<group>"; };
6569
6FE1BF7F8EF374CFB92CBB77 /* Pods-MLKit_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MLKit_Tests.release.xcconfig"; path = "Pods/Target Support Files/Pods-MLKit_Tests/Pods-MLKit_Tests.release.xcconfig"; sourceTree = "<group>"; };
6670
8829C99A800D59865185C8D0 /* Pods_MLKit_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_MLKit_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; };
71+
9A2618FD1E6F1C4E006B9D6E /* GeneticSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneticSpec.swift; sourceTree = "<group>"; };
6772
9A4707A91E5C8F51002C2268 /* MLKit-PlayGround.playground */ = {isa = PBXFileReference; lastKnownFileType = file.playground; name = "MLKit-PlayGround.playground"; path = "../MLKit-PlayGround.playground"; sourceTree = "<group>"; };
73+
9A5294451E6F22BA00506C2A /* GameScene.sks */ = {isa = PBXFileReference; lastKnownFileType = file.sks; path = GameScene.sks; sourceTree = "<group>"; };
74+
9A5294471E6F22C000506C2A /* GameScene.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GameScene.swift; sourceTree = "<group>"; };
75+
9A5294491E6F22C800506C2A /* GameViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GameViewController.swift; sourceTree = "<group>"; };
76+
9A52944B1E6F232F00506C2A /* bird.atlas */ = {isa = PBXFileReference; lastKnownFileType = folder.skatlas; path = bird.atlas; sourceTree = "<group>"; };
77+
9A52944F1E6F44E200506C2A /* GeneticOperations.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneticOperations.swift; sourceTree = "<group>"; };
6878
9A54B3B71E5B5D6D0059B577 /* kc_house_data.csv */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = kc_house_data.csv; sourceTree = "<group>"; };
6979
9A92AE051E6DB958000DBC84 /* LassoRegressionSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LassoRegressionSpec.swift; sourceTree = "<group>"; };
7080
9A92AE071E6DB96B000DBC84 /* MLDataManagerSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MLDataManagerSpec.swift; sourceTree = "<group>"; };
@@ -143,8 +153,12 @@
143153
isa = PBXGroup;
144154
children = (
145155
607FACD51AFB9204008FA782 /* AppDelegate.swift */,
146-
607FACD71AFB9204008FA782 /* ViewController.swift */,
156+
9A5294451E6F22BA00506C2A /* GameScene.sks */,
157+
9A52944F1E6F44E200506C2A /* GeneticOperations.swift */,
158+
9A5294471E6F22C000506C2A /* GameScene.swift */,
159+
9A5294491E6F22C800506C2A /* GameViewController.swift */,
147160
607FACD91AFB9204008FA782 /* Main.storyboard */,
161+
9A52944B1E6F232F00506C2A /* bird.atlas */,
148162
607FACDC1AFB9204008FA782 /* Images.xcassets */,
149163
607FACDE1AFB9204008FA782 /* LaunchScreen.xib */,
150164
607FACD31AFB9204008FA782 /* Supporting Files */,
@@ -171,6 +185,7 @@
171185
9A92AE0B1E6DB995000DBC84 /* SimpleLinearRegressionSpec.swift */,
172186
9A92AE0D1E6DB9A4000DBC84 /* RidgeRegressionSpec.swift */,
173187
9A92AE0F1E6DB9B1000DBC84 /* NeuralNetworkSpec.swift */,
188+
9A2618FD1E6F1C4E006B9D6E /* GeneticSpec.swift */,
174189
607FACE91AFB9204008FA782 /* Supporting Files */,
175190
);
176191
path = Tests;
@@ -288,8 +303,10 @@
288303
isa = PBXResourcesBuildPhase;
289304
buildActionMask = 2147483647;
290305
files = (
306+
9A5294461E6F22BA00506C2A /* GameScene.sks in Resources */,
291307
607FACDB1AFB9204008FA782 /* Main.storyboard in Resources */,
292308
607FACE01AFB9204008FA782 /* LaunchScreen.xib in Resources */,
309+
9A52944C1E6F232F00506C2A /* bird.atlas in Resources */,
293310
607FACDD1AFB9204008FA782 /* Images.xcassets in Resources */,
294311
);
295312
runOnlyForDeploymentPostprocessing = 0;
@@ -402,7 +419,9 @@
402419
isa = PBXSourcesBuildPhase;
403420
buildActionMask = 2147483647;
404421
files = (
405-
607FACD81AFB9204008FA782 /* ViewController.swift in Sources */,
422+
9A5294481E6F22C000506C2A /* GameScene.swift in Sources */,
423+
9A5294501E6F44E200506C2A /* GeneticOperations.swift in Sources */,
424+
9A52944A1E6F22C800506C2A /* GameViewController.swift in Sources */,
406425
607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */,
407426
);
408427
runOnlyForDeploymentPostprocessing = 0;
@@ -417,6 +436,7 @@
417436
9A92AE061E6DB958000DBC84 /* LassoRegressionSpec.swift in Sources */,
418437
9A92AE081E6DB96B000DBC84 /* MLDataManagerSpec.swift in Sources */,
419438
9A92AE101E6DB9B1000DBC84 /* NeuralNetworkSpec.swift in Sources */,
439+
9A2618FF1E6F1C5E006B9D6E /* GeneticSpec.swift in Sources */,
420440
9A92AE141E6DBD9A000DBC84 /* CSVReader.swift in Sources */,
421441
);
422442
runOnlyForDeploymentPostprocessing = 0;

Example/MLKit/Base.lproj/LaunchScreen.xib

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1-
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6214" systemVersion="14A314h" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES">
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="16D32" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES">
3+
<device id="retina4_7" orientation="portrait">
4+
<adaptation id="fullscreen"/>
5+
</device>
36
<dependencies>
4-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6207"/>
7+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
58
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
9+
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
610
</dependencies>
711
<objects>
812
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
@@ -11,25 +15,25 @@
1115
<rect key="frame" x="0.0" y="0.0" width="480" height="480"/>
1216
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
1317
<subviews>
14-
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" Copyright (c) 2015 CocoaPods. All rights reserved." textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="8ie-xW-0ye">
15-
<rect key="frame" x="20" y="439" width="441" height="21"/>
16-
<fontDescription key="fontDescription" type="system" pointSize="17"/>
18+
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="MLKit EXAMPLE" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="kId-c2-rCX">
19+
<rect key="frame" x="20" y="140" width="441" height="43"/>
20+
<fontDescription key="fontDescription" type="boldSystem" pointSize="36"/>
1721
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
1822
<nil key="highlightedColor"/>
1923
</label>
20-
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="MLKit" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="kId-c2-rCX">
21-
<rect key="frame" x="20" y="140" width="441" height="43"/>
22-
<fontDescription key="fontDescription" type="boldSystem" pointSize="36"/>
24+
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" Copyright (c) 2017 Guled Ahmed. All rights reserved. Credit goes to fullstackio for Flappy Bird game. " textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="8ie-xW-0ye">
25+
<rect key="frame" x="23" y="282" width="435" height="21"/>
26+
<fontDescription key="fontDescription" type="system" pointSize="17"/>
2327
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
2428
<nil key="highlightedColor"/>
2529
</label>
2630
</subviews>
27-
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
31+
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
2832
<constraints>
2933
<constraint firstItem="kId-c2-rCX" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="bottom" multiplier="1/3" constant="1" id="5cJ-9S-tgC"/>
3034
<constraint firstAttribute="centerX" secondItem="kId-c2-rCX" secondAttribute="centerX" id="Koa-jz-hwk"/>
31-
<constraint firstAttribute="bottom" secondItem="8ie-xW-0ye" secondAttribute="bottom" constant="20" id="Kzo-t9-V3l"/>
32-
<constraint firstItem="8ie-xW-0ye" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="MfP-vx-nX0"/>
35+
<constraint firstAttribute="bottom" secondItem="8ie-xW-0ye" secondAttribute="bottom" constant="177" id="Kzo-t9-V3l"/>
36+
<constraint firstItem="8ie-xW-0ye" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="23" id="MfP-vx-nX0"/>
3337
<constraint firstAttribute="centerX" secondItem="8ie-xW-0ye" secondAttribute="centerX" id="ZEH-qu-HZ9"/>
3438
<constraint firstItem="kId-c2-rCX" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="fvb-Df-36g"/>
3539
</constraints>

Example/MLKit/Base.lproj/Main.storyboard

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,25 @@
1-
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6211" systemVersion="14A298i" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="vXZ-lx-hvc">
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11762" systemVersion="16D32" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="vXZ-lx-hvc">
3+
<device id="retina4_7" orientation="portrait">
4+
<adaptation id="fullscreen"/>
5+
</device>
36
<dependencies>
4-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6204"/>
7+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
8+
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
59
</dependencies>
610
<scenes>
7-
<!--View Controller-->
11+
<!--Game View Controller-->
812
<scene sceneID="ufC-wZ-h7g">
913
<objects>
10-
<viewController id="vXZ-lx-hvc" customClass="ViewController" customModuleProvider="target" sceneMemberID="viewController">
14+
<viewController id="vXZ-lx-hvc" customClass="GameViewController" customModule="MLKit_Example" customModuleProvider="target" sceneMemberID="viewController">
1115
<layoutGuides>
1216
<viewControllerLayoutGuide type="top" id="jyV-Pf-zRb"/>
1317
<viewControllerLayoutGuide type="bottom" id="2fi-mo-0CV"/>
1418
</layoutGuides>
15-
<view key="view" contentMode="scaleToFill" id="kh9-bI-dsS">
16-
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
19+
<view key="view" contentMode="scaleToFill" id="kh9-bI-dsS" customClass="SKView">
20+
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
1721
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
18-
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
22+
<color key="backgroundColor" cocoaTouchSystemColor="darkTextColor"/>
1923
</view>
2024
</viewController>
2125
<placeholder placeholderIdentifier="IBFirstResponder" id="x5A-6p-PRh" sceneMemberID="firstResponder"/>

Example/MLKit/GameScene.sks

2.51 KB
Binary file not shown.

0 commit comments

Comments
 (0)