-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlocal.c
More file actions
34 lines (27 loc) · 793 Bytes
/
local.c
File metadata and controls
34 lines (27 loc) · 793 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
//
// Created by Jason Pierna on 24/03/2017.
//
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <time.h>
#include "libs/hangman.h"
/**
* Ce fichier est utilisé afin de tester les fonctions
* écrites dans la librairie hangman.h.
* Il fonctionne comme un jeu du pendu en local.
*
* La fonction runGame propose un déroulement du jeu sommaire,
* et n'est pas aussi descriptive envers l'utilisateur que le
* client final.
**/
int main(int argc, const char * argv[]) {
int wordsTotal = 0;
int fileDescriptor = openFile("words.txt");
char ** wordsList = readFile(fileDescriptor, &wordsTotal);
close(fileDescriptor);
srand((unsigned int) time(NULL));
char * selectedWord = wordsList[randomNumber(0, wordsTotal)];
runGame(selectedWord);
return 0;
}