From a550ea0a47374705a37f36b0f05ffe9e4c8161fb Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Tue, 13 Nov 2018 21:44:02 +0000 Subject: Replace TRUE/FALSE with C99 true/false throughout. This commit removes the old #defines of TRUE and FALSE from puzzles.h, and does a mechanical search-and-replace throughout the code to replace them with the C99 standard lowercase spellings. --- loopgen.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'loopgen.c') diff --git a/loopgen.c b/loopgen.c index 0b69904..dd7dd24 100644 --- a/loopgen.c +++ b/loopgen.c @@ -84,7 +84,7 @@ static int can_colour_face(grid *g, char* board, int face_index, grid_dot *starting_dot; int transitions; int current_state, s; /* booleans: equal or not-equal to 'colour' */ - int found_same_coloured_neighbour = FALSE; + int found_same_coloured_neighbour = false; assert(board[face_index] != colour); /* Can only consider a face for colouring if it's adjacent to a face @@ -93,12 +93,12 @@ static int can_colour_face(grid *g, char* board, int face_index, grid_edge *e = test_face->edges[i]; grid_face *f = (e->face1 == test_face) ? e->face2 : e->face1; if (FACE_COLOUR(f) == colour) { - found_same_coloured_neighbour = TRUE; + found_same_coloured_neighbour = true; break; } } if (!found_same_coloured_neighbour) - return FALSE; + return false; /* Need to avoid creating a loop of faces of this colour around some * differently-coloured faces. @@ -158,11 +158,11 @@ static int can_colour_face(grid *g, char* board, int face_index, current_state = (FACE_COLOUR(current_face) == colour); starting_dot = NULL; starting_face = NULL; - while (TRUE) { + while (true) { /* Advance to next face. * Need to loop here because it might take several goes to * find it. */ - while (TRUE) { + while (true) { j++; if (j == test_face->dots[i]->order) j = 0; @@ -206,7 +206,7 @@ static int can_colour_face(grid *g, char* board, int face_index, } } - return (transitions == 2) ? TRUE : FALSE; + return (transitions == 2) ? true : false; } /* Count the number of neighbours of 'face', having colour 'colour' */ @@ -361,7 +361,7 @@ void generate_loop(grid *g, char *board, random_state *rs, } /* Colour faces one at a time until no more faces are colourable. */ - while (TRUE) + while (true) { enum face_colour colour; tree234 *faces_to_pick; @@ -501,12 +501,12 @@ void generate_loop(grid *g, char *board, random_state *rs, * make some illicit deductions. To combat this (and make the path more * interesting), we do one final pass making random flips. */ - /* Set to TRUE for final pass */ - do_random_pass = FALSE; + /* Set to true for final pass */ + do_random_pass = false; - while (TRUE) { + while (true) { /* Remember whether a flip occurred during this pass */ - int flipped = FALSE; + int flipped = false; for (i = 0; i < num_faces; ++i) { int j = face_list[i]; @@ -522,14 +522,14 @@ void generate_loop(grid *g, char *board, random_state *rs, /* normal pass - flip when neighbour count is 1 */ if (face_num_neighbours(g, board, face, opp) == 1) { board[j] = opp; - flipped = TRUE; + flipped = true; } } } } if (do_random_pass) break; - if (!flipped) do_random_pass = TRUE; + if (!flipped) do_random_pass = true; } sfree(face_list); -- cgit v1.1