Skip to content

Commit

Permalink
commit-time-stamping
Browse files Browse the repository at this point in the history
  • Loading branch information
p4ulor committed Dec 23, 2021
1 parent 6bec066 commit 31efb88
Show file tree
Hide file tree
Showing 12 changed files with 13 additions and 9 deletions.
1 change: 1 addition & 0 deletions AppDocumentation/ChessGamingNotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

### Extra rules
- On a check, you can only move pieces that kill the piece that made the check, block it's path, or move the king out of the reach of that piece
- [En Passant, pawn move](https://www.youtube.com/watch?v=c_KRIH0wnhE)

#### When a pawn reaches the opponent's side limit, it can turn into: a queen, horse, tower or bishop. Format examples:
- d1=q //turns into queen
Expand Down
Binary file modified Chess4Android/.gradle/7.2/executionHistory/executionHistory.bin
Binary file not shown.
Binary file modified Chess4Android/.gradle/7.2/executionHistory/executionHistory.lock
Binary file not shown.
Binary file modified Chess4Android/.gradle/7.2/fileHashes/fileHashes.bin
Binary file not shown.
Binary file modified Chess4Android/.gradle/7.2/fileHashes/fileHashes.lock
Binary file not shown.
Binary file modified Chess4Android/.gradle/7.2/fileHashes/resourceHashesCache.bin
Binary file not shown.
Binary file modified Chess4Android/.gradle/buildOutputCleanup/buildOutputCleanup.lock
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class Chess4AndroidApp : Application() { // synonyms to apply to this class to u
)
}

val workRequest = PeriodicWorkRequestBuilder<AutoGetPuzzleWorker>(1, TimeUnit.DAYS)
val workRequest = PeriodicWorkRequestBuilder<AutoGetPuzzleWorker>(12, TimeUnit.HOURS)
.setConstraints(Constraints.Builder()
.setRequiresBatteryNotLow(true)
.setRequiresStorageNotLow(true).build()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class PuzzleSolvingActivity : AppCompatActivity() {
}

solutionSwitch.setOnClickListener {
thisViewModel.board = Board() //board.reset() and board.literalReset() weren't working, the pieces still containing the old Position values
thisViewModel.board = Board() //board.reset() and board.literalReset() weren't working, the pieces still containing the old Position values, garbage collector's fault?
loadGame()
if(!thisViewModel.isDone) {
performSolution()
Expand Down Expand Up @@ -131,13 +131,13 @@ class PuzzleSolvingActivity : AppCompatActivity() {

private fun moveIt(pieceThatWillBeEatenIndex: Int, pieceToMove: Piece) {
val movement = pieceToMove.position.letterAndNumber()+thisViewModel.board.getPieceAtIndex(pieceThatWillBeEatenIndex).position.letterAndNumber()
thisViewModel.board.movePieceToAndLeaveEmptyBehind(pieceThatWillBeEatenIndex, pieceToMove)
myView.invalidate(pieceThatWillBeEatenIndex, thisViewModel.board.getPieceAtIndex(pieceThatWillBeEatenIndex)) //new pos
myView.invalidate(currentlySelectedPieceIndex, thisViewModel.board.getPieceAtIndex(currentlySelectedPieceIndex) ) //old pos
log("moved")
thisViewModel.isWhitesPlaying.value = !(thisViewModel.isWhitesPlaying.value)!!

if(movement == thisViewModel.solution?.get(thisViewModel.correctMovementsPerformed)) {
thisViewModel.board.movePieceToAndLeaveEmptyBehind(pieceThatWillBeEatenIndex, pieceToMove)
myView.invalidate(pieceThatWillBeEatenIndex, thisViewModel.board.getPieceAtIndex(pieceThatWillBeEatenIndex)) //new pos
myView.invalidate(currentlySelectedPieceIndex, thisViewModel.board.getPieceAtIndex(currentlySelectedPieceIndex) ) //old pos
log("moved")
thisViewModel.isWhitesPlaying.value = !(thisViewModel.isWhitesPlaying.value)!!
thisViewModel.correctMovementsPerformed++
toast(R.string.correctMove, this)
play(R.raw.rareee, this)
Expand All @@ -156,15 +156,18 @@ class PuzzleSolvingActivity : AppCompatActivity() {

myView.invalidate(initialIndex, thisViewModel.board.getPieceAtIndex(initialIndex)) //new pos
myView.invalidate(destinationIndex, thisViewModel.board.getPieceAtIndex(destinationIndex)) //old pos
if(thisViewModel.correctMovementsPerformed==thisViewModel.solution?.size) finishedPuzzle()
}
}
} else play(R.raw.my_wrong_button_sound, this)
}

private fun finishedPuzzle(){
thisViewModel.gameDTO?.isDone = true
thisViewModel.isDone = true
thisViewModel.setGameAsDoneInDB()
if(!thisViewModel.isDone) {
thisViewModel.isDone = true
thisViewModel.setGameAsDoneInDB()
}
snackBar(R.string.won)
play(R.raw.kill_bill_siren, this)
play(R.raw.gawdamn, this)
Expand Down
Binary file added _imgs/backgroundTaskInspector.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 31efb88

Please sign in to comment.