Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert Python example to use version 3 #8

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Make C/C++/Python variants use non-repeatable RNG
Let's allow the students to figure out it for themselves.
grigory-rechistov-intel committed Jan 30, 2024
commit fea851c8b915da11ec51e5a2a4a5df50684da74d
4 changes: 3 additions & 1 deletion C++/GameRunner.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
#include <stdlib.h>
#include <time.h>
#include "Game.h"

static bool notAWinner;

int main()
{
Game aGame;
srand(0);
srand ((unsigned)time(0));
// srand(0);
aGame.add("Chet");
aGame.add("Pat");
aGame.add("Sue");
4 changes: 2 additions & 2 deletions C/game_runner.c
Original file line number Diff line number Diff line change
@@ -8,8 +8,8 @@ int
main ()
{
struct Game *a_game = game_new ();
srand(1); // make RNG repeatable
// srand ((unsigned)time(0));
//srand(1); // make RNG repeatable
srand ((unsigned)time(0));

game_add (a_game, "Chet");
game_add (a_game, "Pat");
4 changes: 2 additions & 2 deletions python/texttest_fixture.py
Original file line number Diff line number Diff line change
@@ -2,8 +2,8 @@
from trivia import main

# Make sure all runs use the same random sequence
from random import seed
seed(1)
#from random import seed
#seed(1)

if __name__ == "__main__":
main()