Skip to content

Commit 2c544ee

Browse files
authored
#86 Crash on during evaluation (#91)
* #86 Crash on during evaluation (120 possible undo Moves instead of 64). If Black "passes" each move.
1 parent 30bc5e0 commit 2c544ee

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

project/src/androidTest/java/de/earthlingz/oerszebra/DroidZebraTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ public void testCrash2() throws InterruptedException {
126126
}
127127

128128
@Test
129-
@Ignore
130129
public void testCrash86() throws InterruptedException {
131130
Intent intent = new Intent();
132131
intent.setAction(Intent.ACTION_SEND);

project/src/main/jni/droidzebra-jni.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ static int s_practice_mode = FALSE;
7171
static const char* s_forced_opening_seq = NULL;
7272
static int s_use_book = TRUE;
7373
static int s_enable_msg = TRUE;
74-
static int s_undo_stack[64];
74+
static int s_undo_stack[120]; //60 black and 60 White Moves. A move can be "PASS"
7575
static int s_undo_stack_pointer = 0;
7676
// --
7777

@@ -1017,15 +1017,15 @@ void _droidzebra_undo_turn(int* side_to_move)
10171017
// undo moves until player is a human and he can make a move
10181018
void _droidzebra_undo_all(int* side_to_move)
10191019
{
1020-
int curr_move;
1020+
int curr_move;
10211021

1022+
//already at the beginning
10221023
if(score_sheet_row==0 && *side_to_move==BLACKSQ) return;
10231024

1024-
1025-
10261025
do {
10271026
_droidzebra_undo_stack_push(disks_played);
1028-
*side_to_move = OPP(*side_to_move);
1027+
1028+
*side_to_move = OPP(*side_to_move);
10291029

10301030
if ( *side_to_move == WHITESQ )
10311031
score_sheet_row--;
@@ -1042,7 +1042,7 @@ void _droidzebra_undo_all(int* side_to_move)
10421042
black_moves[score_sheet_row] = PASS;
10431043
}
10441044

1045-
droidzebra_message_debug("undo: side_to_move %d, undo_move %d, score_sheet_row %d, disks_played %d, move_count %d", *side_to_move, curr_move, score_sheet_row, disks_played, move_count[disks_played]);
1045+
droidzebra_message_debug("undoall: side_to_move %d, undo_move %d, score_sheet_row %d, disks_played %d, move_count %d", *side_to_move, curr_move, score_sheet_row, disks_played, move_count[disks_played]);
10461046
} while( !(score_sheet_row==0 && *side_to_move==BLACKSQ));
10471047
clear_endgame_performed();
10481048
}
@@ -1124,7 +1124,7 @@ void _droidzebra_throw_engine_error(JNIEnv* env, const char* msg)
11241124

11251125
void _droidzebra_undo_stack_push(int val)
11261126
{
1127-
assert(s_undo_stack_pointer<64);
1127+
assert(s_undo_stack_pointer< 120);
11281128
s_undo_stack[s_undo_stack_pointer++] = val;
11291129
}
11301130

0 commit comments

Comments
 (0)