Mode:
Duration:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
% Facts
count(0).
isDark(false).
% Rules
updateUI(Count, Theme) :- count(Count), isDark(IsDark), (IsDark -> Theme = 'Dark'; Theme = 'Light').
increment(NewCount) :- count(Count), NewCount is Count + 1, retract(count(Count)), assert(count(NewCount)).
decrement(NewCount) :- count(Count), NewCount is Count - 1, retract(count(Count)), assert(count(NewCount)).
reset() :- retract(count(_)), assert(count(0)).
toggleTheme() :- isDark(IsDark), NewDark is not IsDark, retract(isDark(IsDark)), assert(isDark(NewDark)).
% Simulate actions
updateUI(Count, Theme).
increment(NewCount).
updateUI(NewCount, Theme).
increment(NewCount2).
updateUI(NewCount2, Theme).
toggleTheme().
updateUI(NewCount2, Theme).
decrement(NewCount3).
updateUI(NewCount3, Theme).
reset().
updateUI(0, Theme).Coding works best on desktop or with an external keyboard.