diff --git a/Tic-Tac-ToeTests/Tic-Tac-ToeTests-Info.plist b/Tic-Tac-ToeTests/Tic-Tac-ToeTests-Info.plist
new file mode 100644
index 0000000..1abbc36
--- /dev/null
+++ b/Tic-Tac-ToeTests/Tic-Tac-ToeTests-Info.plist
@@ -0,0 +1,22 @@
+
+
+
+
+ CFBundleDevelopmentRegion
+ en
+ CFBundleExecutable
+ ${EXECUTABLE_NAME}
+ CFBundleIdentifier
+ RUSlan.${PRODUCT_NAME:rfc1034identifier}
+ CFBundleInfoDictionaryVersion
+ 6.0
+ CFBundlePackageType
+ BNDL
+ CFBundleShortVersionString
+ 1.0
+ CFBundleSignature
+ ????
+ CFBundleVersion
+ 1
+
+
diff --git a/Tic-Tac-ToeTests/Tic_Tac_ToeTests.m b/Tic-Tac-ToeTests/Tic_Tac_ToeTests.m
new file mode 100644
index 0000000..b159c87
--- /dev/null
+++ b/Tic-Tac-ToeTests/Tic_Tac_ToeTests.m
@@ -0,0 +1,34 @@
+//
+// Tic_Tac_ToeTests.m
+// Tic-Tac-ToeTests
+//
+// Created by RUSlan on 23.03.14.
+// Copyright (c) 2014 RUSlan. All rights reserved.
+//
+
+#import
+
+@interface Tic_Tac_ToeTests : XCTestCase
+
+@end
+
+@implementation Tic_Tac_ToeTests
+
+- (void)setUp
+{
+ [super setUp];
+ // Put setup code here. This method is called before the invocation of each test method in the class.
+}
+
+- (void)tearDown
+{
+ // Put teardown code here. This method is called after the invocation of each test method in the class.
+ [super tearDown];
+}
+
+- (void)testExample
+{
+ XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__);
+}
+
+@end
diff --git a/Tic-Tac-ToeTests/en.lproj/InfoPlist.strings b/Tic-Tac-ToeTests/en.lproj/InfoPlist.strings
new file mode 100644
index 0000000..477b28f
--- /dev/null
+++ b/Tic-Tac-ToeTests/en.lproj/InfoPlist.strings
@@ -0,0 +1,2 @@
+/* Localized versions of Info.plist keys */
+
diff --git a/tic-tac-toe.xcodeproj/project.pbxproj b/tic-tac-toe.xcodeproj/project.pbxproj
new file mode 100644
index 0000000..9367875
--- /dev/null
+++ b/tic-tac-toe.xcodeproj/project.pbxproj
@@ -0,0 +1,482 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 46;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 440355F518DF4BA2005D32EA /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 440355F418DF4BA2005D32EA /* Cocoa.framework */; };
+ 440355FF18DF4BA3005D32EA /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 440355FD18DF4BA3005D32EA /* InfoPlist.strings */; };
+ 4403560118DF4BA3005D32EA /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 4403560018DF4BA3005D32EA /* main.m */; };
+ 4403560518DF4BA3005D32EA /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = 4403560318DF4BA3005D32EA /* Credits.rtf */; };
+ 4403560818DF4BA3005D32EA /* RIAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 4403560718DF4BA3005D32EA /* RIAppDelegate.m */; };
+ 4403560B18DF4BA3005D32EA /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4403560918DF4BA3005D32EA /* MainMenu.xib */; };
+ 4403560D18DF4BA3005D32EA /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 4403560C18DF4BA3005D32EA /* Images.xcassets */; };
+ 4403561418DF4BA3005D32EA /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4403561318DF4BA3005D32EA /* XCTest.framework */; };
+ 4403561518DF4BA3005D32EA /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 440355F418DF4BA2005D32EA /* Cocoa.framework */; };
+ 4403561D18DF4BA3005D32EA /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 4403561B18DF4BA3005D32EA /* InfoPlist.strings */; };
+ 4403561F18DF4BA3005D32EA /* Tic_Tac_ToeTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4403561E18DF4BA3005D32EA /* Tic_Tac_ToeTests.m */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXContainerItemProxy section */
+ 4403561618DF4BA3005D32EA /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 440355E918DF4BA2005D32EA /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 440355F018DF4BA2005D32EA;
+ remoteInfo = "Tic-Tac-Toe";
+ };
+/* End PBXContainerItemProxy section */
+
+/* Begin PBXFileReference section */
+ 440355F118DF4BA2005D32EA /* Tic-Tac-Toe.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Tic-Tac-Toe.app"; sourceTree = BUILT_PRODUCTS_DIR; };
+ 440355F418DF4BA2005D32EA /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
+ 440355F718DF4BA3005D32EA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
+ 440355F818DF4BA3005D32EA /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; };
+ 440355F918DF4BA3005D32EA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
+ 440355FC18DF4BA3005D32EA /* Tic-Tac-Toe-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Tic-Tac-Toe-Info.plist"; sourceTree = ""; };
+ 440355FE18DF4BA3005D32EA /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; };
+ 4403560018DF4BA3005D32EA /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; };
+ 4403560218DF4BA3005D32EA /* Tic-Tac-Toe-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Tic-Tac-Toe-Prefix.pch"; sourceTree = ""; };
+ 4403560418DF4BA3005D32EA /* en */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = en; path = en.lproj/Credits.rtf; sourceTree = ""; };
+ 4403560618DF4BA3005D32EA /* RIAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RIAppDelegate.h; sourceTree = ""; };
+ 4403560718DF4BA3005D32EA /* RIAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RIAppDelegate.m; sourceTree = ""; };
+ 4403560A18DF4BA3005D32EA /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; };
+ 4403560C18DF4BA3005D32EA /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; };
+ 4403561218DF4BA3005D32EA /* Tic-Tac-ToeTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Tic-Tac-ToeTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
+ 4403561318DF4BA3005D32EA /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; };
+ 4403561A18DF4BA3005D32EA /* Tic-Tac-ToeTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Tic-Tac-ToeTests-Info.plist"; sourceTree = ""; };
+ 4403561C18DF4BA3005D32EA /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; };
+ 4403561E18DF4BA3005D32EA /* Tic_Tac_ToeTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Tic_Tac_ToeTests.m; sourceTree = ""; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 440355EE18DF4BA2005D32EA /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 440355F518DF4BA2005D32EA /* Cocoa.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 4403560F18DF4BA3005D32EA /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 4403561518DF4BA3005D32EA /* Cocoa.framework in Frameworks */,
+ 4403561418DF4BA3005D32EA /* XCTest.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 440355E818DF4BA2005D32EA = {
+ isa = PBXGroup;
+ children = (
+ 440355FA18DF4BA3005D32EA /* Tic-Tac-Toe */,
+ 4403561818DF4BA3005D32EA /* Tic-Tac-ToeTests */,
+ 440355F318DF4BA2005D32EA /* Frameworks */,
+ 440355F218DF4BA2005D32EA /* Products */,
+ );
+ sourceTree = "";
+ };
+ 440355F218DF4BA2005D32EA /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 440355F118DF4BA2005D32EA /* Tic-Tac-Toe.app */,
+ 4403561218DF4BA3005D32EA /* Tic-Tac-ToeTests.xctest */,
+ );
+ name = Products;
+ sourceTree = "";
+ };
+ 440355F318DF4BA2005D32EA /* Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ 440355F418DF4BA2005D32EA /* Cocoa.framework */,
+ 4403561318DF4BA3005D32EA /* XCTest.framework */,
+ 440355F618DF4BA3005D32EA /* Other Frameworks */,
+ );
+ name = Frameworks;
+ sourceTree = "";
+ };
+ 440355F618DF4BA3005D32EA /* Other Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ 440355F718DF4BA3005D32EA /* AppKit.framework */,
+ 440355F818DF4BA3005D32EA /* CoreData.framework */,
+ 440355F918DF4BA3005D32EA /* Foundation.framework */,
+ );
+ name = "Other Frameworks";
+ sourceTree = "";
+ };
+ 440355FA18DF4BA3005D32EA /* Tic-Tac-Toe */ = {
+ isa = PBXGroup;
+ children = (
+ 4403560618DF4BA3005D32EA /* RIAppDelegate.h */,
+ 4403560718DF4BA3005D32EA /* RIAppDelegate.m */,
+ 4403560918DF4BA3005D32EA /* MainMenu.xib */,
+ 4403560C18DF4BA3005D32EA /* Images.xcassets */,
+ 440355FB18DF4BA3005D32EA /* Supporting Files */,
+ );
+ path = "Tic-Tac-Toe";
+ sourceTree = "";
+ };
+ 440355FB18DF4BA3005D32EA /* Supporting Files */ = {
+ isa = PBXGroup;
+ children = (
+ 440355FC18DF4BA3005D32EA /* Tic-Tac-Toe-Info.plist */,
+ 440355FD18DF4BA3005D32EA /* InfoPlist.strings */,
+ 4403560018DF4BA3005D32EA /* main.m */,
+ 4403560218DF4BA3005D32EA /* Tic-Tac-Toe-Prefix.pch */,
+ 4403560318DF4BA3005D32EA /* Credits.rtf */,
+ );
+ name = "Supporting Files";
+ sourceTree = "";
+ };
+ 4403561818DF4BA3005D32EA /* Tic-Tac-ToeTests */ = {
+ isa = PBXGroup;
+ children = (
+ 4403561E18DF4BA3005D32EA /* Tic_Tac_ToeTests.m */,
+ 4403561918DF4BA3005D32EA /* Supporting Files */,
+ );
+ path = "Tic-Tac-ToeTests";
+ sourceTree = "";
+ };
+ 4403561918DF4BA3005D32EA /* Supporting Files */ = {
+ isa = PBXGroup;
+ children = (
+ 4403561A18DF4BA3005D32EA /* Tic-Tac-ToeTests-Info.plist */,
+ 4403561B18DF4BA3005D32EA /* InfoPlist.strings */,
+ );
+ name = "Supporting Files";
+ sourceTree = "";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ 440355F018DF4BA2005D32EA /* Tic-Tac-Toe */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 4403562218DF4BA3005D32EA /* Build configuration list for PBXNativeTarget "Tic-Tac-Toe" */;
+ buildPhases = (
+ 440355ED18DF4BA2005D32EA /* Sources */,
+ 440355EE18DF4BA2005D32EA /* Frameworks */,
+ 440355EF18DF4BA2005D32EA /* Resources */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = "Tic-Tac-Toe";
+ productName = "Tic-Tac-Toe";
+ productReference = 440355F118DF4BA2005D32EA /* Tic-Tac-Toe.app */;
+ productType = "com.apple.product-type.application";
+ };
+ 4403561118DF4BA3005D32EA /* Tic-Tac-ToeTests */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 4403562518DF4BA3005D32EA /* Build configuration list for PBXNativeTarget "Tic-Tac-ToeTests" */;
+ buildPhases = (
+ 4403560E18DF4BA3005D32EA /* Sources */,
+ 4403560F18DF4BA3005D32EA /* Frameworks */,
+ 4403561018DF4BA3005D32EA /* Resources */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ 4403561718DF4BA3005D32EA /* PBXTargetDependency */,
+ );
+ name = "Tic-Tac-ToeTests";
+ productName = "Tic-Tac-ToeTests";
+ productReference = 4403561218DF4BA3005D32EA /* Tic-Tac-ToeTests.xctest */;
+ productType = "com.apple.product-type.bundle.unit-test";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 440355E918DF4BA2005D32EA /* Project object */ = {
+ isa = PBXProject;
+ attributes = {
+ CLASSPREFIX = RI;
+ LastUpgradeCheck = 0510;
+ ORGANIZATIONNAME = RUSlan;
+ TargetAttributes = {
+ 4403561118DF4BA3005D32EA = {
+ TestTargetID = 440355F018DF4BA2005D32EA;
+ };
+ };
+ };
+ buildConfigurationList = 440355EC18DF4BA2005D32EA /* Build configuration list for PBXProject "Tic-Tac-Toe" */;
+ compatibilityVersion = "Xcode 3.2";
+ developmentRegion = English;
+ hasScannedForEncodings = 0;
+ knownRegions = (
+ en,
+ Base,
+ );
+ mainGroup = 440355E818DF4BA2005D32EA;
+ productRefGroup = 440355F218DF4BA2005D32EA /* Products */;
+ projectDirPath = "";
+ projectRoot = "";
+ targets = (
+ 440355F018DF4BA2005D32EA /* Tic-Tac-Toe */,
+ 4403561118DF4BA3005D32EA /* Tic-Tac-ToeTests */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+ 440355EF18DF4BA2005D32EA /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 440355FF18DF4BA3005D32EA /* InfoPlist.strings in Resources */,
+ 4403560D18DF4BA3005D32EA /* Images.xcassets in Resources */,
+ 4403560518DF4BA3005D32EA /* Credits.rtf in Resources */,
+ 4403560B18DF4BA3005D32EA /* MainMenu.xib in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 4403561018DF4BA3005D32EA /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 4403561D18DF4BA3005D32EA /* InfoPlist.strings in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 440355ED18DF4BA2005D32EA /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 4403560118DF4BA3005D32EA /* main.m in Sources */,
+ 4403560818DF4BA3005D32EA /* RIAppDelegate.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 4403560E18DF4BA3005D32EA /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 4403561F18DF4BA3005D32EA /* Tic_Tac_ToeTests.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXTargetDependency section */
+ 4403561718DF4BA3005D32EA /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 440355F018DF4BA2005D32EA /* Tic-Tac-Toe */;
+ targetProxy = 4403561618DF4BA3005D32EA /* PBXContainerItemProxy */;
+ };
+/* End PBXTargetDependency section */
+
+/* Begin PBXVariantGroup section */
+ 440355FD18DF4BA3005D32EA /* InfoPlist.strings */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 440355FE18DF4BA3005D32EA /* en */,
+ );
+ name = InfoPlist.strings;
+ sourceTree = "";
+ };
+ 4403560318DF4BA3005D32EA /* Credits.rtf */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 4403560418DF4BA3005D32EA /* en */,
+ );
+ name = Credits.rtf;
+ sourceTree = "";
+ };
+ 4403560918DF4BA3005D32EA /* MainMenu.xib */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 4403560A18DF4BA3005D32EA /* Base */,
+ );
+ name = MainMenu.xib;
+ sourceTree = "";
+ };
+ 4403561B18DF4BA3005D32EA /* InfoPlist.strings */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 4403561C18DF4BA3005D32EA /* en */,
+ );
+ name = InfoPlist.strings;
+ sourceTree = "";
+ };
+/* End PBXVariantGroup section */
+
+/* Begin XCBuildConfiguration section */
+ 4403562018DF4BA3005D32EA /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ COPY_PHASE_STRIP = NO;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_ENABLE_OBJC_EXCEPTIONS = YES;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "DEBUG=1",
+ "$(inherited)",
+ );
+ GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ MACOSX_DEPLOYMENT_TARGET = 10.9;
+ ONLY_ACTIVE_ARCH = YES;
+ SDKROOT = macosx;
+ };
+ name = Debug;
+ };
+ 4403562118DF4BA3005D32EA /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ COPY_PHASE_STRIP = YES;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ ENABLE_NS_ASSERTIONS = NO;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_ENABLE_OBJC_EXCEPTIONS = YES;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ MACOSX_DEPLOYMENT_TARGET = 10.9;
+ SDKROOT = macosx;
+ };
+ name = Release;
+ };
+ 4403562318DF4BA3005D32EA /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ COMBINE_HIDPI_IMAGES = YES;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = "Tic-Tac-Toe/Tic-Tac-Toe-Prefix.pch";
+ INFOPLIST_FILE = "Tic-Tac-Toe/Tic-Tac-Toe-Info.plist";
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ WRAPPER_EXTENSION = app;
+ };
+ name = Debug;
+ };
+ 4403562418DF4BA3005D32EA /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ COMBINE_HIDPI_IMAGES = YES;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = "Tic-Tac-Toe/Tic-Tac-Toe-Prefix.pch";
+ INFOPLIST_FILE = "Tic-Tac-Toe/Tic-Tac-Toe-Info.plist";
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ WRAPPER_EXTENSION = app;
+ };
+ name = Release;
+ };
+ 4403562618DF4BA3005D32EA /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/Tic-Tac-Toe.app/Contents/MacOS/Tic-Tac-Toe";
+ COMBINE_HIDPI_IMAGES = YES;
+ FRAMEWORK_SEARCH_PATHS = (
+ "$(DEVELOPER_FRAMEWORKS_DIR)",
+ "$(inherited)",
+ );
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = "Tic-Tac-Toe/Tic-Tac-Toe-Prefix.pch";
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "DEBUG=1",
+ "$(inherited)",
+ );
+ INFOPLIST_FILE = "Tic-Tac-ToeTests/Tic-Tac-ToeTests-Info.plist";
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ TEST_HOST = "$(BUNDLE_LOADER)";
+ WRAPPER_EXTENSION = xctest;
+ };
+ name = Debug;
+ };
+ 4403562718DF4BA3005D32EA /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/Tic-Tac-Toe.app/Contents/MacOS/Tic-Tac-Toe";
+ COMBINE_HIDPI_IMAGES = YES;
+ FRAMEWORK_SEARCH_PATHS = (
+ "$(DEVELOPER_FRAMEWORKS_DIR)",
+ "$(inherited)",
+ );
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = "Tic-Tac-Toe/Tic-Tac-Toe-Prefix.pch";
+ INFOPLIST_FILE = "Tic-Tac-ToeTests/Tic-Tac-ToeTests-Info.plist";
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ TEST_HOST = "$(BUNDLE_LOADER)";
+ WRAPPER_EXTENSION = xctest;
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 440355EC18DF4BA2005D32EA /* Build configuration list for PBXProject "Tic-Tac-Toe" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 4403562018DF4BA3005D32EA /* Debug */,
+ 4403562118DF4BA3005D32EA /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 4403562218DF4BA3005D32EA /* Build configuration list for PBXNativeTarget "Tic-Tac-Toe" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 4403562318DF4BA3005D32EA /* Debug */,
+ 4403562418DF4BA3005D32EA /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ };
+ 4403562518DF4BA3005D32EA /* Build configuration list for PBXNativeTarget "Tic-Tac-ToeTests" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 4403562618DF4BA3005D32EA /* Debug */,
+ 4403562718DF4BA3005D32EA /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 440355E918DF4BA2005D32EA /* Project object */;
+}
diff --git a/tic-tac-toe.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/tic-tac-toe.xcodeproj/project.xcworkspace/contents.xcworkspacedata
new file mode 100644
index 0000000..558934b
--- /dev/null
+++ b/tic-tac-toe.xcodeproj/project.xcworkspace/contents.xcworkspacedata
@@ -0,0 +1,7 @@
+
+
+
+
+
diff --git a/tic-tac-toe.xcodeproj/project.xcworkspace/xcuserdata/ruslan.xcuserdatad/UserInterfaceState.xcuserstate b/tic-tac-toe.xcodeproj/project.xcworkspace/xcuserdata/ruslan.xcuserdatad/UserInterfaceState.xcuserstate
new file mode 100644
index 0000000..82bf391
Binary files /dev/null and b/tic-tac-toe.xcodeproj/project.xcworkspace/xcuserdata/ruslan.xcuserdatad/UserInterfaceState.xcuserstate differ
diff --git a/tic-tac-toe.xcodeproj/xcuserdata/ruslan.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/tic-tac-toe.xcodeproj/xcuserdata/ruslan.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
new file mode 100644
index 0000000..fe2b454
--- /dev/null
+++ b/tic-tac-toe.xcodeproj/xcuserdata/ruslan.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
@@ -0,0 +1,5 @@
+
+
+
diff --git a/tic-tac-toe.xcodeproj/xcuserdata/ruslan.xcuserdatad/xcschemes/Tic-Tac-Toe.xcscheme b/tic-tac-toe.xcodeproj/xcuserdata/ruslan.xcuserdatad/xcschemes/Tic-Tac-Toe.xcscheme
new file mode 100644
index 0000000..42bab3e
--- /dev/null
+++ b/tic-tac-toe.xcodeproj/xcuserdata/ruslan.xcuserdatad/xcschemes/Tic-Tac-Toe.xcscheme
@@ -0,0 +1,96 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tic-tac-toe.xcodeproj/xcuserdata/ruslan.xcuserdatad/xcschemes/xcschememanagement.plist b/tic-tac-toe.xcodeproj/xcuserdata/ruslan.xcuserdatad/xcschemes/xcschememanagement.plist
new file mode 100644
index 0000000..9785c2f
--- /dev/null
+++ b/tic-tac-toe.xcodeproj/xcuserdata/ruslan.xcuserdatad/xcschemes/xcschememanagement.plist
@@ -0,0 +1,27 @@
+
+
+
+
+ SchemeUserState
+
+ Tic-Tac-Toe.xcscheme
+
+ orderHint
+ 0
+
+
+ SuppressBuildableAutocreation
+
+ 440355F018DF4BA2005D32EA
+
+ primary
+
+
+ 4403561118DF4BA3005D32EA
+
+ primary
+
+
+
+
+
diff --git a/tic-tac-toe/Base.lproj/MainMenu.xib b/tic-tac-toe/Base.lproj/MainMenu.xib
new file mode 100644
index 0000000..490d29c
--- /dev/null
+++ b/tic-tac-toe/Base.lproj/MainMenu.xib
@@ -0,0 +1,256 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ X
+ O
+ Dual
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tic-tac-toe/Images.xcassets/AppIcon.appiconset/Contents.json b/tic-tac-toe/Images.xcassets/AppIcon.appiconset/Contents.json
new file mode 100644
index 0000000..2db2b1c
--- /dev/null
+++ b/tic-tac-toe/Images.xcassets/AppIcon.appiconset/Contents.json
@@ -0,0 +1,58 @@
+{
+ "images" : [
+ {
+ "idiom" : "mac",
+ "size" : "16x16",
+ "scale" : "1x"
+ },
+ {
+ "idiom" : "mac",
+ "size" : "16x16",
+ "scale" : "2x"
+ },
+ {
+ "idiom" : "mac",
+ "size" : "32x32",
+ "scale" : "1x"
+ },
+ {
+ "idiom" : "mac",
+ "size" : "32x32",
+ "scale" : "2x"
+ },
+ {
+ "idiom" : "mac",
+ "size" : "128x128",
+ "scale" : "1x"
+ },
+ {
+ "idiom" : "mac",
+ "size" : "128x128",
+ "scale" : "2x"
+ },
+ {
+ "idiom" : "mac",
+ "size" : "256x256",
+ "scale" : "1x"
+ },
+ {
+ "idiom" : "mac",
+ "size" : "256x256",
+ "scale" : "2x"
+ },
+ {
+ "idiom" : "mac",
+ "size" : "512x512",
+ "scale" : "1x"
+ },
+ {
+ "idiom" : "mac",
+ "size" : "512x512",
+ "scale" : "2x"
+ }
+ ],
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+}
\ No newline at end of file
diff --git a/tic-tac-toe/RIAppDelegate.h b/tic-tac-toe/RIAppDelegate.h
new file mode 100644
index 0000000..640214f
--- /dev/null
+++ b/tic-tac-toe/RIAppDelegate.h
@@ -0,0 +1,41 @@
+//
+// RIAppDelegate.h
+// Tic-Tac-Toe
+//
+// Created by RUSlan on 23.03.14.
+// Copyright (c) 2014 RUSlan. All rights reserved.
+//
+
+#import
+
+@interface RIAppDelegate : NSObject
+
+@property (assign) IBOutlet NSWindow *window;
+
+
+- (IBAction)NewGame:(id)sender;
+
+- (IBAction)ClickMatrix:(id)sender;
+
+- (IBAction)Checking;
+
+- (IBAction)CheckingDraw;
+
+- (IBAction)FirstMoveChange:(id)sender;
+
+- (IBAction)StatsUpdate:(id)sender;
+
+@property (weak) IBOutlet NSMatrix *Buttons;
+@property (weak) IBOutlet NSTextField *Text;
+@property (weak) IBOutlet NSMatrix *Stats;
+@property (weak) IBOutlet NSButton *FirstMoveMenu;
+@property (weak) IBOutlet NSComboBox *ButtonChangeFirstMove;
+
+bool cellEq(id array, int firstRow, int firstColumn, int secondRow, int secondColumn);
+
+void computerMv(id array, id Text);
+
+void changeXO();
+
+
+@end
diff --git a/tic-tac-toe/RIAppDelegate.m b/tic-tac-toe/RIAppDelegate.m
new file mode 100644
index 0000000..731c3f9
--- /dev/null
+++ b/tic-tac-toe/RIAppDelegate.m
@@ -0,0 +1,482 @@
+//
+// RIAppDelegate.m
+// Tic-Tac-Toe
+//
+// Created by RUSlan on 23.03.14.
+// Copyright (c) 2014 RUSlan. All rights reserved.
+//
+
+#import "RIAppDelegate.h"
+
+
+NSString *playerMove;
+NSString *computerMove;
+NSString *player1Move;
+NSString *player2Move;
+
+bool gameWasEnded;
+bool computerPlaysFirst;
+bool firstPlayerMove;
+bool twoPlayerMode;
+
+NSInteger wins;
+NSInteger loses;
+NSInteger draws;
+NSInteger player1Wins;
+NSInteger player2Wins;
+NSInteger dualDraws;
+
+
+@implementation RIAppDelegate
+
+- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
+{
+ playerMove = [NSString new];
+ computerMove = [NSString new];
+ player1Move = [NSString new];
+ player2Move = [NSString new];
+
+ player1Move = @"X";
+ player2Move = @"O";
+
+
+ gameWasEnded = false;
+
+ wins = 0;
+ loses = 0;
+ draws = 0;
+ player1Wins = 0;
+ player2Wins = 0;
+ dualDraws = 0;
+
+ [_ButtonChangeFirstMove selectItemAtIndex: 0];
+ [self FirstMoveChange: NULL];
+
+ [self NewGame: NULL];
+}
+
+- (IBAction)NewGame:(id)sender {
+ [_Text setStringValue: @"New Game"];
+
+ firstPlayerMove = true;
+
+ [_ButtonChangeFirstMove setEnabled: true];
+
+ [self StatsUpdate: NULL];
+ gameWasEnded = false;
+
+ for (int i = 0; i < 3; i++) {
+ for (int j = 0; j < 3; j++) {
+ [[_Buttons cellAtRow: i column: j] setTitle: @""];
+ }
+ }
+ if (computerPlaysFirst) {
+ computerMv(_Buttons, _Text);
+ }
+}
+
+- (IBAction)ClickMatrix:(id)sender {
+
+ if (gameWasEnded) {
+ [self NewGame: NULL];
+ }
+ else {
+ [_Text setStringValue: @""];
+
+ [_ButtonChangeFirstMove setEnabled: false];
+
+ if ([[[sender selectedCell] title] compare: @""]) {
+ [_Text setStringValue: @"Illegal move!"];
+ }
+ else {
+ [self Checking];
+ if (!gameWasEnded) {
+ [self CheckingDraw];
+ }
+ if (twoPlayerMode) {
+ [[sender selectedCell] setTitle: (firstPlayerMove) ? player1Move : player2Move];
+ [self Checking];
+ if (!gameWasEnded) {
+ [self CheckingDraw];
+ }
+ firstPlayerMove = !firstPlayerMove;
+ }
+ else {
+ [[sender selectedCell] setTitle: playerMove];
+ [self Checking];
+ if (!gameWasEnded) {
+ [self CheckingDraw];
+ }
+ if (!gameWasEnded) {
+ computerMv(sender, _Text);
+ [self Checking];
+ if (!gameWasEnded) {
+ [self CheckingDraw];
+ }
+ }
+ }
+ }
+ }
+}
+
+- (IBAction)Checking {
+ if ( (cellEq(_Buttons, 0, 0, 1, 1) && cellEq(_Buttons, 0, 0, 2, 2)) ||
+ (cellEq(_Buttons, 0, 2, 1, 1) && cellEq(_Buttons, 0, 2, 2, 0)) ) {
+ if (twoPlayerMode) {
+ if ([[_Buttons cellAtRow: 1 column: 1] title] == player1Move) {
+ [_Text setStringValue: @"Player 1 won!"];
+ player1Wins++;
+ }
+ else {
+ [_Text setStringValue: @"Player 2 won!"];
+ player2Wins++;
+ }
+ }
+ else {
+ if ([[_Buttons cellAtRow: 1 column: 1] title] == playerMove) {
+ [_Text setStringValue: @"Player won!"];
+ wins++;
+ }
+ else {
+ [_Text setStringValue: @"Computer won!"];
+ loses++;
+ }
+ }
+ gameWasEnded = true;
+ }
+ for (int i = 0; i < 3; i++) {
+ if ( cellEq(_Buttons, 0, i, 1, i) && cellEq(_Buttons, 0, i, 2, i) ) {
+ if (twoPlayerMode) {
+ if ([[_Buttons cellAtRow: 0 column: i] title] == player1Move) {
+ [_Text setStringValue: @"Player 1 won!"];
+ player1Wins++;
+ }
+ else {
+ [_Text setStringValue: @"Player 2 won!"];
+ player2Wins++;
+ }
+ }
+ else {
+ if ([[_Buttons cellAtRow: 0 column: i] title] == playerMove) {
+ [_Text setStringValue: @"Player won!"];
+ wins++;
+ }
+ else {
+ [_Text setStringValue: @"Computer won!"];
+ loses++;
+ }
+
+ }
+ gameWasEnded = true;
+ break;
+ }
+ if ( cellEq(_Buttons, i, 0, i, 1) && cellEq(_Buttons, i, 0, i, 2) ) {
+ if (twoPlayerMode) {
+ if ([[_Buttons cellAtRow: i column: 0] title] == player1Move) {
+ [_Text setStringValue: @"Player 1 won!"];
+ player1Wins++;
+ }
+ else {
+ [_Text setStringValue: @"Player 2 won!"];
+ player2Wins++;
+ }
+ }
+ else {
+ if ([[_Buttons cellAtRow: i column: 0] title] == playerMove) {
+ [_Text setStringValue: @"Player won!"];
+ wins++;
+ }
+ else {
+ [_Text setStringValue: @"Computer won!"];
+ loses++;
+ }
+ }
+ gameWasEnded = true;
+ break;
+ }
+ }
+}
+
+- (IBAction)CheckingDraw {
+ bool full = true;
+
+ for (int i = 0; i < 3; i++) {
+ for (int j = 0; j < 3; j++) {
+ full = full && ![[[_Buttons cellAtRow: i column: j] title] isEqual: @""];
+ }
+ }
+
+ if (full) {
+ [_Text setStringValue: @"Draw!"];
+ gameWasEnded = true;
+ if (twoPlayerMode) {
+ dualDraws++;
+ }
+ else {
+ draws++;
+ }
+ }
+}
+
+- (IBAction)FirstMoveChange:(id)sender {
+
+ switch ([_ButtonChangeFirstMove indexOfSelectedItem]) {
+ case 0:
+ computerPlaysFirst = false;
+ twoPlayerMode = false;
+ break;
+ case 1:
+ computerPlaysFirst = true;
+ twoPlayerMode = false;
+ break;
+ case 2:
+ computerPlaysFirst = false;
+ twoPlayerMode = true;
+ firstPlayerMove = true;
+ break;
+ }
+ changeXO();
+
+ [self NewGame: NULL];
+ [self StatsUpdate: NULL];
+}
+
+- (IBAction)StatsUpdate:(id)sender {
+ NSInteger percentW;
+ NSInteger percentL;
+ NSInteger games;
+ if (twoPlayerMode) {
+ games = wins + loses + draws;
+
+ if (games) {
+ percentW = round( ((double)wins)/(games) * 100 );
+ percentL = round( ((double)loses)/(games) * 100 );
+ }
+ else {
+ percentW = 0;
+ percentL = 0;
+ }
+ [[_Stats cellAtRow: 0 column: 0] setStringValue: @"P1 wins:"];
+ [[_Stats cellAtRow: 1 column: 0] setStringValue: @"P2 wins:"];
+ [[_Stats cellAtRow: 2 column: 0] setStringValue: @"Draws:"];
+ [[_Stats cellAtRow: 3 column: 0] setStringValue: @"P1 Win rate:"];
+ [[_Stats cellAtRow: 4 column: 0] setStringValue: @"P2 Win rate:"];
+
+ [[_Stats cellAtRow: 0 column: 1] setIntegerValue: player1Wins];
+ [[_Stats cellAtRow: 1 column: 1] setIntegerValue: player2Wins];
+ [[_Stats cellAtRow: 2 column: 1] setIntegerValue: dualDraws];
+ [[_Stats cellAtRow: 3 column: 1] setStringValue:
+ [NSString stringWithFormat: @"%ld%c", (long)percentW, '%']];
+ [[_Stats cellAtRow: 4 column: 1] setStringValue:
+ [NSString stringWithFormat: @"%ld%c", (long)percentL, '%']];
+ }
+ else {
+ games = wins + loses + draws;
+
+ if (games) {
+ percentW = round( ((double)wins)/(games) * 100 );
+ percentL = round( ((double)loses)/(games) * 100 );
+ }
+ else {
+ percentW = 0;
+ percentL = 0;
+ }
+ [[_Stats cellAtRow: 0 column: 0] setStringValue: @"Wins:"];
+ [[_Stats cellAtRow: 1 column: 0] setStringValue: @"Loses:"];
+ [[_Stats cellAtRow: 2 column: 0] setStringValue: @"Draws:"];
+ [[_Stats cellAtRow: 3 column: 0] setStringValue: @"Win rate:"];
+ [[_Stats cellAtRow: 4 column: 0] setStringValue: @"Lose rate:"];
+
+
+ [[_Stats cellAtRow: 0 column: 1] setIntegerValue: wins];
+ [[_Stats cellAtRow: 1 column: 1] setIntegerValue: loses];
+ [[_Stats cellAtRow: 2 column: 1] setIntegerValue: draws];
+ [[_Stats cellAtRow: 3 column: 1] setStringValue:
+ [NSString stringWithFormat: @"%ld%c", (long)percentW, '%']];
+ [[_Stats cellAtRow: 4 column: 1] setStringValue:
+ [NSString stringWithFormat: @"%ld%c", (long)percentL, '%']];
+ }
+}
+
+
+bool cellEq(id array, int firstRow, int firstColumn, int secondRow, int secondColumn) {
+
+ if (![[[array cellAtRow: firstRow column: firstColumn] title] isEqual: @""]) {
+ if ([[array cellAtRow: firstRow column: firstColumn] title] ==
+ [[array cellAtRow: secondRow column: secondColumn] title]) {
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+ else {
+ return false;
+ }
+}
+
+void computerMv(id array, id Text) {
+
+ id cellC = NULL;
+ id cellP = NULL;
+
+ for (int i = 0; i < 3; i++) {
+ if ((cellEq(array, i, 0, i, 1)) &&
+ ([[[array cellAtRow: i column: 2] title] isEqual: @""]))
+ {
+ if ([[[array cellAtRow: i column: 0] title] isEqual: computerMove]) {
+ cellC = [array cellAtRow: i column: 2];
+ }
+ else {
+ cellP = [array cellAtRow: i column: 2];
+ }
+ break;
+ }
+ else if ((cellEq(array, i, 0, i, 2)) &&
+ ([[[array cellAtRow: i column: 1] title] isEqual: @""]))
+ {
+ if (([[[array cellAtRow: i column: 0] title] isEqual: computerMove])) {
+ cellC = [array cellAtRow: i column: 1];
+ }
+ else {
+ cellP = [array cellAtRow: i column: 1];
+ }
+ break;
+ }
+ else if ((cellEq(array, i, 2, i, 1)) &&
+ ([[[array cellAtRow: i column: 0] title] isEqual: @""]))
+ {
+ if ([[[array cellAtRow: i column: 1] title] isEqual: computerMove]) {
+ cellC = [array cellAtRow: i column: 0];
+ }
+ else {
+ cellP = [array cellAtRow: i column: 0];
+ }
+ break;
+ }
+ }
+ for (int i = 0; i < 3; i++) {
+ if ((cellEq(array, 0, i, 1, i)) &&
+ ([[[array cellAtRow: 2 column: i] title] isEqual: @""]))
+ {
+ if ([[[array cellAtRow: 0 column: i] title] isEqual: computerMove]) {
+ cellC = [array cellAtRow: 2 column: i];
+ }
+ else {
+ cellP = [array cellAtRow: 2 column: i];
+ }
+ break;
+ }
+ else if ((cellEq(array, 0, i, 2, i)) &&
+ ([[[array cellAtRow: 1 column: i] title] isEqual: @""]))
+ {
+ if ([[[array cellAtRow: 0 column: i] title] isEqual: computerMove]) {
+ cellC = [array cellAtRow: 1 column: i];
+ }
+ else {
+ cellP = [array cellAtRow: 1 column: i];
+ }
+ break;
+ }
+ else if ((cellEq(array, 2, i, 1, i)) &&
+ ([[[array cellAtRow: 0 column: i] title] isEqual: @""]))
+ {
+ if ([[[array cellAtRow: 2 column: i] title] isEqual: computerMove]) {
+ cellC = [array cellAtRow: 0 column: i];
+ }
+ else {
+ cellP = [array cellAtRow: 0 column: i];
+ }
+ break;
+ }
+ }
+
+ if ((cellEq(array, 0, 0, 1, 1)) &&
+ ([[[array cellAtRow: 2 column: 2] title] isEqual: @""]))
+ {
+ if ([[[array cellAtRow: 0 column: 0] title] isEqual: computerMove]) {
+ cellC = [array cellAtRow: 2 column: 2];
+ }
+ else {
+ cellP = [array cellAtRow: 2 column: 2];
+ }
+ }
+ else if ((cellEq(array, 0, 0, 2, 2)) &&
+ ([[[array cellAtRow: 1 column: 1] title] isEqual: @""]))
+ {
+ if ([[[array cellAtRow: 0 column: 0] title] isEqual: computerMove]) {
+ cellC = [array cellAtRow: 1 column: 1];
+ }
+ else {
+ cellP = [array cellAtRow: 1 column: 1];
+ }
+ }
+ else if ((cellEq(array, 2, 2, 1, 1)) &&
+ ([[[array cellAtRow: 0 column: 0] title] isEqual: @""]))
+ {
+ if ([[[array cellAtRow: 2 column: 2] title] isEqual: computerMove]) {
+ cellC = [array cellAtRow: 0 column: 0];
+ }
+ else {
+ cellP = [array cellAtRow: 0 column: 0];
+ }
+ }
+ else if ((cellEq(array, 0, 2, 1, 1)) &&
+ ([[[array cellAtRow: 2 column: 0] title] isEqual: @""]))
+ {
+ if ([[[array cellAtRow: 0 column: 2] title] isEqual: computerMove]) {
+ cellC = [array cellAtRow: 2 column: 0];
+ }
+ else {
+ cellP = [array cellAtRow: 2 column: 0];
+ }
+ }
+ else if ((cellEq(array, 2, 0, 0, 2)) &&
+ ([[[array cellAtRow: 1 column: 1] title] isEqual: @""]))
+ {
+ if ([[[array cellAtRow: 0 column: 2] title] isEqual: computerMove]) {
+ cellC = [array cellAtRow: 1 column: 1];
+ }
+ else {
+ cellP = [array cellAtRow: 1 column: 1];
+ }
+ }
+ else if ((cellEq(array, 2, 0, 1, 1)) &&
+ ([[[array cellAtRow: 0 column: 2] title] isEqual: @""]))
+ {
+ if ([[[array cellAtRow: 1 column: 1] title] isEqual: computerMove]) {
+ cellC = [array cellAtRow: 0 column: 2];
+ }
+ else {
+ cellP = [array cellAtRow: 0 column: 2];
+ }
+ }
+
+ if (cellC) {
+ [cellC setTitle: computerMove];
+ }
+ else if (cellP) {
+ [cellP setTitle: computerMove];
+ }
+ else {
+ while (true) {
+ int i = random() % 3;
+ int j = random() % 3;
+
+ if ([[[array cellAtRow: i column: j] title] isEqualToString: @""]) {
+ [[array cellAtRow: i column: j] setTitle: computerMove];
+ return;
+ }
+ }
+ }
+}
+
+
+void changeXO()
+{
+ playerMove = (computerPlaysFirst) ? @"O" : @"X";
+ computerMove = (computerPlaysFirst) ? @"X" : @"O";
+}
+
+@end
+
diff --git a/tic-tac-toe/Tic-Tac-Toe-Info.plist b/tic-tac-toe/Tic-Tac-Toe-Info.plist
new file mode 100644
index 0000000..fe457a1
--- /dev/null
+++ b/tic-tac-toe/Tic-Tac-Toe-Info.plist
@@ -0,0 +1,34 @@
+
+
+
+
+ CFBundleDevelopmentRegion
+ en
+ CFBundleExecutable
+ ${EXECUTABLE_NAME}
+ CFBundleIconFile
+
+ CFBundleIdentifier
+ RUSlan.${PRODUCT_NAME:rfc1034identifier}
+ CFBundleInfoDictionaryVersion
+ 6.0
+ CFBundleName
+ ${PRODUCT_NAME}
+ CFBundlePackageType
+ APPL
+ CFBundleShortVersionString
+ 1.0
+ CFBundleSignature
+ ????
+ CFBundleVersion
+ 1
+ LSMinimumSystemVersion
+ ${MACOSX_DEPLOYMENT_TARGET}
+ NSHumanReadableCopyright
+ Copyright © 2014 RUSlan. All rights reserved.
+ NSMainNibFile
+ MainMenu
+ NSPrincipalClass
+ NSApplication
+
+
diff --git a/tic-tac-toe/Tic-Tac-Toe-Prefix.pch b/tic-tac-toe/Tic-Tac-Toe-Prefix.pch
new file mode 100644
index 0000000..35d7640
--- /dev/null
+++ b/tic-tac-toe/Tic-Tac-Toe-Prefix.pch
@@ -0,0 +1,9 @@
+//
+// Prefix header
+//
+// The contents of this file are implicitly included at the beginning of every source file.
+//
+
+#ifdef __OBJC__
+ #import
+#endif
diff --git a/tic-tac-toe/en.lproj/Credits.rtf b/tic-tac-toe/en.lproj/Credits.rtf
new file mode 100644
index 0000000..cb604f6
--- /dev/null
+++ b/tic-tac-toe/en.lproj/Credits.rtf
@@ -0,0 +1,24 @@
+{\rtf1\ansi\ansicpg1252\cocoartf1265\cocoasubrtf190
+{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\paperw11900\paperh16840\vieww9600\viewh8400\viewkind0
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720
+
+\f0\b\fs24 \cf0 UserInterface:
+\b0 \
+ RUSlan\
+\
+
+\b Game logic:
+\b0 \
+ RUSlan\
+\
+
+\b Bugs:
+\b0 \
+ Gaidjin-kun\
+\
+
+\b Testers:
+\b0 \
+ Gaidjin-kun}
\ No newline at end of file
diff --git a/tic-tac-toe/en.lproj/InfoPlist.strings b/tic-tac-toe/en.lproj/InfoPlist.strings
new file mode 100644
index 0000000..477b28f
--- /dev/null
+++ b/tic-tac-toe/en.lproj/InfoPlist.strings
@@ -0,0 +1,2 @@
+/* Localized versions of Info.plist keys */
+
diff --git a/tic-tac-toe/main.m b/tic-tac-toe/main.m
new file mode 100644
index 0000000..4795270
--- /dev/null
+++ b/tic-tac-toe/main.m
@@ -0,0 +1,14 @@
+//
+// main.m
+// Tic-Tac-Toe
+//
+// Created by RUSlan on 23.03.14.
+// Copyright (c) 2014 RUSlan. All rights reserved.
+//
+
+#import
+
+int main(int argc, const char * argv[])
+{
+ return NSApplicationMain(argc, argv);
+}