~ubuntu-branches/ubuntu/intrepid/sgt-puzzles/intrepid

« back to all changes in this revision

Viewing changes to bridges.c

  • Committer: Bazaar Package Importer
  • Author(s): Ben Hutchings
  • Date: 2007-04-24 21:31:11 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20070424213111-6gtsyob16ode8y53
Tags: 7446-1
* New upstream release - closes: #417543
* Corrected minimum number of islands for Bridges - closes: #417541

Show diffs side-by-side

added added

removed removed

Lines of Context:
1064
1064
    struct island *is, *is_join;
1065
1065
 
1066
1066
    /* Initialise dsf. */
1067
 
    for (i = 0; i < wh; i++)
1068
 
        dsf[i] = i;
 
1067
    dsf_init(dsf, wh);
1069
1068
 
1070
1069
    /* For each island, find connected islands right or down
1071
1070
     * and merge the dsf for the island squares as well as the
1602
1601
    ret->solved = ret->completed = 0;
1603
1602
 
1604
1603
    ret->solver = snew(struct solver_state);
1605
 
    ret->solver->dsf = snewn(wh, int);
 
1604
    ret->solver->dsf = snew_dsf(wh);
1606
1605
    ret->solver->tmpdsf = snewn(wh, int);
1607
 
    for (i = 0; i < wh; i++) ret->solver->dsf[i] = i;
1608
1606
 
1609
1607
    ret->solver->refcount = 1;
1610
1608
 
1680
1678
    game_state *tobuild  = NULL;
1681
1679
    int i, j, wh = params->w * params->h, x, y, dx, dy;
1682
1680
    int minx, miny, maxx, maxy, joinx, joiny, newx, newy, diffx, diffy;
1683
 
    int ni_req = max((params->islands * wh) / 100, 2), ni_curr, ni_bad;
 
1681
    int ni_req, ni_curr, ni_bad;
1684
1682
    struct island *is, *is2;
1685
1683
    char *ret;
1686
1684
    unsigned int echeck;
1687
1685
 
 
1686
    ni_req = max((params->islands * wh) / 100,
 
1687
                 (params->difficulty == 0) ? 3 : 4);
 
1688
 
1688
1689
    /* pick a first island position randomly. */
1689
1690
generate:
1690
1691
    if (tobuild) free_game(tobuild);
2631
2632
#endif
2632
2633
 
2633
2634
const struct game thegame = {
2634
 
    "Bridges", "bridges",
 
2635
    "Bridges", "games.bridges", "bridges",
2635
2636
    default_params,
2636
2637
    game_fetch_preset,
2637
2638
    decode_params,
2664
2665
    TRUE, FALSE, game_print_size, game_print,
2665
2666
    FALSE,                             /* wants_statusbar */
2666
2667
    FALSE, game_timing_state,
2667
 
    0,                                 /* flags */
 
2668
    REQUIRE_RBUTTON,                   /* flags */
2668
2669
};
2669
2670
 
2670
2671
/* vim: set shiftwidth=4 tabstop=8: */