-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkarma-game.pl
73 lines (51 loc) · 1.78 KB
/
karma-game.pl
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
% Code of karma game
% Into terminal type: swipl -s karma-game.pl
% Into swipl console type: play .
% Enjoy it!!!
% Turn singleton warnings
:- style_check(-singleton).
:- style_check(-discontiguous).
:- [days].
:- [cardapioBakery].
% Define tomorrow like after head(today)
nextDay(X, Y, [X,Y|_]) :- Tomorrow = Y,
play(Tomorrow).
% Menu changes according of day
menuOfTheDay(Today, M) :-
menuBakery(Today, M).
writeMenu([M]) :- write(M), write('.').
writeMenu([M|Tail]) :- write(M), write(', '),
writeMenu(Tail).
% Init game
play :- play(mon).
% End game
play(n, Today) :- write('Goodbye!'), nl.
% Continue game
play(y, Today) :-
day(Tomorrow),
days(D),
nextDay(Today, Tomorrow, D).
nextDay(X, Y, [_|Tail]) :- nextDay(X, Y, Tail).
nextDay(X, _, [X]) :- write('What?! No, stop! That\'s enough! It was a long week.. Enjoy your weekend!'), nl,
play(n, fri).
days(D) :- findall(X, day(X), D).
%--------------------------So tirar se implementar :) pra nao quebrar a sequencia-------------------------------------%
play(thu) :- write('Thursday! No story yet. Go to friday? y/n'), nl,
read(GameOver),
play(GameOver, thu).
play(fri) :- write('Friday! No story yet. Go to saturday? y/n'), nl,
read(GameOver),
play(GameOver, fri).
%---------------------------------------------------------------------------------------------------------------------%
clear :- write('\e[2J').
:- include('monday.pl').
:- include('tuesday.pl').
:- include('wednesday.pl').
/* TODO
play(thu) :- write('Thursday! <Necessario implementar a historia de quinta> Continue? y/n'), nl,
read(Choice), nl,
play(Choice, thu).
play(fri) :- write('Friday! <Necessario implementar a historia de sexta> Continue? y/n'), nl,
read(Choice), nl,
play(Choice, fri).
*/