Exemplo n.º 1
0
  void test_cell() const
  {
    print_cells();

    // Test with different values and known results
    test_cell(0,0);
    test_cell(49,0,true);
    test_cell(51,0);
    test_cell(0,51);
    test_cell(0,49,true);
    test_cell(.5,0,true,true,true);
    test_cell(0,.5,true,true,true);
    test_cell(.5,20,true,true,true);
    test_cell(20,.5,true,true,true);
  }
Exemplo n.º 2
0
int propagate(board_t *board, uint8_t i, uint8_t j, uint8_t v, uint16_t opt)
{
    uint8_t x, y;
    // (ui, uj) is the unit's upper-left coordinate
    uint8_t ui = (i / 3) * 3, uj = (j / 3) * 3;

    // Propagate change in the unit
    for (y = uj; y < (uj + 3); y++) {
        for (x = ui; x < (ui + 3); x++) {
            if(!(x == i && y == j)) {
                if(test_cell(board, x, y, v, opt)) {
                    return 1;
                }
            }
        }
    }

    // Propagate change in the horizontal line
    for (x = 0; x < 9; x++) {
        if(x != i) {
            if(test_cell(board, x, j, v, opt)) {
                return 1;
            }
        }
    }

    // Propagate change in the vertical line
    for (y = 0; y < 9; y++) {
        if(y != j) {
            if(test_cell(board, i, y, v, opt)) {
                return 1;
            }
        }
    }

    return 0;
}
Exemplo n.º 3
0
int main()
{
   test_symbol();
   test_integer();
   test_cell();
   test_list();
   test_environment();
   test_eval();
   test_plus_integer();
   test_begin();
   test_string();
   test_tokenize();
   test_newlispobj();
   test_expandreadmacro();
   test_read_tokens();
   test_macro();
   test_equal();
   test_cond();

   return 0;
}