Skip to content

Commit

Permalink
C: remove leftover loop, seed random generator with time()
Browse files Browse the repository at this point in the history
The loop would run until the 100th win, which would require several
billions of questions, but obviously there are not enough, so since the
question arrays are not circular, it stops with a segfault. That loop
must be some leftover debug aid, not present in other implementations,
so it's safe to be removed.
  • Loading branch information
Attila M. Magyar committed Oct 15, 2013
1 parent f961d07 commit e180089
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions C/game_runner.c
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
#include <stdlib.h>
#include <time.h>
#include "game.h"

static bool not_a_winner;

int
main ()
{
int i;
struct Game *a_game = game_new ();

game_add (a_game, "Chet");
game_add (a_game, "Pat");
game_add (a_game, "Sue");

for (i = 100; i < 200; i++)
{
srand (i);
srand ((unsigned)time(0));

do
{
Expand All @@ -31,5 +29,4 @@ main ()
}
}
while (not_a_winner);
}
}
}

0 comments on commit e180089

Please sign in to comment.