From 020aea64386e0a9252f52b4867ced8ec81a8549b Mon Sep 17 00:00:00 2001
From: Danqing Liu
Date: Sat, 3 Sep 2016 02:03:35 -0700
Subject: [PATCH 1/4] Update README.md
---
README.md | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/README.md b/README.md
index f78a529d..195a2e34 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@
This is a derivative and the iOS version of the game 2048. In the very unlikely case that you don't know what it is, you can check it out [here](https://github.com/gabrielecirulli/2048).
-Made just for fun! You can find it on the [App Store](https://itunes.apple.com/us/app/2048-and-more!/id848859070?ls=1&mt=8).
+Made just for fun!
@@ -53,9 +53,7 @@ The code started to resemble the structure of the original 2048. So for example,
### Contributing
-If you'd like to contribute, great! That's more than welcome. If you do make improvements to it, remember to put yourself in the "About 2048" page to get yourself credit.
-
-If you'd like to fork and make your own version, that's also great! Feel free to tinker with it however you'd like. It may not be a terribly good idea to change the font, add some ads, and submit to Apple, though.
+Any contributions are more than welcome! If you do make improvements to it, remember to put yourself in the "About 2048" page to get yourself credit.
#### Contributors
@@ -64,10 +62,6 @@ If you'd like to fork and make your own version, that's also great! Feel free to
* [Sihao Lu](https://github.com/DJBen)
-## Licence and Other
-
-2048 for iOS is licenced under the MIT license.
-
-If you find the source code somewhat useful, all I ask is to download it from the [App Store](https://itunes.apple.com/us/app/2048-and-more!/id848859070?ls=1&mt=8), so I know that *someone* has seen it. Relax: It is free; it does not have any ads or weird stuff; it does not send you push notifications to ask you to go back and play it.
+## Licence
-You may also consider to [donate](https://github.com/gabrielecirulli/2048) to the maker of the original 2048 if you'd like, of course. (:
+MIT.
From 7091b3ff04c5ca03f864d52c7b133ec11fb82985 Mon Sep 17 00:00:00 2001
From: Danqing Liu
Date: Fri, 7 Oct 2016 09:57:36 -0700
Subject: [PATCH 2/4] Migrate some Xcode build flags
---
m2048.xcodeproj/project.pbxproj | 25 ++++++++++++++++---
.../xcschemes/m2048.xcscheme | 19 ++++++++------
m2048/m2048-Info.plist | 2 +-
m2048Tests/m2048Tests-Info.plist | 2 +-
4 files changed, 35 insertions(+), 13 deletions(-)
diff --git a/m2048.xcodeproj/project.pbxproj b/m2048.xcodeproj/project.pbxproj
index 1e7d8230..866a6313 100644
--- a/m2048.xcodeproj/project.pbxproj
+++ b/m2048.xcodeproj/project.pbxproj
@@ -311,11 +311,11 @@
isa = PBXProject;
attributes = {
CLASSPREFIX = M2;
- LastUpgradeCheck = 0510;
+ LastUpgradeCheck = 0800;
ORGANIZATIONNAME = Danqing;
TargetAttributes = {
2443DC5118D662CA00C920C1 = {
- DevelopmentTeam = EWJAR4GTP4;
+ DevelopmentTeam = W2DNVV9M96;
};
2443DC7918D662CA00C920C1 = {
TestTargetID = 2443DC5118D662CA00C920C1;
@@ -444,13 +444,19 @@
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_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_SUSPICIOUS_MOVE = YES;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
+ GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
@@ -463,7 +469,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 7.1;
+ IPHONEOS_DEPLOYMENT_TARGET = 8.0;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
};
@@ -482,20 +488,25 @@
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_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_SUSPICIOUS_MOVE = YES;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = YES;
ENABLE_NS_ASSERTIONS = NO;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 7.1;
+ IPHONEOS_DEPLOYMENT_TARGET = 8.0;
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
};
@@ -507,9 +518,11 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
CODE_SIGN_IDENTITY = "iPhone Developer";
+ DEVELOPMENT_TEAM = W2DNVV9M96;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "m2048/m2048-Prefix.pch";
INFOPLIST_FILE = "m2048/m2048-Info.plist";
+ PRODUCT_BUNDLE_IDENTIFIER = "me.danqing.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
SPRITEKIT_TEXTURE_ATLAS_OUTPUT = YES;
WRAPPER_EXTENSION = app;
@@ -522,9 +535,11 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
CODE_SIGN_IDENTITY = "iPhone Developer";
+ DEVELOPMENT_TEAM = W2DNVV9M96;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "m2048/m2048-Prefix.pch";
INFOPLIST_FILE = "m2048/m2048-Info.plist";
+ PRODUCT_BUNDLE_IDENTIFIER = "me.danqing.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
SPRITEKIT_TEXTURE_ATLAS_OUTPUT = YES;
WRAPPER_EXTENSION = app;
@@ -547,6 +562,7 @@
"$(inherited)",
);
INFOPLIST_FILE = "m2048Tests/m2048Tests-Info.plist";
+ PRODUCT_BUNDLE_IDENTIFIER = "me.danqing.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUNDLE_LOADER)";
WRAPPER_EXTENSION = xctest;
@@ -565,6 +581,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "m2048/m2048-Prefix.pch";
INFOPLIST_FILE = "m2048Tests/m2048Tests-Info.plist";
+ PRODUCT_BUNDLE_IDENTIFIER = "me.danqing.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUNDLE_LOADER)";
WRAPPER_EXTENSION = xctest;
diff --git a/m2048.xcodeproj/xcuserdata/danqing.xcuserdatad/xcschemes/m2048.xcscheme b/m2048.xcodeproj/xcuserdata/danqing.xcuserdatad/xcschemes/m2048.xcscheme
index 0a57ca21..7c131711 100644
--- a/m2048.xcodeproj/xcuserdata/danqing.xcuserdatad/xcschemes/m2048.xcscheme
+++ b/m2048.xcodeproj/xcuserdata/danqing.xcuserdatad/xcschemes/m2048.xcscheme
@@ -1,6 +1,6 @@
+ shouldUseLaunchSchemeArgsEnv = "YES">
@@ -48,17 +48,21 @@
ReferencedContainer = "container:m2048.xcodeproj">
+
+
-
+
-
+
CFBundleExecutable
${EXECUTABLE_NAME}
CFBundleIdentifier
- me.danqing.${PRODUCT_NAME:rfc1034identifier}
+ $(PRODUCT_BUNDLE_IDENTIFIER)
CFBundleInfoDictionaryVersion
6.0
CFBundleName
diff --git a/m2048Tests/m2048Tests-Info.plist b/m2048Tests/m2048Tests-Info.plist
index aead2c49..169b6f71 100644
--- a/m2048Tests/m2048Tests-Info.plist
+++ b/m2048Tests/m2048Tests-Info.plist
@@ -7,7 +7,7 @@
CFBundleExecutable
${EXECUTABLE_NAME}
CFBundleIdentifier
- me.danqing.${PRODUCT_NAME:rfc1034identifier}
+ $(PRODUCT_BUNDLE_IDENTIFIER)
CFBundleInfoDictionaryVersion
6.0
CFBundlePackageType
From 30a0f158b524a163490f5c844e6e3218174cf42c Mon Sep 17 00:00:00 2001
From: Danqing Liu
Date: Mon, 9 Oct 2017 15:06:48 -0700
Subject: [PATCH 3/4] Update README.md
---
README.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index 195a2e34..76d68b40 100644
--- a/README.md
+++ b/README.md
@@ -22,9 +22,9 @@ Ideally, the AI should search from 0 depth to infinity and have a time out, it r
## The Game
-Since it is a *derivative* of the original 2048, it is not the *same*. More explicitly, it has the following additions:
+Since it is a *derivative* of the original 2048, it is not the *same*. Specifically, it has the following additions:
-* **Three board sizes**: 3x3, 4x4 and 5x5. The smaller the board is, the fewer cells you have, and the harder the game is.*
+* **Three board sizes**: 3x3, 4x4 and 5x5. The smaller the board is, the fewer cells you have, and the harder the game is.
* **Three game modes**: The original Power of 2, i.e. combining two tiles of the same value to produce their sum. The Power of 3, i.e. combining *three* consecutive tiles of the same value to produce their sum. Not surprisingly, this is pretty hard with the 3x3 board, although I found it pretty easy to get 81. 243 is a different story... And the Fibonacci sequence, i.e. combining two adjacent numbers in the sequence 2, 3, 5, 8, 13... (I omitted the two 1's in the beginning) to produce the one next to the larger value. This is pretty tricky. Try it out and you will know what I mean.
* **Three themes**: I made a bright theme and a 'joyful' theme in addition to the original one. In case you wonder how to do themes in iOS. (There may be a better way, but themes are verbose in nature, because you *have to* specify all the colors, fonts, etc.)
From aa63df495849f752facdb1047a8bf3dc4a5ca5d5 Mon Sep 17 00:00:00 2001
From: Xue Qin
Date: Thu, 8 Mar 2018 12:44:43 -0600
Subject: [PATCH 4/4] Add UI test cases
---
m2048UITests/Info.plist | 22 ++++++
m2048UITests/m2048UITests.swift | 129 ++++++++++++++++++++++++++++++++
2 files changed, 151 insertions(+)
create mode 100644 m2048UITests/Info.plist
create mode 100644 m2048UITests/m2048UITests.swift
diff --git a/m2048UITests/Info.plist b/m2048UITests/Info.plist
new file mode 100644
index 00000000..6c6c23c4
--- /dev/null
+++ b/m2048UITests/Info.plist
@@ -0,0 +1,22 @@
+
+
+
+
+ CFBundleDevelopmentRegion
+ en
+ CFBundleExecutable
+ $(EXECUTABLE_NAME)
+ CFBundleIdentifier
+ $(PRODUCT_BUNDLE_IDENTIFIER)
+ CFBundleInfoDictionaryVersion
+ 6.0
+ CFBundleName
+ $(PRODUCT_NAME)
+ CFBundlePackageType
+ BNDL
+ CFBundleShortVersionString
+ 1.0
+ CFBundleVersion
+ 1
+
+
diff --git a/m2048UITests/m2048UITests.swift b/m2048UITests/m2048UITests.swift
new file mode 100644
index 00000000..f2f0e270
--- /dev/null
+++ b/m2048UITests/m2048UITests.swift
@@ -0,0 +1,129 @@
+//
+// m2048UITests.swift
+// m2048UITests
+//
+// Created by Xue Qin on 1/31/18.
+// Copyright © 2018 Danqing. All rights reserved.
+//
+
+import XCTest
+
+class m2048UITests: XCTestCase {
+
+ let app = XCUIApplication()
+
+ override func setUp() {
+ super.setUp()
+
+ // Put setup code here. This method is called before the invocation of each test method in the class.
+
+ // In UI tests it is usually best to stop immediately when a failure occurs.
+ continueAfterFailure = false
+ // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method.
+ XCUIApplication().launch()
+
+ // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
+ }
+
+ override func tearDown() {
+ // Put teardown code here. This method is called after the invocation of each test method in the class.
+ super.tearDown()
+ }
+
+ func testSettings() {
+
+
+ app.buttons["Settings"].tap()
+ let tablesQuery = app.tables
+ // Game Type
+ tablesQuery.staticTexts["Game Type"].tap()
+ tablesQuery.staticTexts["Powers of 3"].tap()
+ tablesQuery.staticTexts["Fibonacci"].tap()
+ tablesQuery.staticTexts["Powers of 2"].tap()
+ app.navigationBars["Game Type"].buttons["Settings"].tap()
+ // Board Size
+ tablesQuery.staticTexts["Board Size"].tap()
+ tablesQuery.staticTexts["3 x 3"].tap()
+ tablesQuery.staticTexts["5 x 5"].tap()
+ tablesQuery.staticTexts["4 x 4"].tap()
+ app.navigationBars["Board Size"].buttons["Back"].tap()
+
+ // About
+ tablesQuery.staticTexts["About 2048"].tap()
+ app.navigationBars["About 2048"].buttons["Settings"].tap()
+
+ app.navigationBars["Settings"].buttons["Done"].tap()
+ }
+
+ func testThemes() {
+
+ let tablesQuery = app.tables
+
+ // vibrant
+ app.buttons["Settings"].tap()
+ tablesQuery.staticTexts["Theme"].tap()
+ tablesQuery.staticTexts["Vibrant"].tap()
+ app.navigationBars["Theme"].buttons["Settings"].tap()
+ app.navigationBars["Settings"].buttons["Done"].tap()
+
+ // joyful
+ app.buttons["Settings"].tap()
+ tablesQuery.staticTexts["Theme"].tap()
+ tablesQuery.staticTexts["Joyful"].tap()
+ app.navigationBars["Theme"].buttons["Settings"].tap()
+ app.navigationBars["Settings"].buttons["Done"].tap()
+
+ // default
+ app.buttons["Settings"].tap()
+ tablesQuery.staticTexts["Theme"].tap()
+ tablesQuery.staticTexts["Default"].tap()
+ app.navigationBars["Theme"].buttons["Settings"].tap()
+ app.navigationBars["Settings"].buttons["Done"].tap()
+ }
+
+ func testPlayPowerOfTwo() {
+ app.buttons["Settings"].tap()
+ let tablesQuery = app.tables
+ tablesQuery.staticTexts["Game Type"].tap()
+ tablesQuery.staticTexts["Powers of 2"].tap()
+ app.navigationBars["Game Type"].buttons["Settings"].tap()
+ app.navigationBars["Settings"].buttons["Done"].tap()
+
+ app.swipeUp()
+ app.swipeLeft()
+ app.swipeDown()
+ app.swipeRight()
+ app.buttons["Restart"].tap()
+ }
+
+ func testPlayPowerOfThree() {
+ app.buttons["Settings"].tap()
+ let tablesQuery = app.tables
+ tablesQuery.staticTexts["Game Type"].tap()
+ tablesQuery.staticTexts["Powers of 3"].tap()
+ app.navigationBars["Game Type"].buttons["Settings"].tap()
+ app.navigationBars["Settings"].buttons["Done"].tap()
+
+ app.swipeUp()
+ app.swipeLeft()
+ app.swipeDown()
+ app.swipeRight()
+ app.buttons["Restart"].tap()
+ }
+
+ func testPlayFibonacci() {
+ app.buttons["Settings"].tap()
+ let tablesQuery = app.tables
+ tablesQuery.staticTexts["Game Type"].tap()
+ tablesQuery.staticTexts["Fibonacci"].tap()
+ app.navigationBars["Game Type"].buttons["Settings"].tap()
+ app.navigationBars["Settings"].buttons["Done"].tap()
+
+ app.swipeUp()
+ app.swipeLeft()
+ app.swipeDown()
+ app.swipeRight()
+ app.buttons["Restart"].tap()
+ }
+
+}