├── GameOfLifeSwift
├── GameScene.sks
├── GameOfLifeAssets
│ ├── Assets
│ │ ├── grid.png
│ │ ├── balloon.png
│ │ ├── bubble.png
│ │ └── microscope.png
│ ├── Buttons
│ │ ├── play.png
│ │ ├── button.png
│ │ ├── pause.png
│ │ ├── button-pressed.png
│ │ ├── pause-pressed.png
│ │ └── play-pressed.png
│ └── BackgroundImage
│ │ └── background.png
├── Images.xcassets
│ ├── Spaceship.imageset
│ │ ├── Spaceship.png
│ │ └── Contents.json
│ ├── AppIcon.appiconset
│ │ └── Contents.json
│ └── LaunchImage.launchimage
│ │ └── Contents.json
├── Tile.swift
├── Info.plist
├── Base.lproj
│ └── Main.storyboard
├── GameViewController.swift
├── AppDelegate.swift
└── GameScene.swift
├── game-of-life-swift-screenshot.png
├── GameOfLifeSwift.xcodeproj
├── xcuserdata
│ ├── benreynolds.xcuserdatad
│ │ ├── xcdebugger
│ │ │ └── Breakpoints_v2.xcbkptlist
│ │ └── xcschemes
│ │ │ ├── xcschememanagement.plist
│ │ │ └── GameOfLifeSwift.xcscheme
│ └── benjaminencz.xcuserdatad
│ │ └── xcschemes
│ │ ├── xcschememanagement.plist
│ │ └── GameOfLifeSwift.xcscheme
├── project.xcworkspace
│ ├── contents.xcworkspacedata
│ ├── xcuserdata
│ │ ├── benreynolds.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ │ └── benjaminencz.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcshareddata
│ │ └── GameOfLifeSwift.xccheckout
└── project.pbxproj
├── README.md
└── GameOfLifeSwiftTests
├── Info.plist
└── GameOfLifeSwiftTests.swift
/GameOfLifeSwift/GameScene.sks:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Benolds/GameOfLife-Swift/HEAD/GameOfLifeSwift/GameScene.sks
--------------------------------------------------------------------------------
/game-of-life-swift-screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Benolds/GameOfLife-Swift/HEAD/game-of-life-swift-screenshot.png
--------------------------------------------------------------------------------
/GameOfLifeSwift/GameOfLifeAssets/Assets/grid.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Benolds/GameOfLife-Swift/HEAD/GameOfLifeSwift/GameOfLifeAssets/Assets/grid.png
--------------------------------------------------------------------------------
/GameOfLifeSwift/GameOfLifeAssets/Buttons/play.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Benolds/GameOfLife-Swift/HEAD/GameOfLifeSwift/GameOfLifeAssets/Buttons/play.png
--------------------------------------------------------------------------------
/GameOfLifeSwift/GameOfLifeAssets/Assets/balloon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Benolds/GameOfLife-Swift/HEAD/GameOfLifeSwift/GameOfLifeAssets/Assets/balloon.png
--------------------------------------------------------------------------------
/GameOfLifeSwift/GameOfLifeAssets/Assets/bubble.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Benolds/GameOfLife-Swift/HEAD/GameOfLifeSwift/GameOfLifeAssets/Assets/bubble.png
--------------------------------------------------------------------------------
/GameOfLifeSwift/GameOfLifeAssets/Buttons/button.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Benolds/GameOfLife-Swift/HEAD/GameOfLifeSwift/GameOfLifeAssets/Buttons/button.png
--------------------------------------------------------------------------------
/GameOfLifeSwift/GameOfLifeAssets/Buttons/pause.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Benolds/GameOfLife-Swift/HEAD/GameOfLifeSwift/GameOfLifeAssets/Buttons/pause.png
--------------------------------------------------------------------------------
/GameOfLifeSwift/GameOfLifeAssets/Assets/microscope.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Benolds/GameOfLife-Swift/HEAD/GameOfLifeSwift/GameOfLifeAssets/Assets/microscope.png
--------------------------------------------------------------------------------
/GameOfLifeSwift/GameOfLifeAssets/Buttons/button-pressed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Benolds/GameOfLife-Swift/HEAD/GameOfLifeSwift/GameOfLifeAssets/Buttons/button-pressed.png
--------------------------------------------------------------------------------
/GameOfLifeSwift/GameOfLifeAssets/Buttons/pause-pressed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Benolds/GameOfLife-Swift/HEAD/GameOfLifeSwift/GameOfLifeAssets/Buttons/pause-pressed.png
--------------------------------------------------------------------------------
/GameOfLifeSwift/GameOfLifeAssets/Buttons/play-pressed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Benolds/GameOfLife-Swift/HEAD/GameOfLifeSwift/GameOfLifeAssets/Buttons/play-pressed.png
--------------------------------------------------------------------------------
/GameOfLifeSwift/GameOfLifeAssets/BackgroundImage/background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Benolds/GameOfLife-Swift/HEAD/GameOfLifeSwift/GameOfLifeAssets/BackgroundImage/background.png
--------------------------------------------------------------------------------
/GameOfLifeSwift/Images.xcassets/Spaceship.imageset/Spaceship.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Benolds/GameOfLife-Swift/HEAD/GameOfLifeSwift/Images.xcassets/Spaceship.imageset/Spaceship.png
--------------------------------------------------------------------------------
/GameOfLifeSwift.xcodeproj/xcuserdata/benreynolds.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
--------------------------------------------------------------------------------
/GameOfLifeSwift.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/GameOfLifeSwift.xcodeproj/project.xcworkspace/xcuserdata/benreynolds.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Benolds/GameOfLife-Swift/HEAD/GameOfLifeSwift.xcodeproj/project.xcworkspace/xcuserdata/benreynolds.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/GameOfLifeSwift.xcodeproj/project.xcworkspace/xcuserdata/benjaminencz.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Benolds/GameOfLife-Swift/HEAD/GameOfLifeSwift.xcodeproj/project.xcworkspace/xcuserdata/benjaminencz.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/GameOfLifeSwift/Images.xcassets/Spaceship.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x",
6 | "filename" : "Spaceship.png"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | }
12 | ],
13 | "info" : {
14 | "version" : 1,
15 | "author" : "xcode"
16 | }
17 | }
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | GameOfLife-Swift
2 | ================
3 |
4 | This is the complete source code for the MakeGamesWithUs tutorial for building the Game of Life using Swift and SpriteKit. Visit [MakeGamesWithUs](https://www.makegameswith.us/gamernews/399/create-the-game-of-life-using-swift-and-spritekit) to learn more about this tutorial.
5 |
6 | 
7 |
--------------------------------------------------------------------------------
/GameOfLifeSwift/Images.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "29x29",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "40x40",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "60x60",
16 | "scale" : "2x"
17 | }
18 | ],
19 | "info" : {
20 | "version" : 1,
21 | "author" : "xcode"
22 | }
23 | }
--------------------------------------------------------------------------------
/GameOfLifeSwift/Tile.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Tile.swift
3 | // GameOfLifeSwift
4 | //
5 | // Created by Benjamin Reynolds on 6/5/14.
6 | // Copyright (c) 2014 Benjamin Reynolds. All rights reserved.
7 | //
8 |
9 | import SpriteKit
10 |
11 | class Tile: SKSpriteNode {
12 | var isAlive:Bool = false {
13 | didSet {
14 | if isAlive {
15 | self.hidden = false;
16 | } else {
17 | self.hidden = true;
18 | }
19 | }
20 | }
21 | var numLivingNeighbors = 0
22 | }
23 |
--------------------------------------------------------------------------------
/GameOfLifeSwift/Images.xcassets/LaunchImage.launchimage/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "orientation" : "portrait",
5 | "idiom" : "iphone",
6 | "extent" : "full-screen",
7 | "minimum-system-version" : "7.0",
8 | "scale" : "2x"
9 | },
10 | {
11 | "orientation" : "portrait",
12 | "idiom" : "iphone",
13 | "subtype" : "retina4",
14 | "extent" : "full-screen",
15 | "minimum-system-version" : "7.0",
16 | "scale" : "2x"
17 | }
18 | ],
19 | "info" : {
20 | "version" : 1,
21 | "author" : "xcode"
22 | }
23 | }
--------------------------------------------------------------------------------
/GameOfLifeSwift.xcodeproj/xcuserdata/benreynolds.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | GameOfLifeSwift.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | 5D81AA53194039F2002A29E9
16 |
17 | primary
18 |
19 |
20 | 5D81AA69194039F2002A29E9
21 |
22 | primary
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/GameOfLifeSwift.xcodeproj/xcuserdata/benjaminencz.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | GameOfLifeSwift.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | 5D81AA53194039F2002A29E9
16 |
17 | primary
18 |
19 |
20 | 5D81AA69194039F2002A29E9
21 |
22 | primary
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/GameOfLifeSwiftTests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleIdentifier
10 | com.benjamin-reynolds.${PRODUCT_NAME:rfc1034identifier}
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | ${PRODUCT_NAME}
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/GameOfLifeSwiftTests/GameOfLifeSwiftTests.swift:
--------------------------------------------------------------------------------
1 | //
2 | // GameOfLifeSwiftTests.swift
3 | // GameOfLifeSwiftTests
4 | //
5 | // Created by Benjamin Reynolds on 6/4/14.
6 | // Copyright (c) 2014 Benjamin Reynolds. All rights reserved.
7 | //
8 |
9 | import XCTest
10 |
11 | class GameOfLifeSwiftTests: XCTestCase {
12 |
13 | override func setUp() {
14 | super.setUp()
15 | // Put setup code here. This method is called before the invocation of each test method in the class.
16 | }
17 |
18 | override func tearDown() {
19 | // Put teardown code here. This method is called after the invocation of each test method in the class.
20 | super.tearDown()
21 | }
22 |
23 | func testExample() {
24 | // This is an example of a functional test case.
25 | XCTAssert(true, "Pass")
26 | }
27 |
28 | func testPerformanceExample() {
29 | // This is an example of a performance test case.
30 | self.measureBlock() {
31 | // Put the code you want to measure the time of here.
32 | }
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/GameOfLifeSwift/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleIdentifier
10 | com.benjamin-reynolds.${PRODUCT_NAME:rfc1034identifier}
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | ${PRODUCT_NAME}
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 | LSRequiresIPhoneOS
24 |
25 | UIMainStoryboardFile
26 | Main
27 | UIRequiredDeviceCapabilities
28 |
29 | armv7
30 |
31 | UIStatusBarHidden
32 |
33 | UISupportedInterfaceOrientations
34 |
35 | UIInterfaceOrientationLandscapeLeft
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/GameOfLifeSwift/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/GameOfLifeSwift.xcodeproj/project.xcworkspace/xcshareddata/GameOfLifeSwift.xccheckout:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDESourceControlProjectFavoriteDictionaryKey
6 |
7 | IDESourceControlProjectIdentifier
8 | C4C1D024-AFF2-48BF-9C1E-837D5F184256
9 | IDESourceControlProjectName
10 | GameOfLifeSwift
11 | IDESourceControlProjectOriginsDictionary
12 |
13 | 2B826098-7EE0-4FEF-A2D5-4AE9337A1F93
14 | ssh://github.com/MakeGamesWithUs/GameOfLife-Swift.git
15 |
16 | IDESourceControlProjectPath
17 | GameOfLifeSwift.xcodeproj/project.xcworkspace
18 | IDESourceControlProjectRelativeInstallPathDictionary
19 |
20 | 2B826098-7EE0-4FEF-A2D5-4AE9337A1F93
21 | ../..
22 |
23 | IDESourceControlProjectURL
24 | ssh://github.com/MakeGamesWithUs/GameOfLife-Swift.git
25 | IDESourceControlProjectVersion
26 | 110
27 | IDESourceControlProjectWCCIdentifier
28 | 2B826098-7EE0-4FEF-A2D5-4AE9337A1F93
29 | IDESourceControlProjectWCConfigurations
30 |
31 |
32 | IDESourceControlRepositoryExtensionIdentifierKey
33 | public.vcs.git
34 | IDESourceControlWCCIdentifierKey
35 | 2B826098-7EE0-4FEF-A2D5-4AE9337A1F93
36 | IDESourceControlWCCName
37 | GameOfLife-Swift
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/GameOfLifeSwift/GameViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // GameViewController.swift
3 | // GameOfLifeSwift
4 | //
5 | // Created by Benjamin Reynolds on 6/4/14.
6 | // Copyright (c) 2014 Benjamin Reynolds. All rights reserved.
7 | //
8 |
9 | import UIKit
10 | import SpriteKit
11 |
12 | extension SKNode {
13 | class func unarchiveFromFile(file : NSString) -> SKNode? {
14 |
15 | let path = NSBundle.mainBundle().pathForResource(file, ofType: "sks")
16 |
17 | var sceneData = NSData.dataWithContentsOfFile(path, options: .DataReadingMappedIfSafe, error: nil)
18 | var archiver = NSKeyedUnarchiver(forReadingWithData: sceneData)
19 |
20 | archiver.setClass(self.classForKeyedUnarchiver(), forClassName: "SKScene")
21 | let scene = archiver.decodeObjectForKey(NSKeyedArchiveRootObjectKey) as GameScene
22 | archiver.finishDecoding()
23 | return scene
24 | }
25 | }
26 |
27 | class GameViewController: UIViewController {
28 |
29 | override func viewDidLoad() {
30 | super.viewDidLoad()
31 |
32 | if let scene = GameScene.unarchiveFromFile("GameScene") as? GameScene {
33 | // Configure the view.
34 | let skView = self.view as SKView
35 | skView.showsFPS = true
36 | skView.showsNodeCount = true
37 |
38 | /* Sprite Kit applies additional optimizations to improve rendering performance */
39 | skView.ignoresSiblingOrder = true
40 |
41 | /* Set the scale mode to scale to fit the window */
42 | scene.scaleMode = .AspectFill
43 |
44 | skView.presentScene(scene)
45 | }
46 | }
47 |
48 | override func shouldAutorotate() -> Bool {
49 | return true
50 | }
51 |
52 | override func supportedInterfaceOrientations() -> Int {
53 | if UIDevice.currentDevice().userInterfaceIdiom == .Phone {
54 | return Int(UIInterfaceOrientationMask.AllButUpsideDown.toRaw())
55 | } else {
56 | return Int(UIInterfaceOrientationMask.All.toRaw())
57 | }
58 | }
59 |
60 | override func didReceiveMemoryWarning() {
61 | super.didReceiveMemoryWarning()
62 | // Release any cached data, images, etc that aren't in use.
63 | }
64 |
65 | }
66 |
--------------------------------------------------------------------------------
/GameOfLifeSwift/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.swift
3 | // GameOfLifeSwift
4 | //
5 | // Created by Benjamin Reynolds on 6/4/14.
6 | // Copyright (c) 2014 Benjamin Reynolds. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | @UIApplicationMain
12 | class AppDelegate: UIResponder, UIApplicationDelegate {
13 |
14 | var window: UIWindow?
15 |
16 |
17 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool {
18 | // Override point for customization after application launch.
19 | return true
20 | }
21 |
22 | func applicationWillResignActive(application: UIApplication) {
23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
24 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
25 | }
26 |
27 | func applicationDidEnterBackground(application: UIApplication) {
28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
30 | }
31 |
32 | func applicationWillEnterForeground(application: UIApplication) {
33 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
34 | }
35 |
36 | func applicationDidBecomeActive(application: UIApplication) {
37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
38 | }
39 |
40 | func applicationWillTerminate(application: UIApplication) {
41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
42 | }
43 |
44 |
45 | }
46 |
47 |
--------------------------------------------------------------------------------
/GameOfLifeSwift.xcodeproj/xcuserdata/benjaminencz.xcuserdatad/xcschemes/GameOfLifeSwift.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
33 |
39 |
40 |
41 |
42 |
43 |
49 |
50 |
51 |
52 |
61 |
62 |
68 |
69 |
70 |
71 |
72 |
73 |
79 |
80 |
86 |
87 |
88 |
89 |
91 |
92 |
95 |
96 |
97 |
--------------------------------------------------------------------------------
/GameOfLifeSwift.xcodeproj/xcuserdata/benreynolds.xcuserdatad/xcschemes/GameOfLifeSwift.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
33 |
39 |
40 |
41 |
42 |
43 |
49 |
50 |
51 |
52 |
61 |
62 |
68 |
69 |
70 |
71 |
72 |
73 |
79 |
80 |
86 |
87 |
88 |
89 |
91 |
92 |
95 |
96 |
97 |
--------------------------------------------------------------------------------
/GameOfLifeSwift/GameScene.swift:
--------------------------------------------------------------------------------
1 | //
2 | // GameScene.swift
3 | // GameOfLifeSwift
4 | //
5 | // Created by Benjamin Reynolds on 6/4/14.
6 | // Copyright (c) 2014 Benjamin Reynolds. All rights reserved.
7 | //
8 |
9 |
10 | // This is the complete source code for the MakeGamesWithUse - Game of Life tutorial - using Swift and SpriteKit: https://www.makegameswith.us/gamernews/399/create-the-game-of-life-using-swift-and-spritekit
11 |
12 | import SpriteKit
13 |
14 | class GameScene: SKScene {
15 |
16 | // properties defining the grid
17 | let _gridHeight = 300 //grid dimensions (in pixels)
18 | let _gridWidth = 400
19 | let _numRows = 8 //number of tiles per column
20 | let _numCols = 10 // ...per row
21 | let _gridLowerLeftCorner:CGPoint = CGPoint(x: 158, y: 10) //grid offset from lower-left corner of screen
22 | let _margin = 4
23 |
24 | // properties defining the stats labels and buttons
25 | let _populationLabel:SKLabelNode = SKLabelNode(text: "Population")
26 | let _generationLabel:SKLabelNode = SKLabelNode(text: "Generation")
27 | var _populationValueLabel:SKLabelNode = SKLabelNode(text: "0")
28 | var _generationValueLabel:SKLabelNode = SKLabelNode(text: "0")
29 | var _playButton:SKSpriteNode = SKSpriteNode(imageNamed: "play.png")
30 | var _pauseButton:SKSpriteNode = SKSpriteNode(imageNamed: "pause.png")
31 |
32 | // 2d list of tiles
33 | var _tiles:[[Tile]] = []
34 |
35 | // properties affecting the update loop
36 | var _isPlaying = false
37 | var _prevTime:CFTimeInterval = 0
38 | var _timeCounter:CFTimeInterval = 0
39 |
40 | // properties and setters for population and generatino stats
41 | var _population:Int = 0 {
42 | didSet {
43 | _populationValueLabel.text = "\(_population)" // update appropriate label when value changes
44 | }
45 | }
46 | var _generation:Int = 0 {
47 | didSet {
48 | _generationValueLabel.text = "\(_generation)"
49 | }
50 | }
51 |
52 | // set up the user interface upon loading the scene
53 | override func didMoveToView(view: SKView) {
54 |
55 | // add a background for the entire screen
56 | let background = SKSpriteNode(imageNamed: "background.png")
57 | background.anchorPoint = CGPoint(x: 0, y: 0)
58 | background.size = self.size
59 | background.zPosition = -2
60 | self.addChild(background)
61 |
62 | // add a background to appear behind the grid
63 | let gridBackground = SKSpriteNode(imageNamed: "grid.png")
64 | gridBackground.size = CGSize(width: _gridWidth, height: _gridHeight)
65 | gridBackground.zPosition = -1
66 | gridBackground.anchorPoint = CGPoint(x:0, y:0)
67 | gridBackground.position = _gridLowerLeftCorner
68 | self.addChild(gridBackground)
69 |
70 | // add a balloon background for the stats
71 | let balloon = SKSpriteNode(imageNamed: "balloon.png")
72 | balloon.position = CGPoint(x: 79, y: 170)
73 | balloon.setScale(0.5)
74 | self.addChild(balloon)
75 |
76 | // add a microscope image as a decoration
77 | let microscope = SKSpriteNode(imageNamed: "microscope.png")
78 | microscope.position = CGPoint(x: 79, y: 70)
79 | microscope.setScale(0.4)
80 | self.addChild(microscope)
81 |
82 | // population label
83 | _populationLabel.position = CGPoint(x: 79, y: 190)
84 | _populationLabel.fontName = "Courier"
85 | _populationLabel.fontSize = 12
86 | _populationLabel.fontColor = UIColor(red: 0, green: 0.2, blue: 0, alpha: 1)
87 | self.addChild(_populationLabel)
88 |
89 | _populationValueLabel.position = CGPoint(x: 79, y: 175)
90 | _populationValueLabel.fontName = "Courier"
91 | _populationValueLabel.fontSize = 12
92 | _populationValueLabel.fontColor = UIColor(red: 0, green: 0.2, blue: 0, alpha: 1)
93 | self.addChild(_populationValueLabel)
94 |
95 | //generation label
96 | _generationLabel.position = CGPoint(x: 79, y: 160)
97 | _generationLabel.fontName = "Courier"
98 | _generationLabel.fontSize = 12
99 | _generationLabel.fontColor = UIColor(red: 0, green: 0.2, blue: 0, alpha: 1)
100 | self.addChild(_generationLabel)
101 |
102 | _generationValueLabel.position = CGPoint(x: 79, y: 145)
103 | _generationValueLabel.fontName = "Courier"
104 | _generationValueLabel.fontSize = 12
105 | _generationValueLabel.fontColor = UIColor(red: 0, green: 0.2, blue: 0, alpha: 1)
106 | self.addChild(_generationValueLabel)
107 |
108 | // play and pause buttons
109 | _playButton.position = CGPoint(x: 79, y: 290)
110 | _playButton.setScale(0.5)
111 | self.addChild(_playButton)
112 |
113 | _pauseButton.position = CGPoint(x: 79, y: 250)
114 | _pauseButton.setScale(0.5)
115 | self.addChild(_pauseButton)
116 |
117 | // initialize the 2d array of tiles
118 | let tileSize = calculateTileSize()
119 | for r in 0..<_numRows {
120 | var tileRow:[Tile] = []
121 | for c in 0..<_numCols {
122 | let tile = Tile(imageNamed: "bubble.png")
123 | tile.isAlive = false;
124 | tile.size = CGSize(width: tileSize.width, height: tileSize.height)
125 | tile.anchorPoint = CGPoint(x: 0, y: 0)
126 | tile.position = getTilePosition(row: r, column: c)
127 | self.addChild(tile)
128 | tileRow.append(tile)
129 | }
130 | _tiles.append(tileRow)
131 | }
132 |
133 | }
134 |
135 | // given a row and column, returns the (x,y) position that the tile should be placed at
136 | func getTilePosition(row r:Int, column c:Int) -> CGPoint
137 | {
138 | let tileSize = calculateTileSize()
139 | let x = Int(_gridLowerLeftCorner.x) + _margin + (c * (Int(tileSize.width) + _margin))
140 | let y = Int(_gridLowerLeftCorner.y) + _margin + (r * (Int(tileSize.height) + _margin))
141 | return CGPoint(x: x, y: y)
142 | }
143 |
144 | //calculates the width and height tiles should be based on the grid size and number of rows and columns
145 | func calculateTileSize() -> CGSize
146 | {
147 | let tileWidth = _gridWidth / _numCols - _margin
148 | let tileHeight = _gridHeight / _numRows - _margin
149 |
150 | return CGSize(width: tileWidth, height: tileHeight)
151 | }
152 |
153 | // given and (x,y) position, returns a tile overlapping that position, if any, else returns nil
154 | func getTileAtPosition(xPos x: Int, yPos y: Int) -> Tile? {
155 | let r:Int = Int( CGFloat(y - (Int(_gridLowerLeftCorner.y) + _margin)) / CGFloat(_gridHeight) * CGFloat(_numRows))
156 | let c:Int = Int( CGFloat(x - (Int(_gridLowerLeftCorner.x) + _margin)) / CGFloat(_gridWidth) * CGFloat(_numCols))
157 |
158 | if isValidTile(row: r, column: c) {
159 | return _tiles[r][c]
160 | } else {
161 | return nil
162 | }
163 | }
164 |
165 | // returns true if the row and column provided are within the bounds of the grid
166 | func isValidTile(row r: Int, column c:Int) -> Bool {
167 | return r >= 0 && r < _numRows && c >= 0 && c < _numCols
168 | }
169 |
170 | // checks for taps on tiles and buttons
171 | override func touchesBegan(touches: NSSet, withEvent event: UIEvent) {
172 |
173 | // tapping a tile toggles its isAlive state
174 | for touch: AnyObject in touches {
175 | var selectedTile:Tile? = getTileAtPosition(xPos: Int(touch.locationInNode(self).x), yPos: Int(touch.locationInNode(self).y))
176 | if let tile = selectedTile {
177 | tile.isAlive = !tile.isAlive
178 | if tile.isAlive {
179 | _population++
180 | } else {
181 | _population--
182 | }
183 | }
184 |
185 | // tapping tha play button plays the game update loop
186 | if CGRectContainsPoint(_playButton.frame, touch.locationInNode(self)) {
187 | playButtonPressed()
188 | }
189 |
190 | // tapping the pause button stops the game update loop
191 | if CGRectContainsPoint(_pauseButton.frame, touch.locationInNode(self)) {
192 | pauseButtonPressed()
193 | }
194 | }
195 | }
196 |
197 | // evolves the game board state by one iteration
198 | func timeStep()
199 | {
200 | countLivingNeighbors()
201 | updateCreatures()
202 | _generation++
203 | }
204 |
205 | // sets the numLivingNeighbors property of each tile to a value between [0, 8] based on the number of adjacent alive tiles
206 | func countLivingNeighbors()
207 | {
208 | for r in 0..<_numRows {
209 | for c in 0..<_numCols
210 | {
211 | var numLivingNeighbors:Int = 0
212 |
213 | for i in (r-1)...(r+1) {
214 | for j in (c-1)...(c+1)
215 | {
216 | if ( !((r == i) && (c == j)) && isValidTile(row: i, column: j)) {
217 | if _tiles[i][j].isAlive {
218 | numLivingNeighbors++
219 | }
220 | }
221 | }
222 | }
223 | _tiles[r][c].numLivingNeighbors = numLivingNeighbors
224 | }
225 | }
226 | }
227 |
228 | // sets the isAlive state of each tile dependin on their number of living neighbors
229 | func updateCreatures()
230 | {
231 | var numAlive = 0
232 |
233 | for r in 0..<_numRows {
234 | for c in 0..<_numCols
235 | {
236 | var tile:Tile = _tiles[r][c]
237 |
238 | if tile.numLivingNeighbors == 3 {
239 | tile.isAlive = true
240 | } else if tile.numLivingNeighbors < 2 || tile.numLivingNeighbors > 3 {
241 | tile.isAlive = false
242 | }
243 |
244 | if tile.isAlive {
245 | numAlive++
246 | }
247 | }
248 | }
249 |
250 | _population = numAlive
251 | }
252 |
253 | // starts the game update loop upon button pressed
254 | func playButtonPressed()
255 | {
256 | _isPlaying = true
257 | }
258 |
259 | // stops the game update loop upon button pressed
260 | func pauseButtonPressed()
261 | {
262 | _isPlaying = false
263 | }
264 |
265 | // calls the timeStep method every 0.5 seconds
266 | override func update(currentTime: CFTimeInterval) {
267 | /* Called before each frame is rendered */
268 |
269 | if _prevTime == 0 {
270 | _prevTime = currentTime
271 | }
272 |
273 |
274 | if _isPlaying
275 | {
276 | _timeCounter += currentTime - _prevTime
277 |
278 | if _timeCounter > 0.5 {
279 | _timeCounter = 0
280 | timeStep()
281 | }
282 | }
283 |
284 | _prevTime = currentTime
285 |
286 | }
287 | }
288 |
--------------------------------------------------------------------------------
/GameOfLifeSwift.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 5D0541CA1940502B00B79B41 /* Tile.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5D0541C91940502B00B79B41 /* Tile.swift */; };
11 | 5D3654EF194598EB007091A3 /* balloon.png in Resources */ = {isa = PBXBuildFile; fileRef = 5D3654E2194598EB007091A3 /* balloon.png */; };
12 | 5D3654F0194598EB007091A3 /* bubble.png in Resources */ = {isa = PBXBuildFile; fileRef = 5D3654E3194598EB007091A3 /* bubble.png */; };
13 | 5D3654F1194598EB007091A3 /* grid.png in Resources */ = {isa = PBXBuildFile; fileRef = 5D3654E4194598EB007091A3 /* grid.png */; };
14 | 5D3654F2194598EB007091A3 /* microscope.png in Resources */ = {isa = PBXBuildFile; fileRef = 5D3654E5194598EB007091A3 /* microscope.png */; };
15 | 5D3654F3194598EB007091A3 /* background.png in Resources */ = {isa = PBXBuildFile; fileRef = 5D3654E7194598EB007091A3 /* background.png */; };
16 | 5D3654F4194598EB007091A3 /* button-pressed.png in Resources */ = {isa = PBXBuildFile; fileRef = 5D3654E9194598EB007091A3 /* button-pressed.png */; };
17 | 5D3654F5194598EB007091A3 /* button.png in Resources */ = {isa = PBXBuildFile; fileRef = 5D3654EA194598EB007091A3 /* button.png */; };
18 | 5D3654F6194598EB007091A3 /* pause-pressed.png in Resources */ = {isa = PBXBuildFile; fileRef = 5D3654EB194598EB007091A3 /* pause-pressed.png */; };
19 | 5D3654F7194598EB007091A3 /* pause.png in Resources */ = {isa = PBXBuildFile; fileRef = 5D3654EC194598EB007091A3 /* pause.png */; };
20 | 5D3654F8194598EB007091A3 /* play-pressed.png in Resources */ = {isa = PBXBuildFile; fileRef = 5D3654ED194598EB007091A3 /* play-pressed.png */; };
21 | 5D3654F9194598EB007091A3 /* play.png in Resources */ = {isa = PBXBuildFile; fileRef = 5D3654EE194598EB007091A3 /* play.png */; };
22 | 5D81AA5A194039F2002A29E9 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5D81AA59194039F2002A29E9 /* AppDelegate.swift */; };
23 | 5D81AA5C194039F2002A29E9 /* GameScene.sks in Resources */ = {isa = PBXBuildFile; fileRef = 5D81AA5B194039F2002A29E9 /* GameScene.sks */; };
24 | 5D81AA5E194039F2002A29E9 /* GameScene.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5D81AA5D194039F2002A29E9 /* GameScene.swift */; };
25 | 5D81AA60194039F2002A29E9 /* GameViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5D81AA5F194039F2002A29E9 /* GameViewController.swift */; };
26 | 5D81AA63194039F2002A29E9 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5D81AA61194039F2002A29E9 /* Main.storyboard */; };
27 | 5D81AA65194039F2002A29E9 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 5D81AA64194039F2002A29E9 /* Images.xcassets */; };
28 | 5D81AA71194039F2002A29E9 /* GameOfLifeSwiftTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5D81AA70194039F2002A29E9 /* GameOfLifeSwiftTests.swift */; };
29 | /* End PBXBuildFile section */
30 |
31 | /* Begin PBXContainerItemProxy section */
32 | 5D81AA6B194039F2002A29E9 /* PBXContainerItemProxy */ = {
33 | isa = PBXContainerItemProxy;
34 | containerPortal = 5D81AA4C194039F2002A29E9 /* Project object */;
35 | proxyType = 1;
36 | remoteGlobalIDString = 5D81AA53194039F2002A29E9;
37 | remoteInfo = GameOfLifeSwift;
38 | };
39 | /* End PBXContainerItemProxy section */
40 |
41 | /* Begin PBXFileReference section */
42 | 5D0541C91940502B00B79B41 /* Tile.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Tile.swift; sourceTree = ""; };
43 | 5D3654E2194598EB007091A3 /* balloon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = balloon.png; sourceTree = ""; };
44 | 5D3654E3194598EB007091A3 /* bubble.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = bubble.png; sourceTree = ""; };
45 | 5D3654E4194598EB007091A3 /* grid.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = grid.png; sourceTree = ""; };
46 | 5D3654E5194598EB007091A3 /* microscope.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = microscope.png; sourceTree = ""; };
47 | 5D3654E7194598EB007091A3 /* background.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = background.png; sourceTree = ""; };
48 | 5D3654E9194598EB007091A3 /* button-pressed.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "button-pressed.png"; sourceTree = ""; };
49 | 5D3654EA194598EB007091A3 /* button.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = button.png; sourceTree = ""; };
50 | 5D3654EB194598EB007091A3 /* pause-pressed.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "pause-pressed.png"; sourceTree = ""; };
51 | 5D3654EC194598EB007091A3 /* pause.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = pause.png; sourceTree = ""; };
52 | 5D3654ED194598EB007091A3 /* play-pressed.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "play-pressed.png"; sourceTree = ""; };
53 | 5D3654EE194598EB007091A3 /* play.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = play.png; sourceTree = ""; };
54 | 5D81AA54194039F2002A29E9 /* GameOfLifeSwift.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = GameOfLifeSwift.app; sourceTree = BUILT_PRODUCTS_DIR; };
55 | 5D81AA58194039F2002A29E9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
56 | 5D81AA59194039F2002A29E9 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
57 | 5D81AA5B194039F2002A29E9 /* GameScene.sks */ = {isa = PBXFileReference; lastKnownFileType = file.sks; path = GameScene.sks; sourceTree = ""; };
58 | 5D81AA5D194039F2002A29E9 /* GameScene.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GameScene.swift; sourceTree = ""; };
59 | 5D81AA5F194039F2002A29E9 /* GameViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GameViewController.swift; sourceTree = ""; };
60 | 5D81AA62194039F2002A29E9 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
61 | 5D81AA64194039F2002A29E9 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; };
62 | 5D81AA6A194039F2002A29E9 /* GameOfLifeSwiftTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = GameOfLifeSwiftTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
63 | 5D81AA6F194039F2002A29E9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
64 | 5D81AA70194039F2002A29E9 /* GameOfLifeSwiftTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GameOfLifeSwiftTests.swift; sourceTree = ""; };
65 | /* End PBXFileReference section */
66 |
67 | /* Begin PBXFrameworksBuildPhase section */
68 | 5D81AA51194039F2002A29E9 /* Frameworks */ = {
69 | isa = PBXFrameworksBuildPhase;
70 | buildActionMask = 2147483647;
71 | files = (
72 | );
73 | runOnlyForDeploymentPostprocessing = 0;
74 | };
75 | 5D81AA67194039F2002A29E9 /* Frameworks */ = {
76 | isa = PBXFrameworksBuildPhase;
77 | buildActionMask = 2147483647;
78 | files = (
79 | );
80 | runOnlyForDeploymentPostprocessing = 0;
81 | };
82 | /* End PBXFrameworksBuildPhase section */
83 |
84 | /* Begin PBXGroup section */
85 | 5D3654E0194598EB007091A3 /* GameOfLifeAssets */ = {
86 | isa = PBXGroup;
87 | children = (
88 | 5D3654E1194598EB007091A3 /* Assets */,
89 | 5D3654E6194598EB007091A3 /* BackgroundImage */,
90 | 5D3654E8194598EB007091A3 /* Buttons */,
91 | );
92 | path = GameOfLifeAssets;
93 | sourceTree = "";
94 | };
95 | 5D3654E1194598EB007091A3 /* Assets */ = {
96 | isa = PBXGroup;
97 | children = (
98 | 5D3654E2194598EB007091A3 /* balloon.png */,
99 | 5D3654E3194598EB007091A3 /* bubble.png */,
100 | 5D3654E4194598EB007091A3 /* grid.png */,
101 | 5D3654E5194598EB007091A3 /* microscope.png */,
102 | );
103 | path = Assets;
104 | sourceTree = "";
105 | };
106 | 5D3654E6194598EB007091A3 /* BackgroundImage */ = {
107 | isa = PBXGroup;
108 | children = (
109 | 5D3654E7194598EB007091A3 /* background.png */,
110 | );
111 | path = BackgroundImage;
112 | sourceTree = "";
113 | };
114 | 5D3654E8194598EB007091A3 /* Buttons */ = {
115 | isa = PBXGroup;
116 | children = (
117 | 5D3654E9194598EB007091A3 /* button-pressed.png */,
118 | 5D3654EA194598EB007091A3 /* button.png */,
119 | 5D3654EB194598EB007091A3 /* pause-pressed.png */,
120 | 5D3654EC194598EB007091A3 /* pause.png */,
121 | 5D3654ED194598EB007091A3 /* play-pressed.png */,
122 | 5D3654EE194598EB007091A3 /* play.png */,
123 | );
124 | path = Buttons;
125 | sourceTree = "";
126 | };
127 | 5D81AA4B194039F2002A29E9 = {
128 | isa = PBXGroup;
129 | children = (
130 | 5D81AA56194039F2002A29E9 /* GameOfLifeSwift */,
131 | 5D81AA6D194039F2002A29E9 /* GameOfLifeSwiftTests */,
132 | 5D81AA55194039F2002A29E9 /* Products */,
133 | );
134 | sourceTree = "";
135 | };
136 | 5D81AA55194039F2002A29E9 /* Products */ = {
137 | isa = PBXGroup;
138 | children = (
139 | 5D81AA54194039F2002A29E9 /* GameOfLifeSwift.app */,
140 | 5D81AA6A194039F2002A29E9 /* GameOfLifeSwiftTests.xctest */,
141 | );
142 | name = Products;
143 | sourceTree = "";
144 | };
145 | 5D81AA56194039F2002A29E9 /* GameOfLifeSwift */ = {
146 | isa = PBXGroup;
147 | children = (
148 | 5D81AA59194039F2002A29E9 /* AppDelegate.swift */,
149 | 5D81AA5B194039F2002A29E9 /* GameScene.sks */,
150 | 5D81AA5D194039F2002A29E9 /* GameScene.swift */,
151 | 5D0541C91940502B00B79B41 /* Tile.swift */,
152 | 5D81AA5F194039F2002A29E9 /* GameViewController.swift */,
153 | 5D81AA61194039F2002A29E9 /* Main.storyboard */,
154 | 5D81AA64194039F2002A29E9 /* Images.xcassets */,
155 | 5D3654E0194598EB007091A3 /* GameOfLifeAssets */,
156 | 5D81AA57194039F2002A29E9 /* Supporting Files */,
157 | );
158 | path = GameOfLifeSwift;
159 | sourceTree = "";
160 | };
161 | 5D81AA57194039F2002A29E9 /* Supporting Files */ = {
162 | isa = PBXGroup;
163 | children = (
164 | 5D81AA58194039F2002A29E9 /* Info.plist */,
165 | );
166 | name = "Supporting Files";
167 | sourceTree = "";
168 | };
169 | 5D81AA6D194039F2002A29E9 /* GameOfLifeSwiftTests */ = {
170 | isa = PBXGroup;
171 | children = (
172 | 5D81AA70194039F2002A29E9 /* GameOfLifeSwiftTests.swift */,
173 | 5D81AA6E194039F2002A29E9 /* Supporting Files */,
174 | );
175 | path = GameOfLifeSwiftTests;
176 | sourceTree = "";
177 | };
178 | 5D81AA6E194039F2002A29E9 /* Supporting Files */ = {
179 | isa = PBXGroup;
180 | children = (
181 | 5D81AA6F194039F2002A29E9 /* Info.plist */,
182 | );
183 | name = "Supporting Files";
184 | sourceTree = "";
185 | };
186 | /* End PBXGroup section */
187 |
188 | /* Begin PBXNativeTarget section */
189 | 5D81AA53194039F2002A29E9 /* GameOfLifeSwift */ = {
190 | isa = PBXNativeTarget;
191 | buildConfigurationList = 5D81AA74194039F2002A29E9 /* Build configuration list for PBXNativeTarget "GameOfLifeSwift" */;
192 | buildPhases = (
193 | 5D81AA50194039F2002A29E9 /* Sources */,
194 | 5D81AA51194039F2002A29E9 /* Frameworks */,
195 | 5D81AA52194039F2002A29E9 /* Resources */,
196 | );
197 | buildRules = (
198 | );
199 | dependencies = (
200 | );
201 | name = GameOfLifeSwift;
202 | productName = GameOfLifeSwift;
203 | productReference = 5D81AA54194039F2002A29E9 /* GameOfLifeSwift.app */;
204 | productType = "com.apple.product-type.application";
205 | };
206 | 5D81AA69194039F2002A29E9 /* GameOfLifeSwiftTests */ = {
207 | isa = PBXNativeTarget;
208 | buildConfigurationList = 5D81AA77194039F2002A29E9 /* Build configuration list for PBXNativeTarget "GameOfLifeSwiftTests" */;
209 | buildPhases = (
210 | 5D81AA66194039F2002A29E9 /* Sources */,
211 | 5D81AA67194039F2002A29E9 /* Frameworks */,
212 | 5D81AA68194039F2002A29E9 /* Resources */,
213 | );
214 | buildRules = (
215 | );
216 | dependencies = (
217 | 5D81AA6C194039F2002A29E9 /* PBXTargetDependency */,
218 | );
219 | name = GameOfLifeSwiftTests;
220 | productName = GameOfLifeSwiftTests;
221 | productReference = 5D81AA6A194039F2002A29E9 /* GameOfLifeSwiftTests.xctest */;
222 | productType = "com.apple.product-type.bundle.unit-test";
223 | };
224 | /* End PBXNativeTarget section */
225 |
226 | /* Begin PBXProject section */
227 | 5D81AA4C194039F2002A29E9 /* Project object */ = {
228 | isa = PBXProject;
229 | attributes = {
230 | LastUpgradeCheck = 0600;
231 | ORGANIZATIONNAME = "Benjamin Reynolds";
232 | TargetAttributes = {
233 | 5D81AA53194039F2002A29E9 = {
234 | CreatedOnToolsVersion = 6.0;
235 | };
236 | 5D81AA69194039F2002A29E9 = {
237 | CreatedOnToolsVersion = 6.0;
238 | TestTargetID = 5D81AA53194039F2002A29E9;
239 | };
240 | };
241 | };
242 | buildConfigurationList = 5D81AA4F194039F2002A29E9 /* Build configuration list for PBXProject "GameOfLifeSwift" */;
243 | compatibilityVersion = "Xcode 3.2";
244 | developmentRegion = English;
245 | hasScannedForEncodings = 0;
246 | knownRegions = (
247 | en,
248 | Base,
249 | );
250 | mainGroup = 5D81AA4B194039F2002A29E9;
251 | productRefGroup = 5D81AA55194039F2002A29E9 /* Products */;
252 | projectDirPath = "";
253 | projectRoot = "";
254 | targets = (
255 | 5D81AA53194039F2002A29E9 /* GameOfLifeSwift */,
256 | 5D81AA69194039F2002A29E9 /* GameOfLifeSwiftTests */,
257 | );
258 | };
259 | /* End PBXProject section */
260 |
261 | /* Begin PBXResourcesBuildPhase section */
262 | 5D81AA52194039F2002A29E9 /* Resources */ = {
263 | isa = PBXResourcesBuildPhase;
264 | buildActionMask = 2147483647;
265 | files = (
266 | 5D81AA65194039F2002A29E9 /* Images.xcassets in Resources */,
267 | 5D3654F6194598EB007091A3 /* pause-pressed.png in Resources */,
268 | 5D3654F7194598EB007091A3 /* pause.png in Resources */,
269 | 5D3654F5194598EB007091A3 /* button.png in Resources */,
270 | 5D3654F8194598EB007091A3 /* play-pressed.png in Resources */,
271 | 5D3654F3194598EB007091A3 /* background.png in Resources */,
272 | 5D3654EF194598EB007091A3 /* balloon.png in Resources */,
273 | 5D3654F9194598EB007091A3 /* play.png in Resources */,
274 | 5D3654F2194598EB007091A3 /* microscope.png in Resources */,
275 | 5D3654F0194598EB007091A3 /* bubble.png in Resources */,
276 | 5D81AA5C194039F2002A29E9 /* GameScene.sks in Resources */,
277 | 5D81AA63194039F2002A29E9 /* Main.storyboard in Resources */,
278 | 5D3654F4194598EB007091A3 /* button-pressed.png in Resources */,
279 | 5D3654F1194598EB007091A3 /* grid.png in Resources */,
280 | );
281 | runOnlyForDeploymentPostprocessing = 0;
282 | };
283 | 5D81AA68194039F2002A29E9 /* Resources */ = {
284 | isa = PBXResourcesBuildPhase;
285 | buildActionMask = 2147483647;
286 | files = (
287 | );
288 | runOnlyForDeploymentPostprocessing = 0;
289 | };
290 | /* End PBXResourcesBuildPhase section */
291 |
292 | /* Begin PBXSourcesBuildPhase section */
293 | 5D81AA50194039F2002A29E9 /* Sources */ = {
294 | isa = PBXSourcesBuildPhase;
295 | buildActionMask = 2147483647;
296 | files = (
297 | 5D81AA5E194039F2002A29E9 /* GameScene.swift in Sources */,
298 | 5D81AA60194039F2002A29E9 /* GameViewController.swift in Sources */,
299 | 5D81AA5A194039F2002A29E9 /* AppDelegate.swift in Sources */,
300 | 5D0541CA1940502B00B79B41 /* Tile.swift in Sources */,
301 | );
302 | runOnlyForDeploymentPostprocessing = 0;
303 | };
304 | 5D81AA66194039F2002A29E9 /* Sources */ = {
305 | isa = PBXSourcesBuildPhase;
306 | buildActionMask = 2147483647;
307 | files = (
308 | 5D81AA71194039F2002A29E9 /* GameOfLifeSwiftTests.swift in Sources */,
309 | );
310 | runOnlyForDeploymentPostprocessing = 0;
311 | };
312 | /* End PBXSourcesBuildPhase section */
313 |
314 | /* Begin PBXTargetDependency section */
315 | 5D81AA6C194039F2002A29E9 /* PBXTargetDependency */ = {
316 | isa = PBXTargetDependency;
317 | target = 5D81AA53194039F2002A29E9 /* GameOfLifeSwift */;
318 | targetProxy = 5D81AA6B194039F2002A29E9 /* PBXContainerItemProxy */;
319 | };
320 | /* End PBXTargetDependency section */
321 |
322 | /* Begin PBXVariantGroup section */
323 | 5D81AA61194039F2002A29E9 /* Main.storyboard */ = {
324 | isa = PBXVariantGroup;
325 | children = (
326 | 5D81AA62194039F2002A29E9 /* Base */,
327 | );
328 | name = Main.storyboard;
329 | sourceTree = "";
330 | };
331 | /* End PBXVariantGroup section */
332 |
333 | /* Begin XCBuildConfiguration section */
334 | 5D81AA72194039F2002A29E9 /* Debug */ = {
335 | isa = XCBuildConfiguration;
336 | buildSettings = {
337 | ALWAYS_SEARCH_USER_PATHS = NO;
338 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
339 | CLANG_CXX_LIBRARY = "libc++";
340 | CLANG_ENABLE_MODULES = YES;
341 | CLANG_ENABLE_OBJC_ARC = YES;
342 | CLANG_WARN_BOOL_CONVERSION = YES;
343 | CLANG_WARN_CONSTANT_CONVERSION = YES;
344 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
345 | CLANG_WARN_EMPTY_BODY = YES;
346 | CLANG_WARN_ENUM_CONVERSION = YES;
347 | CLANG_WARN_INT_CONVERSION = YES;
348 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
349 | CLANG_WARN_UNREACHABLE_CODE = YES;
350 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
351 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
352 | COPY_PHASE_STRIP = NO;
353 | ENABLE_STRICT_OBJC_MSGSEND = YES;
354 | GCC_C_LANGUAGE_STANDARD = gnu99;
355 | GCC_DYNAMIC_NO_PIC = NO;
356 | GCC_OPTIMIZATION_LEVEL = 0;
357 | GCC_PREPROCESSOR_DEFINITIONS = (
358 | "DEBUG=1",
359 | "$(inherited)",
360 | );
361 | GCC_SYMBOLS_PRIVATE_EXTERN = NO;
362 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
363 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
364 | GCC_WARN_UNDECLARED_SELECTOR = YES;
365 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
366 | GCC_WARN_UNUSED_FUNCTION = YES;
367 | GCC_WARN_UNUSED_VARIABLE = YES;
368 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
369 | METAL_ENABLE_DEBUG_INFO = YES;
370 | ONLY_ACTIVE_ARCH = YES;
371 | SDKROOT = iphoneos;
372 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
373 | };
374 | name = Debug;
375 | };
376 | 5D81AA73194039F2002A29E9 /* Release */ = {
377 | isa = XCBuildConfiguration;
378 | buildSettings = {
379 | ALWAYS_SEARCH_USER_PATHS = NO;
380 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
381 | CLANG_CXX_LIBRARY = "libc++";
382 | CLANG_ENABLE_MODULES = YES;
383 | CLANG_ENABLE_OBJC_ARC = YES;
384 | CLANG_WARN_BOOL_CONVERSION = YES;
385 | CLANG_WARN_CONSTANT_CONVERSION = YES;
386 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
387 | CLANG_WARN_EMPTY_BODY = YES;
388 | CLANG_WARN_ENUM_CONVERSION = YES;
389 | CLANG_WARN_INT_CONVERSION = YES;
390 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
391 | CLANG_WARN_UNREACHABLE_CODE = YES;
392 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
393 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
394 | COPY_PHASE_STRIP = YES;
395 | ENABLE_NS_ASSERTIONS = NO;
396 | ENABLE_STRICT_OBJC_MSGSEND = YES;
397 | GCC_C_LANGUAGE_STANDARD = gnu99;
398 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
399 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
400 | GCC_WARN_UNDECLARED_SELECTOR = YES;
401 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
402 | GCC_WARN_UNUSED_FUNCTION = YES;
403 | GCC_WARN_UNUSED_VARIABLE = YES;
404 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
405 | METAL_ENABLE_DEBUG_INFO = NO;
406 | SDKROOT = iphoneos;
407 | VALIDATE_PRODUCT = YES;
408 | };
409 | name = Release;
410 | };
411 | 5D81AA75194039F2002A29E9 /* Debug */ = {
412 | isa = XCBuildConfiguration;
413 | buildSettings = {
414 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
415 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
416 | INFOPLIST_FILE = GameOfLifeSwift/Info.plist;
417 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
418 | PRODUCT_NAME = "$(TARGET_NAME)";
419 | };
420 | name = Debug;
421 | };
422 | 5D81AA76194039F2002A29E9 /* Release */ = {
423 | isa = XCBuildConfiguration;
424 | buildSettings = {
425 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
426 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
427 | INFOPLIST_FILE = GameOfLifeSwift/Info.plist;
428 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
429 | PRODUCT_NAME = "$(TARGET_NAME)";
430 | };
431 | name = Release;
432 | };
433 | 5D81AA78194039F2002A29E9 /* Debug */ = {
434 | isa = XCBuildConfiguration;
435 | buildSettings = {
436 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/GameOfLifeSwift.app/GameOfLifeSwift";
437 | FRAMEWORK_SEARCH_PATHS = (
438 | "$(SDKROOT)/Developer/Library/Frameworks",
439 | "$(inherited)",
440 | );
441 | GCC_PREPROCESSOR_DEFINITIONS = (
442 | "DEBUG=1",
443 | "$(inherited)",
444 | );
445 | INFOPLIST_FILE = GameOfLifeSwiftTests/Info.plist;
446 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
447 | METAL_ENABLE_DEBUG_INFO = YES;
448 | PRODUCT_NAME = "$(TARGET_NAME)";
449 | TEST_HOST = "$(BUNDLE_LOADER)";
450 | };
451 | name = Debug;
452 | };
453 | 5D81AA79194039F2002A29E9 /* Release */ = {
454 | isa = XCBuildConfiguration;
455 | buildSettings = {
456 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/GameOfLifeSwift.app/GameOfLifeSwift";
457 | FRAMEWORK_SEARCH_PATHS = (
458 | "$(SDKROOT)/Developer/Library/Frameworks",
459 | "$(inherited)",
460 | );
461 | INFOPLIST_FILE = GameOfLifeSwiftTests/Info.plist;
462 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
463 | METAL_ENABLE_DEBUG_INFO = NO;
464 | PRODUCT_NAME = "$(TARGET_NAME)";
465 | TEST_HOST = "$(BUNDLE_LOADER)";
466 | };
467 | name = Release;
468 | };
469 | /* End XCBuildConfiguration section */
470 |
471 | /* Begin XCConfigurationList section */
472 | 5D81AA4F194039F2002A29E9 /* Build configuration list for PBXProject "GameOfLifeSwift" */ = {
473 | isa = XCConfigurationList;
474 | buildConfigurations = (
475 | 5D81AA72194039F2002A29E9 /* Debug */,
476 | 5D81AA73194039F2002A29E9 /* Release */,
477 | );
478 | defaultConfigurationIsVisible = 0;
479 | defaultConfigurationName = Release;
480 | };
481 | 5D81AA74194039F2002A29E9 /* Build configuration list for PBXNativeTarget "GameOfLifeSwift" */ = {
482 | isa = XCConfigurationList;
483 | buildConfigurations = (
484 | 5D81AA75194039F2002A29E9 /* Debug */,
485 | 5D81AA76194039F2002A29E9 /* Release */,
486 | );
487 | defaultConfigurationIsVisible = 0;
488 | defaultConfigurationName = Release;
489 | };
490 | 5D81AA77194039F2002A29E9 /* Build configuration list for PBXNativeTarget "GameOfLifeSwiftTests" */ = {
491 | isa = XCConfigurationList;
492 | buildConfigurations = (
493 | 5D81AA78194039F2002A29E9 /* Debug */,
494 | 5D81AA79194039F2002A29E9 /* Release */,
495 | );
496 | defaultConfigurationIsVisible = 0;
497 | defaultConfigurationName = Release;
498 | };
499 | /* End XCConfigurationList section */
500 | };
501 | rootObject = 5D81AA4C194039F2002A29E9 /* Project object */;
502 | }
503 |
--------------------------------------------------------------------------------