Skip to content

Commit

Permalink
simple players are updated (module names corrected, outputs commented…
Browse files Browse the repository at this point in the history
… out. frame code updated to handle max step executions
  • Loading branch information
basarane committed Dec 30, 2015
1 parent 7d6ea14 commit 4ba5dcb
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 22 deletions.
2 changes: 1 addition & 1 deletion players/simple2014700096.pl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
cardPointList(StateProxy, Player, CanBuyCards, PointList, Nobles),
maximum_list(PointList, _, Index),
nth1(Index, CanBuyCards, CardId),
nl,write(CanBuyCards),nl,write(PointList),nl,
%nl,write(CanBuyCards),nl,write(PointList),nl,
Action = buyCard(CardId)
;
length(Reserves, ReservesLength),
Expand Down
6 changes: 5 additions & 1 deletion players/simple2014700171.pl
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
:- module(s2014700171, []).
:- module(simple2014700171, []).

:- dynamic bonuses/1.
:- dynamic reserves/1.
:- dynamic gems/1.
:- dynamic nobleTiles/1.
:- dynamic targets/1.

initialize(PlayerName, PlayerCount) :-
show(1, 'I am ~w of a ~w player game.~n', [PlayerName, PlayerCount]).


bonuses([0,0,0,0,0,0]).
reserves([]).
gems([0,0,0,0,0,0]).
Expand Down
37 changes: 20 additions & 17 deletions players/simple2015700000.pl
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@
true
)
),
importanceColor(Result), NewImportance = Result,
nl,write('IMPORTANCE:'),write(NewImportance),nl.
importanceColor(Result), NewImportance = Result
%,nl,write('IMPORTANCE:'),write(NewImportance),nl
.

calculateCardsImportance(Cards,NewImportance):-
retractall(importanceColor(_)),
Expand All @@ -38,8 +39,9 @@
true
)
),
importanceColor(Result), NewImportance = Result,
write('IMPORTANCECARDS:'),write(NewImportance),nl.
importanceColor(Result), NewImportance = Result
%,write('IMPORTANCECARDS:'),write(NewImportance),nl
.

decideCardToBuy(CanBuyCards,ImportantCards):-
b_sort(CanBuyCards,[],ImportantCards).
Expand Down Expand Up @@ -91,16 +93,16 @@
(
canBuyCards(Gems, Bonuses, Cards, CanBuyCards),
decideCardToBuy(CanBuyCards, ImportantCards),
write('IMPORTANT:'),write(ImportantCards),nl,
%write('IMPORTANT:'),write(ImportantCards),nl,
last(CardId,ImportantCards),
Action = buyCard(CardId)
;
call(StateProxy, game, tokens, Tokens),
decideCardToBuy(Cards, SortedCards),
write('CARDSONBOARD:'),write(Cards),nl,
write('CARDS:'),write(SortedCards),nl,
%write('CARDSONBOARD:'),write(Cards),nl,
%write('CARDS:'),write(SortedCards),nl,
set(SortedCards, Removed),
write('Removed:'),write(Removed),nl,
%write('Removed:'),write(Removed),nl,
decideGemToGets(Removed, Bonuses,Gems, Tokens, RandGems, BackGems),
%randomGetGems(Gems, Tokens, RandGems, BackGems),
Action = getGems(RandGems, BackGems)
Expand All @@ -117,23 +119,24 @@
(
sortedCardList(AvailableListCards),
card(CardId, RequiredGems-BonusColor-Points), removeGems(RequiredGems, Total, Result),
gemCount(Result, N), N > 3, del(CardId, AvailableListCards, NewList),retractall(sortedCardList(_)), assert(sortedCardList(NewList)),
write('CardId:'),write(CardId),nl,
write('RequiredGems:'),write(RequiredGems),nl,
write('Gems:'),write(Total),nl,
write('Result:'),write(Result),nl
gemCount(Result, N), N > 3, del(CardId, AvailableListCards, NewList),retractall(sortedCardList(_)), assert(sortedCardList(NewList))
%,write('CardId:'),write(CardId),nl,
%write('RequiredGems:'),write(RequiredGems),nl,
%write('Gems:'),write(Total),nl,
%write('Result:'),write(Result),nl
;
true
)
),
sortedCardList(AvailableCards),
write('AvailableCards:'),write(AvailableCards),nl,
%write('AvailableCards:'),write(AvailableCards),nl,
calculateCardsImportance(AvailableCards, Importance),
write('ImportanceCards:'),write(Importance),nl,
%write('ImportanceCards:'),write(Importance),nl,
subtractGems([1,1,1,1,1,0],Importance,K),
removeToGems(K,[0,0,0,0,0,0],L), makeZeros(L,M),
randomGetGems([0,0,0,0,0,0],M,GetGems,BackGems),
write('GetGems:'),write(GetGems),nl.
randomGetGems([0,0,0,0,0,0],M,GetGems,BackGems)
%,write('GetGems:'),write(GetGems),nl
.


selectNoble([H|_],H).
Expand Down
2 changes: 1 addition & 1 deletion players/simple2015700150 → players/simple2015700150.pl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
:- module(koala, []).
:- module(simple2015700150, []).

initialize(PlayerName, PlayerCount) :-
show(1, 'I am ~w of a ~w player game.~n', [PlayerName, PlayerCount]).
Expand Down
5 changes: 3 additions & 2 deletions splendor.pl
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,8 @@
,
(
(winner(player1), P1WinCountNew is 1, P2WinCountNew is 0;true),!,
(winner(player2), P1WinCountNew is 0, P2WinCountNew is 1;true),!
(winner(player2), P1WinCountNew is 0, P2WinCountNew is 1;true),!,
(\+winner(player1), \+winner(player2), P1WinCountNew is 0, P2WinCountNew is 0 ;true),!
),
Count1 is Count-1,
!
Expand Down Expand Up @@ -307,7 +308,7 @@
show(0, 'Winner: ~w~n', [WinnerPlayer])
;
M=500,
show(-1, 'Max steps executed', [])
show(-1, 'Max steps executed~n', [])
;
gameStep(M))
.
Expand Down

0 comments on commit 4ba5dcb

Please sign in to comment.