int check_win(t_gboard *p4, int player) { if (check_lines(p4, player) == 1 || check_columns(p4, player) == 1 || check_left(p4, player, 4) == 1 || check_right(p4, player, 4) == 1) { if (player != p4->ia_id) { ft_putendl("Congratulation human... you win."); ft_putendl(" .... This time !!!"); } return (1); } return (0); }
//============================================================================ DRSM::DynamicRegressionStateModel(const std::vector<Matrix> &predictors) : xdim_(check_columns(predictors)), initial_state_mean_(xdim_, 0.0), initial_state_variance_(xdim_, 1.0), transition_matrix_(new IdentityMatrix(xdim_)) { setup_models_and_transition_variance_matrix(); for (int i = 0; i < predictors.size(); ++i) { const Matrix &X(predictors[i]); sparse_predictor_matrices_.push_back(new DenseMatrix(X)); for (int j = 0; j < X.nrow(); ++j) { sparse_predictor_vectors_.push_back(SparseVector(X.row(j))); } } compute_predictor_variance(); }
UINT CREATE_CreateView( MSIDATABASE *db, MSIVIEW **view, LPCWSTR table, column_info *col_info, BOOL hold ) { MSICREATEVIEW *cv = NULL; UINT r; column_info *col; BOOL temp = TRUE; BOOL tempprim = FALSE; TRACE("%p\n", cv ); r = check_columns( col_info ); if( r != ERROR_SUCCESS ) return r; cv = msi_alloc_zero( sizeof *cv ); if( !cv ) return ERROR_FUNCTION_FAILED; for( col = col_info; col; col = col->next ) { if (!col->table) col->table = table; if( !col->temporary ) temp = FALSE; else if ( col->type & MSITYPE_KEY ) tempprim = TRUE; } if ( !temp && tempprim ) { msi_free( cv ); return ERROR_FUNCTION_FAILED; } /* fill the structure */ cv->view.ops = &create_ops; msiobj_addref( &db->hdr ); cv->db = db; cv->name = table; cv->col_info = col_info; cv->bIsTemp = temp; cv->hold = hold; *view = (MSIVIEW*) cv; return ERROR_SUCCESS; }
unsigned create_view_create( LibmsiDatabase *db, LibmsiView **view, const char *table, column_info *col_info, bool hold ) { LibmsiCreateView *cv = NULL; unsigned r; column_info *col; bool temp = true; bool tempprim = false; TRACE("%p\n", cv ); r = check_columns( col_info ); if( r != LIBMSI_RESULT_SUCCESS ) return r; cv = msi_alloc_zero( sizeof *cv ); if( !cv ) return LIBMSI_RESULT_FUNCTION_FAILED; for( col = col_info; col; col = col->next ) { if (!col->table) col->table = table; if( !col->temporary ) temp = false; else if ( col->type & MSITYPE_KEY ) tempprim = true; } if ( !temp && tempprim ) { msi_free( cv ); return LIBMSI_RESULT_FUNCTION_FAILED; } /* fill the structure */ cv->view.ops = &create_ops; cv->db = g_object_ref(db); cv->name = table; cv->col_info = col_info; cv->bIsTemp = temp; cv->hold = hold; *view = (LibmsiView*) cv; return LIBMSI_RESULT_SUCCESS; }
double Board_2::check_board (const bool is_turn, const char player_piece) const { bool is_limit = false; double utilitly = 0; double temp = 0; temp = check_columns(is_turn,player_piece,used_columns,columns,rows,r,board,is_limit); if (is_limit) return temp; // if a killer move was found return that killer move else utilitly += temp; temp = check_rows(is_turn, player_piece, used_rows, columns, rows, r, board, is_limit); if (is_limit) return temp; else utilitly += temp; temp = check_diagonals(is_turn,player_piece, columns, rows, r, board, is_limit); if (is_limit) return temp; else utilitly += temp; return utilitly; }
void test_columns(int matrix[HEIGHT][WIDTH], int expected_value) { test( check_columns(matrix) == expected_value ? "Pass" : "Fail" ); }