28 Commits

Author SHA1 Message Date
Steve Barnegren 99dd6adbcd Bump version to 1.1.2 2020-10-12 20:58:50 +01:00
Steve Barnegren 59a4aba058 Fixed crash where player could access game after game has been deallocated 2020-10-12 20:53:03 +01:00
Steve Barnegren c2e7b7ccb9 Minor improvements to example app 2020-10-12 20:43:38 +01:00
Steve Barnegren 1a560c00d0 Removed unused logging 2020-10-12 20:37:55 +01:00
Steve Barnegren 99c06fee3c Update travis.yml 2020-10-01 21:16:13 +01:00
Steve Barnegren fb922da99b Update travis.yml 2020-10-01 21:12:22 +01:00
Steve Barnegren 89d089d475 Update travis.yml 2020-10-01 20:59:54 +01:00
Steve Barnegren 8f1e5f07a9 Version to 1.1.1 2020-10-01 20:58:05 +01:00
Steve Barnegren 7865d0cee7 Added spm support 2020-10-01 20:40:16 +01:00
Steve Barnegren 34a70295f2 Removed unused variables, apply game state when constructed from dictionary 2020-10-01 20:31:29 +01:00
Steve Barnegren ed6444a784 Update to recommended project settings 2020-10-01 20:25:05 +01:00
Steve Barnegren fa3580d2ce Added build status and contact badges to readme 2019-05-31 20:57:19 +01:00
Steve Barnegren 77a9e7f9e4 Merge pull request #11 from SteveBarnegren/feature/setup-travis
Feature/setup travis
2019-05-31 20:48:46 +01:00
Steve Barnegren d9b8ebace4 Travis only build master 2019-05-31 20:43:26 +01:00
Steve Barnegren 2ce751ad69 Update Travis configuration 2019-05-31 20:36:27 +01:00
Steve Barnegren 9b21f36f94 Update Travis configuration 2019-05-31 20:33:05 +01:00
Steve Barnegren 52ee0ed99a Update Travis configuration 2019-05-31 20:30:22 +01:00
Steve Barnegren efb982c1a7 Moved tests from example project to library project 2019-05-31 20:15:58 +01:00
Steve Barnegren e6c44034aa Setup Travis 2019-05-30 21:27:16 +01:00
Steve Barnegren 921f5c6899 Merge pull request #10 from SteveBarnegren/feature/swift-5
Feature/swift 5
2019-05-30 21:17:12 +01:00
Steve Barnegren f315a27db1 Update version to 1.1 2019-05-30 21:14:55 +01:00
Steve Barnegren f700ac2ec9 Fixed readme showing wrong badge information 2019-05-30 21:13:00 +01:00
Steve Barnegren 632765e72e Updated to recommended project settings 2019-05-30 21:09:04 +01:00
Steve Barnegren 17325af502 Updated to Swift 5 2019-05-30 21:06:52 +01:00
Steve Barnegren 6373f189cc Fixed project warnings 2019-05-30 20:57:14 +01:00
Steve Barnegren 8e4e478ea3 Merge pull request #4 from yixiang/patch-1
Fixed Board.printBoardState.
2018-04-09 12:01:27 +01:00
Sean Lu 7ebf83e7f4 Fixed Board.printBoardState.
King should be printed as G/g not K/k, since K/k conflicts with knights.
2018-04-06 23:06:14 -07:00
Steve Barnegren 612b3c7938 Updated readme 2018-01-20 18:32:02 +00:00
49 changed files with 426 additions and 274 deletions
-1
View File
@@ -1 +0,0 @@
4.0
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:">
</FileRef>
</Workspace>
+6 -14
View File
@@ -1,14 +1,6 @@
# references:
# * http://www.objc.io/issue-6/travis-ci.html
# * https://github.com/supermarin/xcpretty#usage
osx_image: xcode7.3
language: objective-c
# cache: cocoapods
# podfile: Example/Podfile
# before_install:
# - gem install cocoapods # Since Travis is not always on latest version
# - pod install --project-directory=Example
script:
- set -o pipefail && xcodebuild test -workspace Example/SwiftChess.xcworkspace -scheme SwiftChess-Example -sdk iphonesimulator9.3 ONLY_ACTIVE_ARCH=NO | xcpretty
- pod lib lint
language: swift
osx_image: xcode12
xcode_project: Example/Example.xcodeproj
xcode_scheme: SwiftChessExample
xcode_sdk: iphonesimulator14.0
xcode_destination: platform=iOS Simulator,OS=14.0,name=iPhone 11 Pro Max
+22 -114
View File
@@ -7,18 +7,7 @@
objects = {
/* Begin PBXBuildFile section */
09AE32551E03D71D00A149FE /* BoardRaterPawnProgressionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09AE32541E03D71D00A149FE /* BoardRaterPawnProgressionTests.swift */; };
671989891DFFE0410053EA3D /* BoardRaterCenterOwnershipTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 671989881DFFE0410053EA3D /* BoardRaterCenterOwnershipTests.swift */; };
6719898D1DFFE0F40053EA3D /* BoardRaterBoardDominanceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6719898C1DFFE0F40053EA3D /* BoardRaterBoardDominanceTests.swift */; };
671989911DFFE8650053EA3D /* BoardRaterCenterDominanceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 671989901DFFE8650053EA3D /* BoardRaterCenterDominanceTests.swift */; };
673B95191E4CE5880086CA97 /* BoardRaterThreatenedPiecesTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09A4C0281E013ECB000CFBF4 /* BoardRaterThreatenedPiecesTests.swift */; };
676902581E432380007C76D7 /* PerformanceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 676902571E432380007C76D7 /* PerformanceTests.swift */; };
676C911C1E478A3A00985A4F /* SwiftChess.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 67A9CA0D1DE64D6500510FB8 /* SwiftChess.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
676EF7C51E15AC1700E275B4 /* BoardRaterKingSurroundingPossession.swift in Sources */ = {isa = PBXBuildFile; fileRef = 676EF7C41E15AC1700E275B4 /* BoardRaterKingSurroundingPossession.swift */; };
677BE819200A3749004B27DB /* DictionaryRepresentableExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 677BE818200A3749004B27DB /* DictionaryRepresentableExtensions.swift */; };
677BE81C200A3BDE004B27DB /* SquareTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 677BE81B200A3BDE004B27DB /* SquareTests.swift */; };
677BE81D200A52D8004B27DB /* AIConfigurationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67F7791F1E1B923B00885B89 /* AIConfigurationTests.swift */; };
67A3EB161E3A926C00F6F01B /* BoardScenarios.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67A3EB121E3A826800F6F01B /* BoardScenarios.swift */; };
67A9CA341DE64DD600510FB8 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD51AFB9204008FA782 /* AppDelegate.swift */; };
67A9CA351DE64DD800510FB8 /* MenuViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD71AFB9204008FA782 /* MenuViewController.swift */; };
67A9CA361DE64DDA00510FB8 /* GameViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67AD33A61D7C67BF002730DF /* GameViewController.swift */; };
@@ -28,20 +17,8 @@
67A9CA3A1DE64E0E00510FB8 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */; };
67A9CA3C1DE64E2B00510FB8 /* SwiftChess.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 67A9CA0D1DE64D6500510FB8 /* SwiftChess.framework */; };
67B73A9B1E15351900C19176 /* PromotionSelectionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67B73A9A1E15351900C19176 /* PromotionSelectionViewController.swift */; };
67B73A9F1E154C1E00C19176 /* AIPlayerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67B73A9E1E154C1E00C19176 /* AIPlayerTests.swift */; };
67D54A5D1DE7682D00C12258 /* BoardTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67D54A511DE7680E00C12258 /* BoardTests.swift */; };
67D54A5E1DE7683000C12258 /* GameTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67D54A521DE7680E00C12258 /* GameTests.swift */; };
67D54A5F1DE7683300C12258 /* PieceMovementTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67D54A531DE7680E00C12258 /* PieceMovementTests.swift */; };
67D54A601DE7683800C12258 /* PlayerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67D54A541DE7680E00C12258 /* PlayerTests.swift */; };
67D54A611DE7683A00C12258 /* Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67D54A551DE7680E00C12258 /* Tests.swift */; };
67D54A641DE976A900C12258 /* BoardRaterCountPiecesTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67D54A631DE976A900C12258 /* BoardRaterCountPiecesTests.swift */; };
67D54A661DE986F700C12258 /* PieceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67D54A651DE986F700C12258 /* PieceTests.swift */; };
67D54A681DE9A2DD00C12258 /* PieceView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67D54A671DE9A2DD00C12258 /* PieceView.swift */; };
67F779261E1C32A400885B89 /* BoardRaterCenterFourOccupationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67F779251E1C32A400885B89 /* BoardRaterCenterFourOccupationTests.swift */; };
67F9DB6E1E1AC8DC00C7EC5A /* BoardRaterCheckMateOpportunityTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67F9DB6D1E1AC8DC00C7EC5A /* BoardRaterCheckMateOpportunityTests.swift */; };
67F9DB751E1AD3BB00C7EC5A /* AIBehaviourTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67F9DB741E1AD3BB00C7EC5A /* AIBehaviourTests.swift */; };
67FD868D1E41099B0023335C /* BoardLocationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67FD868C1E41099B0023335C /* BoardLocationTests.swift */; };
67FD86911E4128F00023335C /* OpeningsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67FD86901E4128F00023335C /* OpeningsTests.swift */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@@ -90,8 +67,6 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
09A4C0281E013ECB000CFBF4 /* BoardRaterThreatenedPiecesTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BoardRaterThreatenedPiecesTests.swift; sourceTree = "<group>"; };
09AE32541E03D71D00A149FE /* BoardRaterPawnProgressionTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BoardRaterPawnProgressionTests.swift; sourceTree = "<group>"; };
607FACD41AFB9204008FA782 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
607FACD51AFB9204008FA782 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
607FACD71AFB9204008FA782 /* MenuViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MenuViewController.swift; sourceTree = "<group>"; };
@@ -99,35 +74,14 @@
607FACDC1AFB9204008FA782 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
607FACDF1AFB9204008FA782 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = "<group>"; };
607FACEA1AFB9204008FA782 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
671989881DFFE0410053EA3D /* BoardRaterCenterOwnershipTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BoardRaterCenterOwnershipTests.swift; sourceTree = "<group>"; };
6719898C1DFFE0F40053EA3D /* BoardRaterBoardDominanceTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BoardRaterBoardDominanceTests.swift; sourceTree = "<group>"; };
671989901DFFE8650053EA3D /* BoardRaterCenterDominanceTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BoardRaterCenterDominanceTests.swift; sourceTree = "<group>"; };
676902571E432380007C76D7 /* PerformanceTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PerformanceTests.swift; sourceTree = "<group>"; };
676EF7C41E15AC1700E275B4 /* BoardRaterKingSurroundingPossession.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BoardRaterKingSurroundingPossession.swift; sourceTree = "<group>"; };
677BE818200A3749004B27DB /* DictionaryRepresentableExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DictionaryRepresentableExtensions.swift; sourceTree = "<group>"; };
677BE81B200A3BDE004B27DB /* SquareTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SquareTests.swift; sourceTree = "<group>"; };
67A3EB121E3A826800F6F01B /* BoardScenarios.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BoardScenarios.swift; sourceTree = "<group>"; };
67A9CA071DE64D6500510FB8 /* SwiftChess.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SwiftChess.xcodeproj; path = ../SwiftChess/SwiftChess.xcodeproj; sourceTree = "<group>"; };
67A9CA141DE64DAA00510FB8 /* SwiftChessExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SwiftChessExample.app; sourceTree = BUILT_PRODUCTS_DIR; };
67A9CA271DE64DAA00510FB8 /* SwiftChessExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SwiftChessExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
67AD33A61D7C67BF002730DF /* GameViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GameViewController.swift; sourceTree = "<group>"; };
67AD33A81D7C67DF002730DF /* BoardView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BoardView.swift; sourceTree = "<group>"; };
67B73A9A1E15351900C19176 /* PromotionSelectionViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PromotionSelectionViewController.swift; sourceTree = "<group>"; };
67B73A9E1E154C1E00C19176 /* AIPlayerTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AIPlayerTests.swift; sourceTree = "<group>"; };
67D54A511DE7680E00C12258 /* BoardTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BoardTests.swift; sourceTree = "<group>"; };
67D54A521DE7680E00C12258 /* GameTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GameTests.swift; sourceTree = "<group>"; };
67D54A531DE7680E00C12258 /* PieceMovementTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PieceMovementTests.swift; sourceTree = "<group>"; };
67D54A541DE7680E00C12258 /* PlayerTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PlayerTests.swift; sourceTree = "<group>"; };
67D54A551DE7680E00C12258 /* Tests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Tests.swift; sourceTree = "<group>"; };
67D54A631DE976A900C12258 /* BoardRaterCountPiecesTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BoardRaterCountPiecesTests.swift; sourceTree = "<group>"; };
67D54A651DE986F700C12258 /* PieceTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PieceTests.swift; sourceTree = "<group>"; };
67D54A671DE9A2DD00C12258 /* PieceView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PieceView.swift; sourceTree = "<group>"; };
67F7791F1E1B923B00885B89 /* AIConfigurationTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AIConfigurationTests.swift; sourceTree = "<group>"; };
67F779251E1C32A400885B89 /* BoardRaterCenterFourOccupationTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BoardRaterCenterFourOccupationTests.swift; sourceTree = "<group>"; };
67F9DB6D1E1AC8DC00C7EC5A /* BoardRaterCheckMateOpportunityTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BoardRaterCheckMateOpportunityTests.swift; sourceTree = "<group>"; };
67F9DB741E1AD3BB00C7EC5A /* AIBehaviourTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AIBehaviourTests.swift; sourceTree = "<group>"; };
67FD868C1E41099B0023335C /* BoardLocationTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BoardLocationTests.swift; sourceTree = "<group>"; };
67FD86901E4128F00023335C /* OpeningsTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OpeningsTests.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -203,19 +157,6 @@
isa = PBXGroup;
children = (
607FACE91AFB9204008FA782 /* Supporting Files */,
67D54A651DE986F700C12258 /* PieceTests.swift */,
677BE81B200A3BDE004B27DB /* SquareTests.swift */,
67FD868C1E41099B0023335C /* BoardLocationTests.swift */,
67D54A511DE7680E00C12258 /* BoardTests.swift */,
67D54A521DE7680E00C12258 /* GameTests.swift */,
67D54A531DE7680E00C12258 /* PieceMovementTests.swift */,
67D54A541DE7680E00C12258 /* PlayerTests.swift */,
67B73A9E1E154C1E00C19176 /* AIPlayerTests.swift */,
67F7791F1E1B923B00885B89 /* AIConfigurationTests.swift */,
67F9DB741E1AD3BB00C7EC5A /* AIBehaviourTests.swift */,
676902571E432380007C76D7 /* PerformanceTests.swift */,
67FD86901E4128F00023335C /* OpeningsTests.swift */,
67D54A621DE9768200C12258 /* BoardRaters */,
67D54A551DE7680E00C12258 /* Tests.swift */,
);
path = Tests;
@@ -225,8 +166,6 @@
isa = PBXGroup;
children = (
607FACEA1AFB9204008FA782 /* Info.plist */,
67A3EB121E3A826800F6F01B /* BoardScenarios.swift */,
677BE818200A3749004B27DB /* DictionaryRepresentableExtensions.swift */,
);
name = "Supporting Files";
sourceTree = "<group>";
@@ -240,22 +179,6 @@
name = Products;
sourceTree = "<group>";
};
67D54A621DE9768200C12258 /* BoardRaters */ = {
isa = PBXGroup;
children = (
67D54A631DE976A900C12258 /* BoardRaterCountPiecesTests.swift */,
671989881DFFE0410053EA3D /* BoardRaterCenterOwnershipTests.swift */,
6719898C1DFFE0F40053EA3D /* BoardRaterBoardDominanceTests.swift */,
671989901DFFE8650053EA3D /* BoardRaterCenterDominanceTests.swift */,
09A4C0281E013ECB000CFBF4 /* BoardRaterThreatenedPiecesTests.swift */,
09AE32541E03D71D00A149FE /* BoardRaterPawnProgressionTests.swift */,
676EF7C41E15AC1700E275B4 /* BoardRaterKingSurroundingPossession.swift */,
67F9DB6D1E1AC8DC00C7EC5A /* BoardRaterCheckMateOpportunityTests.swift */,
67F779251E1C32A400885B89 /* BoardRaterCenterFourOccupationTests.swift */,
);
name = BoardRaters;
sourceTree = "<group>";
};
67D54A691DE9A3C500C12258 /* Game */ = {
isa = PBXGroup;
children = (
@@ -316,18 +239,18 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0800;
LastUpgradeCheck = 0900;
LastUpgradeCheck = 1200;
ORGANIZATIONNAME = CocoaPods;
TargetAttributes = {
67A9CA131DE64DAA00510FB8 = {
CreatedOnToolsVersion = 8.0;
DevelopmentTeam = VAA3W4LPY2;
LastSwiftMigration = 0900;
LastSwiftMigration = 1020;
ProvisioningStyle = Automatic;
};
67A9CA261DE64DAA00510FB8 = {
CreatedOnToolsVersion = 8.0;
LastSwiftMigration = 0900;
LastSwiftMigration = 1020;
ProvisioningStyle = Automatic;
TestTargetID = 67A9CA131DE64DAA00510FB8;
};
@@ -335,7 +258,7 @@
};
buildConfigurationList = 607FACCB1AFB9204008FA782 /* Build configuration list for PBXProject "Example" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
@@ -444,30 +367,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
67D54A601DE7683800C12258 /* PlayerTests.swift in Sources */,
67FD86911E4128F00023335C /* OpeningsTests.swift in Sources */,
67D54A611DE7683A00C12258 /* Tests.swift in Sources */,
676EF7C51E15AC1700E275B4 /* BoardRaterKingSurroundingPossession.swift in Sources */,
677BE81C200A3BDE004B27DB /* SquareTests.swift in Sources */,
67FD868D1E41099B0023335C /* BoardLocationTests.swift in Sources */,
67D54A5D1DE7682D00C12258 /* BoardTests.swift in Sources */,
67F9DB751E1AD3BB00C7EC5A /* AIBehaviourTests.swift in Sources */,
671989911DFFE8650053EA3D /* BoardRaterCenterDominanceTests.swift in Sources */,
6719898D1DFFE0F40053EA3D /* BoardRaterBoardDominanceTests.swift in Sources */,
677BE819200A3749004B27DB /* DictionaryRepresentableExtensions.swift in Sources */,
67D54A5E1DE7683000C12258 /* GameTests.swift in Sources */,
673B95191E4CE5880086CA97 /* BoardRaterThreatenedPiecesTests.swift in Sources */,
67D54A661DE986F700C12258 /* PieceTests.swift in Sources */,
671989891DFFE0410053EA3D /* BoardRaterCenterOwnershipTests.swift in Sources */,
67B73A9F1E154C1E00C19176 /* AIPlayerTests.swift in Sources */,
676902581E432380007C76D7 /* PerformanceTests.swift in Sources */,
67D54A641DE976A900C12258 /* BoardRaterCountPiecesTests.swift in Sources */,
677BE81D200A52D8004B27DB /* AIConfigurationTests.swift in Sources */,
67A3EB161E3A926C00F6F01B /* BoardScenarios.swift in Sources */,
09AE32551E03D71D00A149FE /* BoardRaterPawnProgressionTests.swift in Sources */,
67D54A5F1DE7683300C12258 /* PieceMovementTests.swift in Sources */,
67F779261E1C32A400885B89 /* BoardRaterCenterFourOccupationTests.swift in Sources */,
67F9DB6E1E1AC8DC00C7EC5A /* BoardRaterCheckMateOpportunityTests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -510,6 +410,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
@@ -518,14 +419,17 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
@@ -551,7 +455,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.3;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
@@ -563,6 +467,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
@@ -571,14 +476,17 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
@@ -597,7 +505,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.3;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
@@ -616,12 +524,12 @@
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = VAA3W4LPY2;
INFOPLIST_FILE = SwiftChess/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = SteveBarnegren.SwiftChessExample;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
@@ -636,11 +544,11 @@
CLANG_WARN_SUSPICIOUS_MOVES = YES;
DEVELOPMENT_TEAM = VAA3W4LPY2;
INFOPLIST_FILE = SwiftChess/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = SteveBarnegren.SwiftChessExample;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
@@ -655,12 +563,12 @@
CLANG_WARN_SUSPICIOUS_MOVES = YES;
DEBUG_INFORMATION_FORMAT = dwarf;
INFOPLIST_FILE = Tests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = SteveBarnegren.SwiftChessExampleTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SwiftChessExample.app/SwiftChessExample";
};
name = Debug;
@@ -674,11 +582,11 @@
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_SUSPICIOUS_MOVES = YES;
INFOPLIST_FILE = Tests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = SteveBarnegren.SwiftChessExampleTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SwiftChessExample.app/SwiftChessExample";
};
name = Release;
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0900"
LastUpgradeVersion = "1200"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@@ -40,8 +40,16 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "607FACCF1AFB9204008FA782"
BuildableName = "SwiftChess_Example.app"
BlueprintName = "SwiftChess_Example"
ReferencedContainer = "container:SwiftChess.xcodeproj">
</BuildableReference>
</MacroExpansion>
<Testables>
<TestableReference
skipped = "NO">
@@ -54,23 +62,11 @@
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "607FACCF1AFB9204008FA782"
BuildableName = "SwiftChess_Example.app"
BlueprintName = "SwiftChess_Example"
ReferencedContainer = "container:SwiftChess.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
@@ -87,8 +83,6 @@
ReferencedContainer = "container:SwiftChess.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
@@ -0,0 +1,107 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1200"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "67A9CA131DE64DAA00510FB8"
BuildableName = "SwiftChessExample.app"
BlueprintName = "SwiftChessExample"
ReferencedContainer = "container:Example.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "67A9CA131DE64DAA00510FB8"
BuildableName = "SwiftChessExample.app"
BlueprintName = "SwiftChessExample"
ReferencedContainer = "container:Example.xcodeproj">
</BuildableReference>
</MacroExpansion>
<Testables>
<TestableReference
skipped = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "67A9CA261DE64DAA00510FB8"
BuildableName = "SwiftChessExampleTests.xctest"
BlueprintName = "SwiftChessExampleTests"
ReferencedContainer = "container:Example.xcodeproj">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "67A9C9E61DE64CD300510FB8"
BuildableName = "SwiftChessTests.xctest"
BlueprintName = "SwiftChessTests"
ReferencedContainer = "container:../SwiftChess/SwiftChess.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "67A9CA131DE64DAA00510FB8"
BuildableName = "SwiftChessExample.app"
BlueprintName = "SwiftChessExample"
ReferencedContainer = "container:Example.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "67A9CA131DE64DAA00510FB8"
BuildableName = "SwiftChessExample.app"
BlueprintName = "SwiftChessExample"
ReferencedContainer = "container:Example.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
+1 -1
View File
@@ -14,7 +14,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
+13 -16
View File
@@ -1,24 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<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="o9i-0S-2Up">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="17156" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="o9i-0S-2Up">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
<capability name="Aspect ratio constraints" minToolsVersion="5.1"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17125"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--Navigation Controller-->
<scene sceneID="HEd-Os-R93">
<objects>
<navigationController navigationBarHidden="YES" id="o9i-0S-2Up" sceneMemberID="viewController">
<navigationController id="o9i-0S-2Up" sceneMemberID="viewController">
<nil key="simulatedStatusBarMetrics"/>
<nil key="simulatedTopBarMetrics"/>
<nil key="simulatedBottomBarMetrics"/>
<navigationBar key="navigationBar" contentMode="scaleToFill" id="e3D-Nu-dRp">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<connections>
@@ -44,21 +41,21 @@
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="KRf-s7-H9a">
<rect key="frame" x="133.5" y="264.5" width="108" height="138"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="fGu-y2-Qxm">
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="fGu-y2-Qxm">
<rect key="frame" x="0.0" y="92" width="108" height="30"/>
<state key="normal" title="AI vs AI"/>
<connections>
<action selector="AIvsAIButtonPressed:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="mrX-sU-WvD"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="kEX-Ea-5Xq">
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="kEX-Ea-5Xq">
<rect key="frame" x="0.0" y="46" width="108" height="30"/>
<state key="normal" title="Player vs Player"/>
<connections>
<action selector="playerVsPlayerButtonPressed:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="xIZ-0U-CNW"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="gcM-Gf-hHc">
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="gcM-Gf-hHc">
<rect key="frame" x="0.0" y="0.0" width="108" height="30"/>
<state key="normal" title="Player vs AI"/>
<connections>
@@ -112,28 +109,28 @@
<constraint firstAttribute="width" secondItem="NnZ-Ew-a2B" secondAttribute="height" multiplier="1:1" id="GNF-YV-5Vh"/>
</constraints>
</view>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ZZ0-mR-VXd">
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ZZ0-mR-VXd">
<rect key="frame" x="8" y="116" width="44" height="30"/>
<state key="normal" title="Castle"/>
<connections>
<action selector="blackKingSideCastleButtonPressedWithSender:" destination="M5V-oM-g1K" eventType="touchUpInside" id="rLk-f9-Sot"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="eZD-P8-Hr3">
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="eZD-P8-Hr3">
<rect key="frame" x="323" y="116" width="44" height="30"/>
<state key="normal" title="Castle"/>
<connections>
<action selector="blackQueenSideCastleButtonPressedWithSender:" destination="M5V-oM-g1K" eventType="touchUpInside" id="04c-Bn-Bkt"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Yxk-YT-5FA">
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Yxk-YT-5FA">
<rect key="frame" x="8" y="521" width="44" height="30"/>
<state key="normal" title="Castle"/>
<connections>
<action selector="whiteQueenSideCastleButtonPressedWithSender:" destination="M5V-oM-g1K" eventType="touchUpInside" id="3el-xi-NUE"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="FwI-ZC-g1Z">
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="FwI-ZC-g1Z">
<rect key="frame" x="323" y="521" width="44" height="30"/>
<state key="normal" title="Castle"/>
<connections>
@@ -141,7 +138,7 @@
</connections>
</button>
<activityIndicatorView opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" style="gray" translatesAutoresizingMaskIntoConstraints="NO" id="JEV-Ul-qRP">
<rect key="frame" x="177" y="121" width="20" height="20"/>
<rect key="frame" x="177.5" y="121" width="20" height="20"/>
</activityIndicatorView>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
-3
View File
@@ -81,10 +81,7 @@ class BoardView: UIView {
// Get touch location
let location = touches.first!.location(in: self)
print("Touch at x: \(location.x) y: \(location.y)")
let boardIndex = boardIndexForLocation(location)
print("Board index: \(boardIndex)")
delegate?.touchedSquareAtIndex(self, index: boardIndex)
+4 -10
View File
@@ -103,7 +103,7 @@ class GameViewController: UIViewController {
func removePieceView(pieceView: PieceView) {
if let index = pieceViews.index(of: pieceView) {
if let index = pieceViews.firstIndex(of: pieceView) {
pieceViews.remove(at: index)
}
@@ -211,7 +211,6 @@ class GameViewController: UIViewController {
// MARK: - Actions
@IBAction func whiteKingSideCastleButtonPressed(sender: UIButton) {
print("White king side castle button pressed")
if let player = game.currentPlayer as? Human {
player.performCastleMove(side: .kingSide)
@@ -219,7 +218,6 @@ class GameViewController: UIViewController {
}
@IBAction func whiteQueenSideCastleButtonPressed(sender: UIButton) {
print("White queen side castle button pressed")
if let player = game.currentPlayer as? Human {
player.performCastleMove(side: .queenSide)
@@ -227,7 +225,6 @@ class GameViewController: UIViewController {
}
@IBAction func blackKingSideCastleButtonPressed(sender: UIButton) {
print("Black king side castle button pressed")
if let player = game.currentPlayer as? Human {
player.performCastleMove(side: .kingSide)
@@ -235,7 +232,6 @@ class GameViewController: UIViewController {
}
@IBAction func blackQueenSideCastleButtonPressed(sender: UIButton) {
print("Black queen side castle button pressed")
if let player = game.currentPlayer as? Human {
player.performCastleMove(side: .queenSide)
@@ -248,9 +244,7 @@ class GameViewController: UIViewController {
extension GameViewController: BoardViewDelegate {
func touchedSquareAtIndex(_ boardView: BoardView, index: Int) {
print("GVC touched square at index \(index)")
// Get the player (must be human)
guard let player = game.currentPlayer as? Human else {
return
@@ -405,13 +399,13 @@ extension GameViewController: GameDelegate {
possibleTypes: possiblePromotions) {
self.promotionSelectionViewController?.view.removeFromSuperview()
self.promotionSelectionViewController?.removeFromParentViewController()
self.promotionSelectionViewController?.removeFromParent()
self.boardView.isUserInteractionEnabled = true
callback($0)
}
view.addSubview(viewController.view)
addChildViewController(viewController)
addChild(viewController)
promotionSelectionViewController = viewController
}
+10 -7
View File
@@ -11,41 +11,44 @@ import SwiftChess
class MenuViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
self.title = "SwiftChess"
}
// MARK: - Actions
@IBAction func playerVsAIButtonPressed(_ sender: UIButton) {
print("Player vs AI button pressed")
let whitePlayer = Human(color: .white)
let blackPlayer = AIPlayer(color: .black, configuration: AIConfiguration(difficulty: .hard))
let game = Game(firstPlayer: whitePlayer, secondPlayer: blackPlayer)
startGame(game: game)
startGame(game: game, title: "Player vs AI")
}
@IBAction func playerVsPlayerButtonPressed(_ sender: UIButton) {
print("Player vs Player button pressed")
let whitePlayer = Human(color: .white)
let blackPlayer = Human(color: .black)
let game = Game(firstPlayer: whitePlayer, secondPlayer: blackPlayer)
startGame(game: game)
startGame(game: game, title: "Player vs Player")
}
@IBAction func AIvsAIButtonPressed(_ sender: UIButton) {
print("AI vs AI button pressed")
let whitePlayer = AIPlayer(color: .white, configuration: AIConfiguration(difficulty: .hard))
let blackPlayer = AIPlayer(color: .black, configuration: AIConfiguration(difficulty: .hard))
let game = Game(firstPlayer: whitePlayer, secondPlayer: blackPlayer)
startGame(game: game)
startGame(game: game, title: "AI vs AI")
}
func startGame(game: Game) {
func startGame(game: Game, title: String) {
let gameViewController = GameViewController.gameViewController(game: game)
gameViewController.title = title
self.navigationController?.pushViewController(gameViewController, animated: true)
}
@@ -72,12 +72,8 @@ class PromotionSelectionViewController: UIViewController {
@objc func buttonPressed(sender: UIButton) {
let index = buttons.index(of: sender)!
print("Button pressed at index: \(index)")
let index = buttons.firstIndex(of: sender)!
let chosenType = possibleTypes![index]
print("Chose promotion type: \(chosenType)")
callback(chosenType)
}
-1
View File
@@ -1,6 +1,5 @@
import UIKit
import XCTest
import SwiftChess
class Tests: XCTestCase {
+15
View File
@@ -0,0 +1,15 @@
// swift-tools-version:5.1
import PackageDescription
let package = Package(name: "SwiftChess",
platforms: [.macOS(.v10_14),
.iOS(.v10),
.tvOS(.v10)],
products: [.library(name: "SwiftChess",
targets: ["SwiftChess"])],
targets: [.target(name: "SwiftChess",
path: "SwiftChess/Source"),
.testTarget(name: "SwiftChessTests",
dependencies: ["SwiftChess"],
path: "SwiftChess/SwiftChessTests")],
swiftLanguageVersions: [.v5])
+31 -7
View File
@@ -1,8 +1,10 @@
# SwiftChess
[![Version](https://img.shields.io/cocoapods/v/SBAutoLayout.svg?style=flat)](http://cocoapods.org/pods/SwiftChess)
[![License](https://img.shields.io/cocoapods/l/SBAutoLayout.svg?style=flat)](http://cocoapods.org/pods/SwiftChess)
[![Platform](https://img.shields.io/cocoapods/p/SBAutoLayout.svg?style=flat)](http://cocoapods.org/pods/SwiftChess)
[![Version](https://img.shields.io/cocoapods/v/SwiftChess.svg?style=flat)](http://cocoapods.org/pods/SwiftChess)
[![License](https://img.shields.io/cocoapods/l/SwiftChess.svg?style=flat)](http://cocoapods.org/pods/SwiftChess)
[![Platform](https://img.shields.io/cocoapods/p/SwiftChess.svg?style=flat)](http://cocoapods.org/pods/SwiftChess)
[![CI Status](https://api.travis-ci.org/SteveBarnegren/SwiftChess.svg?branch=master)](https://travis-ci.org/SteveBarnegren/SwiftChess)
[![Twitter](https://img.shields.io/badge/contact-@stevebarnegren-blue.svg?style=flat)](https://twitter.com/stevebarnegren)
SwiftChess is a chess engine written in Swift.
@@ -23,7 +25,7 @@ SwiftChess doesn't provide any UI, just all of the logic required to create a ch
## Example
The example application contains a complete implementation of swift chess.
The example application contains a complete implementation of **SwiftChess**.
Run `Example/Example.xcodeproj`
@@ -93,6 +95,27 @@ extension GameViewController: GameDelegate {
}
```
## Persistence
The entire state of a **SwiftChess** game can be converted to and initialised from a `Dictionary`.
Get a snapshot of the current state:
```
let dictionary: [String: Any] = game.dictionaryRepresentation
```
Initialise a game with a previous snapshot:
```
let game = Game(dictionary: dictionary)
```
The returned dictionary stores all the information required to create a 'save game' feature. The player colors, AI difficulty, piece positions etc.
You can serialize this to JSON, save it to disk, send it over the network etc.
## Other stuff
##### Make a castling move
@@ -107,15 +130,16 @@ if game.board.canColorCastle(color: .white, side: .kingSide) {
```
func promotedTypeForPawn(location: BoardLocation,
player: Human,
possiblePromotions: [Piece.PieceType],
callback: @escaping (Piece.PieceType) -> Void) {
player: Human,
possiblePromotions: [Piece.PieceType],
callback: @escaping (Piece.PieceType) -> Void) {
// Show UI for the user to select one of the possible promotion types
// then call the handler
// ...or some games just promote to a queen
callback(.queen)
}
```
## Author
+2 -1
View File
@@ -8,7 +8,7 @@
Pod::Spec.new do |s|
s.name = 'SwiftChess'
s.version = '1.0'
s.version = '1.1.2'
s.summary = 'Chess engine written in Swift'
# This description is used to generate tags and improve search results.
@@ -26,6 +26,7 @@ Chess engine written in Swift, support player vs player, and player vs AI games.
s.author = { 'Steve Barnegren' => 'steve.barnegren@gmail.com' }
s.source = { :git => 'https://github.com/SteveBarnegren/SwiftChess.git', :tag => s.version.to_s }
s.social_media_url = 'https://twitter.com/stevebarnegren'
s.swift_version = '5.0'
s.ios.deployment_target = '8.0'
+9 -15
View File
@@ -46,8 +46,8 @@ public final class AIPlayer: Player {
public func makeMoveSync() {
//print("\n\n****** Make Move ******");
guard let game = self.game else { return }
// Check that the game is in progress
guard game.state == .inProgress else {
return
@@ -59,7 +59,6 @@ public final class AIPlayer: Player {
// Get an opening move
if let openingMove = openingMove(for: board) {
//print("Playing opening move")
move = openingMove
}
// Or, get the Highest rated move
@@ -67,6 +66,9 @@ public final class AIPlayer: Player {
move = highestRatedMove(on: board)
}
// Check that the game still exists
if self.game == nil { return }
// Make move
var operations = [BoardOperation]()
@@ -156,7 +158,6 @@ public final class AIPlayer: Player {
let move = Move(type: .singlePiece(from: sourceLocation, to: targetLocation),
rating: rating)
possibleMoves.append(move)
// print("Rating: \(rating)")
}
}
@@ -164,7 +165,7 @@ public final class AIPlayer: Player {
let castleSides: [CastleSide] = [.kingSide, .queenSide]
for side in castleSides {
guard game.board.canColorCastle(color: color, side: side) else {
guard game?.board.canColorCastle(color: color, side: side) ?? false else {
continue
}
@@ -177,12 +178,10 @@ public final class AIPlayer: Player {
let move = Move(type: .castle(color: color, side: side), rating: rating)
possibleMoves.append(move)
}
//print("Found \(possibleMoves.count) possible moves")
// If there are no possible moves, we must be in stale mate
// If there are no possible moves, we must be in stale mate. This should never happen
if possibleMoves.count == 0 {
print("There are no possible moves!!!!")
print("There are no possible moves!")
}
// Choose move with highest rating
@@ -195,8 +194,6 @@ public final class AIPlayer: Player {
highestRating = move.rating
highestRatedMove = move
}
//print("rating: \(move.rating)")
}
return highestRatedMove
@@ -220,9 +217,6 @@ public final class AIPlayer: Player {
for boardRater in boardRaters {
let result = boardRater.ratingFor(board: board, color: color)
//let className = "\(boardRater)"
//print("\t\(className): \(result)")
rating += result
}
+1 -1
View File
@@ -129,7 +129,7 @@ public struct ASCIIBoard {
var index: Int?
#if swift(>=3.2)
if let idx = artString.index(of: character) {
if let idx = artString.firstIndex(of: character) {
index = artString.distance(from: artString.startIndex, to: idx)
}
#else
+3 -3
View File
@@ -652,7 +652,7 @@ public struct Board: Equatable {
case .queen:
character = piece.color == .white ? "Q" : "q"
case .king:
character = piece.color == .white ? "K" : "k"
character = piece.color == .white ? "G" : "g"
case .pawn:
character = piece.color == .white ? "P" : "p"
}
@@ -697,14 +697,14 @@ extension Board: DictionaryRepresentable {
return nil
}
let squares = squaresDicts.flatMap { Square(dictionary: $0) }
let squares = squaresDicts.compactMap { Square(dictionary: $0) }
if squares.count == 64 {
self.squares = squares
} else {
return nil
}
lastAssignedPieceTag = squares.flatMap { $0.piece }.map { $0.tag }.max() ?? 0
lastAssignedPieceTag = squares.compactMap { $0.piece }.map { $0.tag }.max() ?? 0
}
var dictionaryRepresentation: [String: Any] {
+7 -10
View File
@@ -37,12 +37,12 @@ public final class Game {
}
// MARK: Properties
open internal(set) var board: Board
open let whitePlayer: Player!
open let blackPlayer: Player!
open internal(set) var currentPlayer: Player!
open internal(set) var state = Game.State.inProgress
open weak var delegate: GameDelegate?
public internal(set) var board: Board
public let whitePlayer: Player!
public let blackPlayer: Player!
public internal(set) var currentPlayer: Player!
public internal(set) var state = Game.State.inProgress
public weak var delegate: GameDelegate?
public var gameType: GameType {
@@ -210,7 +210,6 @@ extension Game: DictionaryRepresentable {
struct Keys {
static let state = "state"
static let gameType = "gameType"
static let board = "board"
static let whitePlayerType = "whitePlayerType"
static let blackPlayerType = "blackPlayerType"
@@ -226,8 +225,6 @@ extension Game: DictionaryRepresentable {
// State
guard let stateDict = dictionary[Keys.state] as? [String: Any],
let state = State(dictionary: stateDict),
let gameTypeRaw = dictionary[Keys.gameType] as? Int,
let gameType = GameType(rawValue: gameTypeRaw),
let boardDict = dictionary[Keys.board] as? [String: Any],
let board = Board(dictionary: boardDict),
let currentPlayerColorRaw = dictionary[Keys.currentPlayerColor] as? String,
@@ -267,13 +264,13 @@ extension Game: DictionaryRepresentable {
secondPlayer: blackPlayer,
board: board,
colorToMove: currentPlayerColor)
self.state = state
}
public var dictionaryRepresentation: [String: Any] {
var dictionary = [String: Any]()
dictionary[Keys.state] = state.dictionaryRepresentation
dictionary[Keys.gameType] = gameType.rawValue
dictionary[Keys.board] = board.dictionaryRepresentation
// White Player
+22 -16
View File
@@ -21,6 +21,8 @@ public final class Human: Player {
public func movePiece(from fromLocation: BoardLocation, to toLocation: BoardLocation) throws {
guard let game = self.game else { return }
// Check that the game is in progress
guard game.state == .inProgress else {
throw MoveError.gameIsNotInProgress
@@ -48,22 +50,24 @@ public final class Human: Player {
let pawnLocation = promotablePawnLocations.first!
self.game.delegate?.promotedTypeForPawn(location: pawnLocation,
player: self,
possiblePromotions: Piece.PieceType.possiblePawnPromotionResultingTypes(),
callback: {
// Change the piece
let newPiece = self.game.board.squares[pawnLocation.index].piece?.byChangingType(newType: $0)
self.game.board.setPiece(newPiece!, at: pawnLocation)
// Add a transform piece operation
let modifyOperation = BoardOperation(type: .transformPiece, piece: newPiece!, location: pawnLocation)
operations.append(modifyOperation)
// Inform the delegate that we've finished
self.delegate?.playerDidMakeMove(player: self, boardOperations: operations)
})
game.delegate?.promotedTypeForPawn(location: pawnLocation,
player: self,
possiblePromotions: Piece.PieceType.possiblePawnPromotionResultingTypes(),
callback: {
guard let game = self.game else { return }
// Change the piece
let newPiece = game.board.squares[pawnLocation.index].piece?.byChangingType(newType: $0)
game.board.setPiece(newPiece!, at: pawnLocation)
// Add a transform piece operation
let modifyOperation = BoardOperation(type: .transformPiece, piece: newPiece!, location: pawnLocation)
operations.append(modifyOperation)
// Inform the delegate that we've finished
self.delegate?.playerDidMakeMove(player: self, boardOperations: operations)
})
}
// ... Or if no pawn promotions, end move
else {
@@ -75,6 +79,8 @@ public final class Human: Player {
}
public func performCastleMove(side: CastleSide) {
guard let game = self.game else { return }
// Check that we're the current player
guard game.currentPlayer === self else {
+2 -9
View File
@@ -62,18 +62,11 @@ class Opening {
}
// Filter for color
return moves.enumerated().flatMap { (index, value) in
return moves.enumerated().compactMap { (index, value) in
index % 2 == (color == .white ? 0 : 1) ? value : nil
}
}
/*
public func moveLocations(for color: Color) -> [(from fromLocation: BoardLocation, to toLocation: BoardLocation)] {
return moveLocations().enumerated().flatMap{ (index, value) in
index % 2 == (color == .white ? 0 : 1) ? value : nil
}
}
*/
func moveLocations() -> [(fromLocation: BoardLocation, toLocation: BoardLocation)] {
return moveGridPositions().map {
+9 -5
View File
@@ -15,12 +15,14 @@ protocol PlayerDelegate: class {
open class Player {
public var color: Color!
weak var game: Game!
weak var game: Game?
weak var delegate: PlayerDelegate?
public func occupiesSquare(at location: BoardLocation) -> Bool {
if let piece = self.game.board.getPiece(at: location) {
guard let game = game else { return false }
if let piece = game.board.getPiece(at: location) {
if piece.color == self.color {
return true
}
@@ -46,13 +48,15 @@ open class Player {
func canMovePiece(from fromLocation: BoardLocation, to toLocation: BoardLocation) throws -> Bool {
guard let game = self.game else { return false }
// We can't move to our current location
if fromLocation == toLocation {
throw MoveError.movingToSameLocation
}
// Get the piece
guard let piece = self.game.board.getPiece(at: fromLocation) else {
guard let piece = game.board.getPiece(at: fromLocation) else {
throw MoveError.noPieceToMove
}
@@ -67,8 +71,8 @@ open class Player {
}
// Move the piece
let inCheckBeforeMove = self.game.board.isColorInCheck(color: self.color)
var board = self.game.board
let inCheckBeforeMove = game.board.isColorInCheck(color: self.color)
var board = game.board
board.movePiece(from: fromLocation, to: toLocation)
let inCheckAfterMove = board.isColorInCheck(color: self.color)
+134 -14
View File
@@ -12,6 +12,29 @@
671989831DEB11900053EA3D /* BoardRaterCenterOwnership.swift in Sources */ = {isa = PBXBuildFile; fileRef = 671989821DEB11900053EA3D /* BoardRaterCenterOwnership.swift */; };
6719898B1DFFE0D80053EA3D /* BoardRaterBoardDominance.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6719898A1DFFE0D80053EA3D /* BoardRaterBoardDominance.swift */; };
6719898F1DFFE7550053EA3D /* BoardRaterCenterDominance.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6719898E1DFFE7550053EA3D /* BoardRaterCenterDominance.swift */; };
673596B922A1B43A003086FF /* AIPlayerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 673596AD22A1B43A003086FF /* AIPlayerTests.swift */; };
673596BA22A1B43A003086FF /* PerformanceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 673596AE22A1B43A003086FF /* PerformanceTests.swift */; };
673596BB22A1B43A003086FF /* AIBehaviourTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 673596AF22A1B43A003086FF /* AIBehaviourTests.swift */; };
673596BC22A1B43A003086FF /* GameTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 673596B022A1B43A003086FF /* GameTests.swift */; };
673596BD22A1B43A003086FF /* BoardTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 673596B122A1B43A003086FF /* BoardTests.swift */; };
673596BE22A1B43A003086FF /* OpeningsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 673596B222A1B43A003086FF /* OpeningsTests.swift */; };
673596BF22A1B43A003086FF /* PieceMovementTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 673596B322A1B43A003086FF /* PieceMovementTests.swift */; };
673596C022A1B43A003086FF /* BoardLocationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 673596B422A1B43A003086FF /* BoardLocationTests.swift */; };
673596C122A1B43A003086FF /* PlayerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 673596B522A1B43A003086FF /* PlayerTests.swift */; };
673596C222A1B43A003086FF /* PieceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 673596B622A1B43A003086FF /* PieceTests.swift */; };
673596C322A1B43A003086FF /* AIConfigurationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 673596B722A1B43A003086FF /* AIConfigurationTests.swift */; };
673596C422A1B43A003086FF /* SquareTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 673596B822A1B43A003086FF /* SquareTests.swift */; };
673596C822A1B448003086FF /* DictionaryRepresentableExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 673596C622A1B448003086FF /* DictionaryRepresentableExtensions.swift */; };
673596C922A1B448003086FF /* BoardScenarios.swift in Sources */ = {isa = PBXBuildFile; fileRef = 673596C722A1B448003086FF /* BoardScenarios.swift */; };
673596D422A1B45A003086FF /* BoardRaterCountPiecesTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 673596CB22A1B459003086FF /* BoardRaterCountPiecesTests.swift */; };
673596D522A1B45A003086FF /* BoardRaterCheckMateOpportunityTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 673596CC22A1B459003086FF /* BoardRaterCheckMateOpportunityTests.swift */; };
673596D622A1B45A003086FF /* BoardRaterCenterDominanceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 673596CD22A1B459003086FF /* BoardRaterCenterDominanceTests.swift */; };
673596D722A1B45A003086FF /* BoardRaterCenterOwnershipTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 673596CE22A1B459003086FF /* BoardRaterCenterOwnershipTests.swift */; };
673596D822A1B45A003086FF /* BoardRaterKingSurroundingPossession.swift in Sources */ = {isa = PBXBuildFile; fileRef = 673596CF22A1B459003086FF /* BoardRaterKingSurroundingPossession.swift */; };
673596D922A1B45A003086FF /* BoardRaterCenterFourOccupationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 673596D022A1B459003086FF /* BoardRaterCenterFourOccupationTests.swift */; };
673596DA22A1B45A003086FF /* BoardRaterBoardDominanceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 673596D122A1B45A003086FF /* BoardRaterBoardDominanceTests.swift */; };
673596DB22A1B45A003086FF /* BoardRaterThreatenedPiecesTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 673596D222A1B45A003086FF /* BoardRaterThreatenedPiecesTests.swift */; };
673596DC22A1B45A003086FF /* BoardRaterPawnProgressionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 673596D322A1B45A003086FF /* BoardRaterPawnProgressionTests.swift */; };
676EF7C31E15A8A500E275B4 /* BoardRaterKingSurroundingPossession.swift in Sources */ = {isa = PBXBuildFile; fileRef = 676EF7C21E15A8A500E275B4 /* BoardRaterKingSurroundingPossession.swift */; };
677BE817200A2D78004B27DB /* DictionaryRepresentable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 677BE816200A2D78004B27DB /* DictionaryRepresentable.swift */; };
67A9C9E81DE64CD300510FB8 /* SwiftChess.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 67A9C9DE1DE64CD200510FB8 /* SwiftChess.framework */; };
@@ -50,6 +73,29 @@
671989821DEB11900053EA3D /* BoardRaterCenterOwnership.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BoardRaterCenterOwnership.swift; sourceTree = "<group>"; };
6719898A1DFFE0D80053EA3D /* BoardRaterBoardDominance.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BoardRaterBoardDominance.swift; sourceTree = "<group>"; };
6719898E1DFFE7550053EA3D /* BoardRaterCenterDominance.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BoardRaterCenterDominance.swift; sourceTree = "<group>"; };
673596AD22A1B43A003086FF /* AIPlayerTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AIPlayerTests.swift; sourceTree = "<group>"; };
673596AE22A1B43A003086FF /* PerformanceTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PerformanceTests.swift; sourceTree = "<group>"; };
673596AF22A1B43A003086FF /* AIBehaviourTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AIBehaviourTests.swift; sourceTree = "<group>"; };
673596B022A1B43A003086FF /* GameTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GameTests.swift; sourceTree = "<group>"; };
673596B122A1B43A003086FF /* BoardTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BoardTests.swift; sourceTree = "<group>"; };
673596B222A1B43A003086FF /* OpeningsTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OpeningsTests.swift; sourceTree = "<group>"; };
673596B322A1B43A003086FF /* PieceMovementTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PieceMovementTests.swift; sourceTree = "<group>"; };
673596B422A1B43A003086FF /* BoardLocationTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BoardLocationTests.swift; sourceTree = "<group>"; };
673596B522A1B43A003086FF /* PlayerTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PlayerTests.swift; sourceTree = "<group>"; };
673596B622A1B43A003086FF /* PieceTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PieceTests.swift; sourceTree = "<group>"; };
673596B722A1B43A003086FF /* AIConfigurationTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AIConfigurationTests.swift; sourceTree = "<group>"; };
673596B822A1B43A003086FF /* SquareTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SquareTests.swift; sourceTree = "<group>"; };
673596C622A1B448003086FF /* DictionaryRepresentableExtensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DictionaryRepresentableExtensions.swift; sourceTree = "<group>"; };
673596C722A1B448003086FF /* BoardScenarios.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BoardScenarios.swift; sourceTree = "<group>"; };
673596CB22A1B459003086FF /* BoardRaterCountPiecesTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BoardRaterCountPiecesTests.swift; sourceTree = "<group>"; };
673596CC22A1B459003086FF /* BoardRaterCheckMateOpportunityTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BoardRaterCheckMateOpportunityTests.swift; sourceTree = "<group>"; };
673596CD22A1B459003086FF /* BoardRaterCenterDominanceTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BoardRaterCenterDominanceTests.swift; sourceTree = "<group>"; };
673596CE22A1B459003086FF /* BoardRaterCenterOwnershipTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BoardRaterCenterOwnershipTests.swift; sourceTree = "<group>"; };
673596CF22A1B459003086FF /* BoardRaterKingSurroundingPossession.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BoardRaterKingSurroundingPossession.swift; sourceTree = "<group>"; };
673596D022A1B459003086FF /* BoardRaterCenterFourOccupationTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BoardRaterCenterFourOccupationTests.swift; sourceTree = "<group>"; };
673596D122A1B45A003086FF /* BoardRaterBoardDominanceTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BoardRaterBoardDominanceTests.swift; sourceTree = "<group>"; };
673596D222A1B45A003086FF /* BoardRaterThreatenedPiecesTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BoardRaterThreatenedPiecesTests.swift; sourceTree = "<group>"; };
673596D322A1B45A003086FF /* BoardRaterPawnProgressionTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BoardRaterPawnProgressionTests.swift; sourceTree = "<group>"; };
676EF7C21E15A8A500E275B4 /* BoardRaterKingSurroundingPossession.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BoardRaterKingSurroundingPossession.swift; sourceTree = "<group>"; };
677BE816200A2D78004B27DB /* DictionaryRepresentable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DictionaryRepresentable.swift; sourceTree = "<group>"; };
67A9C9DE1DE64CD200510FB8 /* SwiftChess.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SwiftChess.framework; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -94,6 +140,31 @@
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
673596C522A1B43E003086FF /* Supporting */ = {
isa = PBXGroup;
children = (
673596C722A1B448003086FF /* BoardScenarios.swift */,
673596C622A1B448003086FF /* DictionaryRepresentableExtensions.swift */,
);
path = Supporting;
sourceTree = "<group>";
};
673596CA22A1B44B003086FF /* Board Raters */ = {
isa = PBXGroup;
children = (
673596D122A1B45A003086FF /* BoardRaterBoardDominanceTests.swift */,
673596CD22A1B459003086FF /* BoardRaterCenterDominanceTests.swift */,
673596D022A1B459003086FF /* BoardRaterCenterFourOccupationTests.swift */,
673596CE22A1B459003086FF /* BoardRaterCenterOwnershipTests.swift */,
673596CC22A1B459003086FF /* BoardRaterCheckMateOpportunityTests.swift */,
673596CB22A1B459003086FF /* BoardRaterCountPiecesTests.swift */,
673596CF22A1B459003086FF /* BoardRaterKingSurroundingPossession.swift */,
673596D322A1B45A003086FF /* BoardRaterPawnProgressionTests.swift */,
673596D222A1B45A003086FF /* BoardRaterThreatenedPiecesTests.swift */,
);
path = "Board Raters";
sourceTree = "<group>";
};
677BE815200A2D54004B27DB /* Extensions */ = {
isa = PBXGroup;
children = (
@@ -133,6 +204,20 @@
67A9C9EB1DE64CD300510FB8 /* SwiftChessTests */ = {
isa = PBXGroup;
children = (
673596C522A1B43E003086FF /* Supporting */,
673596CA22A1B44B003086FF /* Board Raters */,
673596AF22A1B43A003086FF /* AIBehaviourTests.swift */,
673596B722A1B43A003086FF /* AIConfigurationTests.swift */,
673596AD22A1B43A003086FF /* AIPlayerTests.swift */,
673596B422A1B43A003086FF /* BoardLocationTests.swift */,
673596B122A1B43A003086FF /* BoardTests.swift */,
673596B022A1B43A003086FF /* GameTests.swift */,
673596B222A1B43A003086FF /* OpeningsTests.swift */,
673596AE22A1B43A003086FF /* PerformanceTests.swift */,
673596B322A1B43A003086FF /* PieceMovementTests.swift */,
673596B622A1B43A003086FF /* PieceTests.swift */,
673596B522A1B43A003086FF /* PlayerTests.swift */,
673596B822A1B43A003086FF /* SquareTests.swift */,
67A9C9EE1DE64CD300510FB8 /* Info.plist */,
);
path = SwiftChessTests;
@@ -258,27 +343,28 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0800;
LastUpgradeCheck = 0900;
LastUpgradeCheck = 1200;
ORGANIZATIONNAME = "Steve Barnegren";
TargetAttributes = {
67A9C9DD1DE64CD200510FB8 = {
CreatedOnToolsVersion = 8.0;
LastSwiftMigration = 0900;
LastSwiftMigration = 1020;
ProvisioningStyle = Automatic;
};
67A9C9E61DE64CD300510FB8 = {
CreatedOnToolsVersion = 8.0;
LastSwiftMigration = 0900;
LastSwiftMigration = 1020;
ProvisioningStyle = Automatic;
};
};
};
buildConfigurationList = 67A9C9D81DE64CD200510FB8 /* Build configuration list for PBXProject "SwiftChess" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 67A9C9D41DE64CD200510FB8;
productRefGroup = 67A9C9DF1DE64CD200510FB8 /* Products */;
@@ -360,6 +446,29 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
673596D622A1B45A003086FF /* BoardRaterCenterDominanceTests.swift in Sources */,
673596C422A1B43A003086FF /* SquareTests.swift in Sources */,
673596DB22A1B45A003086FF /* BoardRaterThreatenedPiecesTests.swift in Sources */,
673596C222A1B43A003086FF /* PieceTests.swift in Sources */,
673596BA22A1B43A003086FF /* PerformanceTests.swift in Sources */,
673596BF22A1B43A003086FF /* PieceMovementTests.swift in Sources */,
673596D822A1B45A003086FF /* BoardRaterKingSurroundingPossession.swift in Sources */,
673596BD22A1B43A003086FF /* BoardTests.swift in Sources */,
673596D922A1B45A003086FF /* BoardRaterCenterFourOccupationTests.swift in Sources */,
673596DC22A1B45A003086FF /* BoardRaterPawnProgressionTests.swift in Sources */,
673596BB22A1B43A003086FF /* AIBehaviourTests.swift in Sources */,
673596C822A1B448003086FF /* DictionaryRepresentableExtensions.swift in Sources */,
673596C122A1B43A003086FF /* PlayerTests.swift in Sources */,
673596B922A1B43A003086FF /* AIPlayerTests.swift in Sources */,
673596C322A1B43A003086FF /* AIConfigurationTests.swift in Sources */,
673596BE22A1B43A003086FF /* OpeningsTests.swift in Sources */,
673596D422A1B45A003086FF /* BoardRaterCountPiecesTests.swift in Sources */,
673596BC22A1B43A003086FF /* GameTests.swift in Sources */,
673596C922A1B448003086FF /* BoardScenarios.swift in Sources */,
673596C022A1B43A003086FF /* BoardLocationTests.swift in Sources */,
673596DA22A1B45A003086FF /* BoardRaterBoardDominanceTests.swift in Sources */,
673596D722A1B45A003086FF /* BoardRaterCenterOwnershipTests.swift in Sources */,
673596D522A1B45A003086FF /* BoardRaterCheckMateOpportunityTests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -378,6 +487,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
@@ -387,6 +497,7 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
@@ -394,8 +505,10 @@
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
@@ -422,7 +535,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
@@ -438,6 +551,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
@@ -447,6 +561,7 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
@@ -454,8 +569,10 @@
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
@@ -476,7 +593,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
@@ -497,12 +614,13 @@
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = SwiftChess/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MARKETING_VERSION = 1.1.2;
PRODUCT_BUNDLE_IDENTIFIER = SteveBarnegren.SwiftChess;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
@@ -516,12 +634,13 @@
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = SwiftChess/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MARKETING_VERSION = 1.1.2;
PRODUCT_BUNDLE_IDENTIFIER = SteveBarnegren.SwiftChess;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Release;
};
@@ -529,12 +648,13 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CLANG_ENABLE_MODULES = YES;
INFOPLIST_FILE = SwiftChessTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = SteveBarnegren.SwiftChessTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.0;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
};
name = Debug;
};
@@ -542,12 +662,12 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CLANG_ENABLE_MODULES = YES;
INFOPLIST_FILE = SwiftChessTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = SteveBarnegren.SwiftChessTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Release;
};
+1 -1
View File
@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
@@ -844,7 +844,6 @@ class BoardTests: XCTestCase {
}
if piece.hasMoved {
print("Has moved flag set at index \(index)")
return true
}
}
@@ -26,9 +26,7 @@ class OpeningsTests: XCTestCase {
let openings = Opening.allOpenings()
for opening in openings {
print("Testing \(opening)")
var board = Board(state: .newGame)
for (source, target) in opening.moveLocations() {