1c1 < ( MUF-Cribbage Version 2.01. Concept and code by Sjade ) --- > ( MUF-Cribbage Version 4.01. Concept and code by Sjade ) 4,12d3 < ( This code is freely usable by permission of both of ) < ( the co-authors listed above with the following stip- ) < ( ulations. [1] This header is to be left intact and ) < ( all mention of the authors associated with this game ) < ( must be left in place and unaltered. [2] All changes ) < ( made to the stock code as distributed in this file be ) < ( sent via mail to either sjade@hobbes.cs.mcgill.ca or ) < ( mouse@collatz.mcrcim.mcgill.edu. Thank you. ) < () 16c7 < ( bitand ) --- > ( bitand ) 25,29c16,20 < ( over not if ) < ( pop pop remove_prop ) < ( else ) < ( addprop ) < ( then ) --- > ( over not if ) > ( pop pop remove_prop ) > ( else ) > ( addprop ) > ( then ) 46,54c37,45 < over 4 pick + -4 rotate begin over 4 pick and while < over 4 pick + 4 + pick 3 pick 5 + pick 3 pick execute if < rot 1 - -3 rotate < else < over 4 + rotate 4 < pick 4 pick + 4 + -1 * rotate swap 1 - swap < then < repeat < pop pop pop --- > over 4 pick + -4 rotate begin over 4 pick and while > over 4 pick + 4 + pick 3 pick 5 + pick 3 pick execute if > rot 1 - -3 rotate > else > over 4 + rotate 4 > pick 4 pick + 4 + -1 * rotate swap 1 - swap > then > repeat > pop pop pop 57,63c48,54 < over 2 < if < pop exit < then < over 2 / rot over - over 3 + -1 * rotate over over < 3 + -1 * rotate swap sort dup 2 + pick over 4 + pick < 3 pick + 4 + 3 pick 2 + roll sort dup 3 + rotate < swap dup 3 + rotate merge --- > over 2 < if > pop exit > then > over 2 / rot over - over 3 + -1 * rotate over over > 3 + -1 * rotate swap sort dup 2 + pick over 4 + pick > 3 pick + 4 + 3 pick 2 + roll sort dup 3 + rotate > swap dup 3 + rotate merge 66c57 < me @ swap notify --- > me @ swap notify 69c60,70 < loc @ me @ rot notify_except --- > loc @ contents begin dup while > dup player? if > dup me @ dbcmp not if > dup "_game_ok?" getpropstr if > dup 3 pick notify > then > then > then > next > repeat > pop pop 72c73,81 < loc @ #-1 rot notify_except --- > loc @ contents begin dup while > dup player? if > dup "_game_ok?" getpropstr if > dup 3 pick notify > then > then > next > repeat > pop pop 75,81c84,90 < dup not if exit then < begin dup 1 strcut pop < " " stringcmp not while < 1 strcut swap pop repeat < begin dup dup strlen 1 - strcut < swap pop " " stringcmp not while < dup strlen 1 - strcut pop repeat --- > dup not if exit then > begin dup 1 strcut pop > " " stringcmp not while > 1 strcut swap pop repeat > begin dup dup strlen 1 - strcut > swap pop " " stringcmp not while > dup strlen 1 - strcut pop repeat 84,88c93,97 < dup dup " " instr dup if < 1 - strcut pop < else < pop < then --- > dup dup " " instr dup if > 1 - strcut pop > else > pop > then 91,95c100,104 < dup " " instr dup if < strcut swap pop strip < else < pop pop "" < then --- > dup " " instr dup if > strcut swap pop strip > else > pop pop "" > then 98c107 < trigger @ location --- > trigger @ location 101,102c110,111 < board ".handtotal1" getpropstr not < board ".handtotal2" getpropstr not and --- > board ".crib1" getpropstr > board ".crib2" getpropstr and 103a113,116 > : end_crib? ( -- i ) > board ".handtotal1" getpropstr not > board ".handtotal2" getpropstr not and > ; 105c118 < board ".turn" getpropstr atoi --- > board ".turn" getpropstr atoi 108c121 < board ".pegturn" getpropstr atoi --- > board ".pegturn" getpropstr atoi 111,115c124,128 < pegturn 1 = if < 2 < else < 1 < then --- > pegturn 1 = if > 2 > else > 1 > then 118,122c131,135 < turn 1 = if < board ".turn" "2" 0 addprop < else < board ".turn" "1" 0 addprop < then --- > turn 1 = if > board ".turn" "2" 0 addprop > else > board ".turn" "1" 0 addprop > then 125,129c138,142 < pegturn 1 = if < board ".pegturn" "2" 0 addprop < else < board ".pegturn" "1" 0 addprop < then --- > pegturn 1 = if > board ".pegturn" "2" 0 addprop > else > board ".pegturn" "1" 0 addprop > then 132,133c145,146 < ".player" turn intostr strcat < board swap getpropstr atoi dbref --- > ".player" turn intostr strcat > board swap getpropstr atoi dbref 136,139c149,152 < turn 1 = if < "2" else "1" then < ".player" swap strcat < board swap getpropstr atoi dbref --- > turn 1 = if > "2" else "1" then > ".player" swap strcat > board swap getpropstr atoi dbref 142,143c155,156 < board ".player1" getpropstr atoi dbref over dbcmp < board ".player2" getpropstr atoi dbref rot dbcmp or --- > board ".player1" getpropstr atoi dbref over dbcmp > board ".player2" getpropstr atoi dbref rot dbcmp or 146,149c159,162 < dup playing? not if < pop 0 exit then < board ".player1" getpropstr atoi dbref swap dbcmp if < 1 else 2 then --- > dup playing? not if > pop 0 exit then > board ".player1" getpropstr atoi dbref swap dbcmp if > 1 else 2 then 152,155c165,168 < dup player? not if < pop 0 exit then < board ".player1" getpropstr atoi dbref swap dbcmp if < 2 else 1 then --- > dup player? not if > pop 0 exit then > board ".player1" getpropstr atoi dbref swap dbcmp if > 2 else 1 then 158c171 < board ".player1" getpropstr atoi dbref --- > board ".player1" getpropstr atoi dbref 161c174 < board ".player2" getpropstr atoi dbref --- > board ".player2" getpropstr atoi dbref 164,169c177,182 < pegturn 1 = if < p1 else p2 then < "## It is now %t's turn." over name "%t" subst announce < "## Your hand is [%h]" < board ".hand" pegturn intostr strcat getpropstr < "%h" subst notify --- > pegturn 1 = if > p1 else p2 then > "## It is now %t's turn." over name "%t" subst announce > "## Your hand is [%h]" > board ".hand" pegturn intostr strcat getpropstr > "%h" subst notify 172,173c185,186 < board ".player1" getpropstr < board ".player2" getpropstr and --- > board ".player1" getpropstr > board ".player2" getpropstr and 176,183c189,196 < "## " p1 name strcat " [" strcat < board ".played1" getpropstr strip dup strlen < " " swap strcut swap pop strcat strcat < "] => " strcat board ".total" getpropstr atoi intostr dup < strlen " " swap strcut swap pop swap strcat strcat " <= [" < strcat board ".played2" getpropstr strip dup strlen < " " swap strcut swap pop strcat strcat "] " strcat < p2 name strcat announce --- > "## " p1 name strcat " [" strcat > board ".played1" getpropstr strip dup strlen > " " swap strcut swap pop strcat strcat > "] => " strcat board ".total" getpropstr atoi intostr dup > strlen " " swap strcut swap pop swap strcat strcat " <= [" > strcat board ".played2" getpropstr strip dup strlen > " " swap strcut swap pop strcat strcat "] " strcat > p2 name strcat announce 186,192c199,205 < board ".peg" 3 pick intostr strcat "1" strcat getpropstr < board ".peg" 4 rotate intostr strcat "2" strcat getpropstr < over not over not and if < pop pop 0 exit then < over atoi 60 > over atoi 60 > or if < 2 else 1 then < swap pop swap pop --- > board ".peg" 3 pick intostr strcat "1" strcat getpropstr > board ".peg" 4 rotate intostr strcat "2" strcat getpropstr > over not over not and if > pop pop 0 exit then > over atoi 60 > over atoi 60 > or if > 2 else 1 then > swap pop swap pop 195,197c208,210 < 1 strcut ".sn" swap strcat board swap getpropstr < swap ".cn" swap strcat board swap getpropstr < " of " strcat swap strcat --- > 1 strcut ".sn" swap strcat board swap getpropstr > swap ".cn" swap strcat board swap getpropstr > " of " strcat swap strcat 200,205c213,218 < 1 strcut pop < dup atoi if < atoi exit then < dup "A" stringcmp not if < pop 1 exit then < pop 10 --- > 1 strcut pop > dup atoi if > atoi exit then > dup "A" stringcmp not if > pop 1 exit then > pop 10 208,219c221,232 < 1 strcut pop < dup atoi if < atoi exit then < dup "A" stringcmp not if < pop 1 exit then < dup "K" stringcmp not if < pop 13 exit then < dup "Q" stringcmp not if < pop 12 exit then < dup "J" stringcmp not if < pop 11 exit then < pop 10 --- > 1 strcut pop > dup atoi if > atoi exit then > dup "A" stringcmp not if > pop 1 exit then > dup "K" stringcmp not if > pop 13 exit then > dup "Q" stringcmp not if > pop 12 exit then > dup "J" stringcmp not if > pop 11 exit then > pop 10 222,228c235,241 < 1 strcut swap pop < tolower < "1" "s" subst < "2" "d" subst < "3" "c" subst < "4" "h" subst < atoi --- > 1 strcut swap pop > tolower > "1" "s" subst > "2" "d" subst > "3" "c" subst > "4" "h" subst > atoi 231,232c244,245 < board ".player1" getpropstr < board ".player2" getpropstr and --- > board ".player1" getpropstr > board ".player2" getpropstr and 235,236c248,249 < begin dup while < swap pop 1 - repeat pop --- > begin dup while > swap pop 1 - repeat pop 239,247c252,260 < board ".hand" 3 pick intostr strcat getpropstr dup not if < pop pop 0 exit then < strip " " explode begin dup while < board ".total" getpropstr atoi 3 pick face_value < + 31 <= if < explode_clear pop 1 exit then < swap pop 1 - < repeat < pop pop 0 --- > board ".hand" 3 pick intostr strcat getpropstr dup not if > pop pop 0 exit then > strip " " explode begin dup while > board ".total" getpropstr atoi 3 pick face_value > + 31 <= if > explode_clear pop 1 exit then > swap pop 1 - > repeat > pop pop 0 250c263 < 1 strcut tolower swap toupper swap strcat --- > 1 strcut tolower swap toupper swap strcat 253,254c266,267 < board ".peg" 4 rotate intostr strcat < rot intostr strcat getpropstr atoi --- > board ".peg" 4 rotate intostr strcat > rot intostr strcat getpropstr atoi 257,259c270,272 < dup 1 pegval swap 2 pegval < over over >= if < pop else swap pop then --- > dup 1 pegval swap 2 pegval > over over >= if > pop else swap pop then 262,264c275,277 < dup 1 pegval swap pegval < over over >= if < swap pop else pop then --- > dup 1 pegval swap pegval > over over >= if > swap pop else pop then 267,271c280,284 < board ".length" getpropstr if < dup 1 pegval 60 > swap 2 pegval 60 > or < else < dup 1 pegval 120 > swap 2 pegval 120 > or < then --- > board ".length" getpropstr if > dup 1 pegval 60 > swap 2 pegval 60 > or > else > dup 1 pegval 120 > swap 2 pegval 120 > or > then 274,295c287,303 < dup 1 = if < 2 else 1 then < board ".length" getpropstr < over hipeg 90 > or if < pop "## " board ".player" 4 rotate intostr strcat < getpropstr atoi dbref name strcat " has won the game!" < strcat announce < else < "## %w has won the game and %s %l!" < over hipeg 91 < if < "skunked" "%s" subst < then < over hipeg 61 < if < "double skunked" "%s" subst < then < board ".player" 4 rotate intostr strcat getpropstr < atoi dbref name "%l" subst < board ".player" 4 rotate intostr strcat getpropstr < atoi dbref name "%w" subst < announce < then < board ".game_over" "yes" 0 addprop --- > dup 1 = if > 2 else 1 then > board ".length" getpropstr if > 31 else 61 then > over hipeg swap >= if > pop "## " board ".player" 4 rotate intostr strcat > getpropstr atoi dbref name strcat " has won the game!" > strcat announce > else > "## %w has won the game and skunked %l!" > board ".player" 4 rotate intostr strcat getpropstr > atoi dbref name "%l" subst > board ".player" 4 rotate intostr strcat getpropstr > atoi dbref name "%w" subst > announce > then > board ".game_over" "yes" 0 addprop 298,324c306,332 < dup not if < pop "## " board ".player" 4 rotate intostr strcat < getpropstr atoi dbref name strcat " has a '19' hand, " < strcat "worth no points." strcat announce 0 exit < then < swap dup rot < board ".peg" 4 pick intostr strcat "1" strcat getpropstr atoi < board ".peg" 5 pick intostr strcat "2" strcat getpropstr atoi < >= if < ".peg" 3 pick intostr strcat "1" strcat < else < ".peg" 3 pick intostr strcat "2" strcat < then < board over getpropstr atoi < 3 pick + dup 121 >= if < pop 121 then < intostr swap dup strlen 1 - strcut "2" stringcmp not if < "1" else "2" < then < strcat board swap rot 0 addprop < "## " rot 1 = if < p1 else p2 then < name strcat " pegs off " strcat < over intostr strcat " points." strcat < swap 1 = if < "point" "points" subst then < announce winner? --- > dup not if > pop "## " board ".player" 4 rotate intostr strcat > getpropstr atoi dbref name strcat " has a '19' hand, " > strcat "worth no points." strcat announce 0 exit > then > swap dup rot > board ".peg" 4 pick intostr strcat "1" strcat getpropstr atoi > board ".peg" 5 pick intostr strcat "2" strcat getpropstr atoi > >= if > ".peg" 3 pick intostr strcat "1" strcat > else > ".peg" 3 pick intostr strcat "2" strcat > then > board over getpropstr atoi > 3 pick + dup 121 >= if > pop 121 then > intostr swap dup strlen 1 - strcut "2" stringcmp not if > "1" else "2" > then > strcat board swap rot 0 addprop > "## " rot 1 = if > p1 else p2 then > name strcat " pegs off " strcat > over intostr strcat " points." strcat > swap 1 = if > "point" "points" subst then > announce winner? 327,330c335,338 < board ".suit1" "As2s3s4s5s6s7s8s9sTsJsQsKs" 0 addprop < board ".suit2" "Ac2c3c4c5c6c7c8c9cTcJcQcKc" 0 addprop < board ".suit3" "Ah2h3h4h5h6h7h8h9hThJhQhKh" 0 addprop < board ".suit4" "Ad2d3d4d5d6d7d8d9dTdJdQdKd" 0 addprop --- > board ".suit1" "As2s3s4s5s6s7s8s9sTsJsQsKs" 0 addprop > board ".suit2" "Ac2c3c4c5c6c7c8c9cTcJcQcKc" 0 addprop > board ".suit3" "Ah2h3h4h5h6h7h8h9hThJhQhKh" 0 addprop > board ".suit4" "Ad2d3d4d5d6d7d8d9dTdJdQdKd" 0 addprop 333,340c341,348 < "" begin over while < random 4 % 1 + intostr ".suit" swap strcat < board over getpropstr < dup strlen 2 / random swap % 2 * < strcut 2 strcut rot swap strcat < board 4 rotate rot 0 addprop strcat < " " strcat swap 1 - swap repeat < swap pop dup strlen 1 - strcut pop --- > "" begin over while > random 4 % 1 + intostr ".suit" swap strcat > board over getpropstr > dup strlen 2 / random swap % 2 * > strcut 2 strcut rot swap strcat > board 4 rotate rot 0 addprop strcat > " " strcat swap 1 - swap repeat > swap pop dup strlen 1 - strcut pop 343,361c351,369 < shuffle < board ".handtotal1" remove_prop < board ".handtotal2" remove_prop < board ".cribtotal" remove_prop < board ".dispute" remove_prop < board ".h1" remove_prop < board ".h2" remove_prop < board ".c" remove_prop < board ".hand1" remove_prop < board ".hand2" remove_prop < board ".dealt" remove_prop < board ".played1" remove_prop < board ".played2" remove_prop < board ".crib1" remove_prop < board ".crib2" remove_prop < board ".cc" remove_prop < board ".total" remove_prop < board ".seq" remove_prop < board ".pegturn" remove_prop --- > shuffle > board ".handtotal1" remove_prop > board ".handtotal2" remove_prop > board ".cribtotal" remove_prop > board ".dispute" remove_prop > board ".h1" remove_prop > board ".h2" remove_prop > board ".c" remove_prop > board ".hand1" remove_prop > board ".hand2" remove_prop > board ".dealt" remove_prop > board ".played1" remove_prop > board ".played2" remove_prop > board ".crib1" remove_prop > board ".crib2" remove_prop > board ".cc" remove_prop > board ".total" remove_prop > board ".seq" remove_prop > board ".pegturn" remove_prop 364,413c372,423 < dup arg tolower "h" instr if < board ".length" "half" 0 addprop < else < board ".length" remove_prop < then < arg tolower "m" instr if < board ".manual" "yes" 0 addprop < else < board ".manual" remove_prop < then < board ".player1" remove_prop < board ".player2" remove_prop < board ".turn" remove_prop < board ".cut1" remove_prop < board ".cut2" remove_prop < board ".peg11" remove_prop < board ".peg12" remove_prop < board ".peg21" remove_prop < board ".peg22" remove_prop < board ".game_over" remove_prop < board ".sns" "spades" 0 addprop < board ".snd" "diamonds" 0 addprop < board ".snc" "clubs" 0 addprop < board ".snh" "hearts" 0 addprop < board ".cnA" "Ace" 0 addprop < board ".cn2" "2" 0 addprop < board ".cn3" "3" 0 addprop < board ".cn4" "4" 0 addprop < board ".cn5" "5" 0 addprop < board ".cn6" "6" 0 addprop < board ".cn7" "7" 0 addprop < board ".cn8" "8" 0 addprop < board ".cn9" "9" 0 addprop < board ".cnT" "10" 0 addprop < board ".cnJ" "Jack" 0 addprop < board ".cnQ" "Queen" 0 addprop < board ".cnK" "King" 0 addprop < hand_reset < "## " me @ name strcat " resets the game." strcat sayall < "## You reset the game." say < board ".length" getpropstr if < "## Next game has been set to half length." announce < else < "## Next game has been set to full length." announce < then < board ".manual" getpropstr if < "## Next game has been set to manual pegging." announce < else < "## Next game has been set to automatic pegging." announce < then --- > dup arg tolower "h" instr if > board ".length" "half" 0 addprop > else > board ".length" remove_prop > then > arg tolower "m" instr if > board ".manual" "yes" 0 addprop > else > board ".manual" remove_prop > then > board ".player1" remove_prop > board ".player2" remove_prop > board ".style1" remove_prop > board ".style2" remove_prop > board ".turn" remove_prop > board ".cut1" remove_prop > board ".cut2" remove_prop > board ".peg11" remove_prop > board ".peg12" remove_prop > board ".peg21" remove_prop > board ".peg22" remove_prop > board ".game_over" remove_prop > board ".sns" "spades" 0 addprop > board ".snd" "diamonds" 0 addprop > board ".snc" "clubs" 0 addprop > board ".snh" "hearts" 0 addprop > board ".cnA" "Ace" 0 addprop > board ".cn2" "2" 0 addprop > board ".cn3" "3" 0 addprop > board ".cn4" "4" 0 addprop > board ".cn5" "5" 0 addprop > board ".cn6" "6" 0 addprop > board ".cn7" "7" 0 addprop > board ".cn8" "8" 0 addprop > board ".cn9" "9" 0 addprop > board ".cnT" "10" 0 addprop > board ".cnJ" "Jack" 0 addprop > board ".cnQ" "Queen" 0 addprop > board ".cnK" "King" 0 addprop > hand_reset > "## " me @ name strcat " resets the game." strcat sayall > "## You reset the game." say > board ".length" getpropstr if > "## Next game has been set to half length." announce > else > "## Next game has been set to full length." announce > then > board ".manual" getpropstr if > "## Next game has been set to manual pegging." announce > else > "## Next game has been set to automatic pegging." announce > then 415,426c425,432 < : do_join ( -- ) < me @ playing? if < "## You are already joined." say exit then < game_full? if < "## Two people are already joined." say exit then < board ".player1" getpropstr if < board ".player2" me @ intostr 0 addprop < else < board ".player1" me @ intostr 0 addprop < then < "## " me @ name strcat " joins the game." strcat sayall < "## You join the game." say --- > : do_hand ( -- ) > me @ playing? not if > "## You're not playing!" say exit then > board ".dealt" getpropstr not if > "## There is no hand in progress." say exit then > me @ player ".hand" swap intostr strcat > board swap getpropstr > "## Your hand is [" swap strcat "]" strcat say 427a434,502 > : do_sort_suit ( -- ) > suit_value swap suit_value > > ; > : do_sort_face_value ( -- ) > cut_face_value swap cut_face_value > > ; > : do_sort_hand ( -- ) > board ".style" rot intostr strcat getpropstr > swap strip " " explode > dup 2 + pick dup "both" stringcmp not > swap "face value" stringcmp not or if > 'do_sort_face_value sort > then > dup 2 + rotate dup "both" stringcmp not > swap "suit" stringcmp not or if > 'do_sort_suit sort > then > 1 - begin dup while > swap " " strcat rot strcat > swap 1 - > repeat > pop strip > ; > : do_sort_manual ( s -- ) > me @ playing? not if > pop "## You're not in this game!" say exit then > board ".dealt" getpropstr not over not and if > pop "## No hand has been dealt." say exit then > dup not if > pop > board ".hand" me @ player intostr strcat getpropstr > me @ player do_sort_hand > board ".hand" me @ player intostr strcat > rot 0 addprop > do_hand exit then > tolower dup 1 strcut pop "nfsb" swap instr not if > pop "## Specify one, ace value, uit or oth." > say exit then > 1 strcut pop > dup "n" stringcmp not if > pop "none" then > dup "f" stringcmp not if > pop "face value" then > dup "s" stringcmp not if > pop "suit" then > dup "b" stringcmp not if > pop "both" then > "## Hand sorting style is now set to: " over strcat > "." strcat say > board ".style" me @ player intostr strcat rot 0 addprop > ; > : do_join ( s -- ) > me @ playing? if > pop "## You are already joined." say exit then > game_full? if > pop "## Two people are already joined." say exit then > board ".player1" getpropstr if > board ".player2" me @ intostr 0 addprop > else > board ".player1" me @ intostr 0 addprop > then > "## " me @ name strcat " joins the game." strcat sayall > "## You join the game." say > dup not if > pop "none" then > tolower dup 1 strcut pop "nfsb" swap instr not if > pop "none" then > do_sort_manual > ; 429,441c504,518 < board ".dealt" getpropstr if < "## Hand is in progress." say exit then < me @ player not if < "## You're not in this game!" say exit then < me @ player turn = not if < "## It's not your turn to deal." say exit then < "## " me @ name strcat " deals the hand." strcat sayall < "## You deal the hand." say < 6 pick_cards "## Your hand is [" over strcat "]" strcat < p1 swap notify board ".hand1" rot 0 addprop < 6 pick_cards "## Your hand is [" over strcat "]" strcat < p2 swap notify board ".hand2" rot 0 addprop < board ".dealt" "yes" 0 addprop --- > board ".dealt" getpropstr if > "## Hand is in progress." say exit then > me @ player not if > "## You're not in this game!" say exit then > me @ player turn = not if > "## It's not your turn to deal." say exit then > "## " me @ name strcat " deals the hand." strcat sayall > "## You deal the hand." say > 6 pick_cards 1 do_sort_hand > "## Your hand is [" over strcat "]" strcat > p1 swap notify board ".hand1" rot 0 addprop > 6 pick_cards 2 do_sort_hand > "## Your hand is [" over strcat "]" strcat > p2 swap notify board ".hand2" rot 0 addprop > board ".dealt" "yes" 0 addprop 444,465c521,542 < me @ player not if < "## You're not playing!" say exit then < me @ op dbcmp not if < "## It's not your turn to cut." say exit then < crib? not if < "## A crib must be decided first." say exit then < board ".cc" getpropstr if < "## A cut card has already been chosen!" say exit then < 1 pick_cards < "## " me @ name strcat " cuts the " strcat over unparse_card < strcat "." strcat sayall "## You cut the " over unparse_card < strcat "." strcat say board ".cc" 3 pick 0 addprop < "J" 1 strncmp not if < "## Lead cut is a Jack." announce < cp player 2 peg if < cp player game_over exit < then < then < "## Pegging play begins with " op name strcat "." strcat < announce op player intostr board ".pegturn" rot 0 addprop < op "## Your hand is [%h]" board ".hand" pegturn intostr < strcat getpropstr "%h" subst notify --- > me @ player not if > "## You're not playing!" say exit then > me @ op dbcmp not if > "## It's not your turn to cut." say exit then > crib? not if > "## A crib must be decided first." say exit then > board ".cc" getpropstr if > "## A cut card has already been chosen!" say exit then > 1 pick_cards > "## %op cuts the deck and %cp turns over the %cc." > op name "%op" subst cp name "%cp" subst over unparse_card > "%cc" subst announce board ".cc" 3 pick 0 addprop > "J" 1 strncmp not if > "## Lead cut is a Jack." announce > cp player 2 peg if > cp player game_over exit > then > then > "## Pegging play begins with " op name strcat "." strcat > announce op player intostr board ".pegturn" rot 0 addprop > op "## Your hand is [%h]" board ".hand" pegturn intostr > strcat getpropstr "%h" subst notify 468,499c545,576 < board ".dealt" getpropstr if < do_cutcard exit then < me @ player dup not if < pop "## You're not playing!" say exit then < turn if < pop "## Lead deal is already determined." say exit then < board ".cut" 3 pick intostr strcat getpropstr if < pop "## You have already cut for deal." say exit then < game_ready? not if < pop "## Two people must join first." say exit then < 1 pick_cards < "## " me @ name strcat " cuts the " strcat over unparse_card < strcat "." strcat sayall < "## You cut the " over unparse_card strcat "." strcat say < ".cut" rot intostr strcat board swap rot 0 addprop < board ".cut1" getpropstr board ".cut2" getpropstr and if < board ".cut1" getpropstr cut_face_value < board ".cut2" getpropstr cut_face_value < over over = if < pop pop "## Cards tie. Cut again." announce < board ".cut1" remove_prop < board ".cut2" remove_prop exit then < < if < "## Player 1, " p1 name strcat < ", has first deal and crib." strcat announce < board ".turn" "1" 0 addprop < else < "## Player 2, " p2 name strcat < ", has first deal and crib." strcat announce < board ".turn" "2" 0 addprop < then < then --- > board ".dealt" getpropstr if > do_cutcard exit then > me @ player dup not if > pop "## You're not playing!" say exit then > turn if > pop "## Lead deal is already determined." say exit then > board ".cut" 3 pick intostr strcat getpropstr if > pop "## You have already cut for deal." say exit then > game_ready? not if > pop "## Two people must join first." say exit then > 1 pick_cards > "## " me @ name strcat " cuts the " strcat over unparse_card > strcat "." strcat sayall > "## You cut the " over unparse_card strcat "." strcat say > ".cut" rot intostr strcat board swap rot 0 addprop > board ".cut1" getpropstr board ".cut2" getpropstr and if > board ".cut1" getpropstr cut_face_value > board ".cut2" getpropstr cut_face_value > over over = if > pop pop "## Cards tie. Cut again." announce > board ".cut1" remove_prop > board ".cut2" remove_prop exit then > < if > "## Player 1, " p1 name strcat > ", has first deal and crib." strcat announce > board ".turn" "1" 0 addprop > else > "## Player 2, " p2 name strcat > ", has first deal and crib." strcat announce > board ".turn" "2" 0 addprop > then > then 502c579 < ".............................." dup strcat --- > ".............................." dup strcat 505,506c582,583 < 1 - strcut 1 strcut swap pop < "!" swap strcat strcat --- > 1 - strcut 1 strcut swap pop > "!" swap strcat strcat 509,515c586,592 < 60 begin dup while < dup dup 30 % swap 5 % not and if < swap over strcut < " " swap strcat strcat swap < then < 1 - repeat < pop --- > 60 begin dup while > dup dup 30 % swap 5 % not and if > swap over strcut > " " swap strcat strcat swap > then > 1 - repeat > pop 518,523c595,600 < "" swap 1 begin dup 35 <= while < swap dup strlen 1 - strcut < 4 rotate swap strcat swap < rot 1 + < repeat < pop pop --- > "" swap 1 begin dup 35 <= while > swap dup strlen 1 - strcut > 4 rotate swap strcat swap > rot 1 + > repeat > pop pop 527,530c604,607 < 1 strcut pop < dup "A" strcmp not if pop "1" then < "TJQK" over instr if pop "10" then < atoi --- > 1 strcut pop > dup "A" strcmp not if pop "1" then > "TJQK" over instr if pop "10" then > atoi 533,539c610,616 < 1 strcut pop < dup "A" strcmp not if pop "1" then < dup "T" strcmp not if pop "10" then < dup "J" strcmp not if pop "11" then < dup "Q" strcmp not if pop "12" then < dup "K" strcmp not if pop "13" then < atoi --- > 1 strcut pop > dup "A" strcmp not if pop "1" then > dup "T" strcmp not if pop "10" then > dup "J" strcmp not if pop "11" then > dup "Q" strcmp not if pop "12" then > dup "K" strcmp not if pop "13" then > atoi 542,547c619,624 < 0 < over 1 & if 4 pick + then < over 2 & if 5 pick + then < over 4 & if 6 pick + then < over 8 & if 7 pick + then < over 16 & if 8 pick + then --- > 0 > over 1 & if 4 pick + then > over 2 & if 5 pick + then > over 4 & if 6 pick + then > over 8 & if 7 pick + then > over 16 & if 8 pick + then 551,553c628,630 < over over < if swap then < rot sort-2 < rot sort-2 --- > over over < if swap then > rot sort-2 > rot sort-2 556,557c633,634 < sort-3 -5 rotate -5 rotate sort-3 5 rotate sort-3 rot < 5 rotate sort-3 4 rotate sort-3 --- > sort-3 -5 rotate -5 rotate sort-3 5 rotate sort-3 rot > 5 rotate sort-3 4 rotate sort-3 560,570c637,647 < " " explode pop < 5 rotate card-value-15 < 5 rotate card-value-15 < 5 rotate card-value-15 < 5 rotate card-value-15 < 5 rotate card-value-15 < 0 < 3 begin (should be "0 begin" for completeness - we optimize) < compute-select-sum 15 = if swap 1 + swap then < 1 + dup 31 <= while repeat < pop -6 rotate pop pop pop pop pop 2 * --- > " " explode pop > 5 rotate card-value-15 > 5 rotate card-value-15 > 5 rotate card-value-15 > 5 rotate card-value-15 > 5 rotate card-value-15 > 0 > 3 begin (should be "0 begin" for completeness - we optimize) > compute-select-sum 15 = if swap 1 + swap then > 1 + dup 31 <= while repeat > pop -6 rotate pop pop pop pop pop 2 * 573,582c650,659 < " " explode pop < 0 < 1 begin < dup 1 + begin < over 3 + pick < over 4 + pick < 1 strncmp not if rot 1 + rot rot then < 1 + dup 5 <= while repeat < pop 1 + dup 4 <= while repeat < pop -6 rotate pop pop pop pop pop 2 * --- > " " explode pop > 0 > 1 begin > dup 1 + begin > over 3 + pick > over 4 + pick > 1 strncmp not if rot 1 + rot rot then > 1 + dup 5 <= while repeat > pop 1 + dup 4 <= while repeat > pop -6 rotate pop pop pop pop pop 2 * 585c662 < 3 pick over & if over pick 4 rotate 4 rotate 1 + 4 rotate then --- > 3 pick over & if over pick 4 rotate 4 rotate 1 + 4 rotate then 588,596c665,673 < 9 16 begin run-maybe-pick 2 / swap 1 - swap dup 0 > while repeat < pop swap pop < begin dup 5 > while < 1 - swap 3 pick 1 + = not if < begin dup 4 > while 1 - swap pop repeat pop 0 < exit < then < repeat < pop pop 1 --- > 9 16 begin run-maybe-pick 2 / swap 1 - swap dup 0 > while repeat > pop swap pop > begin dup 5 > while > 1 - swap 3 pick 1 + = not if > begin dup 4 > while 1 - swap pop repeat pop 0 > exit > then > repeat > pop pop 1 599,627c676,704 < " " explode pop < 5 rotate card-value-run < 5 rotate card-value-run < 5 rotate card-value-run < 5 rotate card-value-run < 5 rotate card-value-run < sort-5 < 0 < 31 check-run if 5 + then < dup 0 = if < 15 check-run if 4 + then < 23 check-run if 4 + then < 27 check-run if 4 + then < 29 check-run if 4 + then < 30 check-run if 4 + then < then < dup 0 = if < 7 check-run if 3 + then < 11 check-run if 3 + then < 13 check-run if 3 + then < 14 check-run if 3 + then < 19 check-run if 3 + then < 21 check-run if 3 + then < 22 check-run if 3 + then < 25 check-run if 3 + then < 26 check-run if 3 + then < 28 check-run if 3 + then < then < -6 rotate pop pop pop pop pop --- > " " explode pop > 5 rotate card-value-run > 5 rotate card-value-run > 5 rotate card-value-run > 5 rotate card-value-run > 5 rotate card-value-run > sort-5 > 0 > 31 check-run if 5 + then > dup 0 = if > 15 check-run if 4 + then > 23 check-run if 4 + then > 27 check-run if 4 + then > 29 check-run if 4 + then > 30 check-run if 4 + then > then > dup 0 = if > 7 check-run if 3 + then > 11 check-run if 3 + then > 13 check-run if 3 + then > 14 check-run if 3 + then > 19 check-run if 3 + then > 21 check-run if 3 + then > 22 check-run if 3 + then > 25 check-run if 3 + then > 26 check-run if 3 + then > 28 check-run if 3 + then > then > -6 rotate pop pop pop pop pop 630,645c707,722 < " " explode pop < card-suit < swap card-suit strcat < swap card-suit strcat < swap card-suit strcat < swap card-suit strcat < dup "ccccc" strcmp not if pop 5 exit then < dup "ddddd" strcmp not if pop 5 exit then < dup "hhhhh" strcmp not if pop 5 exit then < dup "sssss" strcmp not if pop 5 exit then < 4 strcut pop < dup "cccc" strcmp not if pop 4 exit then < dup "dddd" strcmp not if pop 4 exit then < dup "hhhh" strcmp not if pop 4 exit then < dup "ssss" strcmp not if pop 4 exit then < pop 0 --- > " " explode pop > card-suit > swap card-suit strcat > swap card-suit strcat > swap card-suit strcat > swap card-suit strcat > dup "ccccc" strcmp not if pop 5 exit then > dup "ddddd" strcmp not if pop 5 exit then > dup "hhhhh" strcmp not if pop 5 exit then > dup "sssss" strcmp not if pop 5 exit then > 4 strcut pop > dup "cccc" strcmp not if pop 4 exit then > dup "dddd" strcmp not if pop 4 exit then > dup "hhhh" strcmp not if pop 4 exit then > dup "ssss" strcmp not if pop 4 exit then > pop 0 648c725 < score-flushes- --- > score-flushes- 651c728 < 13 strcut "J" swap strcat instr if 1 else 0 then --- > 13 strcut "J" swap strcat instr if 1 else 0 then 654,670c731,747 < "## Determining the value of %n's hand, [%h (%c)]..." < swap 3 = if < "the crib" "%n's hand" subst < else < rot name "%n" subst < then < board ".played" 4 rotate intostr strcat getpropstr < strip swap over "%h" subst < board ".cc" getpropstr < strip swap over "%c" subst announce < " " swap strcat strcat < dup score-15s < over score-pairs + < over score-runs + < over score-flushes + < over score-jack + < swap pop --- > "## Determining the value of %n's hand, [%h (%c)]..." > swap 3 = if > "the crib" "%n's hand" subst > else > rot name "%n" subst > then > board ".played" 4 rotate intostr strcat getpropstr > strip swap over "%h" subst > board ".cc" getpropstr > strip swap over "%c" subst announce > " " swap strcat strcat > dup score-15s > over score-pairs + > over score-runs + > over score-flushes + > over score-jack + > swap pop 673,691c750,768 < over 2 > if < 4 pick cut_face_value 6 pick cut_face_value = if < pop 6 < else < pop explode_clear 2 exit < then < else < pop explode_clear 2 exit < then < over 3 > if < 5 pick cut_face_value 7 pick cut_face_value = if < pop 12 < else < pop explode_clear 6 exit < then < else < pop explode_clear 6 exit < then < over 2 + 0 swap - rotate explode_clear --- > over 2 > if > 4 pick cut_face_value 6 pick cut_face_value = if > pop 6 > else > pop explode_clear 2 exit > then > else > pop explode_clear 2 exit > then > over 3 > if > 5 pick cut_face_value 7 pick cut_face_value = if > pop 12 > else > pop explode_clear 6 exit > then > else > pop explode_clear 6 exit > then > over 2 + 0 swap - rotate explode_clear 694,704c771,781 < 1 begin dup 4 pick < while < dup 3 + pick cut_face_value over 5 + pick < cut_face_value 1 + = if < swap 1 + swap 1 + < else < pop over 2 + 0 swap - rotate < explode_clear exit < then < repeat < pop over 2 + 0 swap - rotate < explode_clear --- > 1 begin dup 4 pick < while > dup 3 + pick cut_face_value over 5 + pick > cut_face_value 1 + = if > swap 1 + swap 1 + > else > pop over 2 + 0 swap - rotate > explode_clear exit > then > repeat > pop over 2 + 0 swap - rotate > explode_clear 707c784 < cut_face_value swap cut_face_value > --- > cut_face_value swap cut_face_value > 710,728c787,805 < " " explode < dup 1 > if < over cut_face_value 4 pick cut_face_value = if < 2 check_pairs exit < then < then < dup 2 > if < dup over 2 + 0 swap - rotate explode_clear < begin dup 2 > while < board ".seq" getpropstr strip " " strcat < over 3 * strcut pop strip " " explode < 'card_compare sort 1 check_peg_run < over over = if < swap pop exit < then < pop 1 - < repeat < then < pop 0 --- > " " explode > dup 1 > if > over cut_face_value 4 pick cut_face_value = if > 2 check_pairs exit > then > then > dup 2 > if > dup over 2 + 0 swap - rotate explode_clear > begin dup 2 > while > board ".seq" getpropstr strip " " strcat > over 3 * strcut pop strip " " explode > 'card_compare sort 1 check_peg_run > over over = if > swap pop exit > then > pop 1 - > repeat > then > pop 0 731,756c808,833 < "## .-------------------------------------." say < dump_row board ".peg11" getpropstr atoi dup if < dup 60 > if 60 - then place_peg else pop then < board ".peg12" getpropstr atoi dup if < dup 60 > if 60 - then place_peg else pop then < insert_spaces 35 strcut reverse swap "## | " swap strcat < " | P1: " strcat board ".player1" getpropstr dup if < atoi dbref name strcat " (L=" strcat 1 lap intostr < strcat ",HP=" strcat 1 hipeg intostr strcat ")" strcat < else < pop < then say "## | " swap strcat " |" strcat say < "## | | CC: " < board ".cc" getpropstr strcat say < dump_row board ".peg21" getpropstr atoi dup if < dup 60 > if 60 - then place_peg else pop then < board ".peg22" getpropstr atoi dup if < dup 60 > if 60 - then place_peg else pop then < insert_spaces 35 strcut reverse "## | " swap strcat < " |" strcat say "## | " swap strcat " | P2: " strcat < board ".player2" getpropstr dup if < atoi dbref name strcat " (L=" strcat 2 lap intostr < strcat ",HP=" strcat 2 hipeg intostr strcat ")" strcat < else < pop < then say "## |_____________________________________|" say --- > "## .-------------------------------------." say > dump_row board ".peg11" getpropstr atoi dup if > dup 60 > if 60 - then place_peg else pop then > board ".peg12" getpropstr atoi dup if > dup 60 > if 60 - then place_peg else pop then > insert_spaces 35 strcut reverse swap "## | " swap strcat > " | P1: " strcat board ".player1" getpropstr dup if > atoi dbref name strcat " (L=" strcat 1 lap intostr > strcat ",HP=" strcat 1 hipeg intostr strcat ")" strcat > else > pop > then say "## | " swap strcat " |" strcat say > "## | | CC: " > board ".cc" getpropstr strcat say > dump_row board ".peg21" getpropstr atoi dup if > dup 60 > if 60 - then place_peg else pop then > board ".peg22" getpropstr atoi dup if > dup 60 > if 60 - then place_peg else pop then > insert_spaces 35 strcut reverse "## | " swap strcat > " |" strcat say "## | " swap strcat " | P2: " strcat > board ".player2" getpropstr dup if > atoi dbref name strcat " (L=" strcat 2 lap intostr > strcat ",HP=" strcat 2 hipeg intostr strcat ")" strcat > else > pop > then say "## |_____________________________________|" say 759,792c836,866 < me @ playing? not if < pop "## You're not playing!" say exit then < " " explode dup 2 = not if < explode_clear < "## Invalid number of cards." say exit then < me @ player ".crib" swap intostr strcat < board swap getpropstr if < explode_clear < "## You've already cribbed two cards." say exit then < board ".dealt" getpropstr not if < explode_clear < "## No hand has been dealt yet." say exit then < me @ player ".hand" swap intostr strcat < board swap getpropstr swap pop < dup tolower 3 pick tolower instr not < over tolower 5 pick tolower instr not or if < pop pop pop < "## One or both cards invalid." say exit then < over 4 pick stringcmp not if < pop pop pop < "## Those two cards are identical!" say exit then < swap repair_card rot repair_card rot < "" 3 pick subst "" 4 pick subst " " " " subst " " " " subst < strip me @ player ".hand" swap intostr strcat < board swap rot 0 addprop < " " swap strcat strcat < me @ player ".crib" swap intostr strcat < board swap rot 0 addprop < "## You submit two cards to the crib." say < "## " me @ name strcat < " submits two cards to the crib." strcat sayall < board ".crib1" getpropstr board ".crib2" getpropstr and if < "## It is " op name strcat "'s cut." strcat < announce then --- > me @ playing? not if > pop "## You're not playing!" say exit then > "" " " subst dup strlen 4 = not if > pop "## One or both cards invalid." say exit then > me @ player ".crib" swap intostr strcat > board swap getpropstr if > pop "## You've already cribbed two cards." say exit then > board ".dealt" getpropstr not if > pop "## No hand has been dealt yet." say exit then > 2 strcut repair_card swap repair_card > me @ player ".hand" swap intostr strcat board swap getpropstr > dup tolower 3 pick tolower instr not > over tolower 5 pick tolower instr not or if > pop pop pop > "## One or both cards invalid." say exit then > over 4 pick stringcmp not if > pop pop pop > "## Those two cards are identical!" say exit then > swap repair_card rot repair_card rot > "" 3 pick subst "" 4 pick subst " " " " subst " " " " subst > strip me @ player ".hand" swap intostr strcat > board swap rot 0 addprop > " " swap strcat strcat > me @ player ".crib" swap intostr strcat > board swap rot 0 addprop > "## You submit two cards to the crib." say > "## " me @ name strcat > " submits two cards to the crib." strcat sayall > board ".crib1" getpropstr board ".crib2" getpropstr and if > "## It is " op name strcat "'s cut." strcat > announce then 795,898c869,972 < pegturn not if < pop "## Pegging play has not begun." say exit then < me @ player pegturn = not if < pop "## It is not your turn to play." say exit then < dup strlen 2 = not if < pop "## Play what?" say exit then < board ".hand" pegturn intostr strcat getpropstr < dup tolower 3 pick tolower instr not if < pop pop "## You don't have that card." say exit then < swap repair_card swap < board ".total" getpropstr atoi 3 pick face_value + 31 > if < pop pop "## Total would exceed 31." say exit then < "" 3 pick subst " " " " subst strip < board ".hand" pegturn intostr strcat rot 0 addprop < board ".played" pegturn intostr strcat getpropstr < over " " strcat strcat < board ".seq" getpropstr 3 pick " " strcat < swap strcat board ".seq" rot strip 0 addprop < board ".played" pegturn intostr strcat rot 0 addprop < "## You play the " over unparse_card strcat "." strcat say < "## " me @ name strcat " plays the " strcat < over unparse_card strcat "." strcat sayall < board ".seq" getpropstr strip count_sequence dup if < pegturn swap peg if < pop pegturn game_over exit < then < else < pop < then < board ".total" getpropstr atoi over face_value < + board ".total" 3 pick intostr 0 addprop < dup 31 = if < board ".total" "0" 0 addprop < board ".seq" remove_prop < board ".hand1" getpropstr not < board ".hand2" getpropstr not and if < 1 else 2 < then < pegturn swap peg if < pegturn game_over exit < then < then < dup 15 = if < pegturn 2 peg if < pegturn game_over exit < then < then < pop board ".hand1" getpropstr not < board ".hand2" getpropstr not and if < "## %t plays the last card in the hand." < board ".player" pegturn intostr strcat getpropstr < atoi dbref name "%t" subst announce < pegturn 1 peg if < pop pegturn game_over exit then < board ".manual" getpropstr not if < pop op dup player dup count_cards op player swap peg if < op player game_over exit then < cp dup player dup count_cards cp player swap peg if < cp player game_over exit then < board ".crib1" getpropstr strip " " strcat board < ".crib2" getpropstr strip strcat board ".played" cp < player intostr strcat rot 0 addprop cp dup player < 3 count_cards cp player swap peg if < cp player game_over exit then < next_turn hand_reset < "## It is now %p's turn to deal." < cp name "%p" subst announce exit < else < pop op dup player dup count_cards intostr < board ".handtotal" op player intostr strcat rot 0 addprop < cp dup player dup count_cards intostr < board ".handtotal" cp player intostr strcat rot 0 addprop < board dup ".played1" getpropstr strip swap ".cc" getpropstr < " " swap strcat strcat strip board ".h1" rot 0 addprop < board dup ".played2" getpropstr strip swap ".cc" getpropstr < " " swap strcat strcat strip board ".h2" rot 0 addprop < board ".crib1" getpropstr strip " " strcat board < ".crib2" getpropstr strip strcat dup board ".cc" getpropstr < " " swap strcat strcat strip board ".c" rot 0 addprop < board ".played" cp player intostr strcat rot 0 addprop < cp dup player 3 count_cards intostr < board ".cribtotal" rot 0 addprop < "## %n counts %p hand first." < op name "%n" subst op swap pronoun_sub announce < board ".pegturn" op player intostr 0 addprop < exit < then < pop op dup < then < next_pegturn pegturn can_play? not if < next_pegturn pegturn can_play? not if < board ".total" "0" 0 addprop < board ".seq" remove_prop < "## %p takes a go." < board ".player" pegturn intostr strcat < getpropstr atoi dbref name "%p" subst announce < pegturn 1 peg if < pegturn game_over exit then < next_pegturn pegturn can_play? not if < next_pegturn then < pegging_display announce_pegturn exit < then < then < pegging_display announce_pegturn --- > pegturn not if > pop "## Pegging play has not begun." say exit then > me @ player pegturn = not if > pop "## It is not your turn to play." say exit then > dup strlen 2 = not if > pop "## Play what?" say exit then > board ".hand" pegturn intostr strcat getpropstr > dup tolower 3 pick tolower instr not if > pop pop "## You don't have that card." say exit then > swap repair_card swap > board ".total" getpropstr atoi 3 pick face_value + 31 > if > pop pop "## Total would exceed 31." say exit then > "" 3 pick subst " " " " subst strip > board ".hand" pegturn intostr strcat rot 0 addprop > board ".played" pegturn intostr strcat getpropstr > over " " strcat strcat > board ".seq" getpropstr 3 pick " " strcat > swap strcat board ".seq" rot strip 0 addprop > board ".played" pegturn intostr strcat rot 0 addprop > "## You play the " over unparse_card strcat "." strcat say > "## " me @ name strcat " plays the " strcat > over unparse_card strcat "." strcat sayall > board ".seq" getpropstr strip count_sequence dup if > pegturn swap peg if > pop pegturn game_over exit > then > else > pop > then > board ".total" getpropstr atoi over face_value > + board ".total" 3 pick intostr 0 addprop > dup 31 = if > board ".total" "0" 0 addprop > board ".seq" remove_prop > board ".hand1" getpropstr not > board ".hand2" getpropstr not and if > 1 else 2 > then > pegturn swap peg if > pegturn game_over exit > then > then > dup 15 = if > pegturn 2 peg if > pegturn game_over exit > then > then > pop board ".hand1" getpropstr not > board ".hand2" getpropstr not and if > "## %t plays the last card in the hand." > board ".player" pegturn intostr strcat getpropstr > atoi dbref name "%t" subst announce > pegturn 1 peg if > pop pegturn game_over exit then > board ".manual" getpropstr not if > pop op dup player dup count_cards op player swap peg if > op player game_over exit then > cp dup player dup count_cards cp player swap peg if > cp player game_over exit then > board ".crib1" getpropstr strip " " strcat board > ".crib2" getpropstr strip strcat board ".played" cp > player intostr strcat rot 0 addprop cp dup player > 3 count_cards cp player swap peg if > cp player game_over exit then > next_turn hand_reset > "## It is now %p's turn to deal." > cp name "%p" subst announce exit > else > pop op dup player dup count_cards intostr > board ".handtotal" op player intostr strcat rot 0 addprop > cp dup player dup count_cards intostr > board ".handtotal" cp player intostr strcat rot 0 addprop > board dup ".played1" getpropstr strip swap ".cc" getpropstr > " " swap strcat strcat strip board ".h1" rot 0 addprop > board dup ".played2" getpropstr strip swap ".cc" getpropstr > " " swap strcat strcat strip board ".h2" rot 0 addprop > board ".crib1" getpropstr strip " " strcat board > ".crib2" getpropstr strip strcat dup board ".cc" getpropstr > " " swap strcat strcat strip board ".c" rot 0 addprop > board ".played" cp player intostr strcat rot 0 addprop > cp dup player 3 count_cards intostr > board ".cribtotal" rot 0 addprop > "## %n counts %p hand first." > op name "%n" subst op swap pronoun_sub announce > board ".pegturn" op player intostr 0 addprop > exit > then > pop op dup > then > next_pegturn pegturn can_play? not if > next_pegturn pegturn can_play? not if > board ".total" "0" 0 addprop > board ".seq" remove_prop > "## %p takes a go." > board ".player" pegturn intostr strcat > getpropstr atoi dbref name "%p" subst announce > pegturn 1 peg if > pegturn game_over exit then > next_pegturn pegturn can_play? not if > next_pegturn then > pegging_display announce_pegturn exit > then > then > pegging_display announce_pegturn 901,923c975,997 < strip me @ playing? not if < pop "## You're not playing!" say exit < then < board ".handtotal1" getpropstr not < board ".handtotal2" getpropstr not < board ".cribtotal" getpropstr not and and if < pop "## It's not time to count hands." say exit < then < board ".dispute" getpropstr if < pop "## A dispute must be settled or waived first." < say exit < then < me @ player pegturn = not if < pop "## It's not your turn to count." say exit < then < "## %n enters a score of %s for %p hand; dispute, %o?" < crib? if < "crib" "hand" subst < then < me @ name "%n" subst over "%s" subst < board ".player" !pegturn intostr strcat getpropstr < atoi dbref name "%o" subst me @ swap pronoun_sub < announce board ".dispute" rot 0 addprop --- > strip me @ playing? not if > pop "## You're not playing!" say exit > then > board ".handtotal1" getpropstr not > board ".handtotal2" getpropstr not > board ".cribtotal" getpropstr not and and if > pop "## It's not time to count hands." say exit > then > board ".dispute" getpropstr if > pop "## A dispute must be settled or waived first." > say exit > then > me @ player pegturn = not if > pop "## It's not your turn to count." say exit > then > "## %n enters a score of %s for %p hand; dispute, %o?" > end_crib? if > "crib" "hand" subst > then > me @ name "%n" subst over "%s" subst > board ".player" !pegturn intostr strcat getpropstr > atoi dbref name "%o" subst me @ swap pronoun_sub > announce board ".dispute" rot 0 addprop 926,943c1000,1017 < board ".dispute" remove_prop < crib? if < next_turn hand_reset < "## It is now %p's turn to deal." < cp name "%p" subst announce exit < else < board ".handtotal" pegturn intostr strcat remove_prop < pegturn turn = not if < next_pegturn < then < then < "## It's %n's turn to count %p hand." < board ".player" pegturn intostr strcat getpropstr < atoi dbref dup rot swap name "%n" subst < pronoun_sub crib? if < "crib" "hand" subst < then < announce --- > board ".dispute" remove_prop > end_crib? if > next_turn hand_reset > "## It is now %p's turn to deal." > cp name "%p" subst announce exit > else > board ".handtotal" pegturn intostr strcat remove_prop > pegturn turn = not if > next_pegturn > then > then > "## It's %n's turn to count %p hand." > board ".player" pegturn intostr strcat getpropstr > atoi dbref dup rot swap name "%n" subst > pronoun_sub end_crib? if > "crib" "hand" subst > then > announce 946,1024c1020,1098 < strip tolower board ".dispute" getpropstr not if < pop "## There is nothing to dispute." say exit < then < me @ player pegturn = if < pop "## It's not your turn to dispute." say exit < then < dup "n" 1 strncmp not over < "o" 1 strncmp 3 pick "m" 1 strncmp and or if < pop "## %n does not dispute the count." < me @ name "%n" subst announce < pegturn board ".dispute" getpropstr atoi peg dup if < pegturn game_over exit < else < next_hand_count exit < then < then < dup "o" 1 strncmp not if < pop "## %n claims the count is over." < me @ name "%n" subst announce < crib? if < board ".cribtotal" getpropstr atoi < else < board ".handtotal" pegturn intostr strcat < getpropstr atoi < then < board ".dispute" getpropstr atoi over over < if < "## Count is over, actual points pegged." < announce pop < else < "## Count not over, counted score stands." < announce swap pop < then < pegturn swap peg dup if < pegturn game_over exit < else < next_hand_count exit < then < then < dup "m" 1 strncmp not if < dup " " instr not if < "## You must specify a point value for a muggins dispute." < say pop exit < then < dup " " instr strcut swap pop < atoi dup not if < "## A muggins dispute value must be positive." < say pop exit < then < "## %n claims a muggins of %p points." < me @ name "%n" subst over intostr "%p" subst < over atoi 1 = if < "point" "points" subst < then < announce crib? if < board ".cribtotal" getpropstr atoi < else < board ".handtotal" pegturn intostr strcat < getpropstr atoi < then < board ".dispute" getpropstr atoi < 3 pick + >= if < "## Hand count is short, muggins awarded." < announce board ".dispute" getpropstr atoi < pegturn swap peg if < pegturn game_over exit < then < !pegturn swap peg if < !pegturn game_over exit < then < else < "## Muggins dispute incorrect, count stands." < announce board ".dispute" getpropstr atoi < pegturn swap peg if < pegturn game_over exit < then < pop < then < next_hand_count exit < then --- > strip tolower board ".dispute" getpropstr not if > pop "## There is nothing to dispute." say exit > then > me @ player pegturn = if > pop "## It's not your turn to dispute." say exit > then > dup "n" 1 strncmp not over > "o" 1 strncmp 3 pick "m" 1 strncmp and or if > pop "## %n does not dispute the count." > me @ name "%n" subst announce > pegturn board ".dispute" getpropstr atoi peg dup if > pegturn game_over exit > else > next_hand_count exit > then > then > dup "o" 1 strncmp not if > pop "## %n claims the count is over." > me @ name "%n" subst announce > end_crib? if > board ".cribtotal" getpropstr atoi > else > board ".handtotal" pegturn intostr strcat > getpropstr atoi > then > board ".dispute" getpropstr atoi over over < if > "## Count is over, actual points pegged." > announce pop > else > "## Count not over, counted score stands." > announce swap pop > then > pegturn swap peg dup if > pegturn game_over exit > else > next_hand_count exit > then > then > dup "m" 1 strncmp not if > dup " " instr not if > "## You must specify a point value for a muggins dispute." > say pop exit > then > dup " " instr strcut swap pop > atoi dup not if > "## A muggins dispute value must be positive." > say pop exit > then > "## %n claims a muggins of %p points." > me @ name "%n" subst over intostr "%p" subst > over atoi 1 = if > "point" "points" subst > then > announce end_crib? if > board ".cribtotal" getpropstr atoi > else > board ".handtotal" pegturn intostr strcat > getpropstr atoi > then > board ".dispute" getpropstr atoi > 3 pick + >= if > "## Hand count is short, muggins awarded." > announce board ".dispute" getpropstr atoi > pegturn swap peg if > pegturn game_over exit > then > !pegturn swap peg if > !pegturn game_over exit > then > else > "## Muggins dispute incorrect, count stands." > announce board ".dispute" getpropstr atoi > pegturn swap peg if > pegturn game_over exit > then > pop > then > next_hand_count exit > then 1027,1107c1101,1186 < "## Status:" say < board ".game_over" getpropstr if < "## Game has ended, type '%tdisplay' for results." < trigger @ "PREFIX" flag? if < trigger @ name "%t" subst < else < trigger @ name " " strcat "%t" subst < then < say exit then < board ".length" getpropstr if < "## Game is set to be half length." say < else < "## Game is set to be full length." say < then < board ".manual" getpropstr if < "## Game is set to manual hand pegging." say < else < "## Game is set to automatic hand pegging." say < then < game_ready? if < "## Two people are joined: " < p1 name strcat " and " strcat p2 name strcat < "." strcat say then < board ".player1" getpropstr < board ".player2" getpropstr not and if < "## One person has joined: " < p1 name strcat "." strcat say exit then < board ".player1" getpropstr not < board ".player2" getpropstr not and if < "## No players have joined." say exit then < turn not game_ready? and if < board ".cut1" getpropstr dup if < "## " p1 name strcat " has cut the " strcat < swap unparse_card strcat " for deal." strcat < say else pop then < board ".cut2" getpropstr dup if < "## " p2 name strcat " has cut the " strcat < swap unparse_card strcat " for deal." strcat < say else pop then < then < turn game_ready? and if < "## First deal and crib has been determined." say < "## It is now " cp name strcat "'s deal and crib." < strcat say < then < board ".dealt" getpropstr if < "## A hand is in progress." say < then < board ".crib1" getpropstr board ".crib2" getpropstr and if < "## A crib has been determined." say < else < "## A crib has not yet been determined." say < then < board ".manual" getpropstr board ".cribtotal" getpropstr and if < op board ".h" 3 pick player intostr strcat getpropstr < "## %n's hand is [%h]" swap "%h" subst < swap name "%n" subst say < cp board ".h" 3 pick player intostr strcat getpropstr < "## %n's hand is [%h]" swap "%h" subst < over name "%n" subst say < board ".c" getpropstr "## %n's crib is [%h]" swap < "%h" subst swap name "%n" subst say < else < me @ playing? if < "## Your hand is [" < me @ player ".hand" swap intostr strcat < board swap getpropstr strcat "]" strcat say < then < board ".pegturn" getpropstr if < "## " p1 name strcat " [" strcat < board ".played1" getpropstr strip dup strlen < " " swap strcut swap pop strcat strcat < "] => " strcat board ".total" getpropstr atoi intostr < dup strlen " " swap strcut swap pop swap strcat strcat < " <= [" strcat board ".played2" getpropstr strip dup < strlen " " swap strcut swap pop strcat strcat < "] " strcat p2 name strcat say < "## It is %t's turn to play a card." < board ".player" pegturn intostr strcat getpropstr < atoi dbref name "%t" subst say then < then --- > "## Status:" say > board ".game_over" getpropstr if > "## Game has ended, type '%tdisplay' for results." > trigger @ "PREFIX" flag? if > trigger @ name "%t" subst > else > trigger @ name " " strcat "%t" subst > then > say exit then > board ".length" getpropstr if > "## Game is set to be half length." say > else > "## Game is set to be full length." say > then > board ".manual" getpropstr if > "## Game is set to manual hand pegging." say > else > "## Game is set to automatic hand pegging." say > then > me @ playing? if > "## You have selected hand sorting style: " > me @ player ".style" swap intostr strcat > board swap getpropstr strcat say > then > game_ready? if > "## Two people are joined: " > p1 name strcat " and " strcat p2 name strcat > "." strcat say then > board ".player1" getpropstr > board ".player2" getpropstr not and if > "## One person has joined: " > p1 name strcat "." strcat say exit then > board ".player1" getpropstr not > board ".player2" getpropstr not and if > "## No players have joined." say exit then > turn not game_ready? and if > board ".cut1" getpropstr dup if > "## " p1 name strcat " has cut the " strcat > swap unparse_card strcat " for deal." strcat > say else pop then > board ".cut2" getpropstr dup if > "## " p2 name strcat " has cut the " strcat > swap unparse_card strcat " for deal." strcat > say else pop then > then > turn game_ready? and if > "## First deal and crib has been determined." say > "## It is now " cp name strcat "'s deal and crib." > strcat say > then > board ".dealt" getpropstr if > "## A hand is in progress." say > then > board ".crib1" getpropstr board ".crib2" getpropstr and if > "## A crib has been determined." say > else > "## A crib has not yet been determined." say > then > board ".manual" getpropstr board ".cribtotal" getpropstr and if > op board ".h" 3 pick player intostr strcat getpropstr > "## %n's hand is [%h]" swap "%h" subst > swap name "%n" subst say > cp board ".h" 3 pick player intostr strcat getpropstr > "## %n's hand is [%h]" swap "%h" subst > over name "%n" subst say > board ".c" getpropstr "## %n's crib is [%h]" swap > "%h" subst swap name "%n" subst say > else > me @ playing? if > "## Your hand is [" > me @ player ".hand" swap intostr strcat > board swap getpropstr strcat "]" strcat say > then > board ".pegturn" getpropstr if > "## " p1 name strcat " [" strcat > board ".played1" getpropstr strip dup strlen > " " swap strcut swap pop strcat strcat > "] => " strcat board ".total" getpropstr atoi intostr > dup strlen " " swap strcut swap pop swap strcat strcat > " <= [" strcat board ".played2" getpropstr strip dup > strlen " " swap strcut swap pop strcat strcat > "] " strcat p2 name strcat say > "## It is %t's turn to play a card." > board ".player" pegturn intostr strcat getpropstr > atoi dbref name "%t" subst say then > then 1109,1116c1188,1203 < : do_hand ( -- ) < me @ playing? not if < "## You're not playing!" say exit then < board ".dealt" getpropstr not if < "## There is no hand in progress." say exit then < me @ player ".hand" swap intostr strcat < board swap getpropstr < "## Your hand is [" swap strcat "]" strcat say --- > : do_rules_main ( -- ) > "+-----------------------------------------------------------+" say > "| Rules (per _Hoyle's Rules of Games_, 2nd Revised Edition) |" say > "+-----------------------------------------------------------+" say > "| Cribbage is believed to have been invented and christened |" say > "| by the English poet Sir John Suckling, who lived 1609- |" say > "| 1642. Some of its features were taken from an older |" say > "| game, Noddy, of which little is known. Early colonists |" say > "| brought Cribbage to America, where it flourishes. |" say > "| |" say > "| Rules Topics: |" say > "| board cards crib deal etiquette |" say > "| fifteen flush hands heels lurch |" say > "| muggins nobs pairs play players |" say > "| runs settings showing starter winning |" say > "+-----------------------------------------------------------+" say 1118,1123c1205,1211 < : addc ( s -- s ) < trigger @ dup "PREFIX" flag? swap name strlen 1 = and if < trigger @ name "%c" subst < else < " " "%c" subst < then --- > : do_rules_players ( -- ) > "+-----------------------------------------------------------+" say > "| Rules (Topic: Players) |" say > "+-----------------------------------------------------------+" say > "| Two. Adaption can be made for three or four. There is |" say > "| no such adaption possible for this MUF version. |" say > "+-----------------------------------------------------------+" say 1125,1126c1213,1222 < : do_sort_suit ( -- ) < suit_value swap suit_value > --- > : do_rules_cards ( -- ) > "+-----------------------------------------------------------+" say > "| Rules (Topic: Cards) |" say > "+-----------------------------------------------------------+" say > "| A regular pack of 52. The CARDS rank K (high), Q, J, T, |" say > "| 9, 8, 7, 6, 5, 4, 3, 2, A. The suits play little part; |" say > "| the CARDS are used chiefly as numbers. Each face CARD |" say > "| represents 10, each ace 1, each other CARD its index |" say > "| value. Face CARDS and tens are called 'tenth CARDS.' |" say > "+-----------------------------------------------------------+" say 1128,1129c1224,1229 < : do_sort_face_value ( -- ) < cut_face_value swap cut_face_value > --- > : do_rules_deal ( -- ) > "+-----------------------------------------------------------+" say > "| Rules (Topic: Deal) |" say > "+-----------------------------------------------------------+" say > "| Each player receives six cards, DEALT one at a time. |" say > "+-----------------------------------------------------------+" say 1131,1152c1231,1239 < : do_sort_hand ( -- ) < me @ player? not if < pop "## You're not playing!" say exit < then < dup not if < "## No argument to sort, face values assumed..." say < pop "f" < then < board ".hand" me @ player intostr strcat getpropstr < strip " " explode < dup 2 + pick tolower "s" 1 strncmp not if < 'do_sort_suit sort < else < 'do_sort_face_value sort < then < 1 - begin dup while < swap " " strcat rot strcat < swap 1 - < loop < pop swap pop strip < board ".hand" me @ player intostr strcat rot 0 addprop < do_hand --- > : do_rules_starter > "+-----------------------------------------------------------+" say > "| Rules (Topic: Starter) |" say > "+-----------------------------------------------------------+" say > "| After the crib is laid away, the nondealer cuts the rest |" say > "| of the pack, and the dealer turns up the top card of the |" say > "| lower portion. This card is the STARTER. If it is a |" say > "| jack, the dealer pegs (scores) 2 points (see HEELS). |" say > "+-----------------------------------------------------------+" say 1154,1174c1241,1258 < : do_rules ( -- ) < "+-----------------------------------------------+" say < "| MUF-Cribbage 3.01 |" say < "+-----------------------------------------------+" say < "| Concept, design and code by Sjade of HoloMUCK |" say < "| Major scoring routines created by der Mouse |" say < "+-----------+-----------------------------------+" say < "| %creset hm | Reset (h=1/2 game, m=manual peg) |" addc say < "| %cjoin | Join in the game |" addc say < "| %cdeal | Deal a hand |" addc say < "| %ccut | Cut for deal or for extra card |" addc say < "| %cdisplay | Show the board |" addc say < "| %ccrib x y | Submit two cards to the crib |" addc say < "| %cplay x | Play a card |" addc say < "| %cstatus | Show status of game in progress |" addc say < "| %csort s|f | Sort by (s)uit or (f)ace value |" addc say < "| %chand | Show your hand |" addc say < "| %chelp | This help screen |" addc say < "| %cpeg i | Peg i points in manual score mode |" addc say < "| %cdispute | 'no', 'over' or 'muggins ' |" addc say < "+-----------+-----------------------------------+" say --- > : do_rules_board > "+-----------------------------------------------------------+" say > "| Rules (Topic: Board) |" say > "+-----------------------------------------------------------+" say > "| Scores accrue so rapidly that a special scoring device is |" say > "| used, a CRIBBAGE BOARD. The BOARD is an oblong panel |" say > "| having four rows of 30 holes each, plus some extra game |" say > "| holes at one end. Each player uses two pegs, which at |" say > "| the outset are placed in the game holes. Each item of |" say > "| score is marked by jumping the rearward peg ahead of the |" say > "| other by a corresponding number of holes. The pegs are |" say > "| marched away from the head of the BOARD (the end with |" say > "| game holes, in this case the left) along an outer row of |" say > "| holes, then back along an inner row. The game may be |" say > "| played 'once around,' for a total of 61 points, but far |" say > "| more common is 'twice around' for a total of 121 (see |" say > "| SETTINGS). |" say > "+-----------------------------------------------------------+" say 1175a1260,1504 > : do_rules_play > "+-----------------------------------------------------------+" say > "| Rules (Topic: Play) |" say > "+-----------------------------------------------------------+" say > "| In PLAYING his cards, each player retains possession of |" say > "| them, merely exposing them face up in a pile in front of |" say > "| himself. The nondealer begins by PLAYING any card, an- |" say > "| nouncing its point value. Dealer than PLAYS a card, an- |" say > "| nouncing the total of the two cards. PLAY continues alt- |" say > "| ernately, the new total being announced each time, until |" say > "| the player in turn is unable to PLAY without carrying the |" say > "| total over 31. He must then say 'go.' The other pegs |" say > "| for the 'go' (1 point). The player who called the 'go' |" say > "| must lead again for a new series of PLAYS. The count be- |" say > "| gins again at 0, and again the total must not be carried |" say > "| beyond 31. After 'go' is called, the other must PLAY |" say > "| additional cards if he can do so without exceeding 31. |" say > "| Thus the same player may PLAY two or three times in suc- |" say > "| cession. For making exactly 31 the player pegs 2. PLAY- |" say > "| ING the last card of all (of the eight in play) counts |" say > "| 1 for last or 2 if it makes 31. |" say > "+-----------------------------------------------------------+" say > ; > : do_rules_fifteen > "+-----------------------------------------------------------+" say > "| Rules (Topic: Fifteen) |" say > "+-----------------------------------------------------------+" say > "| For each combination of 15 (or total 15 in pegging) peg 2 |" say > "| points. 'Combination' here is meant in the strict sense. |" say > "| Thus, a hand (with starter) of 9, 8, 7, 7, 6 has three |" say > "| combinations of 15: 9 and 6, 8 with one 7, 8 with the |" say > "| other 7. A hand of J, 5, 5, 5, 5 had no less than eight |" say > "| combinations of FIFTEEN: four of J and 5, four of three |" say > "| 5's. (This hand, when the J also scores as his nobs, |" say > "| makes 29, the largest possible score.) |" say > "+-----------------------------------------------------------+" say > ; > : do_rules_pairs > "+-----------------------------------------------------------+" say > "| Rules (Topic: Pairs) |" say > "+-----------------------------------------------------------+" say > "| For a PAIR, score 2. For three of a kind (called a PAIR |" say > "| royal or 'proil'), score 6. For four of a kind (called |" say > "| a double PAIR royal or 'double proil'), score 12. |" say > "+-----------------------------------------------------------+" say > ; > : do_rules_runs > "+-----------------------------------------------------------+" say > "| Rules (Topic: Runs) |" say > "+-----------------------------------------------------------+" say > "| For each combination that makes a RUN of three or more |" say > "| cards, peg the number of points equal to the number of |" say > "| cards in the RUN. In the hand 9, 8, 7, 7, 6 there are 8 |" say > "| points for two RUNS of four, using the 7's in turn. |" say > "| In pegging play, RUNS to not need to be in strict order, |" say > "| but the number of cards in a RUN resets to 0 when the |" say > "| total does. |" say > "+-----------------------------------------------------------+" say > ; > : do_rules_showing > "+-----------------------------------------------------------+" say > "| Rules (Topic: Showing) |" say > "+-----------------------------------------------------------+" say > "| By SHOWING is meant counting and scoring a hand. The |" say > "| hands are SHOWN in strict order: nondealer, dealer, then |" say > "| crib. |" say > "+-----------------------------------------------------------+" say > ; > : do_rules_flush > "+-----------------------------------------------------------+" say > "| Rules (Topic: Flush) |" say > "+-----------------------------------------------------------+" say > "| For four cards in hand (not crib, and excluding the |" say > "| starter) of the same suit, score 4, or 5 if the starter |" say > "| is also of the same suit. |" say > "+-----------------------------------------------------------+" say > ; > : do_rules_nobs > "+-----------------------------------------------------------+" say > "| Rules (Topic: Nobs) |" say > "+-----------------------------------------------------------+" say > "| If a jack in a player's hand or crib matches the suit of |" say > "| the starter it is known as 'His NOBS' and worth one point |" say > "| when showing that hand. |" say > "+-----------------------------------------------------------+" say > ; > : do_rules_heels > "+-----------------------------------------------------------+" say > "| Rules (Topic: Heels) |" say > "+-----------------------------------------------------------+" say > "| If the starter is a jack it is known as 'His HEELS' and |" say > "| worth 2 points to the dealer of the hand. |" say > "+-----------------------------------------------------------+" say > ; > : do_rules_muggins > "+-----------------------------------------------------------+" say > "| Rules (Topic: Muggins) |" say > "+-----------------------------------------------------------+" say > "| If a player overlooks a score to which he is entitled, in |" say > "| playing or in showing, the opponent may call 'MUGGINS' |" say > "| and take the score himself. This rule should be waived |" say > "| when a beginning is playing an experienced player. This |" say > "| scoring technique is available in manual score mode only |" say > "| (see SETTINGS). |" say > "+-----------------------------------------------------------+" say > ; > : do_rules_winning > "+-----------------------------------------------------------+" say > "| Rules (Topic: Winning) |" say > "+-----------------------------------------------------------+" say > "| When a player pegs into the game hole that gives him 121 |" say > "| (or 61) points, he WINS the game forthwith; nothing more |" say > "| is scored. If the loser has not passed the halfway mark |" say > "| (has not reached 61 in 'twice around' or 31 in 'once |" say > "| around') he is lurched (skunked) and loses a double game. |" say > "+-----------------------------------------------------------+" say > ; > : do_rules_hands > "+-----------------------------------------------------------+" say > "| Rules (Topic: Hands) |" say > "+-----------------------------------------------------------+" say > "| Each HAND begins as six cards. Two cards from each play- |" say > "| er's HAND are laid off into the crib, forming three HANDS |" say > "| two for the dealer and one for the other. The starter is |" say > "| then chosen making three HANDS of five for showing pur- |" say > "| poses. |" say > "+-----------------------------------------------------------+" say > ; > : do_rules_settings > "+-----------------------------------------------------------+" say > "| Rules (Topic: Settings) |" say > "+-----------------------------------------------------------+" say > "| reset | twice around and automatic pegging |" say > "| reset ha | once around and automatic pegging |" say > "| reset hm | once around and manual pegging |" say > "| reset m | twice around and manual pegging |" say > "+-----------------------------------------------------------+" say > ; > : do_rules_etiquette > "+-----------------------------------------------------------+" say > "| Rules (Topic: Etiquette) |" say > "+-----------------------------------------------------------+" say > "| Proper ETIQUETTE is to count aloud, taking the categories |" say > "| in order: fifteen, pairs, runs, flush, His Nobs -- and |" say > "| indicating the source of the scores briefly. Other com- |" say > "| binations listed below should be called instead of their |" say > "| basic counterparts: |" say > "| 6 pairs: count 12 for double pair royal |" say > "| 3 pairs: count 6 for pair royal |" say > "| Double run: KQQJ, score 8 |" say > "| Double run of four: KQQJT, score 10 |" say > "| Triple run: KQQQJ, score 15 |" say > "| Quadruple run: KKQQJ, score 16 |" say > "| Note that this is not necessary in the online game unless |" say > "| validation is requested in a manual pegging game. |" say > "+-----------------------------------------------------------+" say > ; > : do_rules_crib > "+-----------------------------------------------------------+" say > "| Rules (Topic: Crib) |" say > "+-----------------------------------------------------------+" say > "| From his hand, each player selects two cards, and the |" say > "| four cards are placed face down near the dealer. They |" say > "| form the CRIB, an extra hand that belongs to he dealer. |" say > "+-----------------------------------------------------------+" say > ; > : do_rules_lurch > "+-----------------------------------------------------------+" say > "| Rules (Topic: Lurch) |" say > "+-----------------------------------------------------------+" say > "| If the loser of a game has not passed the halfway mark |" say > "| (61 in 'twice around' or 31 in 'once around'), he is then |" say > "| LURCHED and loses a double game. |" say > "+-----------------------------------------------------------+" say > ; > : do_rules ( s -- ) > strip tolower dup not if > pop do_rules_main exit then > dup "players" instr if > pop do_rules_players exit then > dup "cards" instr if > pop do_rules_cards exit then > dup "deal" instr if > pop do_rules_deal exit then > dup "starter" instr if > pop do_rules_starter exit then > dup "board" instr if > pop do_rules_board exit then > dup "play" instr if > pop do_rules_play exit then > dup "fifteen" instr if > pop do_rules_fifteen exit then > dup "pairs" instr if > pop do_rules_pairs exit then > dup "runs" instr if > pop do_rules_runs exit then > dup "showing" instr if > pop do_rules_showing exit then > dup "flush" instr if > pop do_rules_flush exit then > dup "nobs" instr if > pop do_rules_nobs exit then > dup "heels" instr if > pop do_rules_heels exit then > dup "muggins" instr if > pop do_rules_muggins exit then > dup "winning" instr if > pop do_rules_winning exit then > dup "hands" instr if > pop do_rules_hands exit then > dup "settings" instr if > pop do_rules_settings exit then > dup "etiquette" instr if > pop do_rules_etiquette exit then > dup "crib" instr if > pop do_rules_crib exit then > dup "lurch" instr if > pop do_rules_lurch exit then > pop "" do_rules > ; > : do_help ( -- ) > "+-----------------------------------------------------------+" say > "| MUF-Cribbage 4.01 |" say > "+-----------------------------------------------------------+" say > "| All code by Sjade except final hand scoring by der Mouse. |" say > "+-----------------------------------------------------------+" say > "| crib | Submit two cards to the crib |" say > "| cut | Cut to determine first deal or starter |" say > "| deal | Deal a hand |" say > "| display | Show the board |" say > "| dispute | Specify 'no', 'over' or 'muggins ' |" say > "| hand | Show your hand |" say > "| help | Show this help screen |" say > "| join [