summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile8
-rw-r--r--README.md10
-rw-r--r--session.c2
-rw-r--r--tongues.c (renamed from ouija.c)0
-rw-r--r--utils.c9
5 files changed, 13 insertions, 16 deletions
diff --git a/Makefile b/Makefile
index 744a229..4cf502d 100644
--- a/Makefile
+++ b/Makefile
@@ -1,13 +1,13 @@
build: clean
- cc -o ouija ouija.c session.c utils.c
+ cc -o trt tongues.c session.c utils.c
clean:
- rm -rf ouija
+ rm -rf trt
install: build
mkdir -p /usr/local/bin
- cp -f ouija /usr/local/bin
+ cp -f trt /usr/local/bin
chmod 755 /usr/local/bin
uninstall:
- rm -rf /usr/local/bin/ouija
+ rm -rf /usr/local/bin/trt
diff --git a/README.md b/README.md
index 2ecc931..da3d632 100644
--- a/README.md
+++ b/README.md
@@ -1,11 +1,9 @@
-# Ouija Board
-Just a ouija board based on time and question randomness
+# Timer Random Tongues
+Tongues based on time and question randomness
## Inspiration
Inspired by Terry Davis TempleOS Timer Random Tongues which he used to communicate with God.
-Since TRT was written in HolyC and this random word generator is written in C I decided to call it a Ouija Board.
-
![TempleOS Timer Random Tongues](images/image.png)
## How to Use
@@ -20,8 +18,8 @@ Since TRT was written in HolyC and this random word generator is written in C I
### Run
If you already have a `dictionary.dict` file in your path, just run:
-`ouija`
+`trt`
If you have the file saved in another folder, just type:
-`ouija /path/to/dictionary` \ No newline at end of file
+`trt /path/to/dictionary`
diff --git a/session.c b/session.c
index 2991469..d847c99 100644
--- a/session.c
+++ b/session.c
@@ -13,11 +13,11 @@ startSession (FILE *dictionary)
char reload = '\0';
printf ("WELCOME\n"
+ "Type something to get an answer\n"
"Type GOODBYE to exit\n\n");
while (strcmp (question, "GOODBYE\n") != 0)
{
- printf ("Enter a question: ");
fgets (question, MAX_LINE, stdin);
if (strcmp (question, "GOODBYE\n") != 0)
diff --git a/ouija.c b/tongues.c
index 5b90cdf..5b90cdf 100644
--- a/ouija.c
+++ b/tongues.c
diff --git a/utils.c b/utils.c
index 057f6ef..8ef5567 100644
--- a/utils.c
+++ b/utils.c
@@ -59,9 +59,8 @@ getLine (FILE *dictionary, int lineNumber)
int
getRandomNumber (int min, int max, char *question)
{
- struct timespec s;
- clock_gettime (CLOCK_REALTIME, &s);
- srand (s.tv_nsec * numerize (question));
-
- return ((rand () % (max - min + 1)) + min);
+ struct timeval randtime;
+ gettimeofday(&randtime,NULL);
+ srand(((randtime.tv_sec * 100) + time(NULL)) + ((randtime.tv_usec / 100) - time(NULL)));
+ return ((rand() % (max - min + 1)) + 1);
}