0 Prolog
↳1 UndefinedPredicateHandlerProof (⇒, 0 ms)
↳2 Prolog
↳3 PrologToPiTRSProof (⇒, 253 ms)
↳4 PiTRS
↳5 DependencyPairsProof (⇔, 1291 ms)
↳6 PiDP
↳7 DependencyGraphProof (⇔, 0 ms)
↳8 AND
↳9 PiDP
↳10 UsableRulesProof (⇔, 0 ms)
↳11 PiDP
↳12 PiDPToQDPProof (⇒, 33 ms)
↳13 QDP
↳14 QDPSizeChangeProof (⇔, 0 ms)
↳15 YES
↳16 PiDP
↳17 UsableRulesProof (⇔, 0 ms)
↳18 PiDP
↳19 PiDPToQDPProof (⇒, 0 ms)
↳20 QDP
↳21 QDPSizeChangeProof (⇔, 0 ms)
↳22 YES
↳23 PiDP
↳24 UsableRulesProof (⇔, 0 ms)
↳25 PiDP
↳26 PiDPToQDPProof (⇒, 0 ms)
↳27 QDP
↳28 QDPSizeChangeProof (⇔, 0 ms)
↳29 YES
↳30 PiDP
↳31 UsableRulesProof (⇔, 0 ms)
↳32 PiDP
↳33 PiDPToQDPProof (⇒, 0 ms)
↳34 QDP
↳35 QDPSizeChangeProof (⇔, 0 ms)
↳36 YES
↳37 PiDP
↳38 UsableRulesProof (⇔, 0 ms)
↳39 PiDP
↳40 PiDPToQDPProof (⇒, 35 ms)
↳41 QDP
↳42 QDPSizeChangeProof (⇔, 0 ms)
↳43 YES
↳44 PiDP
↳45 UsableRulesProof (⇔, 0 ms)
↳46 PiDP
↳47 PiDPToQDPProof (⇒, 0 ms)
↳48 QDP
↳49 QDPSizeChangeProof (⇔, 0 ms)
↳50 YES
bid_in_gaaa(Hand, Attributes, Points, Bid) → U1_gaaa(Hand, Attributes, Points, Bid, sort_hand_in_ga(Hand, SortedHand))
sort_hand_in_ga(Hand, SortedHand) → U26_ga(Hand, SortedHand, split_suits_in_ga(Hand, SplitHand))
split_suits_in_ga(Hand, .(=(spades, S), .(=(hearts, H), .(=(diamonds, D), .(=(clubs, C), []))))) → U28_ga(Hand, S, H, D, C, filter_in_gga(Hand, spades, S))
filter_in_gga([], X12, []) → filter_out_gga([], X12, [])
filter_in_gga(.(-(Card, Suit), In), Suit, .(Card, Out)) → U32_gga(Card, Suit, In, Out, filter_in_gga(In, Suit, Out))
filter_in_gga(.(-(_A, X), In), Suit, Out) → U33_gga(_A, X, In, Suit, Out, \==_in_gg(Suit, X))
\==_in_gg(X0, X1) → \==_out_gg(X0, X1)
U33_gga(_A, X, In, Suit, Out, \==_out_gg(Suit, X)) → U34_gga(_A, X, In, Suit, Out, filter_in_gga(In, Suit, Out))
U34_gga(_A, X, In, Suit, Out, filter_out_gga(In, Suit, Out)) → filter_out_gga(.(-(_A, X), In), Suit, Out)
U32_gga(Card, Suit, In, Out, filter_out_gga(In, Suit, Out)) → filter_out_gga(.(-(Card, Suit), In), Suit, .(Card, Out))
U28_ga(Hand, S, H, D, C, filter_out_gga(Hand, spades, S)) → U29_ga(Hand, S, H, D, C, filter_in_gga(Hand, hearts, H))
U29_ga(Hand, S, H, D, C, filter_out_gga(Hand, hearts, H)) → U30_ga(Hand, S, H, D, C, filter_in_gga(Hand, diamonds, D))
U30_ga(Hand, S, H, D, C, filter_out_gga(Hand, diamonds, D)) → U31_ga(Hand, S, H, D, C, filter_in_gga(Hand, clubs, C))
U31_ga(Hand, S, H, D, C, filter_out_gga(Hand, clubs, C)) → split_suits_out_ga(Hand, .(=(spades, S), .(=(hearts, H), .(=(diamonds, D), .(=(clubs, C), [])))))
U26_ga(Hand, SortedHand, split_suits_out_ga(Hand, SplitHand)) → U27_ga(Hand, SortedHand, sort_suits_in_ga(SplitHand, SortedHand))
sort_suits_in_ga([], []) → sort_suits_out_ga([], [])
sort_suits_in_ga(.(=(S, Ci), In), .(=(S, Co), Out)) → U35_ga(S, Ci, In, Co, Out, i_sort_in_gga(Ci, [], Co))
i_sort_in_gga([], L, L) → i_sort_out_gga([], L, L)
i_sort_in_gga(.(C1, Cn), Li, Lo) → U37_gga(C1, Cn, Li, Lo, insert_in_gga(C1, Li, Lt))
insert_in_gga(X, [], .(X, [])) → insert_out_gga(X, [], .(X, []))
insert_in_gga(X, .(Y, Z), .(X, .(Y, Z))) → U39_gga(X, Y, Z, higher_in_gg(X, Y))
higher_in_gg(ace, X13) → higher_out_gg(ace, X13)
higher_in_gg(king, X) → U42_gg(X, \==_in_gg(X, ace))
U42_gg(X, \==_out_gg(X, ace)) → higher_out_gg(king, X)
higher_in_gg(queen, X) → U43_gg(X, \==_in_gg(X, ace))
U43_gg(X, \==_out_gg(X, ace)) → U44_gg(X, \==_in_gg(X, king))
U44_gg(X, \==_out_gg(X, king)) → higher_out_gg(queen, X)
higher_in_gg(jack, X) → U45_gg(X, integer_in_g(X))
integer_in_g(X0) → integer_out_g(X0)
U45_gg(X, integer_out_g(X)) → higher_out_gg(jack, X)
higher_in_gg(jack, jack) → higher_out_gg(jack, jack)
higher_in_gg(X, Y) → U46_gg(X, Y, integer_in_g(X))
U46_gg(X, Y, integer_out_g(X)) → U47_gg(X, Y, integer_in_g(Y))
U47_gg(X, Y, integer_out_g(Y)) → U48_gg(X, Y, >=_in_gg(X, Y))
>=_in_gg(X0, X1) → >=_out_gg(X0, X1)
U48_gg(X, Y, >=_out_gg(X, Y)) → higher_out_gg(X, Y)
U39_gga(X, Y, Z, higher_out_gg(X, Y)) → insert_out_gga(X, .(Y, Z), .(X, .(Y, Z)))
insert_in_gga(X, .(Y, Z), .(Y, L)) → U40_gga(X, Y, Z, L, lower_in_gg(X, Y))
lower_in_gg(king, ace) → lower_out_gg(king, ace)
lower_in_gg(queen, X) → U49_gg(X, honor_in_ga(X, N))
honor_in_ga(C, N) → U19_ga(C, N, face_card_in_ga(C, N))
face_card_in_ga(ace, 4) → face_card_out_ga(ace, 4)
face_card_in_ga(king, 3) → face_card_out_ga(king, 3)
face_card_in_ga(queen, 2) → face_card_out_ga(queen, 2)
face_card_in_ga(jack, 1) → face_card_out_ga(jack, 1)
U19_ga(C, N, face_card_out_ga(C, N)) → honor_out_ga(C, N)
honor_in_ga(C, 0) → U20_ga(C, integer_in_g(C))
U20_ga(C, integer_out_g(C)) → honor_out_ga(C, 0)
U49_gg(X, honor_out_ga(X, N)) → U50_gg(X, >_in_gg(N, 2))
>_in_gg(X0, X1) → >_out_gg(X0, X1)
U50_gg(X, >_out_gg(N, 2)) → lower_out_gg(queen, X)
lower_in_gg(jack, X) → U51_gg(X, honor_in_ga(X, N))
U51_gg(X, honor_out_ga(X, N)) → U52_gg(X, >_in_gg(N, 1))
U52_gg(X, >_out_gg(N, 1)) → lower_out_gg(jack, X)
lower_in_gg(X, Y) → U53_gg(X, Y, integer_in_g(X))
U53_gg(X, Y, integer_out_g(X)) → U54_gg(X, Y, honor_in_ga(Y, _M))
U54_gg(X, Y, honor_out_ga(Y, _M)) → lower_out_gg(X, Y)
U53_gg(X, Y, integer_out_g(X)) → U55_gg(X, Y, integer_in_g(Y))
U55_gg(X, Y, integer_out_g(Y)) → U56_gg(X, Y, <_in_gg(X, Y))
<_in_gg(X0, X1) → <_out_gg(X0, X1)
U56_gg(X, Y, <_out_gg(X, Y)) → lower_out_gg(X, Y)
U40_gga(X, Y, Z, L, lower_out_gg(X, Y)) → U41_gga(X, Y, Z, L, insert_in_gga(X, Z, L))
U41_gga(X, Y, Z, L, insert_out_gga(X, Z, L)) → insert_out_gga(X, .(Y, Z), .(Y, L))
U37_gga(C1, Cn, Li, Lo, insert_out_gga(C1, Li, Lt)) → U38_gga(C1, Cn, Li, Lo, i_sort_in_gga(Cn, Lt, Lo))
U38_gga(C1, Cn, Li, Lo, i_sort_out_gga(Cn, Lt, Lo)) → i_sort_out_gga(.(C1, Cn), Li, Lo)
U35_ga(S, Ci, In, Co, Out, i_sort_out_gga(Ci, [], Co)) → U36_ga(S, Ci, In, Co, Out, sort_suits_in_ga(In, Out))
U36_ga(S, Ci, In, Co, Out, sort_suits_out_ga(In, Out)) → sort_suits_out_ga(.(=(S, Ci), In), .(=(S, Co), Out))
U27_ga(Hand, SortedHand, sort_suits_out_ga(SplitHand, SortedHand)) → sort_hand_out_ga(Hand, SortedHand)
U1_gaaa(Hand, Attributes, Points, Bid, sort_hand_out_ga(Hand, SortedHand)) → U2_gaaa(Hand, Attributes, Points, Bid, SortedHand, evaluate_in_gaa(SortedHand, Attributes, Points))
evaluate_in_gaa(Hand, [], P) → U4_gaa(Hand, P, hcp_in_gga(Hand, 0, HCP))
hcp_in_gga([], N, N) → hcp_out_gga([], N, N)
hcp_in_gga(.(=(_X, C), Sn), Ni, No) → U7_gga(_X, C, Sn, Ni, No, hcp_suit_in_ga(C, N))
hcp_suit_in_ga(S, P) → U10_ga(S, P, honors_in_gga(S, 0, HP))
honors_in_gga([], Pi, Pi) → honors_out_gga([], Pi, Pi)
honors_in_gga(.(C1, Cn), Pi, Po) → U14_gga(C1, Cn, Pi, Po, honor_in_ga(C1, P))
U14_gga(C1, Cn, Pi, Po, honor_out_ga(C1, P)) → U15_gga(C1, Cn, Pi, Po, P, >_in_gg(P, 0))
U15_gga(C1, Cn, Pi, Po, P, >_out_gg(P, 0)) → U16_gga(C1, Cn, Pi, Po, is_in_ag(Pt, +(P, Pi)))
is_in_ag(X0, X1) → is_out_ag(X0, X1)
U16_gga(C1, Cn, Pi, Po, is_out_ag(Pt, +(P, Pi))) → U17_gga(C1, Cn, Pi, Po, honors_in_gaa(Cn, Pt, Po))
honors_in_gaa([], Pi, Pi) → honors_out_gaa([], Pi, Pi)
honors_in_gaa(.(C1, Cn), Pi, Po) → U14_gaa(C1, Cn, Pi, Po, honor_in_ga(C1, P))
U14_gaa(C1, Cn, Pi, Po, honor_out_ga(C1, P)) → U15_gaa(C1, Cn, Pi, Po, P, >_in_gg(P, 0))
U15_gaa(C1, Cn, Pi, Po, P, >_out_gg(P, 0)) → U16_gaa(C1, Cn, Pi, Po, is_in_aa(Pt, +(P, Pi)))
is_in_aa(X0, X1) → is_out_aa(X0, X1)
U16_gaa(C1, Cn, Pi, Po, is_out_aa(Pt, +(P, Pi))) → U17_gaa(C1, Cn, Pi, Po, honors_in_gaa(Cn, Pt, Po))
honors_in_gaa(.(C1, Cn), Pi, Pi) → U18_gaa(C1, Cn, Pi, honor_in_gg(C1, 0))
honor_in_gg(C, N) → U19_gg(C, N, face_card_in_gg(C, N))
face_card_in_gg(ace, 4) → face_card_out_gg(ace, 4)
face_card_in_gg(king, 3) → face_card_out_gg(king, 3)
face_card_in_gg(queen, 2) → face_card_out_gg(queen, 2)
face_card_in_gg(jack, 1) → face_card_out_gg(jack, 1)
U19_gg(C, N, face_card_out_gg(C, N)) → honor_out_gg(C, N)
honor_in_gg(C, 0) → U20_gg(C, integer_in_g(C))
U20_gg(C, integer_out_g(C)) → honor_out_gg(C, 0)
U18_gaa(C1, Cn, Pi, honor_out_gg(C1, 0)) → honors_out_gaa(.(C1, Cn), Pi, Pi)
U17_gaa(C1, Cn, Pi, Po, honors_out_gaa(Cn, Pt, Po)) → honors_out_gaa(.(C1, Cn), Pi, Po)
U17_gga(C1, Cn, Pi, Po, honors_out_gaa(Cn, Pt, Po)) → honors_out_gga(.(C1, Cn), Pi, Po)
honors_in_gga(.(C1, Cn), Pi, Pi) → U18_gga(C1, Cn, Pi, honor_in_gg(C1, 0))
U18_gga(C1, Cn, Pi, honor_out_gg(C1, 0)) → honors_out_gga(.(C1, Cn), Pi, Pi)
U10_ga(S, P, honors_out_gga(S, 0, HP)) → U11_ga(S, P, HP, dist_in_ga(S, DP))
dist_in_ga([], 3) → dist_out_ga([], 3)
dist_in_ga(.(X2, []), 2) → dist_out_ga(.(X2, []), 2)
dist_in_ga(.(X3, .(X4, [])), 1) → dist_out_ga(.(X3, .(X4, [])), 1)
dist_in_ga(.(X5, .(X6, .(X7, X8))), 0) → dist_out_ga(.(X5, .(X6, .(X7, X8))), 0)
U11_ga(S, P, HP, dist_out_ga(S, DP)) → U12_ga(S, P, HP, DP, misc_in_ga(S, MP))
misc_in_ga(.(ace, []), -1) → misc_out_ga(.(ace, []), -1)
misc_in_ga(.(king, []), -2) → misc_out_ga(.(king, []), -2)
misc_in_ga(.(queen, .(X9, [])), -2) → misc_out_ga(.(queen, .(X9, [])), -2)
misc_in_ga(.(jack, .(X10, [])), -1) → misc_out_ga(.(jack, .(X10, [])), -1)
misc_in_ga(.(_X, .(_Y, .(H3, Rem))), P) → U21_ga(_X, _Y, H3, Rem, P, honor_in_ga(H3, X))
U21_ga(_X, _Y, H3, Rem, P, honor_out_ga(H3, X)) → U22_ga(_X, _Y, H3, Rem, P, >_in_gg(X, 0))
U22_ga(_X, _Y, H3, Rem, P, >_out_gg(X, 0)) → U23_ga(_X, _Y, H3, Rem, P, length_in_ga(Rem, N))
length_in_ga(X0, X1) → length_out_ga(X0, X1)
U23_ga(_X, _Y, H3, Rem, P, length_out_ga(Rem, N)) → U24_ga(_X, _Y, H3, Rem, P, N, >_in_ag(N, 2))
>_in_ag(X0, X1) → >_out_ag(X0, X1)
U24_ga(_X, _Y, H3, Rem, P, N, >_out_ag(N, 2)) → U25_ga(_X, _Y, H3, Rem, P, is_in_aa(P, -(N, 2)))
U25_ga(_X, _Y, H3, Rem, P, is_out_aa(P, -(N, 2))) → misc_out_ga(.(_X, .(_Y, .(H3, Rem))), P)
misc_in_ga(X11, 0) → misc_out_ga(X11, 0)
U12_ga(S, P, HP, DP, misc_out_ga(S, MP)) → U13_ga(S, P, is_in_aa(P, +(HP, +(DP, MP))))
U13_ga(S, P, is_out_aa(P, +(HP, +(DP, MP)))) → hcp_suit_out_ga(S, P)
U7_gga(_X, C, Sn, Ni, No, hcp_suit_out_ga(C, N)) → U8_gga(_X, C, Sn, Ni, No, is_in_aa(Nt, +(N, Ni)))
U8_gga(_X, C, Sn, Ni, No, is_out_aa(Nt, +(N, Ni))) → U9_gga(_X, C, Sn, Ni, No, hcp_in_gaa(Sn, Nt, No))
hcp_in_gaa([], N, N) → hcp_out_gaa([], N, N)
hcp_in_gaa(.(=(_X, C), Sn), Ni, No) → U7_gaa(_X, C, Sn, Ni, No, hcp_suit_in_ga(C, N))
U7_gaa(_X, C, Sn, Ni, No, hcp_suit_out_ga(C, N)) → U8_gaa(_X, C, Sn, Ni, No, is_in_aa(Nt, +(N, Ni)))
U8_gaa(_X, C, Sn, Ni, No, is_out_aa(Nt, +(N, Ni))) → U9_gaa(_X, C, Sn, Ni, No, hcp_in_gaa(Sn, Nt, No))
U9_gaa(_X, C, Sn, Ni, No, hcp_out_gaa(Sn, Nt, No)) → hcp_out_gaa(.(=(_X, C), Sn), Ni, No)
U9_gga(_X, C, Sn, Ni, No, hcp_out_gaa(Sn, Nt, No)) → hcp_out_gga(.(=(_X, C), Sn), Ni, No)
U4_gaa(Hand, P, hcp_out_gga(Hand, 0, HCP)) → U5_gaa(Hand, P, HCP, adjustments_in_ga(Hand, MP))
adjustments_in_ga(X1, 0) → adjustments_out_ga(X1, 0)
U5_gaa(Hand, P, HCP, adjustments_out_ga(Hand, MP)) → U6_gaa(Hand, P, is_in_aa(P, +(HCP, MP)))
U6_gaa(Hand, P, is_out_aa(P, +(HCP, MP))) → evaluate_out_gaa(Hand, [], P)
U2_gaaa(Hand, Attributes, Points, Bid, SortedHand, evaluate_out_gaa(SortedHand, Attributes, Points)) → U3_gaaa(Hand, Attributes, Points, Bid, make_bid_in_ggaa(SortedHand, Attributes, Points, Bid))
make_bid_in_ggaa(Hand, Attributes, Points, 'punt...') → make_bid_out_ggaa(Hand, Attributes, Points, 'punt...')
U3_gaaa(Hand, Attributes, Points, Bid, make_bid_out_ggaa(SortedHand, Attributes, Points, Bid)) → bid_out_gaaa(Hand, Attributes, Points, Bid)
Infinitary Constructor Rewriting Termination of PiTRS implies Termination of Prolog
bid_in_gaaa(Hand, Attributes, Points, Bid) → U1_gaaa(Hand, Attributes, Points, Bid, sort_hand_in_ga(Hand, SortedHand))
sort_hand_in_ga(Hand, SortedHand) → U26_ga(Hand, SortedHand, split_suits_in_ga(Hand, SplitHand))
split_suits_in_ga(Hand, .(=(spades, S), .(=(hearts, H), .(=(diamonds, D), .(=(clubs, C), []))))) → U28_ga(Hand, S, H, D, C, filter_in_gga(Hand, spades, S))
filter_in_gga([], X12, []) → filter_out_gga([], X12, [])
filter_in_gga(.(-(Card, Suit), In), Suit, .(Card, Out)) → U32_gga(Card, Suit, In, Out, filter_in_gga(In, Suit, Out))
filter_in_gga(.(-(_A, X), In), Suit, Out) → U33_gga(_A, X, In, Suit, Out, \==_in_gg(Suit, X))
\==_in_gg(X0, X1) → \==_out_gg(X0, X1)
U33_gga(_A, X, In, Suit, Out, \==_out_gg(Suit, X)) → U34_gga(_A, X, In, Suit, Out, filter_in_gga(In, Suit, Out))
U34_gga(_A, X, In, Suit, Out, filter_out_gga(In, Suit, Out)) → filter_out_gga(.(-(_A, X), In), Suit, Out)
U32_gga(Card, Suit, In, Out, filter_out_gga(In, Suit, Out)) → filter_out_gga(.(-(Card, Suit), In), Suit, .(Card, Out))
U28_ga(Hand, S, H, D, C, filter_out_gga(Hand, spades, S)) → U29_ga(Hand, S, H, D, C, filter_in_gga(Hand, hearts, H))
U29_ga(Hand, S, H, D, C, filter_out_gga(Hand, hearts, H)) → U30_ga(Hand, S, H, D, C, filter_in_gga(Hand, diamonds, D))
U30_ga(Hand, S, H, D, C, filter_out_gga(Hand, diamonds, D)) → U31_ga(Hand, S, H, D, C, filter_in_gga(Hand, clubs, C))
U31_ga(Hand, S, H, D, C, filter_out_gga(Hand, clubs, C)) → split_suits_out_ga(Hand, .(=(spades, S), .(=(hearts, H), .(=(diamonds, D), .(=(clubs, C), [])))))
U26_ga(Hand, SortedHand, split_suits_out_ga(Hand, SplitHand)) → U27_ga(Hand, SortedHand, sort_suits_in_ga(SplitHand, SortedHand))
sort_suits_in_ga([], []) → sort_suits_out_ga([], [])
sort_suits_in_ga(.(=(S, Ci), In), .(=(S, Co), Out)) → U35_ga(S, Ci, In, Co, Out, i_sort_in_gga(Ci, [], Co))
i_sort_in_gga([], L, L) → i_sort_out_gga([], L, L)
i_sort_in_gga(.(C1, Cn), Li, Lo) → U37_gga(C1, Cn, Li, Lo, insert_in_gga(C1, Li, Lt))
insert_in_gga(X, [], .(X, [])) → insert_out_gga(X, [], .(X, []))
insert_in_gga(X, .(Y, Z), .(X, .(Y, Z))) → U39_gga(X, Y, Z, higher_in_gg(X, Y))
higher_in_gg(ace, X13) → higher_out_gg(ace, X13)
higher_in_gg(king, X) → U42_gg(X, \==_in_gg(X, ace))
U42_gg(X, \==_out_gg(X, ace)) → higher_out_gg(king, X)
higher_in_gg(queen, X) → U43_gg(X, \==_in_gg(X, ace))
U43_gg(X, \==_out_gg(X, ace)) → U44_gg(X, \==_in_gg(X, king))
U44_gg(X, \==_out_gg(X, king)) → higher_out_gg(queen, X)
higher_in_gg(jack, X) → U45_gg(X, integer_in_g(X))
integer_in_g(X0) → integer_out_g(X0)
U45_gg(X, integer_out_g(X)) → higher_out_gg(jack, X)
higher_in_gg(jack, jack) → higher_out_gg(jack, jack)
higher_in_gg(X, Y) → U46_gg(X, Y, integer_in_g(X))
U46_gg(X, Y, integer_out_g(X)) → U47_gg(X, Y, integer_in_g(Y))
U47_gg(X, Y, integer_out_g(Y)) → U48_gg(X, Y, >=_in_gg(X, Y))
>=_in_gg(X0, X1) → >=_out_gg(X0, X1)
U48_gg(X, Y, >=_out_gg(X, Y)) → higher_out_gg(X, Y)
U39_gga(X, Y, Z, higher_out_gg(X, Y)) → insert_out_gga(X, .(Y, Z), .(X, .(Y, Z)))
insert_in_gga(X, .(Y, Z), .(Y, L)) → U40_gga(X, Y, Z, L, lower_in_gg(X, Y))
lower_in_gg(king, ace) → lower_out_gg(king, ace)
lower_in_gg(queen, X) → U49_gg(X, honor_in_ga(X, N))
honor_in_ga(C, N) → U19_ga(C, N, face_card_in_ga(C, N))
face_card_in_ga(ace, 4) → face_card_out_ga(ace, 4)
face_card_in_ga(king, 3) → face_card_out_ga(king, 3)
face_card_in_ga(queen, 2) → face_card_out_ga(queen, 2)
face_card_in_ga(jack, 1) → face_card_out_ga(jack, 1)
U19_ga(C, N, face_card_out_ga(C, N)) → honor_out_ga(C, N)
honor_in_ga(C, 0) → U20_ga(C, integer_in_g(C))
U20_ga(C, integer_out_g(C)) → honor_out_ga(C, 0)
U49_gg(X, honor_out_ga(X, N)) → U50_gg(X, >_in_gg(N, 2))
>_in_gg(X0, X1) → >_out_gg(X0, X1)
U50_gg(X, >_out_gg(N, 2)) → lower_out_gg(queen, X)
lower_in_gg(jack, X) → U51_gg(X, honor_in_ga(X, N))
U51_gg(X, honor_out_ga(X, N)) → U52_gg(X, >_in_gg(N, 1))
U52_gg(X, >_out_gg(N, 1)) → lower_out_gg(jack, X)
lower_in_gg(X, Y) → U53_gg(X, Y, integer_in_g(X))
U53_gg(X, Y, integer_out_g(X)) → U54_gg(X, Y, honor_in_ga(Y, _M))
U54_gg(X, Y, honor_out_ga(Y, _M)) → lower_out_gg(X, Y)
U53_gg(X, Y, integer_out_g(X)) → U55_gg(X, Y, integer_in_g(Y))
U55_gg(X, Y, integer_out_g(Y)) → U56_gg(X, Y, <_in_gg(X, Y))
<_in_gg(X0, X1) → <_out_gg(X0, X1)
U56_gg(X, Y, <_out_gg(X, Y)) → lower_out_gg(X, Y)
U40_gga(X, Y, Z, L, lower_out_gg(X, Y)) → U41_gga(X, Y, Z, L, insert_in_gga(X, Z, L))
U41_gga(X, Y, Z, L, insert_out_gga(X, Z, L)) → insert_out_gga(X, .(Y, Z), .(Y, L))
U37_gga(C1, Cn, Li, Lo, insert_out_gga(C1, Li, Lt)) → U38_gga(C1, Cn, Li, Lo, i_sort_in_gga(Cn, Lt, Lo))
U38_gga(C1, Cn, Li, Lo, i_sort_out_gga(Cn, Lt, Lo)) → i_sort_out_gga(.(C1, Cn), Li, Lo)
U35_ga(S, Ci, In, Co, Out, i_sort_out_gga(Ci, [], Co)) → U36_ga(S, Ci, In, Co, Out, sort_suits_in_ga(In, Out))
U36_ga(S, Ci, In, Co, Out, sort_suits_out_ga(In, Out)) → sort_suits_out_ga(.(=(S, Ci), In), .(=(S, Co), Out))
U27_ga(Hand, SortedHand, sort_suits_out_ga(SplitHand, SortedHand)) → sort_hand_out_ga(Hand, SortedHand)
U1_gaaa(Hand, Attributes, Points, Bid, sort_hand_out_ga(Hand, SortedHand)) → U2_gaaa(Hand, Attributes, Points, Bid, SortedHand, evaluate_in_gaa(SortedHand, Attributes, Points))
evaluate_in_gaa(Hand, [], P) → U4_gaa(Hand, P, hcp_in_gga(Hand, 0, HCP))
hcp_in_gga([], N, N) → hcp_out_gga([], N, N)
hcp_in_gga(.(=(_X, C), Sn), Ni, No) → U7_gga(_X, C, Sn, Ni, No, hcp_suit_in_ga(C, N))
hcp_suit_in_ga(S, P) → U10_ga(S, P, honors_in_gga(S, 0, HP))
honors_in_gga([], Pi, Pi) → honors_out_gga([], Pi, Pi)
honors_in_gga(.(C1, Cn), Pi, Po) → U14_gga(C1, Cn, Pi, Po, honor_in_ga(C1, P))
U14_gga(C1, Cn, Pi, Po, honor_out_ga(C1, P)) → U15_gga(C1, Cn, Pi, Po, P, >_in_gg(P, 0))
U15_gga(C1, Cn, Pi, Po, P, >_out_gg(P, 0)) → U16_gga(C1, Cn, Pi, Po, is_in_ag(Pt, +(P, Pi)))
is_in_ag(X0, X1) → is_out_ag(X0, X1)
U16_gga(C1, Cn, Pi, Po, is_out_ag(Pt, +(P, Pi))) → U17_gga(C1, Cn, Pi, Po, honors_in_gaa(Cn, Pt, Po))
honors_in_gaa([], Pi, Pi) → honors_out_gaa([], Pi, Pi)
honors_in_gaa(.(C1, Cn), Pi, Po) → U14_gaa(C1, Cn, Pi, Po, honor_in_ga(C1, P))
U14_gaa(C1, Cn, Pi, Po, honor_out_ga(C1, P)) → U15_gaa(C1, Cn, Pi, Po, P, >_in_gg(P, 0))
U15_gaa(C1, Cn, Pi, Po, P, >_out_gg(P, 0)) → U16_gaa(C1, Cn, Pi, Po, is_in_aa(Pt, +(P, Pi)))
is_in_aa(X0, X1) → is_out_aa(X0, X1)
U16_gaa(C1, Cn, Pi, Po, is_out_aa(Pt, +(P, Pi))) → U17_gaa(C1, Cn, Pi, Po, honors_in_gaa(Cn, Pt, Po))
honors_in_gaa(.(C1, Cn), Pi, Pi) → U18_gaa(C1, Cn, Pi, honor_in_gg(C1, 0))
honor_in_gg(C, N) → U19_gg(C, N, face_card_in_gg(C, N))
face_card_in_gg(ace, 4) → face_card_out_gg(ace, 4)
face_card_in_gg(king, 3) → face_card_out_gg(king, 3)
face_card_in_gg(queen, 2) → face_card_out_gg(queen, 2)
face_card_in_gg(jack, 1) → face_card_out_gg(jack, 1)
U19_gg(C, N, face_card_out_gg(C, N)) → honor_out_gg(C, N)
honor_in_gg(C, 0) → U20_gg(C, integer_in_g(C))
U20_gg(C, integer_out_g(C)) → honor_out_gg(C, 0)
U18_gaa(C1, Cn, Pi, honor_out_gg(C1, 0)) → honors_out_gaa(.(C1, Cn), Pi, Pi)
U17_gaa(C1, Cn, Pi, Po, honors_out_gaa(Cn, Pt, Po)) → honors_out_gaa(.(C1, Cn), Pi, Po)
U17_gga(C1, Cn, Pi, Po, honors_out_gaa(Cn, Pt, Po)) → honors_out_gga(.(C1, Cn), Pi, Po)
honors_in_gga(.(C1, Cn), Pi, Pi) → U18_gga(C1, Cn, Pi, honor_in_gg(C1, 0))
U18_gga(C1, Cn, Pi, honor_out_gg(C1, 0)) → honors_out_gga(.(C1, Cn), Pi, Pi)
U10_ga(S, P, honors_out_gga(S, 0, HP)) → U11_ga(S, P, HP, dist_in_ga(S, DP))
dist_in_ga([], 3) → dist_out_ga([], 3)
dist_in_ga(.(X2, []), 2) → dist_out_ga(.(X2, []), 2)
dist_in_ga(.(X3, .(X4, [])), 1) → dist_out_ga(.(X3, .(X4, [])), 1)
dist_in_ga(.(X5, .(X6, .(X7, X8))), 0) → dist_out_ga(.(X5, .(X6, .(X7, X8))), 0)
U11_ga(S, P, HP, dist_out_ga(S, DP)) → U12_ga(S, P, HP, DP, misc_in_ga(S, MP))
misc_in_ga(.(ace, []), -1) → misc_out_ga(.(ace, []), -1)
misc_in_ga(.(king, []), -2) → misc_out_ga(.(king, []), -2)
misc_in_ga(.(queen, .(X9, [])), -2) → misc_out_ga(.(queen, .(X9, [])), -2)
misc_in_ga(.(jack, .(X10, [])), -1) → misc_out_ga(.(jack, .(X10, [])), -1)
misc_in_ga(.(_X, .(_Y, .(H3, Rem))), P) → U21_ga(_X, _Y, H3, Rem, P, honor_in_ga(H3, X))
U21_ga(_X, _Y, H3, Rem, P, honor_out_ga(H3, X)) → U22_ga(_X, _Y, H3, Rem, P, >_in_gg(X, 0))
U22_ga(_X, _Y, H3, Rem, P, >_out_gg(X, 0)) → U23_ga(_X, _Y, H3, Rem, P, length_in_ga(Rem, N))
length_in_ga(X0, X1) → length_out_ga(X0, X1)
U23_ga(_X, _Y, H3, Rem, P, length_out_ga(Rem, N)) → U24_ga(_X, _Y, H3, Rem, P, N, >_in_ag(N, 2))
>_in_ag(X0, X1) → >_out_ag(X0, X1)
U24_ga(_X, _Y, H3, Rem, P, N, >_out_ag(N, 2)) → U25_ga(_X, _Y, H3, Rem, P, is_in_aa(P, -(N, 2)))
U25_ga(_X, _Y, H3, Rem, P, is_out_aa(P, -(N, 2))) → misc_out_ga(.(_X, .(_Y, .(H3, Rem))), P)
misc_in_ga(X11, 0) → misc_out_ga(X11, 0)
U12_ga(S, P, HP, DP, misc_out_ga(S, MP)) → U13_ga(S, P, is_in_aa(P, +(HP, +(DP, MP))))
U13_ga(S, P, is_out_aa(P, +(HP, +(DP, MP)))) → hcp_suit_out_ga(S, P)
U7_gga(_X, C, Sn, Ni, No, hcp_suit_out_ga(C, N)) → U8_gga(_X, C, Sn, Ni, No, is_in_aa(Nt, +(N, Ni)))
U8_gga(_X, C, Sn, Ni, No, is_out_aa(Nt, +(N, Ni))) → U9_gga(_X, C, Sn, Ni, No, hcp_in_gaa(Sn, Nt, No))
hcp_in_gaa([], N, N) → hcp_out_gaa([], N, N)
hcp_in_gaa(.(=(_X, C), Sn), Ni, No) → U7_gaa(_X, C, Sn, Ni, No, hcp_suit_in_ga(C, N))
U7_gaa(_X, C, Sn, Ni, No, hcp_suit_out_ga(C, N)) → U8_gaa(_X, C, Sn, Ni, No, is_in_aa(Nt, +(N, Ni)))
U8_gaa(_X, C, Sn, Ni, No, is_out_aa(Nt, +(N, Ni))) → U9_gaa(_X, C, Sn, Ni, No, hcp_in_gaa(Sn, Nt, No))
U9_gaa(_X, C, Sn, Ni, No, hcp_out_gaa(Sn, Nt, No)) → hcp_out_gaa(.(=(_X, C), Sn), Ni, No)
U9_gga(_X, C, Sn, Ni, No, hcp_out_gaa(Sn, Nt, No)) → hcp_out_gga(.(=(_X, C), Sn), Ni, No)
U4_gaa(Hand, P, hcp_out_gga(Hand, 0, HCP)) → U5_gaa(Hand, P, HCP, adjustments_in_ga(Hand, MP))
adjustments_in_ga(X1, 0) → adjustments_out_ga(X1, 0)
U5_gaa(Hand, P, HCP, adjustments_out_ga(Hand, MP)) → U6_gaa(Hand, P, is_in_aa(P, +(HCP, MP)))
U6_gaa(Hand, P, is_out_aa(P, +(HCP, MP))) → evaluate_out_gaa(Hand, [], P)
U2_gaaa(Hand, Attributes, Points, Bid, SortedHand, evaluate_out_gaa(SortedHand, Attributes, Points)) → U3_gaaa(Hand, Attributes, Points, Bid, make_bid_in_ggaa(SortedHand, Attributes, Points, Bid))
make_bid_in_ggaa(Hand, Attributes, Points, 'punt...') → make_bid_out_ggaa(Hand, Attributes, Points, 'punt...')
U3_gaaa(Hand, Attributes, Points, Bid, make_bid_out_ggaa(SortedHand, Attributes, Points, Bid)) → bid_out_gaaa(Hand, Attributes, Points, Bid)
BID_IN_GAAA(Hand, Attributes, Points, Bid) → U1_GAAA(Hand, Attributes, Points, Bid, sort_hand_in_ga(Hand, SortedHand))
BID_IN_GAAA(Hand, Attributes, Points, Bid) → SORT_HAND_IN_GA(Hand, SortedHand)
SORT_HAND_IN_GA(Hand, SortedHand) → U26_GA(Hand, SortedHand, split_suits_in_ga(Hand, SplitHand))
SORT_HAND_IN_GA(Hand, SortedHand) → SPLIT_SUITS_IN_GA(Hand, SplitHand)
SPLIT_SUITS_IN_GA(Hand, .(=(spades, S), .(=(hearts, H), .(=(diamonds, D), .(=(clubs, C), []))))) → U28_GA(Hand, S, H, D, C, filter_in_gga(Hand, spades, S))
SPLIT_SUITS_IN_GA(Hand, .(=(spades, S), .(=(hearts, H), .(=(diamonds, D), .(=(clubs, C), []))))) → FILTER_IN_GGA(Hand, spades, S)
FILTER_IN_GGA(.(-(Card, Suit), In), Suit, .(Card, Out)) → U32_GGA(Card, Suit, In, Out, filter_in_gga(In, Suit, Out))
FILTER_IN_GGA(.(-(Card, Suit), In), Suit, .(Card, Out)) → FILTER_IN_GGA(In, Suit, Out)
FILTER_IN_GGA(.(-(_A, X), In), Suit, Out) → U33_GGA(_A, X, In, Suit, Out, \==_in_gg(Suit, X))
FILTER_IN_GGA(.(-(_A, X), In), Suit, Out) → \==_IN_GG(Suit, X)
U33_GGA(_A, X, In, Suit, Out, \==_out_gg(Suit, X)) → U34_GGA(_A, X, In, Suit, Out, filter_in_gga(In, Suit, Out))
U33_GGA(_A, X, In, Suit, Out, \==_out_gg(Suit, X)) → FILTER_IN_GGA(In, Suit, Out)
U28_GA(Hand, S, H, D, C, filter_out_gga(Hand, spades, S)) → U29_GA(Hand, S, H, D, C, filter_in_gga(Hand, hearts, H))
U28_GA(Hand, S, H, D, C, filter_out_gga(Hand, spades, S)) → FILTER_IN_GGA(Hand, hearts, H)
U29_GA(Hand, S, H, D, C, filter_out_gga(Hand, hearts, H)) → U30_GA(Hand, S, H, D, C, filter_in_gga(Hand, diamonds, D))
U29_GA(Hand, S, H, D, C, filter_out_gga(Hand, hearts, H)) → FILTER_IN_GGA(Hand, diamonds, D)
U30_GA(Hand, S, H, D, C, filter_out_gga(Hand, diamonds, D)) → U31_GA(Hand, S, H, D, C, filter_in_gga(Hand, clubs, C))
U30_GA(Hand, S, H, D, C, filter_out_gga(Hand, diamonds, D)) → FILTER_IN_GGA(Hand, clubs, C)
U26_GA(Hand, SortedHand, split_suits_out_ga(Hand, SplitHand)) → U27_GA(Hand, SortedHand, sort_suits_in_ga(SplitHand, SortedHand))
U26_GA(Hand, SortedHand, split_suits_out_ga(Hand, SplitHand)) → SORT_SUITS_IN_GA(SplitHand, SortedHand)
SORT_SUITS_IN_GA(.(=(S, Ci), In), .(=(S, Co), Out)) → U35_GA(S, Ci, In, Co, Out, i_sort_in_gga(Ci, [], Co))
SORT_SUITS_IN_GA(.(=(S, Ci), In), .(=(S, Co), Out)) → I_SORT_IN_GGA(Ci, [], Co)
I_SORT_IN_GGA(.(C1, Cn), Li, Lo) → U37_GGA(C1, Cn, Li, Lo, insert_in_gga(C1, Li, Lt))
I_SORT_IN_GGA(.(C1, Cn), Li, Lo) → INSERT_IN_GGA(C1, Li, Lt)
INSERT_IN_GGA(X, .(Y, Z), .(X, .(Y, Z))) → U39_GGA(X, Y, Z, higher_in_gg(X, Y))
INSERT_IN_GGA(X, .(Y, Z), .(X, .(Y, Z))) → HIGHER_IN_GG(X, Y)
HIGHER_IN_GG(king, X) → U42_GG(X, \==_in_gg(X, ace))
HIGHER_IN_GG(king, X) → \==_IN_GG(X, ace)
HIGHER_IN_GG(queen, X) → U43_GG(X, \==_in_gg(X, ace))
HIGHER_IN_GG(queen, X) → \==_IN_GG(X, ace)
U43_GG(X, \==_out_gg(X, ace)) → U44_GG(X, \==_in_gg(X, king))
U43_GG(X, \==_out_gg(X, ace)) → \==_IN_GG(X, king)
HIGHER_IN_GG(jack, X) → U45_GG(X, integer_in_g(X))
HIGHER_IN_GG(jack, X) → INTEGER_IN_G(X)
HIGHER_IN_GG(X, Y) → U46_GG(X, Y, integer_in_g(X))
HIGHER_IN_GG(X, Y) → INTEGER_IN_G(X)
U46_GG(X, Y, integer_out_g(X)) → U47_GG(X, Y, integer_in_g(Y))
U46_GG(X, Y, integer_out_g(X)) → INTEGER_IN_G(Y)
U47_GG(X, Y, integer_out_g(Y)) → U48_GG(X, Y, >=_in_gg(X, Y))
U47_GG(X, Y, integer_out_g(Y)) → >=_IN_GG(X, Y)
INSERT_IN_GGA(X, .(Y, Z), .(Y, L)) → U40_GGA(X, Y, Z, L, lower_in_gg(X, Y))
INSERT_IN_GGA(X, .(Y, Z), .(Y, L)) → LOWER_IN_GG(X, Y)
LOWER_IN_GG(queen, X) → U49_GG(X, honor_in_ga(X, N))
LOWER_IN_GG(queen, X) → HONOR_IN_GA(X, N)
HONOR_IN_GA(C, N) → U19_GA(C, N, face_card_in_ga(C, N))
HONOR_IN_GA(C, N) → FACE_CARD_IN_GA(C, N)
HONOR_IN_GA(C, 0) → U20_GA(C, integer_in_g(C))
HONOR_IN_GA(C, 0) → INTEGER_IN_G(C)
U49_GG(X, honor_out_ga(X, N)) → U50_GG(X, >_in_gg(N, 2))
U49_GG(X, honor_out_ga(X, N)) → >_IN_GG(N, 2)
LOWER_IN_GG(jack, X) → U51_GG(X, honor_in_ga(X, N))
LOWER_IN_GG(jack, X) → HONOR_IN_GA(X, N)
U51_GG(X, honor_out_ga(X, N)) → U52_GG(X, >_in_gg(N, 1))
U51_GG(X, honor_out_ga(X, N)) → >_IN_GG(N, 1)
LOWER_IN_GG(X, Y) → U53_GG(X, Y, integer_in_g(X))
LOWER_IN_GG(X, Y) → INTEGER_IN_G(X)
U53_GG(X, Y, integer_out_g(X)) → U54_GG(X, Y, honor_in_ga(Y, _M))
U53_GG(X, Y, integer_out_g(X)) → HONOR_IN_GA(Y, _M)
U53_GG(X, Y, integer_out_g(X)) → U55_GG(X, Y, integer_in_g(Y))
U53_GG(X, Y, integer_out_g(X)) → INTEGER_IN_G(Y)
U55_GG(X, Y, integer_out_g(Y)) → U56_GG(X, Y, <_in_gg(X, Y))
U55_GG(X, Y, integer_out_g(Y)) → <_IN_GG(X, Y)
U40_GGA(X, Y, Z, L, lower_out_gg(X, Y)) → U41_GGA(X, Y, Z, L, insert_in_gga(X, Z, L))
U40_GGA(X, Y, Z, L, lower_out_gg(X, Y)) → INSERT_IN_GGA(X, Z, L)
U37_GGA(C1, Cn, Li, Lo, insert_out_gga(C1, Li, Lt)) → U38_GGA(C1, Cn, Li, Lo, i_sort_in_gga(Cn, Lt, Lo))
U37_GGA(C1, Cn, Li, Lo, insert_out_gga(C1, Li, Lt)) → I_SORT_IN_GGA(Cn, Lt, Lo)
U35_GA(S, Ci, In, Co, Out, i_sort_out_gga(Ci, [], Co)) → U36_GA(S, Ci, In, Co, Out, sort_suits_in_ga(In, Out))
U35_GA(S, Ci, In, Co, Out, i_sort_out_gga(Ci, [], Co)) → SORT_SUITS_IN_GA(In, Out)
U1_GAAA(Hand, Attributes, Points, Bid, sort_hand_out_ga(Hand, SortedHand)) → U2_GAAA(Hand, Attributes, Points, Bid, SortedHand, evaluate_in_gaa(SortedHand, Attributes, Points))
U1_GAAA(Hand, Attributes, Points, Bid, sort_hand_out_ga(Hand, SortedHand)) → EVALUATE_IN_GAA(SortedHand, Attributes, Points)
EVALUATE_IN_GAA(Hand, [], P) → U4_GAA(Hand, P, hcp_in_gga(Hand, 0, HCP))
EVALUATE_IN_GAA(Hand, [], P) → HCP_IN_GGA(Hand, 0, HCP)
HCP_IN_GGA(.(=(_X, C), Sn), Ni, No) → U7_GGA(_X, C, Sn, Ni, No, hcp_suit_in_ga(C, N))
HCP_IN_GGA(.(=(_X, C), Sn), Ni, No) → HCP_SUIT_IN_GA(C, N)
HCP_SUIT_IN_GA(S, P) → U10_GA(S, P, honors_in_gga(S, 0, HP))
HCP_SUIT_IN_GA(S, P) → HONORS_IN_GGA(S, 0, HP)
HONORS_IN_GGA(.(C1, Cn), Pi, Po) → U14_GGA(C1, Cn, Pi, Po, honor_in_ga(C1, P))
HONORS_IN_GGA(.(C1, Cn), Pi, Po) → HONOR_IN_GA(C1, P)
U14_GGA(C1, Cn, Pi, Po, honor_out_ga(C1, P)) → U15_GGA(C1, Cn, Pi, Po, P, >_in_gg(P, 0))
U14_GGA(C1, Cn, Pi, Po, honor_out_ga(C1, P)) → >_IN_GG(P, 0)
U15_GGA(C1, Cn, Pi, Po, P, >_out_gg(P, 0)) → U16_GGA(C1, Cn, Pi, Po, is_in_ag(Pt, +(P, Pi)))
U15_GGA(C1, Cn, Pi, Po, P, >_out_gg(P, 0)) → IS_IN_AG(Pt, +(P, Pi))
U16_GGA(C1, Cn, Pi, Po, is_out_ag(Pt, +(P, Pi))) → U17_GGA(C1, Cn, Pi, Po, honors_in_gaa(Cn, Pt, Po))
U16_GGA(C1, Cn, Pi, Po, is_out_ag(Pt, +(P, Pi))) → HONORS_IN_GAA(Cn, Pt, Po)
HONORS_IN_GAA(.(C1, Cn), Pi, Po) → U14_GAA(C1, Cn, Pi, Po, honor_in_ga(C1, P))
HONORS_IN_GAA(.(C1, Cn), Pi, Po) → HONOR_IN_GA(C1, P)
U14_GAA(C1, Cn, Pi, Po, honor_out_ga(C1, P)) → U15_GAA(C1, Cn, Pi, Po, P, >_in_gg(P, 0))
U14_GAA(C1, Cn, Pi, Po, honor_out_ga(C1, P)) → >_IN_GG(P, 0)
U15_GAA(C1, Cn, Pi, Po, P, >_out_gg(P, 0)) → U16_GAA(C1, Cn, Pi, Po, is_in_aa(Pt, +(P, Pi)))
U15_GAA(C1, Cn, Pi, Po, P, >_out_gg(P, 0)) → IS_IN_AA(Pt, +(P, Pi))
U16_GAA(C1, Cn, Pi, Po, is_out_aa(Pt, +(P, Pi))) → U17_GAA(C1, Cn, Pi, Po, honors_in_gaa(Cn, Pt, Po))
U16_GAA(C1, Cn, Pi, Po, is_out_aa(Pt, +(P, Pi))) → HONORS_IN_GAA(Cn, Pt, Po)
HONORS_IN_GAA(.(C1, Cn), Pi, Pi) → U18_GAA(C1, Cn, Pi, honor_in_gg(C1, 0))
HONORS_IN_GAA(.(C1, Cn), Pi, Pi) → HONOR_IN_GG(C1, 0)
HONOR_IN_GG(C, N) → U19_GG(C, N, face_card_in_gg(C, N))
HONOR_IN_GG(C, N) → FACE_CARD_IN_GG(C, N)
HONOR_IN_GG(C, 0) → U20_GG(C, integer_in_g(C))
HONOR_IN_GG(C, 0) → INTEGER_IN_G(C)
HONORS_IN_GGA(.(C1, Cn), Pi, Pi) → U18_GGA(C1, Cn, Pi, honor_in_gg(C1, 0))
HONORS_IN_GGA(.(C1, Cn), Pi, Pi) → HONOR_IN_GG(C1, 0)
U10_GA(S, P, honors_out_gga(S, 0, HP)) → U11_GA(S, P, HP, dist_in_ga(S, DP))
U10_GA(S, P, honors_out_gga(S, 0, HP)) → DIST_IN_GA(S, DP)
U11_GA(S, P, HP, dist_out_ga(S, DP)) → U12_GA(S, P, HP, DP, misc_in_ga(S, MP))
U11_GA(S, P, HP, dist_out_ga(S, DP)) → MISC_IN_GA(S, MP)
MISC_IN_GA(.(_X, .(_Y, .(H3, Rem))), P) → U21_GA(_X, _Y, H3, Rem, P, honor_in_ga(H3, X))
MISC_IN_GA(.(_X, .(_Y, .(H3, Rem))), P) → HONOR_IN_GA(H3, X)
U21_GA(_X, _Y, H3, Rem, P, honor_out_ga(H3, X)) → U22_GA(_X, _Y, H3, Rem, P, >_in_gg(X, 0))
U21_GA(_X, _Y, H3, Rem, P, honor_out_ga(H3, X)) → >_IN_GG(X, 0)
U22_GA(_X, _Y, H3, Rem, P, >_out_gg(X, 0)) → U23_GA(_X, _Y, H3, Rem, P, length_in_ga(Rem, N))
U22_GA(_X, _Y, H3, Rem, P, >_out_gg(X, 0)) → LENGTH_IN_GA(Rem, N)
U23_GA(_X, _Y, H3, Rem, P, length_out_ga(Rem, N)) → U24_GA(_X, _Y, H3, Rem, P, N, >_in_ag(N, 2))
U23_GA(_X, _Y, H3, Rem, P, length_out_ga(Rem, N)) → >_IN_AG(N, 2)
U24_GA(_X, _Y, H3, Rem, P, N, >_out_ag(N, 2)) → U25_GA(_X, _Y, H3, Rem, P, is_in_aa(P, -(N, 2)))
U24_GA(_X, _Y, H3, Rem, P, N, >_out_ag(N, 2)) → IS_IN_AA(P, -(N, 2))
U12_GA(S, P, HP, DP, misc_out_ga(S, MP)) → U13_GA(S, P, is_in_aa(P, +(HP, +(DP, MP))))
U12_GA(S, P, HP, DP, misc_out_ga(S, MP)) → IS_IN_AA(P, +(HP, +(DP, MP)))
U7_GGA(_X, C, Sn, Ni, No, hcp_suit_out_ga(C, N)) → U8_GGA(_X, C, Sn, Ni, No, is_in_aa(Nt, +(N, Ni)))
U7_GGA(_X, C, Sn, Ni, No, hcp_suit_out_ga(C, N)) → IS_IN_AA(Nt, +(N, Ni))
U8_GGA(_X, C, Sn, Ni, No, is_out_aa(Nt, +(N, Ni))) → U9_GGA(_X, C, Sn, Ni, No, hcp_in_gaa(Sn, Nt, No))
U8_GGA(_X, C, Sn, Ni, No, is_out_aa(Nt, +(N, Ni))) → HCP_IN_GAA(Sn, Nt, No)
HCP_IN_GAA(.(=(_X, C), Sn), Ni, No) → U7_GAA(_X, C, Sn, Ni, No, hcp_suit_in_ga(C, N))
HCP_IN_GAA(.(=(_X, C), Sn), Ni, No) → HCP_SUIT_IN_GA(C, N)
U7_GAA(_X, C, Sn, Ni, No, hcp_suit_out_ga(C, N)) → U8_GAA(_X, C, Sn, Ni, No, is_in_aa(Nt, +(N, Ni)))
U7_GAA(_X, C, Sn, Ni, No, hcp_suit_out_ga(C, N)) → IS_IN_AA(Nt, +(N, Ni))
U8_GAA(_X, C, Sn, Ni, No, is_out_aa(Nt, +(N, Ni))) → U9_GAA(_X, C, Sn, Ni, No, hcp_in_gaa(Sn, Nt, No))
U8_GAA(_X, C, Sn, Ni, No, is_out_aa(Nt, +(N, Ni))) → HCP_IN_GAA(Sn, Nt, No)
U4_GAA(Hand, P, hcp_out_gga(Hand, 0, HCP)) → U5_GAA(Hand, P, HCP, adjustments_in_ga(Hand, MP))
U4_GAA(Hand, P, hcp_out_gga(Hand, 0, HCP)) → ADJUSTMENTS_IN_GA(Hand, MP)
U5_GAA(Hand, P, HCP, adjustments_out_ga(Hand, MP)) → U6_GAA(Hand, P, is_in_aa(P, +(HCP, MP)))
U5_GAA(Hand, P, HCP, adjustments_out_ga(Hand, MP)) → IS_IN_AA(P, +(HCP, MP))
U2_GAAA(Hand, Attributes, Points, Bid, SortedHand, evaluate_out_gaa(SortedHand, Attributes, Points)) → U3_GAAA(Hand, Attributes, Points, Bid, make_bid_in_ggaa(SortedHand, Attributes, Points, Bid))
U2_GAAA(Hand, Attributes, Points, Bid, SortedHand, evaluate_out_gaa(SortedHand, Attributes, Points)) → MAKE_BID_IN_GGAA(SortedHand, Attributes, Points, Bid)
bid_in_gaaa(Hand, Attributes, Points, Bid) → U1_gaaa(Hand, Attributes, Points, Bid, sort_hand_in_ga(Hand, SortedHand))
sort_hand_in_ga(Hand, SortedHand) → U26_ga(Hand, SortedHand, split_suits_in_ga(Hand, SplitHand))
split_suits_in_ga(Hand, .(=(spades, S), .(=(hearts, H), .(=(diamonds, D), .(=(clubs, C), []))))) → U28_ga(Hand, S, H, D, C, filter_in_gga(Hand, spades, S))
filter_in_gga([], X12, []) → filter_out_gga([], X12, [])
filter_in_gga(.(-(Card, Suit), In), Suit, .(Card, Out)) → U32_gga(Card, Suit, In, Out, filter_in_gga(In, Suit, Out))
filter_in_gga(.(-(_A, X), In), Suit, Out) → U33_gga(_A, X, In, Suit, Out, \==_in_gg(Suit, X))
\==_in_gg(X0, X1) → \==_out_gg(X0, X1)
U33_gga(_A, X, In, Suit, Out, \==_out_gg(Suit, X)) → U34_gga(_A, X, In, Suit, Out, filter_in_gga(In, Suit, Out))
U34_gga(_A, X, In, Suit, Out, filter_out_gga(In, Suit, Out)) → filter_out_gga(.(-(_A, X), In), Suit, Out)
U32_gga(Card, Suit, In, Out, filter_out_gga(In, Suit, Out)) → filter_out_gga(.(-(Card, Suit), In), Suit, .(Card, Out))
U28_ga(Hand, S, H, D, C, filter_out_gga(Hand, spades, S)) → U29_ga(Hand, S, H, D, C, filter_in_gga(Hand, hearts, H))
U29_ga(Hand, S, H, D, C, filter_out_gga(Hand, hearts, H)) → U30_ga(Hand, S, H, D, C, filter_in_gga(Hand, diamonds, D))
U30_ga(Hand, S, H, D, C, filter_out_gga(Hand, diamonds, D)) → U31_ga(Hand, S, H, D, C, filter_in_gga(Hand, clubs, C))
U31_ga(Hand, S, H, D, C, filter_out_gga(Hand, clubs, C)) → split_suits_out_ga(Hand, .(=(spades, S), .(=(hearts, H), .(=(diamonds, D), .(=(clubs, C), [])))))
U26_ga(Hand, SortedHand, split_suits_out_ga(Hand, SplitHand)) → U27_ga(Hand, SortedHand, sort_suits_in_ga(SplitHand, SortedHand))
sort_suits_in_ga([], []) → sort_suits_out_ga([], [])
sort_suits_in_ga(.(=(S, Ci), In), .(=(S, Co), Out)) → U35_ga(S, Ci, In, Co, Out, i_sort_in_gga(Ci, [], Co))
i_sort_in_gga([], L, L) → i_sort_out_gga([], L, L)
i_sort_in_gga(.(C1, Cn), Li, Lo) → U37_gga(C1, Cn, Li, Lo, insert_in_gga(C1, Li, Lt))
insert_in_gga(X, [], .(X, [])) → insert_out_gga(X, [], .(X, []))
insert_in_gga(X, .(Y, Z), .(X, .(Y, Z))) → U39_gga(X, Y, Z, higher_in_gg(X, Y))
higher_in_gg(ace, X13) → higher_out_gg(ace, X13)
higher_in_gg(king, X) → U42_gg(X, \==_in_gg(X, ace))
U42_gg(X, \==_out_gg(X, ace)) → higher_out_gg(king, X)
higher_in_gg(queen, X) → U43_gg(X, \==_in_gg(X, ace))
U43_gg(X, \==_out_gg(X, ace)) → U44_gg(X, \==_in_gg(X, king))
U44_gg(X, \==_out_gg(X, king)) → higher_out_gg(queen, X)
higher_in_gg(jack, X) → U45_gg(X, integer_in_g(X))
integer_in_g(X0) → integer_out_g(X0)
U45_gg(X, integer_out_g(X)) → higher_out_gg(jack, X)
higher_in_gg(jack, jack) → higher_out_gg(jack, jack)
higher_in_gg(X, Y) → U46_gg(X, Y, integer_in_g(X))
U46_gg(X, Y, integer_out_g(X)) → U47_gg(X, Y, integer_in_g(Y))
U47_gg(X, Y, integer_out_g(Y)) → U48_gg(X, Y, >=_in_gg(X, Y))
>=_in_gg(X0, X1) → >=_out_gg(X0, X1)
U48_gg(X, Y, >=_out_gg(X, Y)) → higher_out_gg(X, Y)
U39_gga(X, Y, Z, higher_out_gg(X, Y)) → insert_out_gga(X, .(Y, Z), .(X, .(Y, Z)))
insert_in_gga(X, .(Y, Z), .(Y, L)) → U40_gga(X, Y, Z, L, lower_in_gg(X, Y))
lower_in_gg(king, ace) → lower_out_gg(king, ace)
lower_in_gg(queen, X) → U49_gg(X, honor_in_ga(X, N))
honor_in_ga(C, N) → U19_ga(C, N, face_card_in_ga(C, N))
face_card_in_ga(ace, 4) → face_card_out_ga(ace, 4)
face_card_in_ga(king, 3) → face_card_out_ga(king, 3)
face_card_in_ga(queen, 2) → face_card_out_ga(queen, 2)
face_card_in_ga(jack, 1) → face_card_out_ga(jack, 1)
U19_ga(C, N, face_card_out_ga(C, N)) → honor_out_ga(C, N)
honor_in_ga(C, 0) → U20_ga(C, integer_in_g(C))
U20_ga(C, integer_out_g(C)) → honor_out_ga(C, 0)
U49_gg(X, honor_out_ga(X, N)) → U50_gg(X, >_in_gg(N, 2))
>_in_gg(X0, X1) → >_out_gg(X0, X1)
U50_gg(X, >_out_gg(N, 2)) → lower_out_gg(queen, X)
lower_in_gg(jack, X) → U51_gg(X, honor_in_ga(X, N))
U51_gg(X, honor_out_ga(X, N)) → U52_gg(X, >_in_gg(N, 1))
U52_gg(X, >_out_gg(N, 1)) → lower_out_gg(jack, X)
lower_in_gg(X, Y) → U53_gg(X, Y, integer_in_g(X))
U53_gg(X, Y, integer_out_g(X)) → U54_gg(X, Y, honor_in_ga(Y, _M))
U54_gg(X, Y, honor_out_ga(Y, _M)) → lower_out_gg(X, Y)
U53_gg(X, Y, integer_out_g(X)) → U55_gg(X, Y, integer_in_g(Y))
U55_gg(X, Y, integer_out_g(Y)) → U56_gg(X, Y, <_in_gg(X, Y))
<_in_gg(X0, X1) → <_out_gg(X0, X1)
U56_gg(X, Y, <_out_gg(X, Y)) → lower_out_gg(X, Y)
U40_gga(X, Y, Z, L, lower_out_gg(X, Y)) → U41_gga(X, Y, Z, L, insert_in_gga(X, Z, L))
U41_gga(X, Y, Z, L, insert_out_gga(X, Z, L)) → insert_out_gga(X, .(Y, Z), .(Y, L))
U37_gga(C1, Cn, Li, Lo, insert_out_gga(C1, Li, Lt)) → U38_gga(C1, Cn, Li, Lo, i_sort_in_gga(Cn, Lt, Lo))
U38_gga(C1, Cn, Li, Lo, i_sort_out_gga(Cn, Lt, Lo)) → i_sort_out_gga(.(C1, Cn), Li, Lo)
U35_ga(S, Ci, In, Co, Out, i_sort_out_gga(Ci, [], Co)) → U36_ga(S, Ci, In, Co, Out, sort_suits_in_ga(In, Out))
U36_ga(S, Ci, In, Co, Out, sort_suits_out_ga(In, Out)) → sort_suits_out_ga(.(=(S, Ci), In), .(=(S, Co), Out))
U27_ga(Hand, SortedHand, sort_suits_out_ga(SplitHand, SortedHand)) → sort_hand_out_ga(Hand, SortedHand)
U1_gaaa(Hand, Attributes, Points, Bid, sort_hand_out_ga(Hand, SortedHand)) → U2_gaaa(Hand, Attributes, Points, Bid, SortedHand, evaluate_in_gaa(SortedHand, Attributes, Points))
evaluate_in_gaa(Hand, [], P) → U4_gaa(Hand, P, hcp_in_gga(Hand, 0, HCP))
hcp_in_gga([], N, N) → hcp_out_gga([], N, N)
hcp_in_gga(.(=(_X, C), Sn), Ni, No) → U7_gga(_X, C, Sn, Ni, No, hcp_suit_in_ga(C, N))
hcp_suit_in_ga(S, P) → U10_ga(S, P, honors_in_gga(S, 0, HP))
honors_in_gga([], Pi, Pi) → honors_out_gga([], Pi, Pi)
honors_in_gga(.(C1, Cn), Pi, Po) → U14_gga(C1, Cn, Pi, Po, honor_in_ga(C1, P))
U14_gga(C1, Cn, Pi, Po, honor_out_ga(C1, P)) → U15_gga(C1, Cn, Pi, Po, P, >_in_gg(P, 0))
U15_gga(C1, Cn, Pi, Po, P, >_out_gg(P, 0)) → U16_gga(C1, Cn, Pi, Po, is_in_ag(Pt, +(P, Pi)))
is_in_ag(X0, X1) → is_out_ag(X0, X1)
U16_gga(C1, Cn, Pi, Po, is_out_ag(Pt, +(P, Pi))) → U17_gga(C1, Cn, Pi, Po, honors_in_gaa(Cn, Pt, Po))
honors_in_gaa([], Pi, Pi) → honors_out_gaa([], Pi, Pi)
honors_in_gaa(.(C1, Cn), Pi, Po) → U14_gaa(C1, Cn, Pi, Po, honor_in_ga(C1, P))
U14_gaa(C1, Cn, Pi, Po, honor_out_ga(C1, P)) → U15_gaa(C1, Cn, Pi, Po, P, >_in_gg(P, 0))
U15_gaa(C1, Cn, Pi, Po, P, >_out_gg(P, 0)) → U16_gaa(C1, Cn, Pi, Po, is_in_aa(Pt, +(P, Pi)))
is_in_aa(X0, X1) → is_out_aa(X0, X1)
U16_gaa(C1, Cn, Pi, Po, is_out_aa(Pt, +(P, Pi))) → U17_gaa(C1, Cn, Pi, Po, honors_in_gaa(Cn, Pt, Po))
honors_in_gaa(.(C1, Cn), Pi, Pi) → U18_gaa(C1, Cn, Pi, honor_in_gg(C1, 0))
honor_in_gg(C, N) → U19_gg(C, N, face_card_in_gg(C, N))
face_card_in_gg(ace, 4) → face_card_out_gg(ace, 4)
face_card_in_gg(king, 3) → face_card_out_gg(king, 3)
face_card_in_gg(queen, 2) → face_card_out_gg(queen, 2)
face_card_in_gg(jack, 1) → face_card_out_gg(jack, 1)
U19_gg(C, N, face_card_out_gg(C, N)) → honor_out_gg(C, N)
honor_in_gg(C, 0) → U20_gg(C, integer_in_g(C))
U20_gg(C, integer_out_g(C)) → honor_out_gg(C, 0)
U18_gaa(C1, Cn, Pi, honor_out_gg(C1, 0)) → honors_out_gaa(.(C1, Cn), Pi, Pi)
U17_gaa(C1, Cn, Pi, Po, honors_out_gaa(Cn, Pt, Po)) → honors_out_gaa(.(C1, Cn), Pi, Po)
U17_gga(C1, Cn, Pi, Po, honors_out_gaa(Cn, Pt, Po)) → honors_out_gga(.(C1, Cn), Pi, Po)
honors_in_gga(.(C1, Cn), Pi, Pi) → U18_gga(C1, Cn, Pi, honor_in_gg(C1, 0))
U18_gga(C1, Cn, Pi, honor_out_gg(C1, 0)) → honors_out_gga(.(C1, Cn), Pi, Pi)
U10_ga(S, P, honors_out_gga(S, 0, HP)) → U11_ga(S, P, HP, dist_in_ga(S, DP))
dist_in_ga([], 3) → dist_out_ga([], 3)
dist_in_ga(.(X2, []), 2) → dist_out_ga(.(X2, []), 2)
dist_in_ga(.(X3, .(X4, [])), 1) → dist_out_ga(.(X3, .(X4, [])), 1)
dist_in_ga(.(X5, .(X6, .(X7, X8))), 0) → dist_out_ga(.(X5, .(X6, .(X7, X8))), 0)
U11_ga(S, P, HP, dist_out_ga(S, DP)) → U12_ga(S, P, HP, DP, misc_in_ga(S, MP))
misc_in_ga(.(ace, []), -1) → misc_out_ga(.(ace, []), -1)
misc_in_ga(.(king, []), -2) → misc_out_ga(.(king, []), -2)
misc_in_ga(.(queen, .(X9, [])), -2) → misc_out_ga(.(queen, .(X9, [])), -2)
misc_in_ga(.(jack, .(X10, [])), -1) → misc_out_ga(.(jack, .(X10, [])), -1)
misc_in_ga(.(_X, .(_Y, .(H3, Rem))), P) → U21_ga(_X, _Y, H3, Rem, P, honor_in_ga(H3, X))
U21_ga(_X, _Y, H3, Rem, P, honor_out_ga(H3, X)) → U22_ga(_X, _Y, H3, Rem, P, >_in_gg(X, 0))
U22_ga(_X, _Y, H3, Rem, P, >_out_gg(X, 0)) → U23_ga(_X, _Y, H3, Rem, P, length_in_ga(Rem, N))
length_in_ga(X0, X1) → length_out_ga(X0, X1)
U23_ga(_X, _Y, H3, Rem, P, length_out_ga(Rem, N)) → U24_ga(_X, _Y, H3, Rem, P, N, >_in_ag(N, 2))
>_in_ag(X0, X1) → >_out_ag(X0, X1)
U24_ga(_X, _Y, H3, Rem, P, N, >_out_ag(N, 2)) → U25_ga(_X, _Y, H3, Rem, P, is_in_aa(P, -(N, 2)))
U25_ga(_X, _Y, H3, Rem, P, is_out_aa(P, -(N, 2))) → misc_out_ga(.(_X, .(_Y, .(H3, Rem))), P)
misc_in_ga(X11, 0) → misc_out_ga(X11, 0)
U12_ga(S, P, HP, DP, misc_out_ga(S, MP)) → U13_ga(S, P, is_in_aa(P, +(HP, +(DP, MP))))
U13_ga(S, P, is_out_aa(P, +(HP, +(DP, MP)))) → hcp_suit_out_ga(S, P)
U7_gga(_X, C, Sn, Ni, No, hcp_suit_out_ga(C, N)) → U8_gga(_X, C, Sn, Ni, No, is_in_aa(Nt, +(N, Ni)))
U8_gga(_X, C, Sn, Ni, No, is_out_aa(Nt, +(N, Ni))) → U9_gga(_X, C, Sn, Ni, No, hcp_in_gaa(Sn, Nt, No))
hcp_in_gaa([], N, N) → hcp_out_gaa([], N, N)
hcp_in_gaa(.(=(_X, C), Sn), Ni, No) → U7_gaa(_X, C, Sn, Ni, No, hcp_suit_in_ga(C, N))
U7_gaa(_X, C, Sn, Ni, No, hcp_suit_out_ga(C, N)) → U8_gaa(_X, C, Sn, Ni, No, is_in_aa(Nt, +(N, Ni)))
U8_gaa(_X, C, Sn, Ni, No, is_out_aa(Nt, +(N, Ni))) → U9_gaa(_X, C, Sn, Ni, No, hcp_in_gaa(Sn, Nt, No))
U9_gaa(_X, C, Sn, Ni, No, hcp_out_gaa(Sn, Nt, No)) → hcp_out_gaa(.(=(_X, C), Sn), Ni, No)
U9_gga(_X, C, Sn, Ni, No, hcp_out_gaa(Sn, Nt, No)) → hcp_out_gga(.(=(_X, C), Sn), Ni, No)
U4_gaa(Hand, P, hcp_out_gga(Hand, 0, HCP)) → U5_gaa(Hand, P, HCP, adjustments_in_ga(Hand, MP))
adjustments_in_ga(X1, 0) → adjustments_out_ga(X1, 0)
U5_gaa(Hand, P, HCP, adjustments_out_ga(Hand, MP)) → U6_gaa(Hand, P, is_in_aa(P, +(HCP, MP)))
U6_gaa(Hand, P, is_out_aa(P, +(HCP, MP))) → evaluate_out_gaa(Hand, [], P)
U2_gaaa(Hand, Attributes, Points, Bid, SortedHand, evaluate_out_gaa(SortedHand, Attributes, Points)) → U3_gaaa(Hand, Attributes, Points, Bid, make_bid_in_ggaa(SortedHand, Attributes, Points, Bid))
make_bid_in_ggaa(Hand, Attributes, Points, 'punt...') → make_bid_out_ggaa(Hand, Attributes, Points, 'punt...')
U3_gaaa(Hand, Attributes, Points, Bid, make_bid_out_ggaa(SortedHand, Attributes, Points, Bid)) → bid_out_gaaa(Hand, Attributes, Points, Bid)
BID_IN_GAAA(Hand, Attributes, Points, Bid) → U1_GAAA(Hand, Attributes, Points, Bid, sort_hand_in_ga(Hand, SortedHand))
BID_IN_GAAA(Hand, Attributes, Points, Bid) → SORT_HAND_IN_GA(Hand, SortedHand)
SORT_HAND_IN_GA(Hand, SortedHand) → U26_GA(Hand, SortedHand, split_suits_in_ga(Hand, SplitHand))
SORT_HAND_IN_GA(Hand, SortedHand) → SPLIT_SUITS_IN_GA(Hand, SplitHand)
SPLIT_SUITS_IN_GA(Hand, .(=(spades, S), .(=(hearts, H), .(=(diamonds, D), .(=(clubs, C), []))))) → U28_GA(Hand, S, H, D, C, filter_in_gga(Hand, spades, S))
SPLIT_SUITS_IN_GA(Hand, .(=(spades, S), .(=(hearts, H), .(=(diamonds, D), .(=(clubs, C), []))))) → FILTER_IN_GGA(Hand, spades, S)
FILTER_IN_GGA(.(-(Card, Suit), In), Suit, .(Card, Out)) → U32_GGA(Card, Suit, In, Out, filter_in_gga(In, Suit, Out))
FILTER_IN_GGA(.(-(Card, Suit), In), Suit, .(Card, Out)) → FILTER_IN_GGA(In, Suit, Out)
FILTER_IN_GGA(.(-(_A, X), In), Suit, Out) → U33_GGA(_A, X, In, Suit, Out, \==_in_gg(Suit, X))
FILTER_IN_GGA(.(-(_A, X), In), Suit, Out) → \==_IN_GG(Suit, X)
U33_GGA(_A, X, In, Suit, Out, \==_out_gg(Suit, X)) → U34_GGA(_A, X, In, Suit, Out, filter_in_gga(In, Suit, Out))
U33_GGA(_A, X, In, Suit, Out, \==_out_gg(Suit, X)) → FILTER_IN_GGA(In, Suit, Out)
U28_GA(Hand, S, H, D, C, filter_out_gga(Hand, spades, S)) → U29_GA(Hand, S, H, D, C, filter_in_gga(Hand, hearts, H))
U28_GA(Hand, S, H, D, C, filter_out_gga(Hand, spades, S)) → FILTER_IN_GGA(Hand, hearts, H)
U29_GA(Hand, S, H, D, C, filter_out_gga(Hand, hearts, H)) → U30_GA(Hand, S, H, D, C, filter_in_gga(Hand, diamonds, D))
U29_GA(Hand, S, H, D, C, filter_out_gga(Hand, hearts, H)) → FILTER_IN_GGA(Hand, diamonds, D)
U30_GA(Hand, S, H, D, C, filter_out_gga(Hand, diamonds, D)) → U31_GA(Hand, S, H, D, C, filter_in_gga(Hand, clubs, C))
U30_GA(Hand, S, H, D, C, filter_out_gga(Hand, diamonds, D)) → FILTER_IN_GGA(Hand, clubs, C)
U26_GA(Hand, SortedHand, split_suits_out_ga(Hand, SplitHand)) → U27_GA(Hand, SortedHand, sort_suits_in_ga(SplitHand, SortedHand))
U26_GA(Hand, SortedHand, split_suits_out_ga(Hand, SplitHand)) → SORT_SUITS_IN_GA(SplitHand, SortedHand)
SORT_SUITS_IN_GA(.(=(S, Ci), In), .(=(S, Co), Out)) → U35_GA(S, Ci, In, Co, Out, i_sort_in_gga(Ci, [], Co))
SORT_SUITS_IN_GA(.(=(S, Ci), In), .(=(S, Co), Out)) → I_SORT_IN_GGA(Ci, [], Co)
I_SORT_IN_GGA(.(C1, Cn), Li, Lo) → U37_GGA(C1, Cn, Li, Lo, insert_in_gga(C1, Li, Lt))
I_SORT_IN_GGA(.(C1, Cn), Li, Lo) → INSERT_IN_GGA(C1, Li, Lt)
INSERT_IN_GGA(X, .(Y, Z), .(X, .(Y, Z))) → U39_GGA(X, Y, Z, higher_in_gg(X, Y))
INSERT_IN_GGA(X, .(Y, Z), .(X, .(Y, Z))) → HIGHER_IN_GG(X, Y)
HIGHER_IN_GG(king, X) → U42_GG(X, \==_in_gg(X, ace))
HIGHER_IN_GG(king, X) → \==_IN_GG(X, ace)
HIGHER_IN_GG(queen, X) → U43_GG(X, \==_in_gg(X, ace))
HIGHER_IN_GG(queen, X) → \==_IN_GG(X, ace)
U43_GG(X, \==_out_gg(X, ace)) → U44_GG(X, \==_in_gg(X, king))
U43_GG(X, \==_out_gg(X, ace)) → \==_IN_GG(X, king)
HIGHER_IN_GG(jack, X) → U45_GG(X, integer_in_g(X))
HIGHER_IN_GG(jack, X) → INTEGER_IN_G(X)
HIGHER_IN_GG(X, Y) → U46_GG(X, Y, integer_in_g(X))
HIGHER_IN_GG(X, Y) → INTEGER_IN_G(X)
U46_GG(X, Y, integer_out_g(X)) → U47_GG(X, Y, integer_in_g(Y))
U46_GG(X, Y, integer_out_g(X)) → INTEGER_IN_G(Y)
U47_GG(X, Y, integer_out_g(Y)) → U48_GG(X, Y, >=_in_gg(X, Y))
U47_GG(X, Y, integer_out_g(Y)) → >=_IN_GG(X, Y)
INSERT_IN_GGA(X, .(Y, Z), .(Y, L)) → U40_GGA(X, Y, Z, L, lower_in_gg(X, Y))
INSERT_IN_GGA(X, .(Y, Z), .(Y, L)) → LOWER_IN_GG(X, Y)
LOWER_IN_GG(queen, X) → U49_GG(X, honor_in_ga(X, N))
LOWER_IN_GG(queen, X) → HONOR_IN_GA(X, N)
HONOR_IN_GA(C, N) → U19_GA(C, N, face_card_in_ga(C, N))
HONOR_IN_GA(C, N) → FACE_CARD_IN_GA(C, N)
HONOR_IN_GA(C, 0) → U20_GA(C, integer_in_g(C))
HONOR_IN_GA(C, 0) → INTEGER_IN_G(C)
U49_GG(X, honor_out_ga(X, N)) → U50_GG(X, >_in_gg(N, 2))
U49_GG(X, honor_out_ga(X, N)) → >_IN_GG(N, 2)
LOWER_IN_GG(jack, X) → U51_GG(X, honor_in_ga(X, N))
LOWER_IN_GG(jack, X) → HONOR_IN_GA(X, N)
U51_GG(X, honor_out_ga(X, N)) → U52_GG(X, >_in_gg(N, 1))
U51_GG(X, honor_out_ga(X, N)) → >_IN_GG(N, 1)
LOWER_IN_GG(X, Y) → U53_GG(X, Y, integer_in_g(X))
LOWER_IN_GG(X, Y) → INTEGER_IN_G(X)
U53_GG(X, Y, integer_out_g(X)) → U54_GG(X, Y, honor_in_ga(Y, _M))
U53_GG(X, Y, integer_out_g(X)) → HONOR_IN_GA(Y, _M)
U53_GG(X, Y, integer_out_g(X)) → U55_GG(X, Y, integer_in_g(Y))
U53_GG(X, Y, integer_out_g(X)) → INTEGER_IN_G(Y)
U55_GG(X, Y, integer_out_g(Y)) → U56_GG(X, Y, <_in_gg(X, Y))
U55_GG(X, Y, integer_out_g(Y)) → <_IN_GG(X, Y)
U40_GGA(X, Y, Z, L, lower_out_gg(X, Y)) → U41_GGA(X, Y, Z, L, insert_in_gga(X, Z, L))
U40_GGA(X, Y, Z, L, lower_out_gg(X, Y)) → INSERT_IN_GGA(X, Z, L)
U37_GGA(C1, Cn, Li, Lo, insert_out_gga(C1, Li, Lt)) → U38_GGA(C1, Cn, Li, Lo, i_sort_in_gga(Cn, Lt, Lo))
U37_GGA(C1, Cn, Li, Lo, insert_out_gga(C1, Li, Lt)) → I_SORT_IN_GGA(Cn, Lt, Lo)
U35_GA(S, Ci, In, Co, Out, i_sort_out_gga(Ci, [], Co)) → U36_GA(S, Ci, In, Co, Out, sort_suits_in_ga(In, Out))
U35_GA(S, Ci, In, Co, Out, i_sort_out_gga(Ci, [], Co)) → SORT_SUITS_IN_GA(In, Out)
U1_GAAA(Hand, Attributes, Points, Bid, sort_hand_out_ga(Hand, SortedHand)) → U2_GAAA(Hand, Attributes, Points, Bid, SortedHand, evaluate_in_gaa(SortedHand, Attributes, Points))
U1_GAAA(Hand, Attributes, Points, Bid, sort_hand_out_ga(Hand, SortedHand)) → EVALUATE_IN_GAA(SortedHand, Attributes, Points)
EVALUATE_IN_GAA(Hand, [], P) → U4_GAA(Hand, P, hcp_in_gga(Hand, 0, HCP))
EVALUATE_IN_GAA(Hand, [], P) → HCP_IN_GGA(Hand, 0, HCP)
HCP_IN_GGA(.(=(_X, C), Sn), Ni, No) → U7_GGA(_X, C, Sn, Ni, No, hcp_suit_in_ga(C, N))
HCP_IN_GGA(.(=(_X, C), Sn), Ni, No) → HCP_SUIT_IN_GA(C, N)
HCP_SUIT_IN_GA(S, P) → U10_GA(S, P, honors_in_gga(S, 0, HP))
HCP_SUIT_IN_GA(S, P) → HONORS_IN_GGA(S, 0, HP)
HONORS_IN_GGA(.(C1, Cn), Pi, Po) → U14_GGA(C1, Cn, Pi, Po, honor_in_ga(C1, P))
HONORS_IN_GGA(.(C1, Cn), Pi, Po) → HONOR_IN_GA(C1, P)
U14_GGA(C1, Cn, Pi, Po, honor_out_ga(C1, P)) → U15_GGA(C1, Cn, Pi, Po, P, >_in_gg(P, 0))
U14_GGA(C1, Cn, Pi, Po, honor_out_ga(C1, P)) → >_IN_GG(P, 0)
U15_GGA(C1, Cn, Pi, Po, P, >_out_gg(P, 0)) → U16_GGA(C1, Cn, Pi, Po, is_in_ag(Pt, +(P, Pi)))
U15_GGA(C1, Cn, Pi, Po, P, >_out_gg(P, 0)) → IS_IN_AG(Pt, +(P, Pi))
U16_GGA(C1, Cn, Pi, Po, is_out_ag(Pt, +(P, Pi))) → U17_GGA(C1, Cn, Pi, Po, honors_in_gaa(Cn, Pt, Po))
U16_GGA(C1, Cn, Pi, Po, is_out_ag(Pt, +(P, Pi))) → HONORS_IN_GAA(Cn, Pt, Po)
HONORS_IN_GAA(.(C1, Cn), Pi, Po) → U14_GAA(C1, Cn, Pi, Po, honor_in_ga(C1, P))
HONORS_IN_GAA(.(C1, Cn), Pi, Po) → HONOR_IN_GA(C1, P)
U14_GAA(C1, Cn, Pi, Po, honor_out_ga(C1, P)) → U15_GAA(C1, Cn, Pi, Po, P, >_in_gg(P, 0))
U14_GAA(C1, Cn, Pi, Po, honor_out_ga(C1, P)) → >_IN_GG(P, 0)
U15_GAA(C1, Cn, Pi, Po, P, >_out_gg(P, 0)) → U16_GAA(C1, Cn, Pi, Po, is_in_aa(Pt, +(P, Pi)))
U15_GAA(C1, Cn, Pi, Po, P, >_out_gg(P, 0)) → IS_IN_AA(Pt, +(P, Pi))
U16_GAA(C1, Cn, Pi, Po, is_out_aa(Pt, +(P, Pi))) → U17_GAA(C1, Cn, Pi, Po, honors_in_gaa(Cn, Pt, Po))
U16_GAA(C1, Cn, Pi, Po, is_out_aa(Pt, +(P, Pi))) → HONORS_IN_GAA(Cn, Pt, Po)
HONORS_IN_GAA(.(C1, Cn), Pi, Pi) → U18_GAA(C1, Cn, Pi, honor_in_gg(C1, 0))
HONORS_IN_GAA(.(C1, Cn), Pi, Pi) → HONOR_IN_GG(C1, 0)
HONOR_IN_GG(C, N) → U19_GG(C, N, face_card_in_gg(C, N))
HONOR_IN_GG(C, N) → FACE_CARD_IN_GG(C, N)
HONOR_IN_GG(C, 0) → U20_GG(C, integer_in_g(C))
HONOR_IN_GG(C, 0) → INTEGER_IN_G(C)
HONORS_IN_GGA(.(C1, Cn), Pi, Pi) → U18_GGA(C1, Cn, Pi, honor_in_gg(C1, 0))
HONORS_IN_GGA(.(C1, Cn), Pi, Pi) → HONOR_IN_GG(C1, 0)
U10_GA(S, P, honors_out_gga(S, 0, HP)) → U11_GA(S, P, HP, dist_in_ga(S, DP))
U10_GA(S, P, honors_out_gga(S, 0, HP)) → DIST_IN_GA(S, DP)
U11_GA(S, P, HP, dist_out_ga(S, DP)) → U12_GA(S, P, HP, DP, misc_in_ga(S, MP))
U11_GA(S, P, HP, dist_out_ga(S, DP)) → MISC_IN_GA(S, MP)
MISC_IN_GA(.(_X, .(_Y, .(H3, Rem))), P) → U21_GA(_X, _Y, H3, Rem, P, honor_in_ga(H3, X))
MISC_IN_GA(.(_X, .(_Y, .(H3, Rem))), P) → HONOR_IN_GA(H3, X)
U21_GA(_X, _Y, H3, Rem, P, honor_out_ga(H3, X)) → U22_GA(_X, _Y, H3, Rem, P, >_in_gg(X, 0))
U21_GA(_X, _Y, H3, Rem, P, honor_out_ga(H3, X)) → >_IN_GG(X, 0)
U22_GA(_X, _Y, H3, Rem, P, >_out_gg(X, 0)) → U23_GA(_X, _Y, H3, Rem, P, length_in_ga(Rem, N))
U22_GA(_X, _Y, H3, Rem, P, >_out_gg(X, 0)) → LENGTH_IN_GA(Rem, N)
U23_GA(_X, _Y, H3, Rem, P, length_out_ga(Rem, N)) → U24_GA(_X, _Y, H3, Rem, P, N, >_in_ag(N, 2))
U23_GA(_X, _Y, H3, Rem, P, length_out_ga(Rem, N)) → >_IN_AG(N, 2)
U24_GA(_X, _Y, H3, Rem, P, N, >_out_ag(N, 2)) → U25_GA(_X, _Y, H3, Rem, P, is_in_aa(P, -(N, 2)))
U24_GA(_X, _Y, H3, Rem, P, N, >_out_ag(N, 2)) → IS_IN_AA(P, -(N, 2))
U12_GA(S, P, HP, DP, misc_out_ga(S, MP)) → U13_GA(S, P, is_in_aa(P, +(HP, +(DP, MP))))
U12_GA(S, P, HP, DP, misc_out_ga(S, MP)) → IS_IN_AA(P, +(HP, +(DP, MP)))
U7_GGA(_X, C, Sn, Ni, No, hcp_suit_out_ga(C, N)) → U8_GGA(_X, C, Sn, Ni, No, is_in_aa(Nt, +(N, Ni)))
U7_GGA(_X, C, Sn, Ni, No, hcp_suit_out_ga(C, N)) → IS_IN_AA(Nt, +(N, Ni))
U8_GGA(_X, C, Sn, Ni, No, is_out_aa(Nt, +(N, Ni))) → U9_GGA(_X, C, Sn, Ni, No, hcp_in_gaa(Sn, Nt, No))
U8_GGA(_X, C, Sn, Ni, No, is_out_aa(Nt, +(N, Ni))) → HCP_IN_GAA(Sn, Nt, No)
HCP_IN_GAA(.(=(_X, C), Sn), Ni, No) → U7_GAA(_X, C, Sn, Ni, No, hcp_suit_in_ga(C, N))
HCP_IN_GAA(.(=(_X, C), Sn), Ni, No) → HCP_SUIT_IN_GA(C, N)
U7_GAA(_X, C, Sn, Ni, No, hcp_suit_out_ga(C, N)) → U8_GAA(_X, C, Sn, Ni, No, is_in_aa(Nt, +(N, Ni)))
U7_GAA(_X, C, Sn, Ni, No, hcp_suit_out_ga(C, N)) → IS_IN_AA(Nt, +(N, Ni))
U8_GAA(_X, C, Sn, Ni, No, is_out_aa(Nt, +(N, Ni))) → U9_GAA(_X, C, Sn, Ni, No, hcp_in_gaa(Sn, Nt, No))
U8_GAA(_X, C, Sn, Ni, No, is_out_aa(Nt, +(N, Ni))) → HCP_IN_GAA(Sn, Nt, No)
U4_GAA(Hand, P, hcp_out_gga(Hand, 0, HCP)) → U5_GAA(Hand, P, HCP, adjustments_in_ga(Hand, MP))
U4_GAA(Hand, P, hcp_out_gga(Hand, 0, HCP)) → ADJUSTMENTS_IN_GA(Hand, MP)
U5_GAA(Hand, P, HCP, adjustments_out_ga(Hand, MP)) → U6_GAA(Hand, P, is_in_aa(P, +(HCP, MP)))
U5_GAA(Hand, P, HCP, adjustments_out_ga(Hand, MP)) → IS_IN_AA(P, +(HCP, MP))
U2_GAAA(Hand, Attributes, Points, Bid, SortedHand, evaluate_out_gaa(SortedHand, Attributes, Points)) → U3_GAAA(Hand, Attributes, Points, Bid, make_bid_in_ggaa(SortedHand, Attributes, Points, Bid))
U2_GAAA(Hand, Attributes, Points, Bid, SortedHand, evaluate_out_gaa(SortedHand, Attributes, Points)) → MAKE_BID_IN_GGAA(SortedHand, Attributes, Points, Bid)
bid_in_gaaa(Hand, Attributes, Points, Bid) → U1_gaaa(Hand, Attributes, Points, Bid, sort_hand_in_ga(Hand, SortedHand))
sort_hand_in_ga(Hand, SortedHand) → U26_ga(Hand, SortedHand, split_suits_in_ga(Hand, SplitHand))
split_suits_in_ga(Hand, .(=(spades, S), .(=(hearts, H), .(=(diamonds, D), .(=(clubs, C), []))))) → U28_ga(Hand, S, H, D, C, filter_in_gga(Hand, spades, S))
filter_in_gga([], X12, []) → filter_out_gga([], X12, [])
filter_in_gga(.(-(Card, Suit), In), Suit, .(Card, Out)) → U32_gga(Card, Suit, In, Out, filter_in_gga(In, Suit, Out))
filter_in_gga(.(-(_A, X), In), Suit, Out) → U33_gga(_A, X, In, Suit, Out, \==_in_gg(Suit, X))
\==_in_gg(X0, X1) → \==_out_gg(X0, X1)
U33_gga(_A, X, In, Suit, Out, \==_out_gg(Suit, X)) → U34_gga(_A, X, In, Suit, Out, filter_in_gga(In, Suit, Out))
U34_gga(_A, X, In, Suit, Out, filter_out_gga(In, Suit, Out)) → filter_out_gga(.(-(_A, X), In), Suit, Out)
U32_gga(Card, Suit, In, Out, filter_out_gga(In, Suit, Out)) → filter_out_gga(.(-(Card, Suit), In), Suit, .(Card, Out))
U28_ga(Hand, S, H, D, C, filter_out_gga(Hand, spades, S)) → U29_ga(Hand, S, H, D, C, filter_in_gga(Hand, hearts, H))
U29_ga(Hand, S, H, D, C, filter_out_gga(Hand, hearts, H)) → U30_ga(Hand, S, H, D, C, filter_in_gga(Hand, diamonds, D))
U30_ga(Hand, S, H, D, C, filter_out_gga(Hand, diamonds, D)) → U31_ga(Hand, S, H, D, C, filter_in_gga(Hand, clubs, C))
U31_ga(Hand, S, H, D, C, filter_out_gga(Hand, clubs, C)) → split_suits_out_ga(Hand, .(=(spades, S), .(=(hearts, H), .(=(diamonds, D), .(=(clubs, C), [])))))
U26_ga(Hand, SortedHand, split_suits_out_ga(Hand, SplitHand)) → U27_ga(Hand, SortedHand, sort_suits_in_ga(SplitHand, SortedHand))
sort_suits_in_ga([], []) → sort_suits_out_ga([], [])
sort_suits_in_ga(.(=(S, Ci), In), .(=(S, Co), Out)) → U35_ga(S, Ci, In, Co, Out, i_sort_in_gga(Ci, [], Co))
i_sort_in_gga([], L, L) → i_sort_out_gga([], L, L)
i_sort_in_gga(.(C1, Cn), Li, Lo) → U37_gga(C1, Cn, Li, Lo, insert_in_gga(C1, Li, Lt))
insert_in_gga(X, [], .(X, [])) → insert_out_gga(X, [], .(X, []))
insert_in_gga(X, .(Y, Z), .(X, .(Y, Z))) → U39_gga(X, Y, Z, higher_in_gg(X, Y))
higher_in_gg(ace, X13) → higher_out_gg(ace, X13)
higher_in_gg(king, X) → U42_gg(X, \==_in_gg(X, ace))
U42_gg(X, \==_out_gg(X, ace)) → higher_out_gg(king, X)
higher_in_gg(queen, X) → U43_gg(X, \==_in_gg(X, ace))
U43_gg(X, \==_out_gg(X, ace)) → U44_gg(X, \==_in_gg(X, king))
U44_gg(X, \==_out_gg(X, king)) → higher_out_gg(queen, X)
higher_in_gg(jack, X) → U45_gg(X, integer_in_g(X))
integer_in_g(X0) → integer_out_g(X0)
U45_gg(X, integer_out_g(X)) → higher_out_gg(jack, X)
higher_in_gg(jack, jack) → higher_out_gg(jack, jack)
higher_in_gg(X, Y) → U46_gg(X, Y, integer_in_g(X))
U46_gg(X, Y, integer_out_g(X)) → U47_gg(X, Y, integer_in_g(Y))
U47_gg(X, Y, integer_out_g(Y)) → U48_gg(X, Y, >=_in_gg(X, Y))
>=_in_gg(X0, X1) → >=_out_gg(X0, X1)
U48_gg(X, Y, >=_out_gg(X, Y)) → higher_out_gg(X, Y)
U39_gga(X, Y, Z, higher_out_gg(X, Y)) → insert_out_gga(X, .(Y, Z), .(X, .(Y, Z)))
insert_in_gga(X, .(Y, Z), .(Y, L)) → U40_gga(X, Y, Z, L, lower_in_gg(X, Y))
lower_in_gg(king, ace) → lower_out_gg(king, ace)
lower_in_gg(queen, X) → U49_gg(X, honor_in_ga(X, N))
honor_in_ga(C, N) → U19_ga(C, N, face_card_in_ga(C, N))
face_card_in_ga(ace, 4) → face_card_out_ga(ace, 4)
face_card_in_ga(king, 3) → face_card_out_ga(king, 3)
face_card_in_ga(queen, 2) → face_card_out_ga(queen, 2)
face_card_in_ga(jack, 1) → face_card_out_ga(jack, 1)
U19_ga(C, N, face_card_out_ga(C, N)) → honor_out_ga(C, N)
honor_in_ga(C, 0) → U20_ga(C, integer_in_g(C))
U20_ga(C, integer_out_g(C)) → honor_out_ga(C, 0)
U49_gg(X, honor_out_ga(X, N)) → U50_gg(X, >_in_gg(N, 2))
>_in_gg(X0, X1) → >_out_gg(X0, X1)
U50_gg(X, >_out_gg(N, 2)) → lower_out_gg(queen, X)
lower_in_gg(jack, X) → U51_gg(X, honor_in_ga(X, N))
U51_gg(X, honor_out_ga(X, N)) → U52_gg(X, >_in_gg(N, 1))
U52_gg(X, >_out_gg(N, 1)) → lower_out_gg(jack, X)
lower_in_gg(X, Y) → U53_gg(X, Y, integer_in_g(X))
U53_gg(X, Y, integer_out_g(X)) → U54_gg(X, Y, honor_in_ga(Y, _M))
U54_gg(X, Y, honor_out_ga(Y, _M)) → lower_out_gg(X, Y)
U53_gg(X, Y, integer_out_g(X)) → U55_gg(X, Y, integer_in_g(Y))
U55_gg(X, Y, integer_out_g(Y)) → U56_gg(X, Y, <_in_gg(X, Y))
<_in_gg(X0, X1) → <_out_gg(X0, X1)
U56_gg(X, Y, <_out_gg(X, Y)) → lower_out_gg(X, Y)
U40_gga(X, Y, Z, L, lower_out_gg(X, Y)) → U41_gga(X, Y, Z, L, insert_in_gga(X, Z, L))
U41_gga(X, Y, Z, L, insert_out_gga(X, Z, L)) → insert_out_gga(X, .(Y, Z), .(Y, L))
U37_gga(C1, Cn, Li, Lo, insert_out_gga(C1, Li, Lt)) → U38_gga(C1, Cn, Li, Lo, i_sort_in_gga(Cn, Lt, Lo))
U38_gga(C1, Cn, Li, Lo, i_sort_out_gga(Cn, Lt, Lo)) → i_sort_out_gga(.(C1, Cn), Li, Lo)
U35_ga(S, Ci, In, Co, Out, i_sort_out_gga(Ci, [], Co)) → U36_ga(S, Ci, In, Co, Out, sort_suits_in_ga(In, Out))
U36_ga(S, Ci, In, Co, Out, sort_suits_out_ga(In, Out)) → sort_suits_out_ga(.(=(S, Ci), In), .(=(S, Co), Out))
U27_ga(Hand, SortedHand, sort_suits_out_ga(SplitHand, SortedHand)) → sort_hand_out_ga(Hand, SortedHand)
U1_gaaa(Hand, Attributes, Points, Bid, sort_hand_out_ga(Hand, SortedHand)) → U2_gaaa(Hand, Attributes, Points, Bid, SortedHand, evaluate_in_gaa(SortedHand, Attributes, Points))
evaluate_in_gaa(Hand, [], P) → U4_gaa(Hand, P, hcp_in_gga(Hand, 0, HCP))
hcp_in_gga([], N, N) → hcp_out_gga([], N, N)
hcp_in_gga(.(=(_X, C), Sn), Ni, No) → U7_gga(_X, C, Sn, Ni, No, hcp_suit_in_ga(C, N))
hcp_suit_in_ga(S, P) → U10_ga(S, P, honors_in_gga(S, 0, HP))
honors_in_gga([], Pi, Pi) → honors_out_gga([], Pi, Pi)
honors_in_gga(.(C1, Cn), Pi, Po) → U14_gga(C1, Cn, Pi, Po, honor_in_ga(C1, P))
U14_gga(C1, Cn, Pi, Po, honor_out_ga(C1, P)) → U15_gga(C1, Cn, Pi, Po, P, >_in_gg(P, 0))
U15_gga(C1, Cn, Pi, Po, P, >_out_gg(P, 0)) → U16_gga(C1, Cn, Pi, Po, is_in_ag(Pt, +(P, Pi)))
is_in_ag(X0, X1) → is_out_ag(X0, X1)
U16_gga(C1, Cn, Pi, Po, is_out_ag(Pt, +(P, Pi))) → U17_gga(C1, Cn, Pi, Po, honors_in_gaa(Cn, Pt, Po))
honors_in_gaa([], Pi, Pi) → honors_out_gaa([], Pi, Pi)
honors_in_gaa(.(C1, Cn), Pi, Po) → U14_gaa(C1, Cn, Pi, Po, honor_in_ga(C1, P))
U14_gaa(C1, Cn, Pi, Po, honor_out_ga(C1, P)) → U15_gaa(C1, Cn, Pi, Po, P, >_in_gg(P, 0))
U15_gaa(C1, Cn, Pi, Po, P, >_out_gg(P, 0)) → U16_gaa(C1, Cn, Pi, Po, is_in_aa(Pt, +(P, Pi)))
is_in_aa(X0, X1) → is_out_aa(X0, X1)
U16_gaa(C1, Cn, Pi, Po, is_out_aa(Pt, +(P, Pi))) → U17_gaa(C1, Cn, Pi, Po, honors_in_gaa(Cn, Pt, Po))
honors_in_gaa(.(C1, Cn), Pi, Pi) → U18_gaa(C1, Cn, Pi, honor_in_gg(C1, 0))
honor_in_gg(C, N) → U19_gg(C, N, face_card_in_gg(C, N))
face_card_in_gg(ace, 4) → face_card_out_gg(ace, 4)
face_card_in_gg(king, 3) → face_card_out_gg(king, 3)
face_card_in_gg(queen, 2) → face_card_out_gg(queen, 2)
face_card_in_gg(jack, 1) → face_card_out_gg(jack, 1)
U19_gg(C, N, face_card_out_gg(C, N)) → honor_out_gg(C, N)
honor_in_gg(C, 0) → U20_gg(C, integer_in_g(C))
U20_gg(C, integer_out_g(C)) → honor_out_gg(C, 0)
U18_gaa(C1, Cn, Pi, honor_out_gg(C1, 0)) → honors_out_gaa(.(C1, Cn), Pi, Pi)
U17_gaa(C1, Cn, Pi, Po, honors_out_gaa(Cn, Pt, Po)) → honors_out_gaa(.(C1, Cn), Pi, Po)
U17_gga(C1, Cn, Pi, Po, honors_out_gaa(Cn, Pt, Po)) → honors_out_gga(.(C1, Cn), Pi, Po)
honors_in_gga(.(C1, Cn), Pi, Pi) → U18_gga(C1, Cn, Pi, honor_in_gg(C1, 0))
U18_gga(C1, Cn, Pi, honor_out_gg(C1, 0)) → honors_out_gga(.(C1, Cn), Pi, Pi)
U10_ga(S, P, honors_out_gga(S, 0, HP)) → U11_ga(S, P, HP, dist_in_ga(S, DP))
dist_in_ga([], 3) → dist_out_ga([], 3)
dist_in_ga(.(X2, []), 2) → dist_out_ga(.(X2, []), 2)
dist_in_ga(.(X3, .(X4, [])), 1) → dist_out_ga(.(X3, .(X4, [])), 1)
dist_in_ga(.(X5, .(X6, .(X7, X8))), 0) → dist_out_ga(.(X5, .(X6, .(X7, X8))), 0)
U11_ga(S, P, HP, dist_out_ga(S, DP)) → U12_ga(S, P, HP, DP, misc_in_ga(S, MP))
misc_in_ga(.(ace, []), -1) → misc_out_ga(.(ace, []), -1)
misc_in_ga(.(king, []), -2) → misc_out_ga(.(king, []), -2)
misc_in_ga(.(queen, .(X9, [])), -2) → misc_out_ga(.(queen, .(X9, [])), -2)
misc_in_ga(.(jack, .(X10, [])), -1) → misc_out_ga(.(jack, .(X10, [])), -1)
misc_in_ga(.(_X, .(_Y, .(H3, Rem))), P) → U21_ga(_X, _Y, H3, Rem, P, honor_in_ga(H3, X))
U21_ga(_X, _Y, H3, Rem, P, honor_out_ga(H3, X)) → U22_ga(_X, _Y, H3, Rem, P, >_in_gg(X, 0))
U22_ga(_X, _Y, H3, Rem, P, >_out_gg(X, 0)) → U23_ga(_X, _Y, H3, Rem, P, length_in_ga(Rem, N))
length_in_ga(X0, X1) → length_out_ga(X0, X1)
U23_ga(_X, _Y, H3, Rem, P, length_out_ga(Rem, N)) → U24_ga(_X, _Y, H3, Rem, P, N, >_in_ag(N, 2))
>_in_ag(X0, X1) → >_out_ag(X0, X1)
U24_ga(_X, _Y, H3, Rem, P, N, >_out_ag(N, 2)) → U25_ga(_X, _Y, H3, Rem, P, is_in_aa(P, -(N, 2)))
U25_ga(_X, _Y, H3, Rem, P, is_out_aa(P, -(N, 2))) → misc_out_ga(.(_X, .(_Y, .(H3, Rem))), P)
misc_in_ga(X11, 0) → misc_out_ga(X11, 0)
U12_ga(S, P, HP, DP, misc_out_ga(S, MP)) → U13_ga(S, P, is_in_aa(P, +(HP, +(DP, MP))))
U13_ga(S, P, is_out_aa(P, +(HP, +(DP, MP)))) → hcp_suit_out_ga(S, P)
U7_gga(_X, C, Sn, Ni, No, hcp_suit_out_ga(C, N)) → U8_gga(_X, C, Sn, Ni, No, is_in_aa(Nt, +(N, Ni)))
U8_gga(_X, C, Sn, Ni, No, is_out_aa(Nt, +(N, Ni))) → U9_gga(_X, C, Sn, Ni, No, hcp_in_gaa(Sn, Nt, No))
hcp_in_gaa([], N, N) → hcp_out_gaa([], N, N)
hcp_in_gaa(.(=(_X, C), Sn), Ni, No) → U7_gaa(_X, C, Sn, Ni, No, hcp_suit_in_ga(C, N))
U7_gaa(_X, C, Sn, Ni, No, hcp_suit_out_ga(C, N)) → U8_gaa(_X, C, Sn, Ni, No, is_in_aa(Nt, +(N, Ni)))
U8_gaa(_X, C, Sn, Ni, No, is_out_aa(Nt, +(N, Ni))) → U9_gaa(_X, C, Sn, Ni, No, hcp_in_gaa(Sn, Nt, No))
U9_gaa(_X, C, Sn, Ni, No, hcp_out_gaa(Sn, Nt, No)) → hcp_out_gaa(.(=(_X, C), Sn), Ni, No)
U9_gga(_X, C, Sn, Ni, No, hcp_out_gaa(Sn, Nt, No)) → hcp_out_gga(.(=(_X, C), Sn), Ni, No)
U4_gaa(Hand, P, hcp_out_gga(Hand, 0, HCP)) → U5_gaa(Hand, P, HCP, adjustments_in_ga(Hand, MP))
adjustments_in_ga(X1, 0) → adjustments_out_ga(X1, 0)
U5_gaa(Hand, P, HCP, adjustments_out_ga(Hand, MP)) → U6_gaa(Hand, P, is_in_aa(P, +(HCP, MP)))
U6_gaa(Hand, P, is_out_aa(P, +(HCP, MP))) → evaluate_out_gaa(Hand, [], P)
U2_gaaa(Hand, Attributes, Points, Bid, SortedHand, evaluate_out_gaa(SortedHand, Attributes, Points)) → U3_gaaa(Hand, Attributes, Points, Bid, make_bid_in_ggaa(SortedHand, Attributes, Points, Bid))
make_bid_in_ggaa(Hand, Attributes, Points, 'punt...') → make_bid_out_ggaa(Hand, Attributes, Points, 'punt...')
U3_gaaa(Hand, Attributes, Points, Bid, make_bid_out_ggaa(SortedHand, Attributes, Points, Bid)) → bid_out_gaaa(Hand, Attributes, Points, Bid)
HONORS_IN_GAA(.(C1, Cn), Pi, Po) → U14_GAA(C1, Cn, Pi, Po, honor_in_ga(C1, P))
U14_GAA(C1, Cn, Pi, Po, honor_out_ga(C1, P)) → U15_GAA(C1, Cn, Pi, Po, P, >_in_gg(P, 0))
U15_GAA(C1, Cn, Pi, Po, P, >_out_gg(P, 0)) → U16_GAA(C1, Cn, Pi, Po, is_in_aa(Pt, +(P, Pi)))
U16_GAA(C1, Cn, Pi, Po, is_out_aa(Pt, +(P, Pi))) → HONORS_IN_GAA(Cn, Pt, Po)
bid_in_gaaa(Hand, Attributes, Points, Bid) → U1_gaaa(Hand, Attributes, Points, Bid, sort_hand_in_ga(Hand, SortedHand))
sort_hand_in_ga(Hand, SortedHand) → U26_ga(Hand, SortedHand, split_suits_in_ga(Hand, SplitHand))
split_suits_in_ga(Hand, .(=(spades, S), .(=(hearts, H), .(=(diamonds, D), .(=(clubs, C), []))))) → U28_ga(Hand, S, H, D, C, filter_in_gga(Hand, spades, S))
filter_in_gga([], X12, []) → filter_out_gga([], X12, [])
filter_in_gga(.(-(Card, Suit), In), Suit, .(Card, Out)) → U32_gga(Card, Suit, In, Out, filter_in_gga(In, Suit, Out))
filter_in_gga(.(-(_A, X), In), Suit, Out) → U33_gga(_A, X, In, Suit, Out, \==_in_gg(Suit, X))
\==_in_gg(X0, X1) → \==_out_gg(X0, X1)
U33_gga(_A, X, In, Suit, Out, \==_out_gg(Suit, X)) → U34_gga(_A, X, In, Suit, Out, filter_in_gga(In, Suit, Out))
U34_gga(_A, X, In, Suit, Out, filter_out_gga(In, Suit, Out)) → filter_out_gga(.(-(_A, X), In), Suit, Out)
U32_gga(Card, Suit, In, Out, filter_out_gga(In, Suit, Out)) → filter_out_gga(.(-(Card, Suit), In), Suit, .(Card, Out))
U28_ga(Hand, S, H, D, C, filter_out_gga(Hand, spades, S)) → U29_ga(Hand, S, H, D, C, filter_in_gga(Hand, hearts, H))
U29_ga(Hand, S, H, D, C, filter_out_gga(Hand, hearts, H)) → U30_ga(Hand, S, H, D, C, filter_in_gga(Hand, diamonds, D))
U30_ga(Hand, S, H, D, C, filter_out_gga(Hand, diamonds, D)) → U31_ga(Hand, S, H, D, C, filter_in_gga(Hand, clubs, C))
U31_ga(Hand, S, H, D, C, filter_out_gga(Hand, clubs, C)) → split_suits_out_ga(Hand, .(=(spades, S), .(=(hearts, H), .(=(diamonds, D), .(=(clubs, C), [])))))
U26_ga(Hand, SortedHand, split_suits_out_ga(Hand, SplitHand)) → U27_ga(Hand, SortedHand, sort_suits_in_ga(SplitHand, SortedHand))
sort_suits_in_ga([], []) → sort_suits_out_ga([], [])
sort_suits_in_ga(.(=(S, Ci), In), .(=(S, Co), Out)) → U35_ga(S, Ci, In, Co, Out, i_sort_in_gga(Ci, [], Co))
i_sort_in_gga([], L, L) → i_sort_out_gga([], L, L)
i_sort_in_gga(.(C1, Cn), Li, Lo) → U37_gga(C1, Cn, Li, Lo, insert_in_gga(C1, Li, Lt))
insert_in_gga(X, [], .(X, [])) → insert_out_gga(X, [], .(X, []))
insert_in_gga(X, .(Y, Z), .(X, .(Y, Z))) → U39_gga(X, Y, Z, higher_in_gg(X, Y))
higher_in_gg(ace, X13) → higher_out_gg(ace, X13)
higher_in_gg(king, X) → U42_gg(X, \==_in_gg(X, ace))
U42_gg(X, \==_out_gg(X, ace)) → higher_out_gg(king, X)
higher_in_gg(queen, X) → U43_gg(X, \==_in_gg(X, ace))
U43_gg(X, \==_out_gg(X, ace)) → U44_gg(X, \==_in_gg(X, king))
U44_gg(X, \==_out_gg(X, king)) → higher_out_gg(queen, X)
higher_in_gg(jack, X) → U45_gg(X, integer_in_g(X))
integer_in_g(X0) → integer_out_g(X0)
U45_gg(X, integer_out_g(X)) → higher_out_gg(jack, X)
higher_in_gg(jack, jack) → higher_out_gg(jack, jack)
higher_in_gg(X, Y) → U46_gg(X, Y, integer_in_g(X))
U46_gg(X, Y, integer_out_g(X)) → U47_gg(X, Y, integer_in_g(Y))
U47_gg(X, Y, integer_out_g(Y)) → U48_gg(X, Y, >=_in_gg(X, Y))
>=_in_gg(X0, X1) → >=_out_gg(X0, X1)
U48_gg(X, Y, >=_out_gg(X, Y)) → higher_out_gg(X, Y)
U39_gga(X, Y, Z, higher_out_gg(X, Y)) → insert_out_gga(X, .(Y, Z), .(X, .(Y, Z)))
insert_in_gga(X, .(Y, Z), .(Y, L)) → U40_gga(X, Y, Z, L, lower_in_gg(X, Y))
lower_in_gg(king, ace) → lower_out_gg(king, ace)
lower_in_gg(queen, X) → U49_gg(X, honor_in_ga(X, N))
honor_in_ga(C, N) → U19_ga(C, N, face_card_in_ga(C, N))
face_card_in_ga(ace, 4) → face_card_out_ga(ace, 4)
face_card_in_ga(king, 3) → face_card_out_ga(king, 3)
face_card_in_ga(queen, 2) → face_card_out_ga(queen, 2)
face_card_in_ga(jack, 1) → face_card_out_ga(jack, 1)
U19_ga(C, N, face_card_out_ga(C, N)) → honor_out_ga(C, N)
honor_in_ga(C, 0) → U20_ga(C, integer_in_g(C))
U20_ga(C, integer_out_g(C)) → honor_out_ga(C, 0)
U49_gg(X, honor_out_ga(X, N)) → U50_gg(X, >_in_gg(N, 2))
>_in_gg(X0, X1) → >_out_gg(X0, X1)
U50_gg(X, >_out_gg(N, 2)) → lower_out_gg(queen, X)
lower_in_gg(jack, X) → U51_gg(X, honor_in_ga(X, N))
U51_gg(X, honor_out_ga(X, N)) → U52_gg(X, >_in_gg(N, 1))
U52_gg(X, >_out_gg(N, 1)) → lower_out_gg(jack, X)
lower_in_gg(X, Y) → U53_gg(X, Y, integer_in_g(X))
U53_gg(X, Y, integer_out_g(X)) → U54_gg(X, Y, honor_in_ga(Y, _M))
U54_gg(X, Y, honor_out_ga(Y, _M)) → lower_out_gg(X, Y)
U53_gg(X, Y, integer_out_g(X)) → U55_gg(X, Y, integer_in_g(Y))
U55_gg(X, Y, integer_out_g(Y)) → U56_gg(X, Y, <_in_gg(X, Y))
<_in_gg(X0, X1) → <_out_gg(X0, X1)
U56_gg(X, Y, <_out_gg(X, Y)) → lower_out_gg(X, Y)
U40_gga(X, Y, Z, L, lower_out_gg(X, Y)) → U41_gga(X, Y, Z, L, insert_in_gga(X, Z, L))
U41_gga(X, Y, Z, L, insert_out_gga(X, Z, L)) → insert_out_gga(X, .(Y, Z), .(Y, L))
U37_gga(C1, Cn, Li, Lo, insert_out_gga(C1, Li, Lt)) → U38_gga(C1, Cn, Li, Lo, i_sort_in_gga(Cn, Lt, Lo))
U38_gga(C1, Cn, Li, Lo, i_sort_out_gga(Cn, Lt, Lo)) → i_sort_out_gga(.(C1, Cn), Li, Lo)
U35_ga(S, Ci, In, Co, Out, i_sort_out_gga(Ci, [], Co)) → U36_ga(S, Ci, In, Co, Out, sort_suits_in_ga(In, Out))
U36_ga(S, Ci, In, Co, Out, sort_suits_out_ga(In, Out)) → sort_suits_out_ga(.(=(S, Ci), In), .(=(S, Co), Out))
U27_ga(Hand, SortedHand, sort_suits_out_ga(SplitHand, SortedHand)) → sort_hand_out_ga(Hand, SortedHand)
U1_gaaa(Hand, Attributes, Points, Bid, sort_hand_out_ga(Hand, SortedHand)) → U2_gaaa(Hand, Attributes, Points, Bid, SortedHand, evaluate_in_gaa(SortedHand, Attributes, Points))
evaluate_in_gaa(Hand, [], P) → U4_gaa(Hand, P, hcp_in_gga(Hand, 0, HCP))
hcp_in_gga([], N, N) → hcp_out_gga([], N, N)
hcp_in_gga(.(=(_X, C), Sn), Ni, No) → U7_gga(_X, C, Sn, Ni, No, hcp_suit_in_ga(C, N))
hcp_suit_in_ga(S, P) → U10_ga(S, P, honors_in_gga(S, 0, HP))
honors_in_gga([], Pi, Pi) → honors_out_gga([], Pi, Pi)
honors_in_gga(.(C1, Cn), Pi, Po) → U14_gga(C1, Cn, Pi, Po, honor_in_ga(C1, P))
U14_gga(C1, Cn, Pi, Po, honor_out_ga(C1, P)) → U15_gga(C1, Cn, Pi, Po, P, >_in_gg(P, 0))
U15_gga(C1, Cn, Pi, Po, P, >_out_gg(P, 0)) → U16_gga(C1, Cn, Pi, Po, is_in_ag(Pt, +(P, Pi)))
is_in_ag(X0, X1) → is_out_ag(X0, X1)
U16_gga(C1, Cn, Pi, Po, is_out_ag(Pt, +(P, Pi))) → U17_gga(C1, Cn, Pi, Po, honors_in_gaa(Cn, Pt, Po))
honors_in_gaa([], Pi, Pi) → honors_out_gaa([], Pi, Pi)
honors_in_gaa(.(C1, Cn), Pi, Po) → U14_gaa(C1, Cn, Pi, Po, honor_in_ga(C1, P))
U14_gaa(C1, Cn, Pi, Po, honor_out_ga(C1, P)) → U15_gaa(C1, Cn, Pi, Po, P, >_in_gg(P, 0))
U15_gaa(C1, Cn, Pi, Po, P, >_out_gg(P, 0)) → U16_gaa(C1, Cn, Pi, Po, is_in_aa(Pt, +(P, Pi)))
is_in_aa(X0, X1) → is_out_aa(X0, X1)
U16_gaa(C1, Cn, Pi, Po, is_out_aa(Pt, +(P, Pi))) → U17_gaa(C1, Cn, Pi, Po, honors_in_gaa(Cn, Pt, Po))
honors_in_gaa(.(C1, Cn), Pi, Pi) → U18_gaa(C1, Cn, Pi, honor_in_gg(C1, 0))
honor_in_gg(C, N) → U19_gg(C, N, face_card_in_gg(C, N))
face_card_in_gg(ace, 4) → face_card_out_gg(ace, 4)
face_card_in_gg(king, 3) → face_card_out_gg(king, 3)
face_card_in_gg(queen, 2) → face_card_out_gg(queen, 2)
face_card_in_gg(jack, 1) → face_card_out_gg(jack, 1)
U19_gg(C, N, face_card_out_gg(C, N)) → honor_out_gg(C, N)
honor_in_gg(C, 0) → U20_gg(C, integer_in_g(C))
U20_gg(C, integer_out_g(C)) → honor_out_gg(C, 0)
U18_gaa(C1, Cn, Pi, honor_out_gg(C1, 0)) → honors_out_gaa(.(C1, Cn), Pi, Pi)
U17_gaa(C1, Cn, Pi, Po, honors_out_gaa(Cn, Pt, Po)) → honors_out_gaa(.(C1, Cn), Pi, Po)
U17_gga(C1, Cn, Pi, Po, honors_out_gaa(Cn, Pt, Po)) → honors_out_gga(.(C1, Cn), Pi, Po)
honors_in_gga(.(C1, Cn), Pi, Pi) → U18_gga(C1, Cn, Pi, honor_in_gg(C1, 0))
U18_gga(C1, Cn, Pi, honor_out_gg(C1, 0)) → honors_out_gga(.(C1, Cn), Pi, Pi)
U10_ga(S, P, honors_out_gga(S, 0, HP)) → U11_ga(S, P, HP, dist_in_ga(S, DP))
dist_in_ga([], 3) → dist_out_ga([], 3)
dist_in_ga(.(X2, []), 2) → dist_out_ga(.(X2, []), 2)
dist_in_ga(.(X3, .(X4, [])), 1) → dist_out_ga(.(X3, .(X4, [])), 1)
dist_in_ga(.(X5, .(X6, .(X7, X8))), 0) → dist_out_ga(.(X5, .(X6, .(X7, X8))), 0)
U11_ga(S, P, HP, dist_out_ga(S, DP)) → U12_ga(S, P, HP, DP, misc_in_ga(S, MP))
misc_in_ga(.(ace, []), -1) → misc_out_ga(.(ace, []), -1)
misc_in_ga(.(king, []), -2) → misc_out_ga(.(king, []), -2)
misc_in_ga(.(queen, .(X9, [])), -2) → misc_out_ga(.(queen, .(X9, [])), -2)
misc_in_ga(.(jack, .(X10, [])), -1) → misc_out_ga(.(jack, .(X10, [])), -1)
misc_in_ga(.(_X, .(_Y, .(H3, Rem))), P) → U21_ga(_X, _Y, H3, Rem, P, honor_in_ga(H3, X))
U21_ga(_X, _Y, H3, Rem, P, honor_out_ga(H3, X)) → U22_ga(_X, _Y, H3, Rem, P, >_in_gg(X, 0))
U22_ga(_X, _Y, H3, Rem, P, >_out_gg(X, 0)) → U23_ga(_X, _Y, H3, Rem, P, length_in_ga(Rem, N))
length_in_ga(X0, X1) → length_out_ga(X0, X1)
U23_ga(_X, _Y, H3, Rem, P, length_out_ga(Rem, N)) → U24_ga(_X, _Y, H3, Rem, P, N, >_in_ag(N, 2))
>_in_ag(X0, X1) → >_out_ag(X0, X1)
U24_ga(_X, _Y, H3, Rem, P, N, >_out_ag(N, 2)) → U25_ga(_X, _Y, H3, Rem, P, is_in_aa(P, -(N, 2)))
U25_ga(_X, _Y, H3, Rem, P, is_out_aa(P, -(N, 2))) → misc_out_ga(.(_X, .(_Y, .(H3, Rem))), P)
misc_in_ga(X11, 0) → misc_out_ga(X11, 0)
U12_ga(S, P, HP, DP, misc_out_ga(S, MP)) → U13_ga(S, P, is_in_aa(P, +(HP, +(DP, MP))))
U13_ga(S, P, is_out_aa(P, +(HP, +(DP, MP)))) → hcp_suit_out_ga(S, P)
U7_gga(_X, C, Sn, Ni, No, hcp_suit_out_ga(C, N)) → U8_gga(_X, C, Sn, Ni, No, is_in_aa(Nt, +(N, Ni)))
U8_gga(_X, C, Sn, Ni, No, is_out_aa(Nt, +(N, Ni))) → U9_gga(_X, C, Sn, Ni, No, hcp_in_gaa(Sn, Nt, No))
hcp_in_gaa([], N, N) → hcp_out_gaa([], N, N)
hcp_in_gaa(.(=(_X, C), Sn), Ni, No) → U7_gaa(_X, C, Sn, Ni, No, hcp_suit_in_ga(C, N))
U7_gaa(_X, C, Sn, Ni, No, hcp_suit_out_ga(C, N)) → U8_gaa(_X, C, Sn, Ni, No, is_in_aa(Nt, +(N, Ni)))
U8_gaa(_X, C, Sn, Ni, No, is_out_aa(Nt, +(N, Ni))) → U9_gaa(_X, C, Sn, Ni, No, hcp_in_gaa(Sn, Nt, No))
U9_gaa(_X, C, Sn, Ni, No, hcp_out_gaa(Sn, Nt, No)) → hcp_out_gaa(.(=(_X, C), Sn), Ni, No)
U9_gga(_X, C, Sn, Ni, No, hcp_out_gaa(Sn, Nt, No)) → hcp_out_gga(.(=(_X, C), Sn), Ni, No)
U4_gaa(Hand, P, hcp_out_gga(Hand, 0, HCP)) → U5_gaa(Hand, P, HCP, adjustments_in_ga(Hand, MP))
adjustments_in_ga(X1, 0) → adjustments_out_ga(X1, 0)
U5_gaa(Hand, P, HCP, adjustments_out_ga(Hand, MP)) → U6_gaa(Hand, P, is_in_aa(P, +(HCP, MP)))
U6_gaa(Hand, P, is_out_aa(P, +(HCP, MP))) → evaluate_out_gaa(Hand, [], P)
U2_gaaa(Hand, Attributes, Points, Bid, SortedHand, evaluate_out_gaa(SortedHand, Attributes, Points)) → U3_gaaa(Hand, Attributes, Points, Bid, make_bid_in_ggaa(SortedHand, Attributes, Points, Bid))
make_bid_in_ggaa(Hand, Attributes, Points, 'punt...') → make_bid_out_ggaa(Hand, Attributes, Points, 'punt...')
U3_gaaa(Hand, Attributes, Points, Bid, make_bid_out_ggaa(SortedHand, Attributes, Points, Bid)) → bid_out_gaaa(Hand, Attributes, Points, Bid)
HONORS_IN_GAA(.(C1, Cn), Pi, Po) → U14_GAA(C1, Cn, Pi, Po, honor_in_ga(C1, P))
U14_GAA(C1, Cn, Pi, Po, honor_out_ga(C1, P)) → U15_GAA(C1, Cn, Pi, Po, P, >_in_gg(P, 0))
U15_GAA(C1, Cn, Pi, Po, P, >_out_gg(P, 0)) → U16_GAA(C1, Cn, Pi, Po, is_in_aa(Pt, +(P, Pi)))
U16_GAA(C1, Cn, Pi, Po, is_out_aa(Pt, +(P, Pi))) → HONORS_IN_GAA(Cn, Pt, Po)
honor_in_ga(C, N) → U19_ga(C, N, face_card_in_ga(C, N))
honor_in_ga(C, 0) → U20_ga(C, integer_in_g(C))
>_in_gg(X0, X1) → >_out_gg(X0, X1)
is_in_aa(X0, X1) → is_out_aa(X0, X1)
U19_ga(C, N, face_card_out_ga(C, N)) → honor_out_ga(C, N)
U20_ga(C, integer_out_g(C)) → honor_out_ga(C, 0)
face_card_in_ga(ace, 4) → face_card_out_ga(ace, 4)
face_card_in_ga(king, 3) → face_card_out_ga(king, 3)
face_card_in_ga(queen, 2) → face_card_out_ga(queen, 2)
face_card_in_ga(jack, 1) → face_card_out_ga(jack, 1)
integer_in_g(X0) → integer_out_g(X0)
HONORS_IN_GAA(.(C1, Cn)) → U14_GAA(Cn, honor_in_ga(C1))
U14_GAA(Cn, honor_out_ga(P)) → U15_GAA(Cn, >_in_gg(P, 0))
U15_GAA(Cn, >_out_gg) → U16_GAA(Cn, is_in_aa)
U16_GAA(Cn, is_out_aa) → HONORS_IN_GAA(Cn)
honor_in_ga(C) → U19_ga(face_card_in_ga(C))
honor_in_ga(C) → U20_ga(integer_in_g(C))
>_in_gg(X0, X1) → >_out_gg
is_in_aa → is_out_aa
U19_ga(face_card_out_ga(N)) → honor_out_ga(N)
U20_ga(integer_out_g) → honor_out_ga(0)
face_card_in_ga(ace) → face_card_out_ga(4)
face_card_in_ga(king) → face_card_out_ga(3)
face_card_in_ga(queen) → face_card_out_ga(2)
face_card_in_ga(jack) → face_card_out_ga(1)
integer_in_g(X0) → integer_out_g
honor_in_ga(x0)
>_in_gg(x0, x1)
is_in_aa
U19_ga(x0)
U20_ga(x0)
face_card_in_ga(x0)
integer_in_g(x0)
From the DPs we obtained the following set of size-change graphs:
HCP_IN_GAA(.(=(_X, C), Sn), Ni, No) → U7_GAA(_X, C, Sn, Ni, No, hcp_suit_in_ga(C, N))
U7_GAA(_X, C, Sn, Ni, No, hcp_suit_out_ga(C, N)) → U8_GAA(_X, C, Sn, Ni, No, is_in_aa(Nt, +(N, Ni)))
U8_GAA(_X, C, Sn, Ni, No, is_out_aa(Nt, +(N, Ni))) → HCP_IN_GAA(Sn, Nt, No)
bid_in_gaaa(Hand, Attributes, Points, Bid) → U1_gaaa(Hand, Attributes, Points, Bid, sort_hand_in_ga(Hand, SortedHand))
sort_hand_in_ga(Hand, SortedHand) → U26_ga(Hand, SortedHand, split_suits_in_ga(Hand, SplitHand))
split_suits_in_ga(Hand, .(=(spades, S), .(=(hearts, H), .(=(diamonds, D), .(=(clubs, C), []))))) → U28_ga(Hand, S, H, D, C, filter_in_gga(Hand, spades, S))
filter_in_gga([], X12, []) → filter_out_gga([], X12, [])
filter_in_gga(.(-(Card, Suit), In), Suit, .(Card, Out)) → U32_gga(Card, Suit, In, Out, filter_in_gga(In, Suit, Out))
filter_in_gga(.(-(_A, X), In), Suit, Out) → U33_gga(_A, X, In, Suit, Out, \==_in_gg(Suit, X))
\==_in_gg(X0, X1) → \==_out_gg(X0, X1)
U33_gga(_A, X, In, Suit, Out, \==_out_gg(Suit, X)) → U34_gga(_A, X, In, Suit, Out, filter_in_gga(In, Suit, Out))
U34_gga(_A, X, In, Suit, Out, filter_out_gga(In, Suit, Out)) → filter_out_gga(.(-(_A, X), In), Suit, Out)
U32_gga(Card, Suit, In, Out, filter_out_gga(In, Suit, Out)) → filter_out_gga(.(-(Card, Suit), In), Suit, .(Card, Out))
U28_ga(Hand, S, H, D, C, filter_out_gga(Hand, spades, S)) → U29_ga(Hand, S, H, D, C, filter_in_gga(Hand, hearts, H))
U29_ga(Hand, S, H, D, C, filter_out_gga(Hand, hearts, H)) → U30_ga(Hand, S, H, D, C, filter_in_gga(Hand, diamonds, D))
U30_ga(Hand, S, H, D, C, filter_out_gga(Hand, diamonds, D)) → U31_ga(Hand, S, H, D, C, filter_in_gga(Hand, clubs, C))
U31_ga(Hand, S, H, D, C, filter_out_gga(Hand, clubs, C)) → split_suits_out_ga(Hand, .(=(spades, S), .(=(hearts, H), .(=(diamonds, D), .(=(clubs, C), [])))))
U26_ga(Hand, SortedHand, split_suits_out_ga(Hand, SplitHand)) → U27_ga(Hand, SortedHand, sort_suits_in_ga(SplitHand, SortedHand))
sort_suits_in_ga([], []) → sort_suits_out_ga([], [])
sort_suits_in_ga(.(=(S, Ci), In), .(=(S, Co), Out)) → U35_ga(S, Ci, In, Co, Out, i_sort_in_gga(Ci, [], Co))
i_sort_in_gga([], L, L) → i_sort_out_gga([], L, L)
i_sort_in_gga(.(C1, Cn), Li, Lo) → U37_gga(C1, Cn, Li, Lo, insert_in_gga(C1, Li, Lt))
insert_in_gga(X, [], .(X, [])) → insert_out_gga(X, [], .(X, []))
insert_in_gga(X, .(Y, Z), .(X, .(Y, Z))) → U39_gga(X, Y, Z, higher_in_gg(X, Y))
higher_in_gg(ace, X13) → higher_out_gg(ace, X13)
higher_in_gg(king, X) → U42_gg(X, \==_in_gg(X, ace))
U42_gg(X, \==_out_gg(X, ace)) → higher_out_gg(king, X)
higher_in_gg(queen, X) → U43_gg(X, \==_in_gg(X, ace))
U43_gg(X, \==_out_gg(X, ace)) → U44_gg(X, \==_in_gg(X, king))
U44_gg(X, \==_out_gg(X, king)) → higher_out_gg(queen, X)
higher_in_gg(jack, X) → U45_gg(X, integer_in_g(X))
integer_in_g(X0) → integer_out_g(X0)
U45_gg(X, integer_out_g(X)) → higher_out_gg(jack, X)
higher_in_gg(jack, jack) → higher_out_gg(jack, jack)
higher_in_gg(X, Y) → U46_gg(X, Y, integer_in_g(X))
U46_gg(X, Y, integer_out_g(X)) → U47_gg(X, Y, integer_in_g(Y))
U47_gg(X, Y, integer_out_g(Y)) → U48_gg(X, Y, >=_in_gg(X, Y))
>=_in_gg(X0, X1) → >=_out_gg(X0, X1)
U48_gg(X, Y, >=_out_gg(X, Y)) → higher_out_gg(X, Y)
U39_gga(X, Y, Z, higher_out_gg(X, Y)) → insert_out_gga(X, .(Y, Z), .(X, .(Y, Z)))
insert_in_gga(X, .(Y, Z), .(Y, L)) → U40_gga(X, Y, Z, L, lower_in_gg(X, Y))
lower_in_gg(king, ace) → lower_out_gg(king, ace)
lower_in_gg(queen, X) → U49_gg(X, honor_in_ga(X, N))
honor_in_ga(C, N) → U19_ga(C, N, face_card_in_ga(C, N))
face_card_in_ga(ace, 4) → face_card_out_ga(ace, 4)
face_card_in_ga(king, 3) → face_card_out_ga(king, 3)
face_card_in_ga(queen, 2) → face_card_out_ga(queen, 2)
face_card_in_ga(jack, 1) → face_card_out_ga(jack, 1)
U19_ga(C, N, face_card_out_ga(C, N)) → honor_out_ga(C, N)
honor_in_ga(C, 0) → U20_ga(C, integer_in_g(C))
U20_ga(C, integer_out_g(C)) → honor_out_ga(C, 0)
U49_gg(X, honor_out_ga(X, N)) → U50_gg(X, >_in_gg(N, 2))
>_in_gg(X0, X1) → >_out_gg(X0, X1)
U50_gg(X, >_out_gg(N, 2)) → lower_out_gg(queen, X)
lower_in_gg(jack, X) → U51_gg(X, honor_in_ga(X, N))
U51_gg(X, honor_out_ga(X, N)) → U52_gg(X, >_in_gg(N, 1))
U52_gg(X, >_out_gg(N, 1)) → lower_out_gg(jack, X)
lower_in_gg(X, Y) → U53_gg(X, Y, integer_in_g(X))
U53_gg(X, Y, integer_out_g(X)) → U54_gg(X, Y, honor_in_ga(Y, _M))
U54_gg(X, Y, honor_out_ga(Y, _M)) → lower_out_gg(X, Y)
U53_gg(X, Y, integer_out_g(X)) → U55_gg(X, Y, integer_in_g(Y))
U55_gg(X, Y, integer_out_g(Y)) → U56_gg(X, Y, <_in_gg(X, Y))
<_in_gg(X0, X1) → <_out_gg(X0, X1)
U56_gg(X, Y, <_out_gg(X, Y)) → lower_out_gg(X, Y)
U40_gga(X, Y, Z, L, lower_out_gg(X, Y)) → U41_gga(X, Y, Z, L, insert_in_gga(X, Z, L))
U41_gga(X, Y, Z, L, insert_out_gga(X, Z, L)) → insert_out_gga(X, .(Y, Z), .(Y, L))
U37_gga(C1, Cn, Li, Lo, insert_out_gga(C1, Li, Lt)) → U38_gga(C1, Cn, Li, Lo, i_sort_in_gga(Cn, Lt, Lo))
U38_gga(C1, Cn, Li, Lo, i_sort_out_gga(Cn, Lt, Lo)) → i_sort_out_gga(.(C1, Cn), Li, Lo)
U35_ga(S, Ci, In, Co, Out, i_sort_out_gga(Ci, [], Co)) → U36_ga(S, Ci, In, Co, Out, sort_suits_in_ga(In, Out))
U36_ga(S, Ci, In, Co, Out, sort_suits_out_ga(In, Out)) → sort_suits_out_ga(.(=(S, Ci), In), .(=(S, Co), Out))
U27_ga(Hand, SortedHand, sort_suits_out_ga(SplitHand, SortedHand)) → sort_hand_out_ga(Hand, SortedHand)
U1_gaaa(Hand, Attributes, Points, Bid, sort_hand_out_ga(Hand, SortedHand)) → U2_gaaa(Hand, Attributes, Points, Bid, SortedHand, evaluate_in_gaa(SortedHand, Attributes, Points))
evaluate_in_gaa(Hand, [], P) → U4_gaa(Hand, P, hcp_in_gga(Hand, 0, HCP))
hcp_in_gga([], N, N) → hcp_out_gga([], N, N)
hcp_in_gga(.(=(_X, C), Sn), Ni, No) → U7_gga(_X, C, Sn, Ni, No, hcp_suit_in_ga(C, N))
hcp_suit_in_ga(S, P) → U10_ga(S, P, honors_in_gga(S, 0, HP))
honors_in_gga([], Pi, Pi) → honors_out_gga([], Pi, Pi)
honors_in_gga(.(C1, Cn), Pi, Po) → U14_gga(C1, Cn, Pi, Po, honor_in_ga(C1, P))
U14_gga(C1, Cn, Pi, Po, honor_out_ga(C1, P)) → U15_gga(C1, Cn, Pi, Po, P, >_in_gg(P, 0))
U15_gga(C1, Cn, Pi, Po, P, >_out_gg(P, 0)) → U16_gga(C1, Cn, Pi, Po, is_in_ag(Pt, +(P, Pi)))
is_in_ag(X0, X1) → is_out_ag(X0, X1)
U16_gga(C1, Cn, Pi, Po, is_out_ag(Pt, +(P, Pi))) → U17_gga(C1, Cn, Pi, Po, honors_in_gaa(Cn, Pt, Po))
honors_in_gaa([], Pi, Pi) → honors_out_gaa([], Pi, Pi)
honors_in_gaa(.(C1, Cn), Pi, Po) → U14_gaa(C1, Cn, Pi, Po, honor_in_ga(C1, P))
U14_gaa(C1, Cn, Pi, Po, honor_out_ga(C1, P)) → U15_gaa(C1, Cn, Pi, Po, P, >_in_gg(P, 0))
U15_gaa(C1, Cn, Pi, Po, P, >_out_gg(P, 0)) → U16_gaa(C1, Cn, Pi, Po, is_in_aa(Pt, +(P, Pi)))
is_in_aa(X0, X1) → is_out_aa(X0, X1)
U16_gaa(C1, Cn, Pi, Po, is_out_aa(Pt, +(P, Pi))) → U17_gaa(C1, Cn, Pi, Po, honors_in_gaa(Cn, Pt, Po))
honors_in_gaa(.(C1, Cn), Pi, Pi) → U18_gaa(C1, Cn, Pi, honor_in_gg(C1, 0))
honor_in_gg(C, N) → U19_gg(C, N, face_card_in_gg(C, N))
face_card_in_gg(ace, 4) → face_card_out_gg(ace, 4)
face_card_in_gg(king, 3) → face_card_out_gg(king, 3)
face_card_in_gg(queen, 2) → face_card_out_gg(queen, 2)
face_card_in_gg(jack, 1) → face_card_out_gg(jack, 1)
U19_gg(C, N, face_card_out_gg(C, N)) → honor_out_gg(C, N)
honor_in_gg(C, 0) → U20_gg(C, integer_in_g(C))
U20_gg(C, integer_out_g(C)) → honor_out_gg(C, 0)
U18_gaa(C1, Cn, Pi, honor_out_gg(C1, 0)) → honors_out_gaa(.(C1, Cn), Pi, Pi)
U17_gaa(C1, Cn, Pi, Po, honors_out_gaa(Cn, Pt, Po)) → honors_out_gaa(.(C1, Cn), Pi, Po)
U17_gga(C1, Cn, Pi, Po, honors_out_gaa(Cn, Pt, Po)) → honors_out_gga(.(C1, Cn), Pi, Po)
honors_in_gga(.(C1, Cn), Pi, Pi) → U18_gga(C1, Cn, Pi, honor_in_gg(C1, 0))
U18_gga(C1, Cn, Pi, honor_out_gg(C1, 0)) → honors_out_gga(.(C1, Cn), Pi, Pi)
U10_ga(S, P, honors_out_gga(S, 0, HP)) → U11_ga(S, P, HP, dist_in_ga(S, DP))
dist_in_ga([], 3) → dist_out_ga([], 3)
dist_in_ga(.(X2, []), 2) → dist_out_ga(.(X2, []), 2)
dist_in_ga(.(X3, .(X4, [])), 1) → dist_out_ga(.(X3, .(X4, [])), 1)
dist_in_ga(.(X5, .(X6, .(X7, X8))), 0) → dist_out_ga(.(X5, .(X6, .(X7, X8))), 0)
U11_ga(S, P, HP, dist_out_ga(S, DP)) → U12_ga(S, P, HP, DP, misc_in_ga(S, MP))
misc_in_ga(.(ace, []), -1) → misc_out_ga(.(ace, []), -1)
misc_in_ga(.(king, []), -2) → misc_out_ga(.(king, []), -2)
misc_in_ga(.(queen, .(X9, [])), -2) → misc_out_ga(.(queen, .(X9, [])), -2)
misc_in_ga(.(jack, .(X10, [])), -1) → misc_out_ga(.(jack, .(X10, [])), -1)
misc_in_ga(.(_X, .(_Y, .(H3, Rem))), P) → U21_ga(_X, _Y, H3, Rem, P, honor_in_ga(H3, X))
U21_ga(_X, _Y, H3, Rem, P, honor_out_ga(H3, X)) → U22_ga(_X, _Y, H3, Rem, P, >_in_gg(X, 0))
U22_ga(_X, _Y, H3, Rem, P, >_out_gg(X, 0)) → U23_ga(_X, _Y, H3, Rem, P, length_in_ga(Rem, N))
length_in_ga(X0, X1) → length_out_ga(X0, X1)
U23_ga(_X, _Y, H3, Rem, P, length_out_ga(Rem, N)) → U24_ga(_X, _Y, H3, Rem, P, N, >_in_ag(N, 2))
>_in_ag(X0, X1) → >_out_ag(X0, X1)
U24_ga(_X, _Y, H3, Rem, P, N, >_out_ag(N, 2)) → U25_ga(_X, _Y, H3, Rem, P, is_in_aa(P, -(N, 2)))
U25_ga(_X, _Y, H3, Rem, P, is_out_aa(P, -(N, 2))) → misc_out_ga(.(_X, .(_Y, .(H3, Rem))), P)
misc_in_ga(X11, 0) → misc_out_ga(X11, 0)
U12_ga(S, P, HP, DP, misc_out_ga(S, MP)) → U13_ga(S, P, is_in_aa(P, +(HP, +(DP, MP))))
U13_ga(S, P, is_out_aa(P, +(HP, +(DP, MP)))) → hcp_suit_out_ga(S, P)
U7_gga(_X, C, Sn, Ni, No, hcp_suit_out_ga(C, N)) → U8_gga(_X, C, Sn, Ni, No, is_in_aa(Nt, +(N, Ni)))
U8_gga(_X, C, Sn, Ni, No, is_out_aa(Nt, +(N, Ni))) → U9_gga(_X, C, Sn, Ni, No, hcp_in_gaa(Sn, Nt, No))
hcp_in_gaa([], N, N) → hcp_out_gaa([], N, N)
hcp_in_gaa(.(=(_X, C), Sn), Ni, No) → U7_gaa(_X, C, Sn, Ni, No, hcp_suit_in_ga(C, N))
U7_gaa(_X, C, Sn, Ni, No, hcp_suit_out_ga(C, N)) → U8_gaa(_X, C, Sn, Ni, No, is_in_aa(Nt, +(N, Ni)))
U8_gaa(_X, C, Sn, Ni, No, is_out_aa(Nt, +(N, Ni))) → U9_gaa(_X, C, Sn, Ni, No, hcp_in_gaa(Sn, Nt, No))
U9_gaa(_X, C, Sn, Ni, No, hcp_out_gaa(Sn, Nt, No)) → hcp_out_gaa(.(=(_X, C), Sn), Ni, No)
U9_gga(_X, C, Sn, Ni, No, hcp_out_gaa(Sn, Nt, No)) → hcp_out_gga(.(=(_X, C), Sn), Ni, No)
U4_gaa(Hand, P, hcp_out_gga(Hand, 0, HCP)) → U5_gaa(Hand, P, HCP, adjustments_in_ga(Hand, MP))
adjustments_in_ga(X1, 0) → adjustments_out_ga(X1, 0)
U5_gaa(Hand, P, HCP, adjustments_out_ga(Hand, MP)) → U6_gaa(Hand, P, is_in_aa(P, +(HCP, MP)))
U6_gaa(Hand, P, is_out_aa(P, +(HCP, MP))) → evaluate_out_gaa(Hand, [], P)
U2_gaaa(Hand, Attributes, Points, Bid, SortedHand, evaluate_out_gaa(SortedHand, Attributes, Points)) → U3_gaaa(Hand, Attributes, Points, Bid, make_bid_in_ggaa(SortedHand, Attributes, Points, Bid))
make_bid_in_ggaa(Hand, Attributes, Points, 'punt...') → make_bid_out_ggaa(Hand, Attributes, Points, 'punt...')
U3_gaaa(Hand, Attributes, Points, Bid, make_bid_out_ggaa(SortedHand, Attributes, Points, Bid)) → bid_out_gaaa(Hand, Attributes, Points, Bid)
HCP_IN_GAA(.(=(_X, C), Sn), Ni, No) → U7_GAA(_X, C, Sn, Ni, No, hcp_suit_in_ga(C, N))
U7_GAA(_X, C, Sn, Ni, No, hcp_suit_out_ga(C, N)) → U8_GAA(_X, C, Sn, Ni, No, is_in_aa(Nt, +(N, Ni)))
U8_GAA(_X, C, Sn, Ni, No, is_out_aa(Nt, +(N, Ni))) → HCP_IN_GAA(Sn, Nt, No)
hcp_suit_in_ga(S, P) → U10_ga(S, P, honors_in_gga(S, 0, HP))
is_in_aa(X0, X1) → is_out_aa(X0, X1)
U10_ga(S, P, honors_out_gga(S, 0, HP)) → U11_ga(S, P, HP, dist_in_ga(S, DP))
honors_in_gga([], Pi, Pi) → honors_out_gga([], Pi, Pi)
honors_in_gga(.(C1, Cn), Pi, Po) → U14_gga(C1, Cn, Pi, Po, honor_in_ga(C1, P))
honors_in_gga(.(C1, Cn), Pi, Pi) → U18_gga(C1, Cn, Pi, honor_in_gg(C1, 0))
U11_ga(S, P, HP, dist_out_ga(S, DP)) → U12_ga(S, P, HP, DP, misc_in_ga(S, MP))
U14_gga(C1, Cn, Pi, Po, honor_out_ga(C1, P)) → U15_gga(C1, Cn, Pi, Po, P, >_in_gg(P, 0))
U18_gga(C1, Cn, Pi, honor_out_gg(C1, 0)) → honors_out_gga(.(C1, Cn), Pi, Pi)
dist_in_ga([], 3) → dist_out_ga([], 3)
dist_in_ga(.(X2, []), 2) → dist_out_ga(.(X2, []), 2)
dist_in_ga(.(X3, .(X4, [])), 1) → dist_out_ga(.(X3, .(X4, [])), 1)
dist_in_ga(.(X5, .(X6, .(X7, X8))), 0) → dist_out_ga(.(X5, .(X6, .(X7, X8))), 0)
U12_ga(S, P, HP, DP, misc_out_ga(S, MP)) → U13_ga(S, P, is_in_aa(P, +(HP, +(DP, MP))))
honor_in_ga(C, N) → U19_ga(C, N, face_card_in_ga(C, N))
honor_in_ga(C, 0) → U20_ga(C, integer_in_g(C))
U15_gga(C1, Cn, Pi, Po, P, >_out_gg(P, 0)) → U16_gga(C1, Cn, Pi, Po, is_in_ag(Pt, +(P, Pi)))
honor_in_gg(C, N) → U19_gg(C, N, face_card_in_gg(C, N))
honor_in_gg(C, 0) → U20_gg(C, integer_in_g(C))
misc_in_ga(.(ace, []), -1) → misc_out_ga(.(ace, []), -1)
misc_in_ga(.(king, []), -2) → misc_out_ga(.(king, []), -2)
misc_in_ga(.(queen, .(X9, [])), -2) → misc_out_ga(.(queen, .(X9, [])), -2)
misc_in_ga(.(jack, .(X10, [])), -1) → misc_out_ga(.(jack, .(X10, [])), -1)
misc_in_ga(.(_X, .(_Y, .(H3, Rem))), P) → U21_ga(_X, _Y, H3, Rem, P, honor_in_ga(H3, X))
misc_in_ga(X11, 0) → misc_out_ga(X11, 0)
U13_ga(S, P, is_out_aa(P, +(HP, +(DP, MP)))) → hcp_suit_out_ga(S, P)
U19_ga(C, N, face_card_out_ga(C, N)) → honor_out_ga(C, N)
U20_ga(C, integer_out_g(C)) → honor_out_ga(C, 0)
>_in_gg(X0, X1) → >_out_gg(X0, X1)
U16_gga(C1, Cn, Pi, Po, is_out_ag(Pt, +(P, Pi))) → U17_gga(C1, Cn, Pi, Po, honors_in_gaa(Cn, Pt, Po))
U19_gg(C, N, face_card_out_gg(C, N)) → honor_out_gg(C, N)
U20_gg(C, integer_out_g(C)) → honor_out_gg(C, 0)
U21_ga(_X, _Y, H3, Rem, P, honor_out_ga(H3, X)) → U22_ga(_X, _Y, H3, Rem, P, >_in_gg(X, 0))
face_card_in_ga(ace, 4) → face_card_out_ga(ace, 4)
face_card_in_ga(king, 3) → face_card_out_ga(king, 3)
face_card_in_ga(queen, 2) → face_card_out_ga(queen, 2)
face_card_in_ga(jack, 1) → face_card_out_ga(jack, 1)
integer_in_g(X0) → integer_out_g(X0)
is_in_ag(X0, X1) → is_out_ag(X0, X1)
U17_gga(C1, Cn, Pi, Po, honors_out_gaa(Cn, Pt, Po)) → honors_out_gga(.(C1, Cn), Pi, Po)
face_card_in_gg(ace, 4) → face_card_out_gg(ace, 4)
face_card_in_gg(king, 3) → face_card_out_gg(king, 3)
face_card_in_gg(queen, 2) → face_card_out_gg(queen, 2)
face_card_in_gg(jack, 1) → face_card_out_gg(jack, 1)
U22_ga(_X, _Y, H3, Rem, P, >_out_gg(X, 0)) → U23_ga(_X, _Y, H3, Rem, P, length_in_ga(Rem, N))
honors_in_gaa([], Pi, Pi) → honors_out_gaa([], Pi, Pi)
honors_in_gaa(.(C1, Cn), Pi, Po) → U14_gaa(C1, Cn, Pi, Po, honor_in_ga(C1, P))
honors_in_gaa(.(C1, Cn), Pi, Pi) → U18_gaa(C1, Cn, Pi, honor_in_gg(C1, 0))
U23_ga(_X, _Y, H3, Rem, P, length_out_ga(Rem, N)) → U24_ga(_X, _Y, H3, Rem, P, N, >_in_ag(N, 2))
U14_gaa(C1, Cn, Pi, Po, honor_out_ga(C1, P)) → U15_gaa(C1, Cn, Pi, Po, P, >_in_gg(P, 0))
U18_gaa(C1, Cn, Pi, honor_out_gg(C1, 0)) → honors_out_gaa(.(C1, Cn), Pi, Pi)
length_in_ga(X0, X1) → length_out_ga(X0, X1)
U24_ga(_X, _Y, H3, Rem, P, N, >_out_ag(N, 2)) → U25_ga(_X, _Y, H3, Rem, P, is_in_aa(P, -(N, 2)))
U15_gaa(C1, Cn, Pi, Po, P, >_out_gg(P, 0)) → U16_gaa(C1, Cn, Pi, Po, is_in_aa(Pt, +(P, Pi)))
>_in_ag(X0, X1) → >_out_ag(X0, X1)
U25_ga(_X, _Y, H3, Rem, P, is_out_aa(P, -(N, 2))) → misc_out_ga(.(_X, .(_Y, .(H3, Rem))), P)
U16_gaa(C1, Cn, Pi, Po, is_out_aa(Pt, +(P, Pi))) → U17_gaa(C1, Cn, Pi, Po, honors_in_gaa(Cn, Pt, Po))
U17_gaa(C1, Cn, Pi, Po, honors_out_gaa(Cn, Pt, Po)) → honors_out_gaa(.(C1, Cn), Pi, Po)
HCP_IN_GAA(.(=(_X, C), Sn)) → U7_GAA(Sn, hcp_suit_in_ga(C))
U7_GAA(Sn, hcp_suit_out_ga) → U8_GAA(Sn, is_in_aa)
U8_GAA(Sn, is_out_aa) → HCP_IN_GAA(Sn)
hcp_suit_in_ga(S) → U10_ga(S, honors_in_gga(S, 0))
is_in_aa → is_out_aa
U10_ga(S, honors_out_gga) → U11_ga(S, dist_in_ga(S))
honors_in_gga([], Pi) → honors_out_gga
honors_in_gga(.(C1, Cn), Pi) → U14_gga(Cn, Pi, honor_in_ga(C1))
honors_in_gga(.(C1, Cn), Pi) → U18_gga(honor_in_gg(C1, 0))
U11_ga(S, dist_out_ga(DP)) → U12_ga(misc_in_ga(S))
U14_gga(Cn, Pi, honor_out_ga(P)) → U15_gga(Cn, Pi, P, >_in_gg(P, 0))
U18_gga(honor_out_gg) → honors_out_gga
dist_in_ga([]) → dist_out_ga(3)
dist_in_ga(.(X2, [])) → dist_out_ga(2)
dist_in_ga(.(X3, .(X4, []))) → dist_out_ga(1)
dist_in_ga(.(X5, .(X6, .(X7, X8)))) → dist_out_ga(0)
U12_ga(misc_out_ga) → U13_ga(is_in_aa)
honor_in_ga(C) → U19_ga(face_card_in_ga(C))
honor_in_ga(C) → U20_ga(integer_in_g(C))
U15_gga(Cn, Pi, P, >_out_gg) → U16_gga(Cn, is_in_ag(+(P, Pi)))
honor_in_gg(C, N) → U19_gg(face_card_in_gg(C, N))
honor_in_gg(C, 0) → U20_gg(integer_in_g(C))
misc_in_ga(.(ace, [])) → misc_out_ga
misc_in_ga(.(king, [])) → misc_out_ga
misc_in_ga(.(queen, .(X9, []))) → misc_out_ga
misc_in_ga(.(jack, .(X10, []))) → misc_out_ga
misc_in_ga(.(_X, .(_Y, .(H3, Rem)))) → U21_ga(Rem, honor_in_ga(H3))
misc_in_ga(X11) → misc_out_ga
U13_ga(is_out_aa) → hcp_suit_out_ga
U19_ga(face_card_out_ga(N)) → honor_out_ga(N)
U20_ga(integer_out_g) → honor_out_ga(0)
>_in_gg(X0, X1) → >_out_gg
U16_gga(Cn, is_out_ag) → U17_gga(honors_in_gaa(Cn))
U19_gg(face_card_out_gg) → honor_out_gg
U20_gg(integer_out_g) → honor_out_gg
U21_ga(Rem, honor_out_ga(X)) → U22_ga(Rem, >_in_gg(X, 0))
face_card_in_ga(ace) → face_card_out_ga(4)
face_card_in_ga(king) → face_card_out_ga(3)
face_card_in_ga(queen) → face_card_out_ga(2)
face_card_in_ga(jack) → face_card_out_ga(1)
integer_in_g(X0) → integer_out_g
is_in_ag(X1) → is_out_ag
U17_gga(honors_out_gaa) → honors_out_gga
face_card_in_gg(ace, 4) → face_card_out_gg
face_card_in_gg(king, 3) → face_card_out_gg
face_card_in_gg(queen, 2) → face_card_out_gg
face_card_in_gg(jack, 1) → face_card_out_gg
U22_ga(Rem, >_out_gg) → U23_ga(length_in_ga(Rem))
honors_in_gaa([]) → honors_out_gaa
honors_in_gaa(.(C1, Cn)) → U14_gaa(Cn, honor_in_ga(C1))
honors_in_gaa(.(C1, Cn)) → U18_gaa(honor_in_gg(C1, 0))
U23_ga(length_out_ga) → U24_ga(>_in_ag(2))
U14_gaa(Cn, honor_out_ga(P)) → U15_gaa(Cn, >_in_gg(P, 0))
U18_gaa(honor_out_gg) → honors_out_gaa
length_in_ga(X0) → length_out_ga
U24_ga(>_out_ag) → U25_ga(is_in_aa)
U15_gaa(Cn, >_out_gg) → U16_gaa(Cn, is_in_aa)
>_in_ag(X1) → >_out_ag
U25_ga(is_out_aa) → misc_out_ga
U16_gaa(Cn, is_out_aa) → U17_gaa(honors_in_gaa(Cn))
U17_gaa(honors_out_gaa) → honors_out_gaa
hcp_suit_in_ga(x0)
is_in_aa
U10_ga(x0, x1)
honors_in_gga(x0, x1)
U11_ga(x0, x1)
U14_gga(x0, x1, x2)
U18_gga(x0)
dist_in_ga(x0)
U12_ga(x0)
honor_in_ga(x0)
U15_gga(x0, x1, x2, x3)
honor_in_gg(x0, x1)
misc_in_ga(x0)
U13_ga(x0)
U19_ga(x0)
U20_ga(x0)
>_in_gg(x0, x1)
U16_gga(x0, x1)
U19_gg(x0)
U20_gg(x0)
U21_ga(x0, x1)
face_card_in_ga(x0)
integer_in_g(x0)
is_in_ag(x0)
U17_gga(x0)
face_card_in_gg(x0, x1)
U22_ga(x0, x1)
honors_in_gaa(x0)
U23_ga(x0)
U14_gaa(x0, x1)
U18_gaa(x0)
length_in_ga(x0)
U24_ga(x0)
U15_gaa(x0, x1)
>_in_ag(x0)
U25_ga(x0)
U16_gaa(x0, x1)
U17_gaa(x0)
From the DPs we obtained the following set of size-change graphs:
INSERT_IN_GGA(X, .(Y, Z), .(Y, L)) → U40_GGA(X, Y, Z, L, lower_in_gg(X, Y))
U40_GGA(X, Y, Z, L, lower_out_gg(X, Y)) → INSERT_IN_GGA(X, Z, L)
bid_in_gaaa(Hand, Attributes, Points, Bid) → U1_gaaa(Hand, Attributes, Points, Bid, sort_hand_in_ga(Hand, SortedHand))
sort_hand_in_ga(Hand, SortedHand) → U26_ga(Hand, SortedHand, split_suits_in_ga(Hand, SplitHand))
split_suits_in_ga(Hand, .(=(spades, S), .(=(hearts, H), .(=(diamonds, D), .(=(clubs, C), []))))) → U28_ga(Hand, S, H, D, C, filter_in_gga(Hand, spades, S))
filter_in_gga([], X12, []) → filter_out_gga([], X12, [])
filter_in_gga(.(-(Card, Suit), In), Suit, .(Card, Out)) → U32_gga(Card, Suit, In, Out, filter_in_gga(In, Suit, Out))
filter_in_gga(.(-(_A, X), In), Suit, Out) → U33_gga(_A, X, In, Suit, Out, \==_in_gg(Suit, X))
\==_in_gg(X0, X1) → \==_out_gg(X0, X1)
U33_gga(_A, X, In, Suit, Out, \==_out_gg(Suit, X)) → U34_gga(_A, X, In, Suit, Out, filter_in_gga(In, Suit, Out))
U34_gga(_A, X, In, Suit, Out, filter_out_gga(In, Suit, Out)) → filter_out_gga(.(-(_A, X), In), Suit, Out)
U32_gga(Card, Suit, In, Out, filter_out_gga(In, Suit, Out)) → filter_out_gga(.(-(Card, Suit), In), Suit, .(Card, Out))
U28_ga(Hand, S, H, D, C, filter_out_gga(Hand, spades, S)) → U29_ga(Hand, S, H, D, C, filter_in_gga(Hand, hearts, H))
U29_ga(Hand, S, H, D, C, filter_out_gga(Hand, hearts, H)) → U30_ga(Hand, S, H, D, C, filter_in_gga(Hand, diamonds, D))
U30_ga(Hand, S, H, D, C, filter_out_gga(Hand, diamonds, D)) → U31_ga(Hand, S, H, D, C, filter_in_gga(Hand, clubs, C))
U31_ga(Hand, S, H, D, C, filter_out_gga(Hand, clubs, C)) → split_suits_out_ga(Hand, .(=(spades, S), .(=(hearts, H), .(=(diamonds, D), .(=(clubs, C), [])))))
U26_ga(Hand, SortedHand, split_suits_out_ga(Hand, SplitHand)) → U27_ga(Hand, SortedHand, sort_suits_in_ga(SplitHand, SortedHand))
sort_suits_in_ga([], []) → sort_suits_out_ga([], [])
sort_suits_in_ga(.(=(S, Ci), In), .(=(S, Co), Out)) → U35_ga(S, Ci, In, Co, Out, i_sort_in_gga(Ci, [], Co))
i_sort_in_gga([], L, L) → i_sort_out_gga([], L, L)
i_sort_in_gga(.(C1, Cn), Li, Lo) → U37_gga(C1, Cn, Li, Lo, insert_in_gga(C1, Li, Lt))
insert_in_gga(X, [], .(X, [])) → insert_out_gga(X, [], .(X, []))
insert_in_gga(X, .(Y, Z), .(X, .(Y, Z))) → U39_gga(X, Y, Z, higher_in_gg(X, Y))
higher_in_gg(ace, X13) → higher_out_gg(ace, X13)
higher_in_gg(king, X) → U42_gg(X, \==_in_gg(X, ace))
U42_gg(X, \==_out_gg(X, ace)) → higher_out_gg(king, X)
higher_in_gg(queen, X) → U43_gg(X, \==_in_gg(X, ace))
U43_gg(X, \==_out_gg(X, ace)) → U44_gg(X, \==_in_gg(X, king))
U44_gg(X, \==_out_gg(X, king)) → higher_out_gg(queen, X)
higher_in_gg(jack, X) → U45_gg(X, integer_in_g(X))
integer_in_g(X0) → integer_out_g(X0)
U45_gg(X, integer_out_g(X)) → higher_out_gg(jack, X)
higher_in_gg(jack, jack) → higher_out_gg(jack, jack)
higher_in_gg(X, Y) → U46_gg(X, Y, integer_in_g(X))
U46_gg(X, Y, integer_out_g(X)) → U47_gg(X, Y, integer_in_g(Y))
U47_gg(X, Y, integer_out_g(Y)) → U48_gg(X, Y, >=_in_gg(X, Y))
>=_in_gg(X0, X1) → >=_out_gg(X0, X1)
U48_gg(X, Y, >=_out_gg(X, Y)) → higher_out_gg(X, Y)
U39_gga(X, Y, Z, higher_out_gg(X, Y)) → insert_out_gga(X, .(Y, Z), .(X, .(Y, Z)))
insert_in_gga(X, .(Y, Z), .(Y, L)) → U40_gga(X, Y, Z, L, lower_in_gg(X, Y))
lower_in_gg(king, ace) → lower_out_gg(king, ace)
lower_in_gg(queen, X) → U49_gg(X, honor_in_ga(X, N))
honor_in_ga(C, N) → U19_ga(C, N, face_card_in_ga(C, N))
face_card_in_ga(ace, 4) → face_card_out_ga(ace, 4)
face_card_in_ga(king, 3) → face_card_out_ga(king, 3)
face_card_in_ga(queen, 2) → face_card_out_ga(queen, 2)
face_card_in_ga(jack, 1) → face_card_out_ga(jack, 1)
U19_ga(C, N, face_card_out_ga(C, N)) → honor_out_ga(C, N)
honor_in_ga(C, 0) → U20_ga(C, integer_in_g(C))
U20_ga(C, integer_out_g(C)) → honor_out_ga(C, 0)
U49_gg(X, honor_out_ga(X, N)) → U50_gg(X, >_in_gg(N, 2))
>_in_gg(X0, X1) → >_out_gg(X0, X1)
U50_gg(X, >_out_gg(N, 2)) → lower_out_gg(queen, X)
lower_in_gg(jack, X) → U51_gg(X, honor_in_ga(X, N))
U51_gg(X, honor_out_ga(X, N)) → U52_gg(X, >_in_gg(N, 1))
U52_gg(X, >_out_gg(N, 1)) → lower_out_gg(jack, X)
lower_in_gg(X, Y) → U53_gg(X, Y, integer_in_g(X))
U53_gg(X, Y, integer_out_g(X)) → U54_gg(X, Y, honor_in_ga(Y, _M))
U54_gg(X, Y, honor_out_ga(Y, _M)) → lower_out_gg(X, Y)
U53_gg(X, Y, integer_out_g(X)) → U55_gg(X, Y, integer_in_g(Y))
U55_gg(X, Y, integer_out_g(Y)) → U56_gg(X, Y, <_in_gg(X, Y))
<_in_gg(X0, X1) → <_out_gg(X0, X1)
U56_gg(X, Y, <_out_gg(X, Y)) → lower_out_gg(X, Y)
U40_gga(X, Y, Z, L, lower_out_gg(X, Y)) → U41_gga(X, Y, Z, L, insert_in_gga(X, Z, L))
U41_gga(X, Y, Z, L, insert_out_gga(X, Z, L)) → insert_out_gga(X, .(Y, Z), .(Y, L))
U37_gga(C1, Cn, Li, Lo, insert_out_gga(C1, Li, Lt)) → U38_gga(C1, Cn, Li, Lo, i_sort_in_gga(Cn, Lt, Lo))
U38_gga(C1, Cn, Li, Lo, i_sort_out_gga(Cn, Lt, Lo)) → i_sort_out_gga(.(C1, Cn), Li, Lo)
U35_ga(S, Ci, In, Co, Out, i_sort_out_gga(Ci, [], Co)) → U36_ga(S, Ci, In, Co, Out, sort_suits_in_ga(In, Out))
U36_ga(S, Ci, In, Co, Out, sort_suits_out_ga(In, Out)) → sort_suits_out_ga(.(=(S, Ci), In), .(=(S, Co), Out))
U27_ga(Hand, SortedHand, sort_suits_out_ga(SplitHand, SortedHand)) → sort_hand_out_ga(Hand, SortedHand)
U1_gaaa(Hand, Attributes, Points, Bid, sort_hand_out_ga(Hand, SortedHand)) → U2_gaaa(Hand, Attributes, Points, Bid, SortedHand, evaluate_in_gaa(SortedHand, Attributes, Points))
evaluate_in_gaa(Hand, [], P) → U4_gaa(Hand, P, hcp_in_gga(Hand, 0, HCP))
hcp_in_gga([], N, N) → hcp_out_gga([], N, N)
hcp_in_gga(.(=(_X, C), Sn), Ni, No) → U7_gga(_X, C, Sn, Ni, No, hcp_suit_in_ga(C, N))
hcp_suit_in_ga(S, P) → U10_ga(S, P, honors_in_gga(S, 0, HP))
honors_in_gga([], Pi, Pi) → honors_out_gga([], Pi, Pi)
honors_in_gga(.(C1, Cn), Pi, Po) → U14_gga(C1, Cn, Pi, Po, honor_in_ga(C1, P))
U14_gga(C1, Cn, Pi, Po, honor_out_ga(C1, P)) → U15_gga(C1, Cn, Pi, Po, P, >_in_gg(P, 0))
U15_gga(C1, Cn, Pi, Po, P, >_out_gg(P, 0)) → U16_gga(C1, Cn, Pi, Po, is_in_ag(Pt, +(P, Pi)))
is_in_ag(X0, X1) → is_out_ag(X0, X1)
U16_gga(C1, Cn, Pi, Po, is_out_ag(Pt, +(P, Pi))) → U17_gga(C1, Cn, Pi, Po, honors_in_gaa(Cn, Pt, Po))
honors_in_gaa([], Pi, Pi) → honors_out_gaa([], Pi, Pi)
honors_in_gaa(.(C1, Cn), Pi, Po) → U14_gaa(C1, Cn, Pi, Po, honor_in_ga(C1, P))
U14_gaa(C1, Cn, Pi, Po, honor_out_ga(C1, P)) → U15_gaa(C1, Cn, Pi, Po, P, >_in_gg(P, 0))
U15_gaa(C1, Cn, Pi, Po, P, >_out_gg(P, 0)) → U16_gaa(C1, Cn, Pi, Po, is_in_aa(Pt, +(P, Pi)))
is_in_aa(X0, X1) → is_out_aa(X0, X1)
U16_gaa(C1, Cn, Pi, Po, is_out_aa(Pt, +(P, Pi))) → U17_gaa(C1, Cn, Pi, Po, honors_in_gaa(Cn, Pt, Po))
honors_in_gaa(.(C1, Cn), Pi, Pi) → U18_gaa(C1, Cn, Pi, honor_in_gg(C1, 0))
honor_in_gg(C, N) → U19_gg(C, N, face_card_in_gg(C, N))
face_card_in_gg(ace, 4) → face_card_out_gg(ace, 4)
face_card_in_gg(king, 3) → face_card_out_gg(king, 3)
face_card_in_gg(queen, 2) → face_card_out_gg(queen, 2)
face_card_in_gg(jack, 1) → face_card_out_gg(jack, 1)
U19_gg(C, N, face_card_out_gg(C, N)) → honor_out_gg(C, N)
honor_in_gg(C, 0) → U20_gg(C, integer_in_g(C))
U20_gg(C, integer_out_g(C)) → honor_out_gg(C, 0)
U18_gaa(C1, Cn, Pi, honor_out_gg(C1, 0)) → honors_out_gaa(.(C1, Cn), Pi, Pi)
U17_gaa(C1, Cn, Pi, Po, honors_out_gaa(Cn, Pt, Po)) → honors_out_gaa(.(C1, Cn), Pi, Po)
U17_gga(C1, Cn, Pi, Po, honors_out_gaa(Cn, Pt, Po)) → honors_out_gga(.(C1, Cn), Pi, Po)
honors_in_gga(.(C1, Cn), Pi, Pi) → U18_gga(C1, Cn, Pi, honor_in_gg(C1, 0))
U18_gga(C1, Cn, Pi, honor_out_gg(C1, 0)) → honors_out_gga(.(C1, Cn), Pi, Pi)
U10_ga(S, P, honors_out_gga(S, 0, HP)) → U11_ga(S, P, HP, dist_in_ga(S, DP))
dist_in_ga([], 3) → dist_out_ga([], 3)
dist_in_ga(.(X2, []), 2) → dist_out_ga(.(X2, []), 2)
dist_in_ga(.(X3, .(X4, [])), 1) → dist_out_ga(.(X3, .(X4, [])), 1)
dist_in_ga(.(X5, .(X6, .(X7, X8))), 0) → dist_out_ga(.(X5, .(X6, .(X7, X8))), 0)
U11_ga(S, P, HP, dist_out_ga(S, DP)) → U12_ga(S, P, HP, DP, misc_in_ga(S, MP))
misc_in_ga(.(ace, []), -1) → misc_out_ga(.(ace, []), -1)
misc_in_ga(.(king, []), -2) → misc_out_ga(.(king, []), -2)
misc_in_ga(.(queen, .(X9, [])), -2) → misc_out_ga(.(queen, .(X9, [])), -2)
misc_in_ga(.(jack, .(X10, [])), -1) → misc_out_ga(.(jack, .(X10, [])), -1)
misc_in_ga(.(_X, .(_Y, .(H3, Rem))), P) → U21_ga(_X, _Y, H3, Rem, P, honor_in_ga(H3, X))
U21_ga(_X, _Y, H3, Rem, P, honor_out_ga(H3, X)) → U22_ga(_X, _Y, H3, Rem, P, >_in_gg(X, 0))
U22_ga(_X, _Y, H3, Rem, P, >_out_gg(X, 0)) → U23_ga(_X, _Y, H3, Rem, P, length_in_ga(Rem, N))
length_in_ga(X0, X1) → length_out_ga(X0, X1)
U23_ga(_X, _Y, H3, Rem, P, length_out_ga(Rem, N)) → U24_ga(_X, _Y, H3, Rem, P, N, >_in_ag(N, 2))
>_in_ag(X0, X1) → >_out_ag(X0, X1)
U24_ga(_X, _Y, H3, Rem, P, N, >_out_ag(N, 2)) → U25_ga(_X, _Y, H3, Rem, P, is_in_aa(P, -(N, 2)))
U25_ga(_X, _Y, H3, Rem, P, is_out_aa(P, -(N, 2))) → misc_out_ga(.(_X, .(_Y, .(H3, Rem))), P)
misc_in_ga(X11, 0) → misc_out_ga(X11, 0)
U12_ga(S, P, HP, DP, misc_out_ga(S, MP)) → U13_ga(S, P, is_in_aa(P, +(HP, +(DP, MP))))
U13_ga(S, P, is_out_aa(P, +(HP, +(DP, MP)))) → hcp_suit_out_ga(S, P)
U7_gga(_X, C, Sn, Ni, No, hcp_suit_out_ga(C, N)) → U8_gga(_X, C, Sn, Ni, No, is_in_aa(Nt, +(N, Ni)))
U8_gga(_X, C, Sn, Ni, No, is_out_aa(Nt, +(N, Ni))) → U9_gga(_X, C, Sn, Ni, No, hcp_in_gaa(Sn, Nt, No))
hcp_in_gaa([], N, N) → hcp_out_gaa([], N, N)
hcp_in_gaa(.(=(_X, C), Sn), Ni, No) → U7_gaa(_X, C, Sn, Ni, No, hcp_suit_in_ga(C, N))
U7_gaa(_X, C, Sn, Ni, No, hcp_suit_out_ga(C, N)) → U8_gaa(_X, C, Sn, Ni, No, is_in_aa(Nt, +(N, Ni)))
U8_gaa(_X, C, Sn, Ni, No, is_out_aa(Nt, +(N, Ni))) → U9_gaa(_X, C, Sn, Ni, No, hcp_in_gaa(Sn, Nt, No))
U9_gaa(_X, C, Sn, Ni, No, hcp_out_gaa(Sn, Nt, No)) → hcp_out_gaa(.(=(_X, C), Sn), Ni, No)
U9_gga(_X, C, Sn, Ni, No, hcp_out_gaa(Sn, Nt, No)) → hcp_out_gga(.(=(_X, C), Sn), Ni, No)
U4_gaa(Hand, P, hcp_out_gga(Hand, 0, HCP)) → U5_gaa(Hand, P, HCP, adjustments_in_ga(Hand, MP))
adjustments_in_ga(X1, 0) → adjustments_out_ga(X1, 0)
U5_gaa(Hand, P, HCP, adjustments_out_ga(Hand, MP)) → U6_gaa(Hand, P, is_in_aa(P, +(HCP, MP)))
U6_gaa(Hand, P, is_out_aa(P, +(HCP, MP))) → evaluate_out_gaa(Hand, [], P)
U2_gaaa(Hand, Attributes, Points, Bid, SortedHand, evaluate_out_gaa(SortedHand, Attributes, Points)) → U3_gaaa(Hand, Attributes, Points, Bid, make_bid_in_ggaa(SortedHand, Attributes, Points, Bid))
make_bid_in_ggaa(Hand, Attributes, Points, 'punt...') → make_bid_out_ggaa(Hand, Attributes, Points, 'punt...')
U3_gaaa(Hand, Attributes, Points, Bid, make_bid_out_ggaa(SortedHand, Attributes, Points, Bid)) → bid_out_gaaa(Hand, Attributes, Points, Bid)
INSERT_IN_GGA(X, .(Y, Z), .(Y, L)) → U40_GGA(X, Y, Z, L, lower_in_gg(X, Y))
U40_GGA(X, Y, Z, L, lower_out_gg(X, Y)) → INSERT_IN_GGA(X, Z, L)
lower_in_gg(king, ace) → lower_out_gg(king, ace)
lower_in_gg(queen, X) → U49_gg(X, honor_in_ga(X, N))
lower_in_gg(jack, X) → U51_gg(X, honor_in_ga(X, N))
lower_in_gg(X, Y) → U53_gg(X, Y, integer_in_g(X))
U49_gg(X, honor_out_ga(X, N)) → U50_gg(X, >_in_gg(N, 2))
U51_gg(X, honor_out_ga(X, N)) → U52_gg(X, >_in_gg(N, 1))
U53_gg(X, Y, integer_out_g(X)) → U54_gg(X, Y, honor_in_ga(Y, _M))
U53_gg(X, Y, integer_out_g(X)) → U55_gg(X, Y, integer_in_g(Y))
honor_in_ga(C, N) → U19_ga(C, N, face_card_in_ga(C, N))
honor_in_ga(C, 0) → U20_ga(C, integer_in_g(C))
U50_gg(X, >_out_gg(N, 2)) → lower_out_gg(queen, X)
U52_gg(X, >_out_gg(N, 1)) → lower_out_gg(jack, X)
integer_in_g(X0) → integer_out_g(X0)
U54_gg(X, Y, honor_out_ga(Y, _M)) → lower_out_gg(X, Y)
U55_gg(X, Y, integer_out_g(Y)) → U56_gg(X, Y, <_in_gg(X, Y))
U19_ga(C, N, face_card_out_ga(C, N)) → honor_out_ga(C, N)
U20_ga(C, integer_out_g(C)) → honor_out_ga(C, 0)
>_in_gg(X0, X1) → >_out_gg(X0, X1)
U56_gg(X, Y, <_out_gg(X, Y)) → lower_out_gg(X, Y)
face_card_in_ga(ace, 4) → face_card_out_ga(ace, 4)
face_card_in_ga(king, 3) → face_card_out_ga(king, 3)
face_card_in_ga(queen, 2) → face_card_out_ga(queen, 2)
face_card_in_ga(jack, 1) → face_card_out_ga(jack, 1)
<_in_gg(X0, X1) → <_out_gg(X0, X1)
INSERT_IN_GGA(X, .(Y, Z)) → U40_GGA(X, Y, Z, lower_in_gg(X, Y))
U40_GGA(X, Y, Z, lower_out_gg) → INSERT_IN_GGA(X, Z)
lower_in_gg(king, ace) → lower_out_gg
lower_in_gg(queen, X) → U49_gg(honor_in_ga(X))
lower_in_gg(jack, X) → U51_gg(honor_in_ga(X))
lower_in_gg(X, Y) → U53_gg(X, Y, integer_in_g(X))
U49_gg(honor_out_ga(N)) → U50_gg(>_in_gg(N, 2))
U51_gg(honor_out_ga(N)) → U52_gg(>_in_gg(N, 1))
U53_gg(X, Y, integer_out_g) → U54_gg(honor_in_ga(Y))
U53_gg(X, Y, integer_out_g) → U55_gg(X, Y, integer_in_g(Y))
honor_in_ga(C) → U19_ga(face_card_in_ga(C))
honor_in_ga(C) → U20_ga(integer_in_g(C))
U50_gg(>_out_gg) → lower_out_gg
U52_gg(>_out_gg) → lower_out_gg
integer_in_g(X0) → integer_out_g
U54_gg(honor_out_ga(_M)) → lower_out_gg
U55_gg(X, Y, integer_out_g) → U56_gg(<_in_gg(X, Y))
U19_ga(face_card_out_ga(N)) → honor_out_ga(N)
U20_ga(integer_out_g) → honor_out_ga(0)
>_in_gg(X0, X1) → >_out_gg
U56_gg(<_out_gg) → lower_out_gg
face_card_in_ga(ace) → face_card_out_ga(4)
face_card_in_ga(king) → face_card_out_ga(3)
face_card_in_ga(queen) → face_card_out_ga(2)
face_card_in_ga(jack) → face_card_out_ga(1)
<_in_gg(X0, X1) → <_out_gg
lower_in_gg(x0, x1)
U49_gg(x0)
U51_gg(x0)
U53_gg(x0, x1, x2)
honor_in_ga(x0)
U50_gg(x0)
U52_gg(x0)
integer_in_g(x0)
U54_gg(x0)
U55_gg(x0, x1, x2)
U19_ga(x0)
U20_ga(x0)
>_in_gg(x0, x1)
U56_gg(x0)
face_card_in_ga(x0)
<_in_gg(x0, x1)
From the DPs we obtained the following set of size-change graphs:
U37_GGA(C1, Cn, Li, Lo, insert_out_gga(C1, Li, Lt)) → I_SORT_IN_GGA(Cn, Lt, Lo)
I_SORT_IN_GGA(.(C1, Cn), Li, Lo) → U37_GGA(C1, Cn, Li, Lo, insert_in_gga(C1, Li, Lt))
bid_in_gaaa(Hand, Attributes, Points, Bid) → U1_gaaa(Hand, Attributes, Points, Bid, sort_hand_in_ga(Hand, SortedHand))
sort_hand_in_ga(Hand, SortedHand) → U26_ga(Hand, SortedHand, split_suits_in_ga(Hand, SplitHand))
split_suits_in_ga(Hand, .(=(spades, S), .(=(hearts, H), .(=(diamonds, D), .(=(clubs, C), []))))) → U28_ga(Hand, S, H, D, C, filter_in_gga(Hand, spades, S))
filter_in_gga([], X12, []) → filter_out_gga([], X12, [])
filter_in_gga(.(-(Card, Suit), In), Suit, .(Card, Out)) → U32_gga(Card, Suit, In, Out, filter_in_gga(In, Suit, Out))
filter_in_gga(.(-(_A, X), In), Suit, Out) → U33_gga(_A, X, In, Suit, Out, \==_in_gg(Suit, X))
\==_in_gg(X0, X1) → \==_out_gg(X0, X1)
U33_gga(_A, X, In, Suit, Out, \==_out_gg(Suit, X)) → U34_gga(_A, X, In, Suit, Out, filter_in_gga(In, Suit, Out))
U34_gga(_A, X, In, Suit, Out, filter_out_gga(In, Suit, Out)) → filter_out_gga(.(-(_A, X), In), Suit, Out)
U32_gga(Card, Suit, In, Out, filter_out_gga(In, Suit, Out)) → filter_out_gga(.(-(Card, Suit), In), Suit, .(Card, Out))
U28_ga(Hand, S, H, D, C, filter_out_gga(Hand, spades, S)) → U29_ga(Hand, S, H, D, C, filter_in_gga(Hand, hearts, H))
U29_ga(Hand, S, H, D, C, filter_out_gga(Hand, hearts, H)) → U30_ga(Hand, S, H, D, C, filter_in_gga(Hand, diamonds, D))
U30_ga(Hand, S, H, D, C, filter_out_gga(Hand, diamonds, D)) → U31_ga(Hand, S, H, D, C, filter_in_gga(Hand, clubs, C))
U31_ga(Hand, S, H, D, C, filter_out_gga(Hand, clubs, C)) → split_suits_out_ga(Hand, .(=(spades, S), .(=(hearts, H), .(=(diamonds, D), .(=(clubs, C), [])))))
U26_ga(Hand, SortedHand, split_suits_out_ga(Hand, SplitHand)) → U27_ga(Hand, SortedHand, sort_suits_in_ga(SplitHand, SortedHand))
sort_suits_in_ga([], []) → sort_suits_out_ga([], [])
sort_suits_in_ga(.(=(S, Ci), In), .(=(S, Co), Out)) → U35_ga(S, Ci, In, Co, Out, i_sort_in_gga(Ci, [], Co))
i_sort_in_gga([], L, L) → i_sort_out_gga([], L, L)
i_sort_in_gga(.(C1, Cn), Li, Lo) → U37_gga(C1, Cn, Li, Lo, insert_in_gga(C1, Li, Lt))
insert_in_gga(X, [], .(X, [])) → insert_out_gga(X, [], .(X, []))
insert_in_gga(X, .(Y, Z), .(X, .(Y, Z))) → U39_gga(X, Y, Z, higher_in_gg(X, Y))
higher_in_gg(ace, X13) → higher_out_gg(ace, X13)
higher_in_gg(king, X) → U42_gg(X, \==_in_gg(X, ace))
U42_gg(X, \==_out_gg(X, ace)) → higher_out_gg(king, X)
higher_in_gg(queen, X) → U43_gg(X, \==_in_gg(X, ace))
U43_gg(X, \==_out_gg(X, ace)) → U44_gg(X, \==_in_gg(X, king))
U44_gg(X, \==_out_gg(X, king)) → higher_out_gg(queen, X)
higher_in_gg(jack, X) → U45_gg(X, integer_in_g(X))
integer_in_g(X0) → integer_out_g(X0)
U45_gg(X, integer_out_g(X)) → higher_out_gg(jack, X)
higher_in_gg(jack, jack) → higher_out_gg(jack, jack)
higher_in_gg(X, Y) → U46_gg(X, Y, integer_in_g(X))
U46_gg(X, Y, integer_out_g(X)) → U47_gg(X, Y, integer_in_g(Y))
U47_gg(X, Y, integer_out_g(Y)) → U48_gg(X, Y, >=_in_gg(X, Y))
>=_in_gg(X0, X1) → >=_out_gg(X0, X1)
U48_gg(X, Y, >=_out_gg(X, Y)) → higher_out_gg(X, Y)
U39_gga(X, Y, Z, higher_out_gg(X, Y)) → insert_out_gga(X, .(Y, Z), .(X, .(Y, Z)))
insert_in_gga(X, .(Y, Z), .(Y, L)) → U40_gga(X, Y, Z, L, lower_in_gg(X, Y))
lower_in_gg(king, ace) → lower_out_gg(king, ace)
lower_in_gg(queen, X) → U49_gg(X, honor_in_ga(X, N))
honor_in_ga(C, N) → U19_ga(C, N, face_card_in_ga(C, N))
face_card_in_ga(ace, 4) → face_card_out_ga(ace, 4)
face_card_in_ga(king, 3) → face_card_out_ga(king, 3)
face_card_in_ga(queen, 2) → face_card_out_ga(queen, 2)
face_card_in_ga(jack, 1) → face_card_out_ga(jack, 1)
U19_ga(C, N, face_card_out_ga(C, N)) → honor_out_ga(C, N)
honor_in_ga(C, 0) → U20_ga(C, integer_in_g(C))
U20_ga(C, integer_out_g(C)) → honor_out_ga(C, 0)
U49_gg(X, honor_out_ga(X, N)) → U50_gg(X, >_in_gg(N, 2))
>_in_gg(X0, X1) → >_out_gg(X0, X1)
U50_gg(X, >_out_gg(N, 2)) → lower_out_gg(queen, X)
lower_in_gg(jack, X) → U51_gg(X, honor_in_ga(X, N))
U51_gg(X, honor_out_ga(X, N)) → U52_gg(X, >_in_gg(N, 1))
U52_gg(X, >_out_gg(N, 1)) → lower_out_gg(jack, X)
lower_in_gg(X, Y) → U53_gg(X, Y, integer_in_g(X))
U53_gg(X, Y, integer_out_g(X)) → U54_gg(X, Y, honor_in_ga(Y, _M))
U54_gg(X, Y, honor_out_ga(Y, _M)) → lower_out_gg(X, Y)
U53_gg(X, Y, integer_out_g(X)) → U55_gg(X, Y, integer_in_g(Y))
U55_gg(X, Y, integer_out_g(Y)) → U56_gg(X, Y, <_in_gg(X, Y))
<_in_gg(X0, X1) → <_out_gg(X0, X1)
U56_gg(X, Y, <_out_gg(X, Y)) → lower_out_gg(X, Y)
U40_gga(X, Y, Z, L, lower_out_gg(X, Y)) → U41_gga(X, Y, Z, L, insert_in_gga(X, Z, L))
U41_gga(X, Y, Z, L, insert_out_gga(X, Z, L)) → insert_out_gga(X, .(Y, Z), .(Y, L))
U37_gga(C1, Cn, Li, Lo, insert_out_gga(C1, Li, Lt)) → U38_gga(C1, Cn, Li, Lo, i_sort_in_gga(Cn, Lt, Lo))
U38_gga(C1, Cn, Li, Lo, i_sort_out_gga(Cn, Lt, Lo)) → i_sort_out_gga(.(C1, Cn), Li, Lo)
U35_ga(S, Ci, In, Co, Out, i_sort_out_gga(Ci, [], Co)) → U36_ga(S, Ci, In, Co, Out, sort_suits_in_ga(In, Out))
U36_ga(S, Ci, In, Co, Out, sort_suits_out_ga(In, Out)) → sort_suits_out_ga(.(=(S, Ci), In), .(=(S, Co), Out))
U27_ga(Hand, SortedHand, sort_suits_out_ga(SplitHand, SortedHand)) → sort_hand_out_ga(Hand, SortedHand)
U1_gaaa(Hand, Attributes, Points, Bid, sort_hand_out_ga(Hand, SortedHand)) → U2_gaaa(Hand, Attributes, Points, Bid, SortedHand, evaluate_in_gaa(SortedHand, Attributes, Points))
evaluate_in_gaa(Hand, [], P) → U4_gaa(Hand, P, hcp_in_gga(Hand, 0, HCP))
hcp_in_gga([], N, N) → hcp_out_gga([], N, N)
hcp_in_gga(.(=(_X, C), Sn), Ni, No) → U7_gga(_X, C, Sn, Ni, No, hcp_suit_in_ga(C, N))
hcp_suit_in_ga(S, P) → U10_ga(S, P, honors_in_gga(S, 0, HP))
honors_in_gga([], Pi, Pi) → honors_out_gga([], Pi, Pi)
honors_in_gga(.(C1, Cn), Pi, Po) → U14_gga(C1, Cn, Pi, Po, honor_in_ga(C1, P))
U14_gga(C1, Cn, Pi, Po, honor_out_ga(C1, P)) → U15_gga(C1, Cn, Pi, Po, P, >_in_gg(P, 0))
U15_gga(C1, Cn, Pi, Po, P, >_out_gg(P, 0)) → U16_gga(C1, Cn, Pi, Po, is_in_ag(Pt, +(P, Pi)))
is_in_ag(X0, X1) → is_out_ag(X0, X1)
U16_gga(C1, Cn, Pi, Po, is_out_ag(Pt, +(P, Pi))) → U17_gga(C1, Cn, Pi, Po, honors_in_gaa(Cn, Pt, Po))
honors_in_gaa([], Pi, Pi) → honors_out_gaa([], Pi, Pi)
honors_in_gaa(.(C1, Cn), Pi, Po) → U14_gaa(C1, Cn, Pi, Po, honor_in_ga(C1, P))
U14_gaa(C1, Cn, Pi, Po, honor_out_ga(C1, P)) → U15_gaa(C1, Cn, Pi, Po, P, >_in_gg(P, 0))
U15_gaa(C1, Cn, Pi, Po, P, >_out_gg(P, 0)) → U16_gaa(C1, Cn, Pi, Po, is_in_aa(Pt, +(P, Pi)))
is_in_aa(X0, X1) → is_out_aa(X0, X1)
U16_gaa(C1, Cn, Pi, Po, is_out_aa(Pt, +(P, Pi))) → U17_gaa(C1, Cn, Pi, Po, honors_in_gaa(Cn, Pt, Po))
honors_in_gaa(.(C1, Cn), Pi, Pi) → U18_gaa(C1, Cn, Pi, honor_in_gg(C1, 0))
honor_in_gg(C, N) → U19_gg(C, N, face_card_in_gg(C, N))
face_card_in_gg(ace, 4) → face_card_out_gg(ace, 4)
face_card_in_gg(king, 3) → face_card_out_gg(king, 3)
face_card_in_gg(queen, 2) → face_card_out_gg(queen, 2)
face_card_in_gg(jack, 1) → face_card_out_gg(jack, 1)
U19_gg(C, N, face_card_out_gg(C, N)) → honor_out_gg(C, N)
honor_in_gg(C, 0) → U20_gg(C, integer_in_g(C))
U20_gg(C, integer_out_g(C)) → honor_out_gg(C, 0)
U18_gaa(C1, Cn, Pi, honor_out_gg(C1, 0)) → honors_out_gaa(.(C1, Cn), Pi, Pi)
U17_gaa(C1, Cn, Pi, Po, honors_out_gaa(Cn, Pt, Po)) → honors_out_gaa(.(C1, Cn), Pi, Po)
U17_gga(C1, Cn, Pi, Po, honors_out_gaa(Cn, Pt, Po)) → honors_out_gga(.(C1, Cn), Pi, Po)
honors_in_gga(.(C1, Cn), Pi, Pi) → U18_gga(C1, Cn, Pi, honor_in_gg(C1, 0))
U18_gga(C1, Cn, Pi, honor_out_gg(C1, 0)) → honors_out_gga(.(C1, Cn), Pi, Pi)
U10_ga(S, P, honors_out_gga(S, 0, HP)) → U11_ga(S, P, HP, dist_in_ga(S, DP))
dist_in_ga([], 3) → dist_out_ga([], 3)
dist_in_ga(.(X2, []), 2) → dist_out_ga(.(X2, []), 2)
dist_in_ga(.(X3, .(X4, [])), 1) → dist_out_ga(.(X3, .(X4, [])), 1)
dist_in_ga(.(X5, .(X6, .(X7, X8))), 0) → dist_out_ga(.(X5, .(X6, .(X7, X8))), 0)
U11_ga(S, P, HP, dist_out_ga(S, DP)) → U12_ga(S, P, HP, DP, misc_in_ga(S, MP))
misc_in_ga(.(ace, []), -1) → misc_out_ga(.(ace, []), -1)
misc_in_ga(.(king, []), -2) → misc_out_ga(.(king, []), -2)
misc_in_ga(.(queen, .(X9, [])), -2) → misc_out_ga(.(queen, .(X9, [])), -2)
misc_in_ga(.(jack, .(X10, [])), -1) → misc_out_ga(.(jack, .(X10, [])), -1)
misc_in_ga(.(_X, .(_Y, .(H3, Rem))), P) → U21_ga(_X, _Y, H3, Rem, P, honor_in_ga(H3, X))
U21_ga(_X, _Y, H3, Rem, P, honor_out_ga(H3, X)) → U22_ga(_X, _Y, H3, Rem, P, >_in_gg(X, 0))
U22_ga(_X, _Y, H3, Rem, P, >_out_gg(X, 0)) → U23_ga(_X, _Y, H3, Rem, P, length_in_ga(Rem, N))
length_in_ga(X0, X1) → length_out_ga(X0, X1)
U23_ga(_X, _Y, H3, Rem, P, length_out_ga(Rem, N)) → U24_ga(_X, _Y, H3, Rem, P, N, >_in_ag(N, 2))
>_in_ag(X0, X1) → >_out_ag(X0, X1)
U24_ga(_X, _Y, H3, Rem, P, N, >_out_ag(N, 2)) → U25_ga(_X, _Y, H3, Rem, P, is_in_aa(P, -(N, 2)))
U25_ga(_X, _Y, H3, Rem, P, is_out_aa(P, -(N, 2))) → misc_out_ga(.(_X, .(_Y, .(H3, Rem))), P)
misc_in_ga(X11, 0) → misc_out_ga(X11, 0)
U12_ga(S, P, HP, DP, misc_out_ga(S, MP)) → U13_ga(S, P, is_in_aa(P, +(HP, +(DP, MP))))
U13_ga(S, P, is_out_aa(P, +(HP, +(DP, MP)))) → hcp_suit_out_ga(S, P)
U7_gga(_X, C, Sn, Ni, No, hcp_suit_out_ga(C, N)) → U8_gga(_X, C, Sn, Ni, No, is_in_aa(Nt, +(N, Ni)))
U8_gga(_X, C, Sn, Ni, No, is_out_aa(Nt, +(N, Ni))) → U9_gga(_X, C, Sn, Ni, No, hcp_in_gaa(Sn, Nt, No))
hcp_in_gaa([], N, N) → hcp_out_gaa([], N, N)
hcp_in_gaa(.(=(_X, C), Sn), Ni, No) → U7_gaa(_X, C, Sn, Ni, No, hcp_suit_in_ga(C, N))
U7_gaa(_X, C, Sn, Ni, No, hcp_suit_out_ga(C, N)) → U8_gaa(_X, C, Sn, Ni, No, is_in_aa(Nt, +(N, Ni)))
U8_gaa(_X, C, Sn, Ni, No, is_out_aa(Nt, +(N, Ni))) → U9_gaa(_X, C, Sn, Ni, No, hcp_in_gaa(Sn, Nt, No))
U9_gaa(_X, C, Sn, Ni, No, hcp_out_gaa(Sn, Nt, No)) → hcp_out_gaa(.(=(_X, C), Sn), Ni, No)
U9_gga(_X, C, Sn, Ni, No, hcp_out_gaa(Sn, Nt, No)) → hcp_out_gga(.(=(_X, C), Sn), Ni, No)
U4_gaa(Hand, P, hcp_out_gga(Hand, 0, HCP)) → U5_gaa(Hand, P, HCP, adjustments_in_ga(Hand, MP))
adjustments_in_ga(X1, 0) → adjustments_out_ga(X1, 0)
U5_gaa(Hand, P, HCP, adjustments_out_ga(Hand, MP)) → U6_gaa(Hand, P, is_in_aa(P, +(HCP, MP)))
U6_gaa(Hand, P, is_out_aa(P, +(HCP, MP))) → evaluate_out_gaa(Hand, [], P)
U2_gaaa(Hand, Attributes, Points, Bid, SortedHand, evaluate_out_gaa(SortedHand, Attributes, Points)) → U3_gaaa(Hand, Attributes, Points, Bid, make_bid_in_ggaa(SortedHand, Attributes, Points, Bid))
make_bid_in_ggaa(Hand, Attributes, Points, 'punt...') → make_bid_out_ggaa(Hand, Attributes, Points, 'punt...')
U3_gaaa(Hand, Attributes, Points, Bid, make_bid_out_ggaa(SortedHand, Attributes, Points, Bid)) → bid_out_gaaa(Hand, Attributes, Points, Bid)
U37_GGA(C1, Cn, Li, Lo, insert_out_gga(C1, Li, Lt)) → I_SORT_IN_GGA(Cn, Lt, Lo)
I_SORT_IN_GGA(.(C1, Cn), Li, Lo) → U37_GGA(C1, Cn, Li, Lo, insert_in_gga(C1, Li, Lt))
insert_in_gga(X, [], .(X, [])) → insert_out_gga(X, [], .(X, []))
insert_in_gga(X, .(Y, Z), .(X, .(Y, Z))) → U39_gga(X, Y, Z, higher_in_gg(X, Y))
insert_in_gga(X, .(Y, Z), .(Y, L)) → U40_gga(X, Y, Z, L, lower_in_gg(X, Y))
U39_gga(X, Y, Z, higher_out_gg(X, Y)) → insert_out_gga(X, .(Y, Z), .(X, .(Y, Z)))
U40_gga(X, Y, Z, L, lower_out_gg(X, Y)) → U41_gga(X, Y, Z, L, insert_in_gga(X, Z, L))
higher_in_gg(ace, X13) → higher_out_gg(ace, X13)
higher_in_gg(king, X) → U42_gg(X, \==_in_gg(X, ace))
higher_in_gg(queen, X) → U43_gg(X, \==_in_gg(X, ace))
higher_in_gg(jack, X) → U45_gg(X, integer_in_g(X))
higher_in_gg(jack, jack) → higher_out_gg(jack, jack)
higher_in_gg(X, Y) → U46_gg(X, Y, integer_in_g(X))
lower_in_gg(king, ace) → lower_out_gg(king, ace)
lower_in_gg(queen, X) → U49_gg(X, honor_in_ga(X, N))
lower_in_gg(jack, X) → U51_gg(X, honor_in_ga(X, N))
lower_in_gg(X, Y) → U53_gg(X, Y, integer_in_g(X))
U41_gga(X, Y, Z, L, insert_out_gga(X, Z, L)) → insert_out_gga(X, .(Y, Z), .(Y, L))
U42_gg(X, \==_out_gg(X, ace)) → higher_out_gg(king, X)
U43_gg(X, \==_out_gg(X, ace)) → U44_gg(X, \==_in_gg(X, king))
U45_gg(X, integer_out_g(X)) → higher_out_gg(jack, X)
U46_gg(X, Y, integer_out_g(X)) → U47_gg(X, Y, integer_in_g(Y))
U49_gg(X, honor_out_ga(X, N)) → U50_gg(X, >_in_gg(N, 2))
U51_gg(X, honor_out_ga(X, N)) → U52_gg(X, >_in_gg(N, 1))
U53_gg(X, Y, integer_out_g(X)) → U54_gg(X, Y, honor_in_ga(Y, _M))
U53_gg(X, Y, integer_out_g(X)) → U55_gg(X, Y, integer_in_g(Y))
\==_in_gg(X0, X1) → \==_out_gg(X0, X1)
U44_gg(X, \==_out_gg(X, king)) → higher_out_gg(queen, X)
integer_in_g(X0) → integer_out_g(X0)
U47_gg(X, Y, integer_out_g(Y)) → U48_gg(X, Y, >=_in_gg(X, Y))
honor_in_ga(C, N) → U19_ga(C, N, face_card_in_ga(C, N))
honor_in_ga(C, 0) → U20_ga(C, integer_in_g(C))
U50_gg(X, >_out_gg(N, 2)) → lower_out_gg(queen, X)
U52_gg(X, >_out_gg(N, 1)) → lower_out_gg(jack, X)
U54_gg(X, Y, honor_out_ga(Y, _M)) → lower_out_gg(X, Y)
U55_gg(X, Y, integer_out_g(Y)) → U56_gg(X, Y, <_in_gg(X, Y))
U48_gg(X, Y, >=_out_gg(X, Y)) → higher_out_gg(X, Y)
U19_ga(C, N, face_card_out_ga(C, N)) → honor_out_ga(C, N)
U20_ga(C, integer_out_g(C)) → honor_out_ga(C, 0)
>_in_gg(X0, X1) → >_out_gg(X0, X1)
U56_gg(X, Y, <_out_gg(X, Y)) → lower_out_gg(X, Y)
>=_in_gg(X0, X1) → >=_out_gg(X0, X1)
face_card_in_ga(ace, 4) → face_card_out_ga(ace, 4)
face_card_in_ga(king, 3) → face_card_out_ga(king, 3)
face_card_in_ga(queen, 2) → face_card_out_ga(queen, 2)
face_card_in_ga(jack, 1) → face_card_out_ga(jack, 1)
<_in_gg(X0, X1) → <_out_gg(X0, X1)
U37_GGA(Cn, insert_out_gga(Lt)) → I_SORT_IN_GGA(Cn, Lt)
I_SORT_IN_GGA(.(C1, Cn), Li) → U37_GGA(Cn, insert_in_gga(C1, Li))
insert_in_gga(X, []) → insert_out_gga(.(X, []))
insert_in_gga(X, .(Y, Z)) → U39_gga(X, Y, Z, higher_in_gg(X, Y))
insert_in_gga(X, .(Y, Z)) → U40_gga(X, Y, Z, lower_in_gg(X, Y))
U39_gga(X, Y, Z, higher_out_gg) → insert_out_gga(.(X, .(Y, Z)))
U40_gga(X, Y, Z, lower_out_gg) → U41_gga(Y, insert_in_gga(X, Z))
higher_in_gg(ace, X13) → higher_out_gg
higher_in_gg(king, X) → U42_gg(\==_in_gg(X, ace))
higher_in_gg(queen, X) → U43_gg(X, \==_in_gg(X, ace))
higher_in_gg(jack, X) → U45_gg(integer_in_g(X))
higher_in_gg(jack, jack) → higher_out_gg
higher_in_gg(X, Y) → U46_gg(X, Y, integer_in_g(X))
lower_in_gg(king, ace) → lower_out_gg
lower_in_gg(queen, X) → U49_gg(honor_in_ga(X))
lower_in_gg(jack, X) → U51_gg(honor_in_ga(X))
lower_in_gg(X, Y) → U53_gg(X, Y, integer_in_g(X))
U41_gga(Y, insert_out_gga(L)) → insert_out_gga(.(Y, L))
U42_gg(\==_out_gg) → higher_out_gg
U43_gg(X, \==_out_gg) → U44_gg(\==_in_gg(X, king))
U45_gg(integer_out_g) → higher_out_gg
U46_gg(X, Y, integer_out_g) → U47_gg(X, Y, integer_in_g(Y))
U49_gg(honor_out_ga(N)) → U50_gg(>_in_gg(N, 2))
U51_gg(honor_out_ga(N)) → U52_gg(>_in_gg(N, 1))
U53_gg(X, Y, integer_out_g) → U54_gg(honor_in_ga(Y))
U53_gg(X, Y, integer_out_g) → U55_gg(X, Y, integer_in_g(Y))
\==_in_gg(X0, X1) → \==_out_gg
U44_gg(\==_out_gg) → higher_out_gg
integer_in_g(X0) → integer_out_g
U47_gg(X, Y, integer_out_g) → U48_gg(>=_in_gg(X, Y))
honor_in_ga(C) → U19_ga(face_card_in_ga(C))
honor_in_ga(C) → U20_ga(integer_in_g(C))
U50_gg(>_out_gg) → lower_out_gg
U52_gg(>_out_gg) → lower_out_gg
U54_gg(honor_out_ga(_M)) → lower_out_gg
U55_gg(X, Y, integer_out_g) → U56_gg(<_in_gg(X, Y))
U48_gg(>=_out_gg) → higher_out_gg
U19_ga(face_card_out_ga(N)) → honor_out_ga(N)
U20_ga(integer_out_g) → honor_out_ga(0)
>_in_gg(X0, X1) → >_out_gg
U56_gg(<_out_gg) → lower_out_gg
>=_in_gg(X0, X1) → >=_out_gg
face_card_in_ga(ace) → face_card_out_ga(4)
face_card_in_ga(king) → face_card_out_ga(3)
face_card_in_ga(queen) → face_card_out_ga(2)
face_card_in_ga(jack) → face_card_out_ga(1)
<_in_gg(X0, X1) → <_out_gg
insert_in_gga(x0, x1)
U39_gga(x0, x1, x2, x3)
U40_gga(x0, x1, x2, x3)
higher_in_gg(x0, x1)
lower_in_gg(x0, x1)
U41_gga(x0, x1)
U42_gg(x0)
U43_gg(x0, x1)
U45_gg(x0)
U46_gg(x0, x1, x2)
U49_gg(x0)
U51_gg(x0)
U53_gg(x0, x1, x2)
\==_in_gg(x0, x1)
U44_gg(x0)
integer_in_g(x0)
U47_gg(x0, x1, x2)
honor_in_ga(x0)
U50_gg(x0)
U52_gg(x0)
U54_gg(x0)
U55_gg(x0, x1, x2)
U48_gg(x0)
U19_ga(x0)
U20_ga(x0)
>_in_gg(x0, x1)
U56_gg(x0)
>=_in_gg(x0, x1)
face_card_in_ga(x0)
<_in_gg(x0, x1)
From the DPs we obtained the following set of size-change graphs:
U35_GA(S, Ci, In, Co, Out, i_sort_out_gga(Ci, [], Co)) → SORT_SUITS_IN_GA(In, Out)
SORT_SUITS_IN_GA(.(=(S, Ci), In), .(=(S, Co), Out)) → U35_GA(S, Ci, In, Co, Out, i_sort_in_gga(Ci, [], Co))
bid_in_gaaa(Hand, Attributes, Points, Bid) → U1_gaaa(Hand, Attributes, Points, Bid, sort_hand_in_ga(Hand, SortedHand))
sort_hand_in_ga(Hand, SortedHand) → U26_ga(Hand, SortedHand, split_suits_in_ga(Hand, SplitHand))
split_suits_in_ga(Hand, .(=(spades, S), .(=(hearts, H), .(=(diamonds, D), .(=(clubs, C), []))))) → U28_ga(Hand, S, H, D, C, filter_in_gga(Hand, spades, S))
filter_in_gga([], X12, []) → filter_out_gga([], X12, [])
filter_in_gga(.(-(Card, Suit), In), Suit, .(Card, Out)) → U32_gga(Card, Suit, In, Out, filter_in_gga(In, Suit, Out))
filter_in_gga(.(-(_A, X), In), Suit, Out) → U33_gga(_A, X, In, Suit, Out, \==_in_gg(Suit, X))
\==_in_gg(X0, X1) → \==_out_gg(X0, X1)
U33_gga(_A, X, In, Suit, Out, \==_out_gg(Suit, X)) → U34_gga(_A, X, In, Suit, Out, filter_in_gga(In, Suit, Out))
U34_gga(_A, X, In, Suit, Out, filter_out_gga(In, Suit, Out)) → filter_out_gga(.(-(_A, X), In), Suit, Out)
U32_gga(Card, Suit, In, Out, filter_out_gga(In, Suit, Out)) → filter_out_gga(.(-(Card, Suit), In), Suit, .(Card, Out))
U28_ga(Hand, S, H, D, C, filter_out_gga(Hand, spades, S)) → U29_ga(Hand, S, H, D, C, filter_in_gga(Hand, hearts, H))
U29_ga(Hand, S, H, D, C, filter_out_gga(Hand, hearts, H)) → U30_ga(Hand, S, H, D, C, filter_in_gga(Hand, diamonds, D))
U30_ga(Hand, S, H, D, C, filter_out_gga(Hand, diamonds, D)) → U31_ga(Hand, S, H, D, C, filter_in_gga(Hand, clubs, C))
U31_ga(Hand, S, H, D, C, filter_out_gga(Hand, clubs, C)) → split_suits_out_ga(Hand, .(=(spades, S), .(=(hearts, H), .(=(diamonds, D), .(=(clubs, C), [])))))
U26_ga(Hand, SortedHand, split_suits_out_ga(Hand, SplitHand)) → U27_ga(Hand, SortedHand, sort_suits_in_ga(SplitHand, SortedHand))
sort_suits_in_ga([], []) → sort_suits_out_ga([], [])
sort_suits_in_ga(.(=(S, Ci), In), .(=(S, Co), Out)) → U35_ga(S, Ci, In, Co, Out, i_sort_in_gga(Ci, [], Co))
i_sort_in_gga([], L, L) → i_sort_out_gga([], L, L)
i_sort_in_gga(.(C1, Cn), Li, Lo) → U37_gga(C1, Cn, Li, Lo, insert_in_gga(C1, Li, Lt))
insert_in_gga(X, [], .(X, [])) → insert_out_gga(X, [], .(X, []))
insert_in_gga(X, .(Y, Z), .(X, .(Y, Z))) → U39_gga(X, Y, Z, higher_in_gg(X, Y))
higher_in_gg(ace, X13) → higher_out_gg(ace, X13)
higher_in_gg(king, X) → U42_gg(X, \==_in_gg(X, ace))
U42_gg(X, \==_out_gg(X, ace)) → higher_out_gg(king, X)
higher_in_gg(queen, X) → U43_gg(X, \==_in_gg(X, ace))
U43_gg(X, \==_out_gg(X, ace)) → U44_gg(X, \==_in_gg(X, king))
U44_gg(X, \==_out_gg(X, king)) → higher_out_gg(queen, X)
higher_in_gg(jack, X) → U45_gg(X, integer_in_g(X))
integer_in_g(X0) → integer_out_g(X0)
U45_gg(X, integer_out_g(X)) → higher_out_gg(jack, X)
higher_in_gg(jack, jack) → higher_out_gg(jack, jack)
higher_in_gg(X, Y) → U46_gg(X, Y, integer_in_g(X))
U46_gg(X, Y, integer_out_g(X)) → U47_gg(X, Y, integer_in_g(Y))
U47_gg(X, Y, integer_out_g(Y)) → U48_gg(X, Y, >=_in_gg(X, Y))
>=_in_gg(X0, X1) → >=_out_gg(X0, X1)
U48_gg(X, Y, >=_out_gg(X, Y)) → higher_out_gg(X, Y)
U39_gga(X, Y, Z, higher_out_gg(X, Y)) → insert_out_gga(X, .(Y, Z), .(X, .(Y, Z)))
insert_in_gga(X, .(Y, Z), .(Y, L)) → U40_gga(X, Y, Z, L, lower_in_gg(X, Y))
lower_in_gg(king, ace) → lower_out_gg(king, ace)
lower_in_gg(queen, X) → U49_gg(X, honor_in_ga(X, N))
honor_in_ga(C, N) → U19_ga(C, N, face_card_in_ga(C, N))
face_card_in_ga(ace, 4) → face_card_out_ga(ace, 4)
face_card_in_ga(king, 3) → face_card_out_ga(king, 3)
face_card_in_ga(queen, 2) → face_card_out_ga(queen, 2)
face_card_in_ga(jack, 1) → face_card_out_ga(jack, 1)
U19_ga(C, N, face_card_out_ga(C, N)) → honor_out_ga(C, N)
honor_in_ga(C, 0) → U20_ga(C, integer_in_g(C))
U20_ga(C, integer_out_g(C)) → honor_out_ga(C, 0)
U49_gg(X, honor_out_ga(X, N)) → U50_gg(X, >_in_gg(N, 2))
>_in_gg(X0, X1) → >_out_gg(X0, X1)
U50_gg(X, >_out_gg(N, 2)) → lower_out_gg(queen, X)
lower_in_gg(jack, X) → U51_gg(X, honor_in_ga(X, N))
U51_gg(X, honor_out_ga(X, N)) → U52_gg(X, >_in_gg(N, 1))
U52_gg(X, >_out_gg(N, 1)) → lower_out_gg(jack, X)
lower_in_gg(X, Y) → U53_gg(X, Y, integer_in_g(X))
U53_gg(X, Y, integer_out_g(X)) → U54_gg(X, Y, honor_in_ga(Y, _M))
U54_gg(X, Y, honor_out_ga(Y, _M)) → lower_out_gg(X, Y)
U53_gg(X, Y, integer_out_g(X)) → U55_gg(X, Y, integer_in_g(Y))
U55_gg(X, Y, integer_out_g(Y)) → U56_gg(X, Y, <_in_gg(X, Y))
<_in_gg(X0, X1) → <_out_gg(X0, X1)
U56_gg(X, Y, <_out_gg(X, Y)) → lower_out_gg(X, Y)
U40_gga(X, Y, Z, L, lower_out_gg(X, Y)) → U41_gga(X, Y, Z, L, insert_in_gga(X, Z, L))
U41_gga(X, Y, Z, L, insert_out_gga(X, Z, L)) → insert_out_gga(X, .(Y, Z), .(Y, L))
U37_gga(C1, Cn, Li, Lo, insert_out_gga(C1, Li, Lt)) → U38_gga(C1, Cn, Li, Lo, i_sort_in_gga(Cn, Lt, Lo))
U38_gga(C1, Cn, Li, Lo, i_sort_out_gga(Cn, Lt, Lo)) → i_sort_out_gga(.(C1, Cn), Li, Lo)
U35_ga(S, Ci, In, Co, Out, i_sort_out_gga(Ci, [], Co)) → U36_ga(S, Ci, In, Co, Out, sort_suits_in_ga(In, Out))
U36_ga(S, Ci, In, Co, Out, sort_suits_out_ga(In, Out)) → sort_suits_out_ga(.(=(S, Ci), In), .(=(S, Co), Out))
U27_ga(Hand, SortedHand, sort_suits_out_ga(SplitHand, SortedHand)) → sort_hand_out_ga(Hand, SortedHand)
U1_gaaa(Hand, Attributes, Points, Bid, sort_hand_out_ga(Hand, SortedHand)) → U2_gaaa(Hand, Attributes, Points, Bid, SortedHand, evaluate_in_gaa(SortedHand, Attributes, Points))
evaluate_in_gaa(Hand, [], P) → U4_gaa(Hand, P, hcp_in_gga(Hand, 0, HCP))
hcp_in_gga([], N, N) → hcp_out_gga([], N, N)
hcp_in_gga(.(=(_X, C), Sn), Ni, No) → U7_gga(_X, C, Sn, Ni, No, hcp_suit_in_ga(C, N))
hcp_suit_in_ga(S, P) → U10_ga(S, P, honors_in_gga(S, 0, HP))
honors_in_gga([], Pi, Pi) → honors_out_gga([], Pi, Pi)
honors_in_gga(.(C1, Cn), Pi, Po) → U14_gga(C1, Cn, Pi, Po, honor_in_ga(C1, P))
U14_gga(C1, Cn, Pi, Po, honor_out_ga(C1, P)) → U15_gga(C1, Cn, Pi, Po, P, >_in_gg(P, 0))
U15_gga(C1, Cn, Pi, Po, P, >_out_gg(P, 0)) → U16_gga(C1, Cn, Pi, Po, is_in_ag(Pt, +(P, Pi)))
is_in_ag(X0, X1) → is_out_ag(X0, X1)
U16_gga(C1, Cn, Pi, Po, is_out_ag(Pt, +(P, Pi))) → U17_gga(C1, Cn, Pi, Po, honors_in_gaa(Cn, Pt, Po))
honors_in_gaa([], Pi, Pi) → honors_out_gaa([], Pi, Pi)
honors_in_gaa(.(C1, Cn), Pi, Po) → U14_gaa(C1, Cn, Pi, Po, honor_in_ga(C1, P))
U14_gaa(C1, Cn, Pi, Po, honor_out_ga(C1, P)) → U15_gaa(C1, Cn, Pi, Po, P, >_in_gg(P, 0))
U15_gaa(C1, Cn, Pi, Po, P, >_out_gg(P, 0)) → U16_gaa(C1, Cn, Pi, Po, is_in_aa(Pt, +(P, Pi)))
is_in_aa(X0, X1) → is_out_aa(X0, X1)
U16_gaa(C1, Cn, Pi, Po, is_out_aa(Pt, +(P, Pi))) → U17_gaa(C1, Cn, Pi, Po, honors_in_gaa(Cn, Pt, Po))
honors_in_gaa(.(C1, Cn), Pi, Pi) → U18_gaa(C1, Cn, Pi, honor_in_gg(C1, 0))
honor_in_gg(C, N) → U19_gg(C, N, face_card_in_gg(C, N))
face_card_in_gg(ace, 4) → face_card_out_gg(ace, 4)
face_card_in_gg(king, 3) → face_card_out_gg(king, 3)
face_card_in_gg(queen, 2) → face_card_out_gg(queen, 2)
face_card_in_gg(jack, 1) → face_card_out_gg(jack, 1)
U19_gg(C, N, face_card_out_gg(C, N)) → honor_out_gg(C, N)
honor_in_gg(C, 0) → U20_gg(C, integer_in_g(C))
U20_gg(C, integer_out_g(C)) → honor_out_gg(C, 0)
U18_gaa(C1, Cn, Pi, honor_out_gg(C1, 0)) → honors_out_gaa(.(C1, Cn), Pi, Pi)
U17_gaa(C1, Cn, Pi, Po, honors_out_gaa(Cn, Pt, Po)) → honors_out_gaa(.(C1, Cn), Pi, Po)
U17_gga(C1, Cn, Pi, Po, honors_out_gaa(Cn, Pt, Po)) → honors_out_gga(.(C1, Cn), Pi, Po)
honors_in_gga(.(C1, Cn), Pi, Pi) → U18_gga(C1, Cn, Pi, honor_in_gg(C1, 0))
U18_gga(C1, Cn, Pi, honor_out_gg(C1, 0)) → honors_out_gga(.(C1, Cn), Pi, Pi)
U10_ga(S, P, honors_out_gga(S, 0, HP)) → U11_ga(S, P, HP, dist_in_ga(S, DP))
dist_in_ga([], 3) → dist_out_ga([], 3)
dist_in_ga(.(X2, []), 2) → dist_out_ga(.(X2, []), 2)
dist_in_ga(.(X3, .(X4, [])), 1) → dist_out_ga(.(X3, .(X4, [])), 1)
dist_in_ga(.(X5, .(X6, .(X7, X8))), 0) → dist_out_ga(.(X5, .(X6, .(X7, X8))), 0)
U11_ga(S, P, HP, dist_out_ga(S, DP)) → U12_ga(S, P, HP, DP, misc_in_ga(S, MP))
misc_in_ga(.(ace, []), -1) → misc_out_ga(.(ace, []), -1)
misc_in_ga(.(king, []), -2) → misc_out_ga(.(king, []), -2)
misc_in_ga(.(queen, .(X9, [])), -2) → misc_out_ga(.(queen, .(X9, [])), -2)
misc_in_ga(.(jack, .(X10, [])), -1) → misc_out_ga(.(jack, .(X10, [])), -1)
misc_in_ga(.(_X, .(_Y, .(H3, Rem))), P) → U21_ga(_X, _Y, H3, Rem, P, honor_in_ga(H3, X))
U21_ga(_X, _Y, H3, Rem, P, honor_out_ga(H3, X)) → U22_ga(_X, _Y, H3, Rem, P, >_in_gg(X, 0))
U22_ga(_X, _Y, H3, Rem, P, >_out_gg(X, 0)) → U23_ga(_X, _Y, H3, Rem, P, length_in_ga(Rem, N))
length_in_ga(X0, X1) → length_out_ga(X0, X1)
U23_ga(_X, _Y, H3, Rem, P, length_out_ga(Rem, N)) → U24_ga(_X, _Y, H3, Rem, P, N, >_in_ag(N, 2))
>_in_ag(X0, X1) → >_out_ag(X0, X1)
U24_ga(_X, _Y, H3, Rem, P, N, >_out_ag(N, 2)) → U25_ga(_X, _Y, H3, Rem, P, is_in_aa(P, -(N, 2)))
U25_ga(_X, _Y, H3, Rem, P, is_out_aa(P, -(N, 2))) → misc_out_ga(.(_X, .(_Y, .(H3, Rem))), P)
misc_in_ga(X11, 0) → misc_out_ga(X11, 0)
U12_ga(S, P, HP, DP, misc_out_ga(S, MP)) → U13_ga(S, P, is_in_aa(P, +(HP, +(DP, MP))))
U13_ga(S, P, is_out_aa(P, +(HP, +(DP, MP)))) → hcp_suit_out_ga(S, P)
U7_gga(_X, C, Sn, Ni, No, hcp_suit_out_ga(C, N)) → U8_gga(_X, C, Sn, Ni, No, is_in_aa(Nt, +(N, Ni)))
U8_gga(_X, C, Sn, Ni, No, is_out_aa(Nt, +(N, Ni))) → U9_gga(_X, C, Sn, Ni, No, hcp_in_gaa(Sn, Nt, No))
hcp_in_gaa([], N, N) → hcp_out_gaa([], N, N)
hcp_in_gaa(.(=(_X, C), Sn), Ni, No) → U7_gaa(_X, C, Sn, Ni, No, hcp_suit_in_ga(C, N))
U7_gaa(_X, C, Sn, Ni, No, hcp_suit_out_ga(C, N)) → U8_gaa(_X, C, Sn, Ni, No, is_in_aa(Nt, +(N, Ni)))
U8_gaa(_X, C, Sn, Ni, No, is_out_aa(Nt, +(N, Ni))) → U9_gaa(_X, C, Sn, Ni, No, hcp_in_gaa(Sn, Nt, No))
U9_gaa(_X, C, Sn, Ni, No, hcp_out_gaa(Sn, Nt, No)) → hcp_out_gaa(.(=(_X, C), Sn), Ni, No)
U9_gga(_X, C, Sn, Ni, No, hcp_out_gaa(Sn, Nt, No)) → hcp_out_gga(.(=(_X, C), Sn), Ni, No)
U4_gaa(Hand, P, hcp_out_gga(Hand, 0, HCP)) → U5_gaa(Hand, P, HCP, adjustments_in_ga(Hand, MP))
adjustments_in_ga(X1, 0) → adjustments_out_ga(X1, 0)
U5_gaa(Hand, P, HCP, adjustments_out_ga(Hand, MP)) → U6_gaa(Hand, P, is_in_aa(P, +(HCP, MP)))
U6_gaa(Hand, P, is_out_aa(P, +(HCP, MP))) → evaluate_out_gaa(Hand, [], P)
U2_gaaa(Hand, Attributes, Points, Bid, SortedHand, evaluate_out_gaa(SortedHand, Attributes, Points)) → U3_gaaa(Hand, Attributes, Points, Bid, make_bid_in_ggaa(SortedHand, Attributes, Points, Bid))
make_bid_in_ggaa(Hand, Attributes, Points, 'punt...') → make_bid_out_ggaa(Hand, Attributes, Points, 'punt...')
U3_gaaa(Hand, Attributes, Points, Bid, make_bid_out_ggaa(SortedHand, Attributes, Points, Bid)) → bid_out_gaaa(Hand, Attributes, Points, Bid)
U35_GA(S, Ci, In, Co, Out, i_sort_out_gga(Ci, [], Co)) → SORT_SUITS_IN_GA(In, Out)
SORT_SUITS_IN_GA(.(=(S, Ci), In), .(=(S, Co), Out)) → U35_GA(S, Ci, In, Co, Out, i_sort_in_gga(Ci, [], Co))
i_sort_in_gga([], L, L) → i_sort_out_gga([], L, L)
i_sort_in_gga(.(C1, Cn), Li, Lo) → U37_gga(C1, Cn, Li, Lo, insert_in_gga(C1, Li, Lt))
U37_gga(C1, Cn, Li, Lo, insert_out_gga(C1, Li, Lt)) → U38_gga(C1, Cn, Li, Lo, i_sort_in_gga(Cn, Lt, Lo))
insert_in_gga(X, [], .(X, [])) → insert_out_gga(X, [], .(X, []))
insert_in_gga(X, .(Y, Z), .(X, .(Y, Z))) → U39_gga(X, Y, Z, higher_in_gg(X, Y))
insert_in_gga(X, .(Y, Z), .(Y, L)) → U40_gga(X, Y, Z, L, lower_in_gg(X, Y))
U38_gga(C1, Cn, Li, Lo, i_sort_out_gga(Cn, Lt, Lo)) → i_sort_out_gga(.(C1, Cn), Li, Lo)
U39_gga(X, Y, Z, higher_out_gg(X, Y)) → insert_out_gga(X, .(Y, Z), .(X, .(Y, Z)))
U40_gga(X, Y, Z, L, lower_out_gg(X, Y)) → U41_gga(X, Y, Z, L, insert_in_gga(X, Z, L))
higher_in_gg(ace, X13) → higher_out_gg(ace, X13)
higher_in_gg(king, X) → U42_gg(X, \==_in_gg(X, ace))
higher_in_gg(queen, X) → U43_gg(X, \==_in_gg(X, ace))
higher_in_gg(jack, X) → U45_gg(X, integer_in_g(X))
higher_in_gg(jack, jack) → higher_out_gg(jack, jack)
higher_in_gg(X, Y) → U46_gg(X, Y, integer_in_g(X))
lower_in_gg(king, ace) → lower_out_gg(king, ace)
lower_in_gg(queen, X) → U49_gg(X, honor_in_ga(X, N))
lower_in_gg(jack, X) → U51_gg(X, honor_in_ga(X, N))
lower_in_gg(X, Y) → U53_gg(X, Y, integer_in_g(X))
U41_gga(X, Y, Z, L, insert_out_gga(X, Z, L)) → insert_out_gga(X, .(Y, Z), .(Y, L))
U42_gg(X, \==_out_gg(X, ace)) → higher_out_gg(king, X)
U43_gg(X, \==_out_gg(X, ace)) → U44_gg(X, \==_in_gg(X, king))
U45_gg(X, integer_out_g(X)) → higher_out_gg(jack, X)
U46_gg(X, Y, integer_out_g(X)) → U47_gg(X, Y, integer_in_g(Y))
U49_gg(X, honor_out_ga(X, N)) → U50_gg(X, >_in_gg(N, 2))
U51_gg(X, honor_out_ga(X, N)) → U52_gg(X, >_in_gg(N, 1))
U53_gg(X, Y, integer_out_g(X)) → U54_gg(X, Y, honor_in_ga(Y, _M))
U53_gg(X, Y, integer_out_g(X)) → U55_gg(X, Y, integer_in_g(Y))
\==_in_gg(X0, X1) → \==_out_gg(X0, X1)
U44_gg(X, \==_out_gg(X, king)) → higher_out_gg(queen, X)
integer_in_g(X0) → integer_out_g(X0)
U47_gg(X, Y, integer_out_g(Y)) → U48_gg(X, Y, >=_in_gg(X, Y))
honor_in_ga(C, N) → U19_ga(C, N, face_card_in_ga(C, N))
honor_in_ga(C, 0) → U20_ga(C, integer_in_g(C))
U50_gg(X, >_out_gg(N, 2)) → lower_out_gg(queen, X)
U52_gg(X, >_out_gg(N, 1)) → lower_out_gg(jack, X)
U54_gg(X, Y, honor_out_ga(Y, _M)) → lower_out_gg(X, Y)
U55_gg(X, Y, integer_out_g(Y)) → U56_gg(X, Y, <_in_gg(X, Y))
U48_gg(X, Y, >=_out_gg(X, Y)) → higher_out_gg(X, Y)
U19_ga(C, N, face_card_out_ga(C, N)) → honor_out_ga(C, N)
U20_ga(C, integer_out_g(C)) → honor_out_ga(C, 0)
>_in_gg(X0, X1) → >_out_gg(X0, X1)
U56_gg(X, Y, <_out_gg(X, Y)) → lower_out_gg(X, Y)
>=_in_gg(X0, X1) → >=_out_gg(X0, X1)
face_card_in_ga(ace, 4) → face_card_out_ga(ace, 4)
face_card_in_ga(king, 3) → face_card_out_ga(king, 3)
face_card_in_ga(queen, 2) → face_card_out_ga(queen, 2)
face_card_in_ga(jack, 1) → face_card_out_ga(jack, 1)
<_in_gg(X0, X1) → <_out_gg(X0, X1)
U35_GA(S, In, i_sort_out_gga(Co)) → SORT_SUITS_IN_GA(In)
SORT_SUITS_IN_GA(.(=(S, Ci), In)) → U35_GA(S, In, i_sort_in_gga(Ci, []))
i_sort_in_gga([], L) → i_sort_out_gga(L)
i_sort_in_gga(.(C1, Cn), Li) → U37_gga(Cn, insert_in_gga(C1, Li))
U37_gga(Cn, insert_out_gga(Lt)) → U38_gga(i_sort_in_gga(Cn, Lt))
insert_in_gga(X, []) → insert_out_gga(.(X, []))
insert_in_gga(X, .(Y, Z)) → U39_gga(X, Y, Z, higher_in_gg(X, Y))
insert_in_gga(X, .(Y, Z)) → U40_gga(X, Y, Z, lower_in_gg(X, Y))
U38_gga(i_sort_out_gga(Lo)) → i_sort_out_gga(Lo)
U39_gga(X, Y, Z, higher_out_gg) → insert_out_gga(.(X, .(Y, Z)))
U40_gga(X, Y, Z, lower_out_gg) → U41_gga(Y, insert_in_gga(X, Z))
higher_in_gg(ace, X13) → higher_out_gg
higher_in_gg(king, X) → U42_gg(\==_in_gg(X, ace))
higher_in_gg(queen, X) → U43_gg(X, \==_in_gg(X, ace))
higher_in_gg(jack, X) → U45_gg(integer_in_g(X))
higher_in_gg(jack, jack) → higher_out_gg
higher_in_gg(X, Y) → U46_gg(X, Y, integer_in_g(X))
lower_in_gg(king, ace) → lower_out_gg
lower_in_gg(queen, X) → U49_gg(honor_in_ga(X))
lower_in_gg(jack, X) → U51_gg(honor_in_ga(X))
lower_in_gg(X, Y) → U53_gg(X, Y, integer_in_g(X))
U41_gga(Y, insert_out_gga(L)) → insert_out_gga(.(Y, L))
U42_gg(\==_out_gg) → higher_out_gg
U43_gg(X, \==_out_gg) → U44_gg(\==_in_gg(X, king))
U45_gg(integer_out_g) → higher_out_gg
U46_gg(X, Y, integer_out_g) → U47_gg(X, Y, integer_in_g(Y))
U49_gg(honor_out_ga(N)) → U50_gg(>_in_gg(N, 2))
U51_gg(honor_out_ga(N)) → U52_gg(>_in_gg(N, 1))
U53_gg(X, Y, integer_out_g) → U54_gg(honor_in_ga(Y))
U53_gg(X, Y, integer_out_g) → U55_gg(X, Y, integer_in_g(Y))
\==_in_gg(X0, X1) → \==_out_gg
U44_gg(\==_out_gg) → higher_out_gg
integer_in_g(X0) → integer_out_g
U47_gg(X, Y, integer_out_g) → U48_gg(>=_in_gg(X, Y))
honor_in_ga(C) → U19_ga(face_card_in_ga(C))
honor_in_ga(C) → U20_ga(integer_in_g(C))
U50_gg(>_out_gg) → lower_out_gg
U52_gg(>_out_gg) → lower_out_gg
U54_gg(honor_out_ga(_M)) → lower_out_gg
U55_gg(X, Y, integer_out_g) → U56_gg(<_in_gg(X, Y))
U48_gg(>=_out_gg) → higher_out_gg
U19_ga(face_card_out_ga(N)) → honor_out_ga(N)
U20_ga(integer_out_g) → honor_out_ga(0)
>_in_gg(X0, X1) → >_out_gg
U56_gg(<_out_gg) → lower_out_gg
>=_in_gg(X0, X1) → >=_out_gg
face_card_in_ga(ace) → face_card_out_ga(4)
face_card_in_ga(king) → face_card_out_ga(3)
face_card_in_ga(queen) → face_card_out_ga(2)
face_card_in_ga(jack) → face_card_out_ga(1)
<_in_gg(X0, X1) → <_out_gg
i_sort_in_gga(x0, x1)
U37_gga(x0, x1)
insert_in_gga(x0, x1)
U38_gga(x0)
U39_gga(x0, x1, x2, x3)
U40_gga(x0, x1, x2, x3)
higher_in_gg(x0, x1)
lower_in_gg(x0, x1)
U41_gga(x0, x1)
U42_gg(x0)
U43_gg(x0, x1)
U45_gg(x0)
U46_gg(x0, x1, x2)
U49_gg(x0)
U51_gg(x0)
U53_gg(x0, x1, x2)
\==_in_gg(x0, x1)
U44_gg(x0)
integer_in_g(x0)
U47_gg(x0, x1, x2)
honor_in_ga(x0)
U50_gg(x0)
U52_gg(x0)
U54_gg(x0)
U55_gg(x0, x1, x2)
U48_gg(x0)
U19_ga(x0)
U20_ga(x0)
>_in_gg(x0, x1)
U56_gg(x0)
>=_in_gg(x0, x1)
face_card_in_ga(x0)
<_in_gg(x0, x1)
From the DPs we obtained the following set of size-change graphs:
FILTER_IN_GGA(.(-(_A, X), In), Suit, Out) → U33_GGA(_A, X, In, Suit, Out, \==_in_gg(Suit, X))
U33_GGA(_A, X, In, Suit, Out, \==_out_gg(Suit, X)) → FILTER_IN_GGA(In, Suit, Out)
FILTER_IN_GGA(.(-(Card, Suit), In), Suit, .(Card, Out)) → FILTER_IN_GGA(In, Suit, Out)
bid_in_gaaa(Hand, Attributes, Points, Bid) → U1_gaaa(Hand, Attributes, Points, Bid, sort_hand_in_ga(Hand, SortedHand))
sort_hand_in_ga(Hand, SortedHand) → U26_ga(Hand, SortedHand, split_suits_in_ga(Hand, SplitHand))
split_suits_in_ga(Hand, .(=(spades, S), .(=(hearts, H), .(=(diamonds, D), .(=(clubs, C), []))))) → U28_ga(Hand, S, H, D, C, filter_in_gga(Hand, spades, S))
filter_in_gga([], X12, []) → filter_out_gga([], X12, [])
filter_in_gga(.(-(Card, Suit), In), Suit, .(Card, Out)) → U32_gga(Card, Suit, In, Out, filter_in_gga(In, Suit, Out))
filter_in_gga(.(-(_A, X), In), Suit, Out) → U33_gga(_A, X, In, Suit, Out, \==_in_gg(Suit, X))
\==_in_gg(X0, X1) → \==_out_gg(X0, X1)
U33_gga(_A, X, In, Suit, Out, \==_out_gg(Suit, X)) → U34_gga(_A, X, In, Suit, Out, filter_in_gga(In, Suit, Out))
U34_gga(_A, X, In, Suit, Out, filter_out_gga(In, Suit, Out)) → filter_out_gga(.(-(_A, X), In), Suit, Out)
U32_gga(Card, Suit, In, Out, filter_out_gga(In, Suit, Out)) → filter_out_gga(.(-(Card, Suit), In), Suit, .(Card, Out))
U28_ga(Hand, S, H, D, C, filter_out_gga(Hand, spades, S)) → U29_ga(Hand, S, H, D, C, filter_in_gga(Hand, hearts, H))
U29_ga(Hand, S, H, D, C, filter_out_gga(Hand, hearts, H)) → U30_ga(Hand, S, H, D, C, filter_in_gga(Hand, diamonds, D))
U30_ga(Hand, S, H, D, C, filter_out_gga(Hand, diamonds, D)) → U31_ga(Hand, S, H, D, C, filter_in_gga(Hand, clubs, C))
U31_ga(Hand, S, H, D, C, filter_out_gga(Hand, clubs, C)) → split_suits_out_ga(Hand, .(=(spades, S), .(=(hearts, H), .(=(diamonds, D), .(=(clubs, C), [])))))
U26_ga(Hand, SortedHand, split_suits_out_ga(Hand, SplitHand)) → U27_ga(Hand, SortedHand, sort_suits_in_ga(SplitHand, SortedHand))
sort_suits_in_ga([], []) → sort_suits_out_ga([], [])
sort_suits_in_ga(.(=(S, Ci), In), .(=(S, Co), Out)) → U35_ga(S, Ci, In, Co, Out, i_sort_in_gga(Ci, [], Co))
i_sort_in_gga([], L, L) → i_sort_out_gga([], L, L)
i_sort_in_gga(.(C1, Cn), Li, Lo) → U37_gga(C1, Cn, Li, Lo, insert_in_gga(C1, Li, Lt))
insert_in_gga(X, [], .(X, [])) → insert_out_gga(X, [], .(X, []))
insert_in_gga(X, .(Y, Z), .(X, .(Y, Z))) → U39_gga(X, Y, Z, higher_in_gg(X, Y))
higher_in_gg(ace, X13) → higher_out_gg(ace, X13)
higher_in_gg(king, X) → U42_gg(X, \==_in_gg(X, ace))
U42_gg(X, \==_out_gg(X, ace)) → higher_out_gg(king, X)
higher_in_gg(queen, X) → U43_gg(X, \==_in_gg(X, ace))
U43_gg(X, \==_out_gg(X, ace)) → U44_gg(X, \==_in_gg(X, king))
U44_gg(X, \==_out_gg(X, king)) → higher_out_gg(queen, X)
higher_in_gg(jack, X) → U45_gg(X, integer_in_g(X))
integer_in_g(X0) → integer_out_g(X0)
U45_gg(X, integer_out_g(X)) → higher_out_gg(jack, X)
higher_in_gg(jack, jack) → higher_out_gg(jack, jack)
higher_in_gg(X, Y) → U46_gg(X, Y, integer_in_g(X))
U46_gg(X, Y, integer_out_g(X)) → U47_gg(X, Y, integer_in_g(Y))
U47_gg(X, Y, integer_out_g(Y)) → U48_gg(X, Y, >=_in_gg(X, Y))
>=_in_gg(X0, X1) → >=_out_gg(X0, X1)
U48_gg(X, Y, >=_out_gg(X, Y)) → higher_out_gg(X, Y)
U39_gga(X, Y, Z, higher_out_gg(X, Y)) → insert_out_gga(X, .(Y, Z), .(X, .(Y, Z)))
insert_in_gga(X, .(Y, Z), .(Y, L)) → U40_gga(X, Y, Z, L, lower_in_gg(X, Y))
lower_in_gg(king, ace) → lower_out_gg(king, ace)
lower_in_gg(queen, X) → U49_gg(X, honor_in_ga(X, N))
honor_in_ga(C, N) → U19_ga(C, N, face_card_in_ga(C, N))
face_card_in_ga(ace, 4) → face_card_out_ga(ace, 4)
face_card_in_ga(king, 3) → face_card_out_ga(king, 3)
face_card_in_ga(queen, 2) → face_card_out_ga(queen, 2)
face_card_in_ga(jack, 1) → face_card_out_ga(jack, 1)
U19_ga(C, N, face_card_out_ga(C, N)) → honor_out_ga(C, N)
honor_in_ga(C, 0) → U20_ga(C, integer_in_g(C))
U20_ga(C, integer_out_g(C)) → honor_out_ga(C, 0)
U49_gg(X, honor_out_ga(X, N)) → U50_gg(X, >_in_gg(N, 2))
>_in_gg(X0, X1) → >_out_gg(X0, X1)
U50_gg(X, >_out_gg(N, 2)) → lower_out_gg(queen, X)
lower_in_gg(jack, X) → U51_gg(X, honor_in_ga(X, N))
U51_gg(X, honor_out_ga(X, N)) → U52_gg(X, >_in_gg(N, 1))
U52_gg(X, >_out_gg(N, 1)) → lower_out_gg(jack, X)
lower_in_gg(X, Y) → U53_gg(X, Y, integer_in_g(X))
U53_gg(X, Y, integer_out_g(X)) → U54_gg(X, Y, honor_in_ga(Y, _M))
U54_gg(X, Y, honor_out_ga(Y, _M)) → lower_out_gg(X, Y)
U53_gg(X, Y, integer_out_g(X)) → U55_gg(X, Y, integer_in_g(Y))
U55_gg(X, Y, integer_out_g(Y)) → U56_gg(X, Y, <_in_gg(X, Y))
<_in_gg(X0, X1) → <_out_gg(X0, X1)
U56_gg(X, Y, <_out_gg(X, Y)) → lower_out_gg(X, Y)
U40_gga(X, Y, Z, L, lower_out_gg(X, Y)) → U41_gga(X, Y, Z, L, insert_in_gga(X, Z, L))
U41_gga(X, Y, Z, L, insert_out_gga(X, Z, L)) → insert_out_gga(X, .(Y, Z), .(Y, L))
U37_gga(C1, Cn, Li, Lo, insert_out_gga(C1, Li, Lt)) → U38_gga(C1, Cn, Li, Lo, i_sort_in_gga(Cn, Lt, Lo))
U38_gga(C1, Cn, Li, Lo, i_sort_out_gga(Cn, Lt, Lo)) → i_sort_out_gga(.(C1, Cn), Li, Lo)
U35_ga(S, Ci, In, Co, Out, i_sort_out_gga(Ci, [], Co)) → U36_ga(S, Ci, In, Co, Out, sort_suits_in_ga(In, Out))
U36_ga(S, Ci, In, Co, Out, sort_suits_out_ga(In, Out)) → sort_suits_out_ga(.(=(S, Ci), In), .(=(S, Co), Out))
U27_ga(Hand, SortedHand, sort_suits_out_ga(SplitHand, SortedHand)) → sort_hand_out_ga(Hand, SortedHand)
U1_gaaa(Hand, Attributes, Points, Bid, sort_hand_out_ga(Hand, SortedHand)) → U2_gaaa(Hand, Attributes, Points, Bid, SortedHand, evaluate_in_gaa(SortedHand, Attributes, Points))
evaluate_in_gaa(Hand, [], P) → U4_gaa(Hand, P, hcp_in_gga(Hand, 0, HCP))
hcp_in_gga([], N, N) → hcp_out_gga([], N, N)
hcp_in_gga(.(=(_X, C), Sn), Ni, No) → U7_gga(_X, C, Sn, Ni, No, hcp_suit_in_ga(C, N))
hcp_suit_in_ga(S, P) → U10_ga(S, P, honors_in_gga(S, 0, HP))
honors_in_gga([], Pi, Pi) → honors_out_gga([], Pi, Pi)
honors_in_gga(.(C1, Cn), Pi, Po) → U14_gga(C1, Cn, Pi, Po, honor_in_ga(C1, P))
U14_gga(C1, Cn, Pi, Po, honor_out_ga(C1, P)) → U15_gga(C1, Cn, Pi, Po, P, >_in_gg(P, 0))
U15_gga(C1, Cn, Pi, Po, P, >_out_gg(P, 0)) → U16_gga(C1, Cn, Pi, Po, is_in_ag(Pt, +(P, Pi)))
is_in_ag(X0, X1) → is_out_ag(X0, X1)
U16_gga(C1, Cn, Pi, Po, is_out_ag(Pt, +(P, Pi))) → U17_gga(C1, Cn, Pi, Po, honors_in_gaa(Cn, Pt, Po))
honors_in_gaa([], Pi, Pi) → honors_out_gaa([], Pi, Pi)
honors_in_gaa(.(C1, Cn), Pi, Po) → U14_gaa(C1, Cn, Pi, Po, honor_in_ga(C1, P))
U14_gaa(C1, Cn, Pi, Po, honor_out_ga(C1, P)) → U15_gaa(C1, Cn, Pi, Po, P, >_in_gg(P, 0))
U15_gaa(C1, Cn, Pi, Po, P, >_out_gg(P, 0)) → U16_gaa(C1, Cn, Pi, Po, is_in_aa(Pt, +(P, Pi)))
is_in_aa(X0, X1) → is_out_aa(X0, X1)
U16_gaa(C1, Cn, Pi, Po, is_out_aa(Pt, +(P, Pi))) → U17_gaa(C1, Cn, Pi, Po, honors_in_gaa(Cn, Pt, Po))
honors_in_gaa(.(C1, Cn), Pi, Pi) → U18_gaa(C1, Cn, Pi, honor_in_gg(C1, 0))
honor_in_gg(C, N) → U19_gg(C, N, face_card_in_gg(C, N))
face_card_in_gg(ace, 4) → face_card_out_gg(ace, 4)
face_card_in_gg(king, 3) → face_card_out_gg(king, 3)
face_card_in_gg(queen, 2) → face_card_out_gg(queen, 2)
face_card_in_gg(jack, 1) → face_card_out_gg(jack, 1)
U19_gg(C, N, face_card_out_gg(C, N)) → honor_out_gg(C, N)
honor_in_gg(C, 0) → U20_gg(C, integer_in_g(C))
U20_gg(C, integer_out_g(C)) → honor_out_gg(C, 0)
U18_gaa(C1, Cn, Pi, honor_out_gg(C1, 0)) → honors_out_gaa(.(C1, Cn), Pi, Pi)
U17_gaa(C1, Cn, Pi, Po, honors_out_gaa(Cn, Pt, Po)) → honors_out_gaa(.(C1, Cn), Pi, Po)
U17_gga(C1, Cn, Pi, Po, honors_out_gaa(Cn, Pt, Po)) → honors_out_gga(.(C1, Cn), Pi, Po)
honors_in_gga(.(C1, Cn), Pi, Pi) → U18_gga(C1, Cn, Pi, honor_in_gg(C1, 0))
U18_gga(C1, Cn, Pi, honor_out_gg(C1, 0)) → honors_out_gga(.(C1, Cn), Pi, Pi)
U10_ga(S, P, honors_out_gga(S, 0, HP)) → U11_ga(S, P, HP, dist_in_ga(S, DP))
dist_in_ga([], 3) → dist_out_ga([], 3)
dist_in_ga(.(X2, []), 2) → dist_out_ga(.(X2, []), 2)
dist_in_ga(.(X3, .(X4, [])), 1) → dist_out_ga(.(X3, .(X4, [])), 1)
dist_in_ga(.(X5, .(X6, .(X7, X8))), 0) → dist_out_ga(.(X5, .(X6, .(X7, X8))), 0)
U11_ga(S, P, HP, dist_out_ga(S, DP)) → U12_ga(S, P, HP, DP, misc_in_ga(S, MP))
misc_in_ga(.(ace, []), -1) → misc_out_ga(.(ace, []), -1)
misc_in_ga(.(king, []), -2) → misc_out_ga(.(king, []), -2)
misc_in_ga(.(queen, .(X9, [])), -2) → misc_out_ga(.(queen, .(X9, [])), -2)
misc_in_ga(.(jack, .(X10, [])), -1) → misc_out_ga(.(jack, .(X10, [])), -1)
misc_in_ga(.(_X, .(_Y, .(H3, Rem))), P) → U21_ga(_X, _Y, H3, Rem, P, honor_in_ga(H3, X))
U21_ga(_X, _Y, H3, Rem, P, honor_out_ga(H3, X)) → U22_ga(_X, _Y, H3, Rem, P, >_in_gg(X, 0))
U22_ga(_X, _Y, H3, Rem, P, >_out_gg(X, 0)) → U23_ga(_X, _Y, H3, Rem, P, length_in_ga(Rem, N))
length_in_ga(X0, X1) → length_out_ga(X0, X1)
U23_ga(_X, _Y, H3, Rem, P, length_out_ga(Rem, N)) → U24_ga(_X, _Y, H3, Rem, P, N, >_in_ag(N, 2))
>_in_ag(X0, X1) → >_out_ag(X0, X1)
U24_ga(_X, _Y, H3, Rem, P, N, >_out_ag(N, 2)) → U25_ga(_X, _Y, H3, Rem, P, is_in_aa(P, -(N, 2)))
U25_ga(_X, _Y, H3, Rem, P, is_out_aa(P, -(N, 2))) → misc_out_ga(.(_X, .(_Y, .(H3, Rem))), P)
misc_in_ga(X11, 0) → misc_out_ga(X11, 0)
U12_ga(S, P, HP, DP, misc_out_ga(S, MP)) → U13_ga(S, P, is_in_aa(P, +(HP, +(DP, MP))))
U13_ga(S, P, is_out_aa(P, +(HP, +(DP, MP)))) → hcp_suit_out_ga(S, P)
U7_gga(_X, C, Sn, Ni, No, hcp_suit_out_ga(C, N)) → U8_gga(_X, C, Sn, Ni, No, is_in_aa(Nt, +(N, Ni)))
U8_gga(_X, C, Sn, Ni, No, is_out_aa(Nt, +(N, Ni))) → U9_gga(_X, C, Sn, Ni, No, hcp_in_gaa(Sn, Nt, No))
hcp_in_gaa([], N, N) → hcp_out_gaa([], N, N)
hcp_in_gaa(.(=(_X, C), Sn), Ni, No) → U7_gaa(_X, C, Sn, Ni, No, hcp_suit_in_ga(C, N))
U7_gaa(_X, C, Sn, Ni, No, hcp_suit_out_ga(C, N)) → U8_gaa(_X, C, Sn, Ni, No, is_in_aa(Nt, +(N, Ni)))
U8_gaa(_X, C, Sn, Ni, No, is_out_aa(Nt, +(N, Ni))) → U9_gaa(_X, C, Sn, Ni, No, hcp_in_gaa(Sn, Nt, No))
U9_gaa(_X, C, Sn, Ni, No, hcp_out_gaa(Sn, Nt, No)) → hcp_out_gaa(.(=(_X, C), Sn), Ni, No)
U9_gga(_X, C, Sn, Ni, No, hcp_out_gaa(Sn, Nt, No)) → hcp_out_gga(.(=(_X, C), Sn), Ni, No)
U4_gaa(Hand, P, hcp_out_gga(Hand, 0, HCP)) → U5_gaa(Hand, P, HCP, adjustments_in_ga(Hand, MP))
adjustments_in_ga(X1, 0) → adjustments_out_ga(X1, 0)
U5_gaa(Hand, P, HCP, adjustments_out_ga(Hand, MP)) → U6_gaa(Hand, P, is_in_aa(P, +(HCP, MP)))
U6_gaa(Hand, P, is_out_aa(P, +(HCP, MP))) → evaluate_out_gaa(Hand, [], P)
U2_gaaa(Hand, Attributes, Points, Bid, SortedHand, evaluate_out_gaa(SortedHand, Attributes, Points)) → U3_gaaa(Hand, Attributes, Points, Bid, make_bid_in_ggaa(SortedHand, Attributes, Points, Bid))
make_bid_in_ggaa(Hand, Attributes, Points, 'punt...') → make_bid_out_ggaa(Hand, Attributes, Points, 'punt...')
U3_gaaa(Hand, Attributes, Points, Bid, make_bid_out_ggaa(SortedHand, Attributes, Points, Bid)) → bid_out_gaaa(Hand, Attributes, Points, Bid)
FILTER_IN_GGA(.(-(_A, X), In), Suit, Out) → U33_GGA(_A, X, In, Suit, Out, \==_in_gg(Suit, X))
U33_GGA(_A, X, In, Suit, Out, \==_out_gg(Suit, X)) → FILTER_IN_GGA(In, Suit, Out)
FILTER_IN_GGA(.(-(Card, Suit), In), Suit, .(Card, Out)) → FILTER_IN_GGA(In, Suit, Out)
\==_in_gg(X0, X1) → \==_out_gg(X0, X1)
FILTER_IN_GGA(.(-(_A, X), In), Suit) → U33_GGA(In, Suit, \==_in_gg(Suit, X))
U33_GGA(In, Suit, \==_out_gg) → FILTER_IN_GGA(In, Suit)
FILTER_IN_GGA(.(-(Card, Suit), In), Suit) → FILTER_IN_GGA(In, Suit)
\==_in_gg(X0, X1) → \==_out_gg
\==_in_gg(x0, x1)
From the DPs we obtained the following set of size-change graphs: