void ndfs_explore_state_blue (wctx_t *ctx) { work_counter_t *cnt = ctx->counters; dfs_stack_enter (ctx->local->stack); increase_level (cnt); cnt->trans += permute_trans (ctx->permute, ctx->state, ndfs_blue_handle, ctx); cnt->explored++; run_maybe_report (ctx->run, cnt, "[Blue] "); }
void ndfs_explore_state_red (wctx_t *ctx) { alg_local_t *loc = ctx->local; work_counter_t *cnt = &loc->red_work; dfs_stack_enter (loc->stack); increase_level (cnt); cnt->trans += permute_trans (ctx->permute, ctx->state, ndfs_red_handle, ctx); run_maybe_report (ctx->run, cnt, "[Red ] "); }
void reach_explore_all (wctx_t *ctx, state_info_t *state) { alg_local_t *loc = ctx->local; permute_set_por (ctx->permute, 0); dfs_stack_enter (loc->stack); increase_level (ctx->counters); permute_trans (ctx->permute, state, endfs_handle_all, ctx); permute_set_por (ctx->permute, 1); }
void increase_expr(int expr) { if (expr < 0) { expr = expr * -1; } experience += expr; if (experience < 0) { experience = 0; } if (ready_for_next_level()) { increase_level(); write("Congratulations, you just went up a level...\n"); level += 1; } }
void ta_bfs (wctx_t *ctx) { alg_global_t *sm = ctx->global; while (lb_balance(ctx->run->shared->lb, ctx->id, bfs_load(sm), split_bfs)) { raw_data_t state_data = dfs_stack_pop (sm->in_stack); if (NULL != state_data) { if (grab_waiting(ctx, state_data)) { ta_explore_state (ctx); } } else { swap (sm->in_stack, sm->out_stack); increase_level (ctx->counters); } } }
static inline void endfs_explore_state_blue (wctx_t *ctx) { alg_local_t *loc = ctx->local; work_counter_t *cnt = ctx->counters; cndfs_alg_local_t *cloc = (cndfs_alg_local_t *) ctx->local; cloc->successors = NONEC; dfs_stack_enter (loc->stack); increase_level (ctx->counters); cnt->trans += permute_trans (ctx->permute, ctx->state, endfs_handle_blue, ctx); check_counter_example (ctx, loc->stack, true); cnt->explored++; run_maybe_report1 (ctx->run, cnt, "[Blue] "); set_proviso_stack (ctx, loc, cloc); }
/** * make a stackframe on search_stack and handle the successors of ctx->state */ static inline void explore_state (wctx_t *ctx) { alg_local_t *loc = ctx->local; dfs_stack_enter (loc->search_stack); increase_level (ctx->counters); #ifdef SEARCH_COMPLETE_GRAPH // bypass the pins interface by directly handling the successors int ref_arr[2]; ref_arr[0] = (int) ctx->state->ref; dlopen_next_state (NULL, 0, ref_arr, permute_complete, ctx); #else permute_trans (ctx->permute, ctx->state, tarjan_handle, ctx); #endif ctx->counters->explored++; run_maybe_report1 (ctx->run, (work_counter_t *) ctx->counters, ""); }
void ta_dfs (wctx_t *ctx) { alg_shared_t *shared = ctx->run->shared; alg_global_t *sm = ctx->global; while (lb_balance(shared->lb, ctx->id, dfs_stack_size(sm->stack), split_dfs)) { raw_data_t state_data = dfs_stack_top (sm->stack); if (NULL != state_data) { if (grab_waiting(ctx, state_data)) { dfs_stack_enter (sm->stack); increase_level (ctx->counters); ta_explore_state (ctx); } else { dfs_stack_pop (sm->stack); } } else { if (0 == dfs_stack_size (sm->stack)) continue; dfs_stack_leave (sm->stack); ctx->counters->level_cur--; dfs_stack_pop (sm->stack); } } }
void activate_dungeon_special(struct Thing *cratetng, struct PlayerInfo *player) { SYNCDBG(6,"Starting"); short used; struct Coord3d pos; int spkindidx; // Gathering data which we'll need if the special is used and disposed. memcpy(&pos,&cratetng->mappos,sizeof(struct Coord3d)); spkindidx = cratetng->model - 86; used = 0; if (thing_exists(cratetng) && is_dungeon_special(cratetng)) { switch (cratetng->model) { case 86: reveal_whole_map(player); remove_events_thing_is_attached_to(cratetng); used = 1; delete_thing_structure(cratetng, 0); break; case 87: start_resurrect_creature(player, cratetng); break; case 88: start_transfer_creature(player, cratetng); break; case 89: if (steal_hero(player, &cratetng->mappos)) { remove_events_thing_is_attached_to(cratetng); used = 1; delete_thing_structure(cratetng, 0); } break; case 90: multiply_creatures(player); remove_events_thing_is_attached_to(cratetng); used = 1; delete_thing_structure(cratetng, 0); break; case 91: increase_level(player); remove_events_thing_is_attached_to(cratetng); used = 1; delete_thing_structure(cratetng, 0); break; case 92: make_safe(player); remove_events_thing_is_attached_to(cratetng); used = 1; delete_thing_structure(cratetng, 0); break; case 93: activate_bonus_level(player); remove_events_thing_is_attached_to(cratetng); used = 1; delete_thing_structure(cratetng, 0); break; default: ERRORLOG("Invalid dungeon special (Model %d)", (int)cratetng->model); break; } if ( used ) { if (is_my_player(player)) output_message(special_desc[spkindidx].speech_msg, 0, true); create_special_used_effect(&pos, player->id_number); } } }