Skip to content

Commit cb869a4

Browse files
committed
Fixed sending empty boards over bt and bumped version to 2.1.0
1 parent 4a730b5 commit cb869a4

File tree

2 files changed

+22
-22
lines changed

2 files changed

+22
-22
lines changed

app/build.gradle

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ android {
1010
applicationId "com.henrykvdb.sttt"
1111
minSdkVersion 19
1212
targetSdkVersion 26
13-
versionCode 16
14-
versionName "2.0.0"
13+
versionCode 17
14+
versionName "2.1.0"
1515
jackOptions {
1616
enabled true
1717
}
@@ -31,9 +31,9 @@ dependencies {
3131
compile 'com.android.support:appcompat-v7:26.1.0'
3232
compile 'com.android.support:design:26.1.0'
3333

34-
compile 'com.google.firebase:firebase-core:11.6.0'
35-
compile 'com.google.firebase:firebase-ads:11.6.0'
36-
compile 'com.google.firebase:firebase-crash:11.6.0'
34+
compile 'com.google.firebase:firebase-core:11.8.0'
35+
compile 'com.google.firebase:firebase-ads:11.8.0'
36+
compile 'com.google.firebase:firebase-crash:11.8.0'
3737

3838
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
3939
}

app/src/main/java/com/flaghacker/sttt/common/JSONBoard.kt

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,27 @@ import org.json.JSONArray
44
import org.json.JSONObject
55

66
fun Board.toJSON(): JSONObject {
7-
val json = JSONObject()
8-
val jsonBoard = JSONArray()
9-
for (i in 0 until 81) jsonBoard.put(tile(i.toByte()).toNiceString())
7+
val json = JSONObject()
8+
val jsonBoard = JSONArray()
9+
for (i in 0 until 81) jsonBoard.put(tile(i.toByte()).toNiceString())
1010

11-
json.put("board", jsonBoard)
12-
json.put("macroMask", macroMask())
13-
json.put("lastMove",lastMove()?.toInt())
11+
json.put("board", jsonBoard)
12+
json.put("macroMask", macroMask())
13+
json.put("lastMove", lastMove()?.toInt())
1414

15-
return json
15+
return json
1616
}
1717

1818
class JSONBoard {
19-
companion object {
20-
fun fromJSON(json: JSONObject): com.flaghacker.sttt.common.Board {
21-
val board = Array(9, { Array(9, { Player.NEUTRAL }) })
22-
for (i in 0 until 81)
23-
board[i.toPair().first][i.toPair().second] = fromNiceString(json.getJSONArray("board").getString(i))
24-
val macroMask = json.getInt("macroMask")
25-
val lastMove = json.getInt("lastMove")
19+
companion object {
20+
fun fromJSON(json: JSONObject): com.flaghacker.sttt.common.Board {
21+
val board = Array(9, { Array(9, { Player.NEUTRAL }) })
22+
for (i in 0 until 81)
23+
board[i.toPair().first][i.toPair().second] = fromNiceString(json.getJSONArray("board").getString(i))
24+
val macroMask = json.getInt("macroMask")
25+
val lastMove = if (json.length() == 3) json.getInt("lastMove") else null
2626

27-
return Board(board, macroMask, lastMove.toByte())
28-
}
29-
}
27+
return Board(board, macroMask, lastMove?.toByte())
28+
}
29+
}
3030
}

0 commit comments

Comments
 (0)