Skip to content

Commit

Permalink
Switch to traditional C comment symbols.
Browse files Browse the repository at this point in the history
  • Loading branch information
anachrocomputer committed Sep 19, 2020
1 parent 7b60ce9 commit 09442dc
Showing 1 changed file with 20 additions and 18 deletions.
38 changes: 20 additions & 18 deletions truchet2.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ struct Tile {
bool right;
};

void drawtile(const double x, const double y, const double wd, const double ht, const int tile_type);
void drawTile(const double x, const double y, const double wd, const double ht, const int tile_type);


int main(int argc, char * const argv[])
Expand All @@ -36,13 +36,13 @@ int main(int argc, char * const argv[])
double gridw, gridh;
double gridx0;
static struct Tile connect[7] = {
{false, true, true, false}, // 0
{false, true, false, true}, // 1
{true, false, true, false}, // 2
{true, false, false, true}, // 3
{true, true, false, false}, // 4
{false, false, true, true}, // 5
{false, false, false, false} // 6
{false, true, true, false}, /* 0 */
{false, true, false, true}, /* 1 */
{true, false, true, false}, /* 2 */
{true, false, false, true}, /* 3 */
{true, true, false, false}, /* 4 */
{false, false, true, true}, /* 5 */
{false, false, false, false} /* 6 */
};

while ((opt = getopt(argc, argv, "no:p:s:t:v:")) != -1) {
Expand Down Expand Up @@ -99,7 +99,7 @@ int main(int argc, char * const argv[])
gridw = maxy / ngridx;
gridh = maxy / ngridy;

// Generate the grid
/* Generate the grid */
for (i = 0; i < ngridy; i++) {
for (j = 0; j < ngridx; j++) {
// tile_type = (i + j) % 6;
Expand All @@ -108,7 +108,7 @@ int main(int argc, char * const argv[])
}
}

// Draw the top edge
/* Draw the top edge */
for (i = 0; i < ngridx; i++) {
x = gridx0 + (i * gridw);

Expand All @@ -122,7 +122,7 @@ int main(int argc, char * const argv[])
}
}

// Draw the left-hand edge
/* Draw the left-hand edge */
for (i = 0; i < ngridy; i++) {
y = i * gridh;

Expand All @@ -136,7 +136,7 @@ int main(int argc, char * const argv[])
}
}

// Draw the bottom edge
/* Draw the bottom edge */
for (i = 0; i < ngridx; i++) {
x = gridx0 + (i * gridw);

Expand All @@ -150,7 +150,7 @@ int main(int argc, char * const argv[])
}
}

// Draw right-hand edge
/* Draw right-hand edge */
for (i = 0; i < ngridy; i++) {
y = i * gridh;

Expand All @@ -164,16 +164,16 @@ int main(int argc, char * const argv[])
}
}

// Draw the main grid
/* Draw the main grid */
for (i = 0; i < ngridy; i++) {
for (j = 0; j < ngridx; j++) {
x = gridx0 + (j * gridw);
y = i * gridh;
drawtile(x, y, gridw, gridh, grid[i][j]);
drawTile(x, y, gridw, gridh, grid[i][j]);
}
}

// Draw horizontal lines
/* Draw horizontal lines */
for (i = 0; i < (ngridy - 1); i++) {
for (j = 0; j < ngridx; j++) {
const int lower = grid[i][j];
Expand All @@ -190,7 +190,7 @@ int main(int argc, char * const argv[])
}
}

// Draw vertical lines
/* Draw vertical lines */
for (i = 0; i < ngridy; i++) {
for (j = 0; j < (ngridx - 1); j++) {
const int left = grid[i][j];
Expand All @@ -213,7 +213,9 @@ int main(int argc, char * const argv[])
}


void drawtile(const double x, const double y, const double wd, const double ht, const int tile_type)
/* drawTile --- draw a single tile at (x, y) */

void drawTile(const double x, const double y, const double wd, const double ht, const int tile_type)
{
int i;
const double dr = (wd / 5.0);
Expand Down

0 comments on commit 09442dc

Please sign in to comment.