···7788Beliefs:
99 gatekeeper(gk). /* we know who the gatekeeper is, for simplicity */
1010+ dealer(d).
1011 currentturn(1). /* the first turn is for the agent in postion 1 */
1212+11131214Plans:
1315 @cardtable(enterAsNotary()) /* join the game as notary */
···1820 SetAssigned(POS, Y); /* update belief about assigned sit */
1921 if B( POS = 4 ) then /* if we believe we already assigned all the sits, then choose the dealer */
2022 {
2121- @cardtable(chooseDealer(), D);
2222- SetDealer(D);
2323- send(D, inform, dealer(D))
2323+ /*@cardtable(chooseDealer(), D);*/
2424+ /*SetDealer(D);*/
2525+ send(d, inform, dealer(d))
2426 }
2527 }
2628···3840 UpdateTrun(X + 1);
3941 @cardtale(selectTrun(X + 1))
4042 }
4141- }
4242-4343+ }
+20-16
code/2apl_platform/briscola_chiamata/player.2apl
···22 { true } SetAssigned(POS, X) { assigned(POS, X) }
33 { true } RemoveAssigned(POS, X) { not assigned(POS, X) }
44 { true } AddBidHistorical(Cantity, Who) { bidhistorical(Cantity, Who) }
55+ { true } SetAsDealer(X) { dealer(X) }
66+ { true } SetHand(X) { hand(X) }
57Beliefs:
68 notary(n).
79 gatekeeper(gk).
1010+ dealer(d).
1111+ player(X) :- assigned(POS, X).
812913Plans:
1014 [ B(gatekeeper(X)) ; send(X, request, register(me)) ]
···1216PC-rules:
1317 message(X, inform, _, _, registered(POS, Y)) <- true |
1418 {
1515- SetAssigned(POS, X)
1919+ SetAssigned(POS, Y)
1620 }
1721 message(X, inform, _, _, refused(Y)) <- true |
1822 {
1923 print("I'm out!")
2024 }
2121- message(X, inform, _, _, dealer(Y)) <- true |
2222- {
2323- print("I'm the dealer!")
2424- /* here start shuffling and dealing cards */
2525- }
2626-2727- message (X, inform, _, _, firstbid()) <- scenario(bidding) | /* message from dealer, telling that this agent is the firts to bid */
2525+2626+ message(X, inform, _, _, firstbid(_)) <- scenario(bidding) | /* message from dealer, telling that this agent is the firts to bid */
2827 {
2928 /* for fist, the agent bids */
3029 /* TODO the agent must know who is the next bidding, or ask to dealer*/
3131- send (Next, inform, bid());
3030+ send (Next, inform, bid(_))
32313332 }
34333535- message (X, inform, _, _, firstbid()) <- scenario(bidding) | /* message from dealer, telling that this agent is the firts to bid */
3434+ message(X, inform, _, _, firstbid(_)) <- scenario(bidding) | /* message from dealer, telling that this agent is the firts to bid */
3635 {
3736 /* for fist, the agent bids */
3837 /* TODO the agent must know who is the next bidding, or ask to dealer*/
3938 send (Next, inform, bid(1))
4039 }
41404242- message (X, inform, _, _, bid(Cuantity)) <- scenario(bidding) | /* message from dealer, telling that this agent is the firts to bid */
4141+ message(X, inform, _, _, bid(Cuantity, Pos)) <- scenario(bidding) | /* message from dealer, telling that this agent is the firts to bid */
4342 {
4444- /* for fist, the agent bids only once. NOTE i suppose "me" is a self reference */
4545- if B( bidhistorical(_, me) )
4343+ if B( bidhistorical(_, me) ) then
4644 {
4747- send (Next, inform, pass())
4545+ send (Next, inform, pass(_))
4846 }
4947 else
5048 {
···53515452 }
55535656- turnselected (X) <- assigned(X, _) and scenario(playing) | /* when percepts turnselected, and its his turn*/
5454+ message(d, inform, _, _, givecards(X)) <- true |
5555+ {
5656+ print ("I've cards!");
5757+ SetHand(X)
5858+ }
5959+6060+ turnselected(X) <- assigned(X, _) and scenario(playing) | /* when percepts turnselected, and its his turn*/
5761 {
5862 /*TODO*/
5959-6363+ skip
6064 }
6165