One Man's Trash

An original card game that gets its name from the notion that the card that one person may not want is desired greatly by another, and that players are constantly trying to judge the value of cards compared to each other's goals.

Instructions

MUSHCode for One Man's Trash

@create OMT@lock OMT==me@Desc OMT=A deck of One Man's Trash consists of 60 cards, 4 suits, each with numbers 1 through 10, 3 Flip-Flops, 1 Doubler, and 1 Nullifier.%r%rThere are [words(v(hand_[first(v(players))]))] rounds left this game.%r%rType %chstatus%cn to see more details about the current game, or %chcommands%cn to see how to use this game object.@Ause OMT=@pemit %#=You may want to check the list of game %chcommands%cn.&STATUS OMT=nogame&ENDGAME OMT=[iter(lcon(here),[pemit(##,That's the end of this hand.)])][iter(v(players),{[u(ENDGAME_PEMIT,##)]})][iter(lcon(here),[pemit(##,[repeat(-,48)])])][set(me,STATUS:nogame)]&CARDS OMT=r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r- r- r- rX r0 g1 g2 g3 g4 g5 g6 g7 g8 g9 g10 g- g- g- gX g0 b1 b2 b3 b4 b5 b6 b7 b8 b9 b10 b- b- b- bX b0 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y- y- y- yX y0&CMD_SHUFFLE OMT=$shuffle:think [iter(lcon(here),pemit(##,%n takes a fresh deck and shuffles it.))][iter(lattr(me/hand_*),set(me,##:))][set(me,drawpile:[shuffle(v(cards))])][iter(lattr(me/points_*),set(me,##:))][set(me,lead:)][set(me,status:nogame)]&CMD_LEAD OMT=$lead *:think [ifelse(not(strmatch(v(lead),%#)),{[pemit(%#,You're not the Trashman this go-round.)]},{[ifelse(not(strmatch(v(status),prelead)),{[pemit(%#,Now is not the time when you lead.)]},{[ifelse(not(setr(0,member(v(hand_%#),first(%0)))),{[pemit(%#,You don't have that card.)]},{[pemit(%#,You lead with the [u(cardname,[setr(1,extract(v(hand_%#),%q0,1))])].)][iter(setdiff(lcon(here),%#),pemit(##,%n plays the [u(cardname,%q1)] as the trash card.))][set(me,hand_%#:[remove(v(hand_%#),%q1)])][set(me,trash:%q1)][iter(lattr(me/bid_*),set(me,##:))][set(me,hasntbid:[remove(v(players),%#)])][iter(setdiff(lcon(here),%#),pemit(##,Use the %chbid%cn command to choose a card from your hand to bid with.))][set(me,status:prereveal)]})]})]})]&CMD_BID OMT=$bid *:think [switch(v(lead),%#,{[pemit(%#,The Trashman doesn't bid.)]},{[ifelse(not(strmatch(v(status),prereveal)),{[pemit(%#,Now is not the time when you bid.)]},{[ifelse(not(setr(0,member(v(hand_%#),first(%0)))),{[pemit(%#,You don't have that card.)]},{[pemit(%#,You bid the [u(cardname,[setr(1,extract(v(hand_%#),%q0,1))])].)][iter(setdiff(lcon(here),%#),pemit(##,%n bids a card.))][set(me,bid_%#:%q1)][set(me,hasntbid:[remove(v(hasntbid),%#)])][pemit(%#,You can change your bid anytime before the Trashman asks for a reveal by re%chbid%cnding a different card.)]})]})]})]&CARDNAME OMT=ansi(strtrunc(%0,1)h,[trim([switch(strtrunc(%0,1),r,Red,g,Green,b,Blue,y,Yellow)] [switch(mid(%0,1,2),-,Flip-Flop,X,Doubler,0,Nullifier,mid(%0,1,2))])])&CARDNAMESHORT OMT=ansi(strtrunc(%0,1)h,%0)&CMD_HAND OMT=$hand:think [iter(extract(shuffle(setdiff(v(players),%#)),1,2),pemit(##,%n looks at %p cards.))][pemit(%#,Your hand contains:%r[ifelse(v(hand_%#),[u(tablecards,v(hand_%#))],Nothing)])]&CMD_JOIN OMT=$join:think [ifelse(member(v(players),%#),{[pemit(%#,You're already in the game%, smart guy.)]},{[ifelse(not(strmatch(v(status),nogame)),{[pemit(%#,A game is in progress.)]},{[set(me,players:[trim(cat(v(players),%#))])][iter(lcon(here),pemit(##,%n joins the game.))]})]})]&CMD_LEAVE OMT=$part:think [ifelse(not(member(v(players),%#)),{[pemit(%#,You're not in the game%, smart guy.)]},{[ifelse(strmatch(v(status),nogame),{[set(me,players:[remove(v(players),%#)])][iter(lcon(here),pemit(##,%n leaves the game.))][set(me,hand_%#:)][set(me,points_%#:)]},{[pemit(%#,You cannot leave while a game is in progress.)]})]})]&SIG_LEAD OMT=[pemit(v(lead),You are the Trashman. Choose a card to %chlead%cn by looking at your %chhand%cn and then type %chlead <cardname>%cn.)][iter(setdiff(lcon(here),v(lead)),[pemit(##,[name(v(lead))] is the Trashman this go-round.)])][set(me,status:prelead)]&CMD_REVEAL OMT=$reveal:think [ifelse(strmatch(v(lead),%#),{[switch(v(status),prereveal,{[ifelse(gte(words(v(hasntbid)),1),{[pemit(%#,Not everyone has bid yet.)]},{[iter(lcon(here),[pemit(##,%n reveals everyone's bid cards.)])][iter(remove(v(players),%#),{[u(REVEAL_PEMIT,##)][set(me,hand_##:[remove(v(hand_##),v(bid_##))])]})][pemit(%#,Now you must %chpick%cn whose card you want.)][set(me,turn:%#)][set(me,status:picktime)]})]},{[pemit(%#,Now is not the time when you reveal.)]})]},{[pemit(%#,Only the Trashman can ask for a reveal.)]})]&CMD_PICK OMT=$pick *:think [ifelse(not(strmatch(v(status),picktime)),{[pemit(%#,Now is not the time when you pick.)]},{[ifelse(not(strmatch(v(turn),%#)),{[pemit(%#,It's not your turn to choose.)]},{[ifelse(strmatch(setr(0,u(playermatch,%0)),#-1),{[pemit(%#,Who? \\\\\\\\\(They're not playing%, or they're the Trashman.\\\\\\\\\))]},{[ifelse(not(hasattr(me,bid_%q0)),{[pemit(%#,That card has already been taken.)]},{[iter(setdiff(lcon(here),%#),pemit(##,%n takes [name(%q0)]'s [u(cardname,v(bid_%q0))].))][pemit(%#,You take [name(%q0)]'s [u(cardname,v(bid_%q0))].)][set(me,points_%#:[cat(v(bid_%q0),v(points_%#))])][set(me,bid_%q0:)][set(me,turn:%q0)][ifelse(not(member(iter(v(players),hasattr( me,bid_##)),1)),{[pemit(%q0,You end up with the trash card%, the [u(cardname,v(trash))].)][iter(setdiff(lcon(here),%q0),pemit(##,[name(%q0)] ends up with the trash card%, the [u(cardname,v(trash))].))][set(me,points_%q0:[cat(v(trash),v(points_%q0))])][set(me,trash:)][set(me,turn:)][ifelse(not(member(iter(v(players),hasattr(me,hand_##)),1)),{[u(endround)]},{[set(me,lead:%q0)][u(sig_lead)]})]},{[pemit(%q0,It 's your turn to %chpick%cn someone else's bid card.)][iter(setdiff(lcon(here),%q0),pemit(##,It's [name(%q0)]'s turn to pick a bid card.))]})]})]})]})]})]&CMD_POINTS OMT=$show:think [ifelse(strmatch(v(status),nogame),{[pemit(%#,There is no game currently underway.)]},{[pemit(%#,[repeat(-,48)])][iter(v(players),{[pemit(%#,[name(##)]'s acquired cards: [u(tablecards,v(points_##))])][pemit(%#,[name(##)]'s current score: [u(cmd_score,##)])][pemit(%#,[repeat(-,48)])]})]})]&ENDROUND OMT=@emit That's the end of this hand.;@dolist [v(players)]={@emit %#=[name(##)]'s final score: [u(cmd_score,##)]};&status me=nogame&PLAYERMATCH OMT=[first([trim(iter(remove(v(players),v(lead)),switch(strmatch(name(##),%0*),1,##)))] #-1)]&TABLECARDS OMT=[iter(sort(%0),u(cardnameshort,##))]&CMD_SHOWPOINTS OMT=$showpoints:@dolist [v(players)]={@pemit %#=name(##)'s acquired cards:;@pemit %#=[u(tablecards,v(points_##))]}&CMD_RULES OMT=$rules:@pemit %#=One Man's Trash is a game consisting of 3-6 players, and 60 cards.%r%rObject: To score as many points as possible in the 4 color suits.%rScoring: Each color is scored separately, then all are summed together.%rNumbers 1-10 are face value.%rThe Flip-Flops (-) change the sign of the color's total to the opposite.%rTwo Flip-Flops cancel each other out, leaving the result positive.%rThe Doublers (X) multiply the color's total by 2, no matter its sign.%rThe Nullifiers (0) retroactively change the color's total to 0,%rregardless of the other cards you have scored in that color.%r%rPlay is divided into rounds, each round having a Trashman, or leader. The %rdealer automatically is the first Trashman each round.%r%rThe Trashman %chlead%cns with a card from his hand, face-up. The other players%rthen %chbid%cn with a face-down card from their hands, in an attempt to%rdetermine when their card is picked in the following order.%r%rThe lead %chreveal%cns the bids all at the same time, and %chpick%cn a person%rto take a bid card from. This card is placed on the table in front of them and%rcounts towards their score.%r%rThe player whose bid card was picked, %chpick%cns from the remaining bid cards,%rand so on, until there are no bid cards left. The player who has not picked a%rcard yet, receives the Trashman's card, and is the Trashman for the next round.%r%rThe game ends when everyone's hand has been emptied. The player with the%rhighest score wins the game.%r&CMD_COMMANDS OMT=$commands:@pemit %#=The following commands are used in %chOne Man's Trash%cn:%r%chjoin%cn%b%b%b%b%b%b%b%b- Joins the game. You must wait for the current game to finish.%r%chpart%cn%b%b%b%b%b%b%b%b- Leaves the game. You can't leave until the current game finishes.%r%chreset%cn%b%b%b%b%b%b%b- Clears all aspects of the game, including players present, etc.%r%chshuffle%cn%b%b%b%b%b- Shuffles the deck and cancels a game in progress. It leaves the%r%b%b%b%b%b%b%b%b%b%b%b%b%b%bcurrent players list and their scores intact.%r%chdeal%cn%b%b%b%b%b%b%b%b- Deals equal cards to all current players and starts a new game.%r%chlead <card>%cn - Useable by the current Trashman, it leads a card in your hand.%r%chbid <card>%cn%b%b- Everyone but the Trashman uses this to bid a card from their hand.%r%b%b%b%b%b%b%b%b%b%b%b%b%b%bYou are able to change the bid card any time before the Trashman%r%b%b%b%b%b%b%b%b%b%b%b%b%b%bcalls for the cards to be revealed.%r%chreveal%cn%b%b%b%b%b%b- The current Trashman uses this to reveal everyone else's bid card.%r%chpick <user>%cn - Pick a player's bid card to score.%r%chhand%cn%b%b%b%b%b%b%b%b- Look at the cards in your hand.%r%chshow%cn%b%b%b%b%b%b%b%b- Look at the cards each player has scored this game.%r%chshowbids%cn%b%b%b%b- Look at the bid cards still available to pick from this round.%r%chstatus%cn%b%b%b%b%b%b- General information about the game situation.%r%chrules%cn%b%b%b%b%b%b%b- View the game rules. (How to play.)%r%chhints%cn%b%b%b%b%b%b%b- View general guidelines on how not to suck at One Man's Trash.%r%chcommands%cn%b%b%b%b- You're looking at it right now.%r%chcredits%cn%b%b%b%b%b- The idea for this game, and all disclaimers therein.&CMD_HINTS OMT=$hints:@pemit %#=%chHow Not To Suck At %cgOne Man's Trash%cw:%cn%r--------------------------------------%r* The cards in your hand are NOT a direct indicator of your potential for%r%b%bpoints. They are, however, good in determining what kind of cards you can%r%b%bexpect to get from other players when you lead them.%r%r* When you are the Trashman, keep in mind that if you lead a card that everyone%r%b%b(or perhaps a particular person) wants to score, they will attempt to bid%r%b%ba card that they think no one will want to pick, in hopes that they are picked%r%b%blast (and get your card). In the same manner, leading with undesirable cards%r%b%bwill result in players bidding with cards favorable to you as they try to avoid being last picked.%r%r* Sometimes, it is more important that an opponent that is ahead point-wise be%r%b%bforced to take a card severely unfavorable to him (such as a Doubler when%r%b%bhe has a color that is Flip-Flopped), rather than focusing on obtaining a high%r%b%bscore for yourself.%r%r* Don't fear taking the Flip-Flops unless the cards already played on the table%r%b%bsuggest that no more are in players' hands.%r%r* Nullifiers are offensive and defensive cards - they can save you from a%r%b%bvery negative score in a color, but if forced on an opponent, can reduce his%r%b%bscoring potential to a minimum (especially if the Nullified color is Doubled).%r&CMD_CREDITS OMT=$credits:@pemit %#=------------------------------------------------------------%r%ch%cgOne Man's Trash%cw%cn was designed and coded by Zachery Gaskins,%raka Tenchi Freelance on SluggyMUX (mux.sluggy.com:2025).%rRecoded for bugfixes and speed by Aranor@SluggyMUX.%rBased on the bestselling German card game %chNicht Die Bohne! ("Not The Bean!")%cn,%rby Horst-Reiner Rosner, and manufactured by Amigo.%rThe game gets its name from the notion that the card that one person may not%rwant is desired greatly by another, and that players are constantly trying to%rjudge the value of cards compared to each other's goals.%r------------------------------------------------------------%r&CMD_SHOW_STATUS OMT=$status:think [switch(v(status),nogame,{[pemit(%#,There is no game currently underway.)]},prelead,{[pemit(%#,%ch[name(v(lead))]%cn is the Trashman this go-round.%rA Trash card has not been lead yet.)]},prereveal,{[pemit(%#,%ch[name(v(lead))]%cn is the Trashman this go-round.%rThe trash card is a [u(cardname,v(trash))].%rBids have not been revealed.%rThe following people have not bid yet: [iter(v(hasntbid),name(##))])]},picktime,{[pemit(%#,%ch[name(v(lead))]%cn is the Trashman this go-round.%rThe trash card is a [u(cardname,v(trash))].%rIt's %ch[name(v(turn))]'s%cn turn to pick from the bid cards.)]})]&ISOLATE_SUIT OMT=trim(iter(sort(%0),u(in_suit,##,%1)))&IN_SUIT OMT=switch(%0,%1*,mid(%0,1,2),)&CMD_SCORE OMT=fold(me/sum,iter(b g r y,u(tabulate,u(isolate_suit,v(points_%0),##))))&TABULATE OMT=mul(fold(me/sum,%0),[switch(words(filter(me/flipflop,%0)),1,-1,2,1,3,-1, 1)],ifelse(member(%0,X),2,1),ifelse(member(%0,0),0,1))&SUM OMT=add(%0,%1)&FLIPFLOP OMT=member(%0,-)&PLAYERMATCHTEST OMT=$playtest *:@pemit %#=[u(playermatch,%0)]&CMD_SHOWBIDS OMT=$showbids:think [ifelse(strmatch(v(status),nogame),{[pemit(%#,There is no game currently underway.)]},{[pemit(%#,The trash card is a [u(cardname,v(trash))].)][ifelse(strmatch(v(status),picktime),[iter(v(players),ifelse(hasattr(me,bid_##),[pemit(%#,[name(##)] is bidding a [u(cardname,v(bid_##))].)],))],[iter(v(players),ifelse(hasattr(me,bid_##),[pemit(%#,[name(##)] has placed a bid.)],))])]})]&ENDGAME_PEMIT OMT=[iter(lcon(here),[pemit(##,[repeat(-,48)])][pemit(##,[name(%0)]'s acquired cards: [u(tablecards,v(points_%0))])][pemit(##,[name(%0)]'s final score: [u(cmd_score,%0)])])]&REVEAL_PEMIT OMT=[iter(lcon(here),[pemit(##,[name(%0)] has the [u(cardname,v(bid_%0))].)])]&CMD_DEAL OMT=$deal:think [ifelse(not(strmatch(v(status),nogame)),{[pemit(%#,You can't deal in the middle of a game.)]},{[ifelse(member(v(players),%#),{[setq(0,[div(60,words(v(players)))])][iter(v(players),{[set(me,hand_##:[extract(v(drawpile),1,%q0)])][set(me,drawpile:[extract(v(drawpile),[add(%q0,1)],60)])]})][iter(lcon(here),pemit(##,%n deals out %q0 cards to each player.))][set(me,lead:%#)][u(sig_lead)]},{[pemit(%#,You have to be in the game before you can deal.)]})]})]&CMD_RESET OMT=$reset:[set(me,players:)][set(me,lead:)][set(me,trash:)][iter(lattr(me/points_*),set(me,##:))][iter(lattr(me/bid_*),set(me,##:))][iter(lattr(me/hand_*),set(me,##:))][set(me,drawpile:[shuffle(v(cards))])][set(me,status:nogame)][iter(lcon(here),pemit(##,Game reset by %n.))]&PLAYERS OMT=#7907&DRAWPILE OMT=g6 b4 g- g7 y10 g10 g8 g- r4 y9 b6 y- y3 y- r5 y2 b2 y0 b- r10 r0 y8 b7 b8 b- y6 bX g3 r- g2 r9 r8 r- b5 b- r2 r1 b9 gX r3 y1 g9 g4 r7 g0 y5 y- g- g5 yX r- b0 y4 b10 y7 g1 b3 b1 r6 rX@set OMT=HALTED@set OMT=VISUAL