Last active
December 31, 2017 11:21
-
-
Save AhmadElsagheer/98aac4dc6f40ff9449c0aeb19e77d1f7 to your computer and use it in GitHub Desktop.
Players Showers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:-use_module(library(clpfd)). | |
shower(Times, End):- | |
maplist(player_task, Times, Tasks, Es), | |
Es ins 1..100, | |
cumulative(Tasks, [limit(3)]), | |
max_list2(Es, End), | |
once(labeling([min(End)], Es)). | |
player_task(Time, task(S, Time, E, 1, _), E):- S #>= 0. | |
max_list2([H|T], Max):- | |
max_list2(T, H, Max). | |
max_list2([], Max, Max). | |
max_list2([H|T], X, Y):- | |
Z #= max(X, H), | |
max_list2(T, Z, Y). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment