|
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: Tue Dec 11, 2007 6:28 am
Deal Or No Deal |
Here is a manual (via alias) Script to make you serve up Deal or no Deal. You're the host, the bank etc... When your player wants to do something, you simply use the appropriate alias. You can easily set what channel the script uses by changing the chan variable from say to ooc, chat, gsay, or whatever. It lacks fancy frills, and would require adjustments to the payout amounts for most muds. Also I charge 10,000 coins for each person who plays per game they play.
Code: |
#CLASS {DealOrNoDeal}
#ALIAS CaseMaker {
#CLASS DealOrNoDeal
#var Amounts ""
#var CR ""
#loop 26 {#ADDITEM CR %i}
#while (%numitems( @Amounts) < 26) {#ADDITEM Amounts %item( @Cash, %random( 1, 26))}
#CLASS {DealOrNoDeal|Cases}
#loop 26 {
#var Case%{i} %item( @Amounts, 1)
#DELNITEM Amounts 1
}
#CLASS 0
}
#ALIAS Estimate {
#CLASS DealOrNoDeal
#var Offer 0
#var TotalValue 0
#loop %numitems( @CR) {#ADD TotalValue @{%concat( "Case", %item( @CR, %i))}}
#MATH Offer %int( (@TotalValue / %numitems( @CR)) * @TurnNumber / 10)
#var Offer %format( "&.0n", @Offer)
#IF (@TurnNumber > 1) {
#VAR ToShow %concat( @Offer, " Gold Coins (", %subchar( @PrevOffer, "|", ","), ")")
@chan The Banker's Current Offer Is: @ToShow
} {@chan The Banker's Current Offer Is: @Offer Gold Coins}
#VAR PrevOffer %push( @Offer, @PrevOffer)
#CLASS 0
}
#ALIAS Banker {#EXEC Estimate}
#ALIAS Deal {
@chan Player Accepts Banker's Offer Of: @Offer
#EXEC InitGame
}
#ALIAS NoDeal {
@chan Player says No Deal!
#ADD TurnNumber 1
#EXEC InPlay
@chan Cases Left To Choose From: %subchar( @CR, "|", " ")
#VAR Picked 0
#EXEC ToOpen
}
#ALIAS InitGame {
#CLASS DealOrNoDeal
#VAR TurnNumber 1
#VAR Picked 0
#VAR PrevOffer ""
#EXEC CaseMaker
#CLASS 0
}
#ALIAS PlayerCase {
#CLASS DealOrNoDeal
#VAR PCase %1
#DELITEM CR %1
#EXEC ToOpen
#Class 0
}
#ALIAS Open {
#CLASS DealOrNoDeal
#IF (%ismember( %1, @CR) > 0) {
@chan Case %1 Contains: @{%concat( "Case", %1) Gold Coins}
#DELITEM CR %1
#ADD Picked 1
} {@chan Case Already Chosen}
#EXEC InPlay
@chan Cases Left To Choose From: %subchar( @CR, "|", " ")
#EXEC ToOpen
#CLASS 0
}
#ALIAS InPlay {
#CLASS DealOrNoDeal
#var LeftInPlay ""
#loop %numitems( @CR) {#ADDITEM LeftInPlay @{%concat( "Case", %item( @CR, %i))}}
#ADDITEM LeftInPlay @{%concat( "Case", @PCase)}
#var CasesLeft @LeftInPlay
#EXEC NumSort
#var LeftInPlay %subchar( @LeftInPlay, "|", " ")
@chan Amounts Left In Play: @LeftInPlay
}
#ALIAS NumSort {
#CLASS DealOrNoDeal
#VAR LeftInPlay ""
#while (%numitems( @CasesLeft)) {
#var temp %item( @CasesLeft, 1)
#loop %numitems( @CasesLeft) {#IF (%int( %item( @CasesLeft, %i)) < %int( @temp)) {#var temp %item( @CasesLeft, %i)}}
#ADDITEM LeftInPlay @temp
#DELITEM CasesLeft @temp
}
#var CasesLeft @LeftInPlay
#var LeftInPlay ""
#while %numitems( @CasesLeft) {
#ADDITEM LeftInPlay %format( "&.0n", %item( @CasesLeft, 1))
#DELNITEM CasesLeft 1
}
#CLASS 0
}
#ALIAS ToOpen {
#CLASS DealOrNoDeal
#CASE @TurnNumber {#VAR HowMany 6} {#VAR HowMany 5} {#VAR HowMany 4} {#VAR HowMany 3} {#VAR HowMany 2} {#VAR HowMany 1} {#VAR HowMany 1} {#VAR HowMany 1} {#VAR HowMany 1} {#VAR HowMany "Switch?"}
#IF (@TurnNumber < 10) {#MATH HowMany (@HowMany - @Picked)}
@chan Cases Remaining To Open: @HowMany
}
#ALIAS Switch {
@chan Player Chooses To Switch Cases, The Case Player Now Has Contains: @{%concat( "Case", @CR)}
@chan The Last Remaining Case Contained: @{%concat( "Case", @PCase)}
}
#ALIAS Keep {
@chan Player Chooses To Keep Their Case, And It Contains: @{%concat( "Case", @PCase)}
@chan The Last Remaining Case Contained: @{%concat( "Case", @CR)}
}
#VAR Cash {1|10|50|100|250|500|750|1000|2000|3000|4000|5000|7500|10000|50000|100000|250000|500000|750000|1000000|2000000|3000000|4000000|5000000|7500000|10000000}
#VAR Amounts {}
#VAR CR {1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26}
#VAR Offer {173,155}
#VAR TotalValue {12120851}
#VAR TurnNumber {1}
#VAR Picked {0}
#VAR PCase {13}
#VAR HowMany {0}
#VAR LeftInPlay {1 100 500 750 3,000 4,000 5,000 7,500 100,000 250,000 500,000 750,000 3,000,000 7,500,000 10,000,000}
#VAR PrevOffer {}
#VAR ToShow {173,155 Gold Coins (74,388)}
#VAR CasesLeft {}
#VAR temp {10000000}
#VAR chan {say}
#CLASS 0
#CLASS {DealOrNoDeal|Cases}
#VAR Case1 {2000}
#VAR Case2 {50000}
#VAR Case3 {750000}
#VAR Case4 {10000}
#VAR Case5 {5000}
#VAR Case6 {100}
#VAR Case7 {500000}
#VAR Case8 {250000}
#VAR Case9 {50}
#VAR Case10 {100000}
#VAR Case11 {3000}
#VAR Case12 {1000}
#VAR Case13 {500}
#VAR Case14 {7500}
#VAR Case15 {4000000}
#VAR Case16 {750}
#VAR Case17 {2000000}
#VAR Case18 {5000000}
#VAR Case19 {3000000}
#VAR Case20 {250}
#VAR Case21 {1000000}
#VAR Case22 {10000000}
#VAR Case23 {1}
#VAR Case24 {7500000}
#VAR Case25 {4000}
#VAR Case26 {10}
#CLASS 0
|
Simple Command Help (For the aliases):
-----------------------------------------------------
initgame - use this before EVERY game to reset everything
playercase - use this to set the player's case at start of game before asking them to start choosing cases.
open - use this to open each case as player asks. It has protection from repeat cases.
banker - use when the number to open reaches 0, gives the banker's offer.
deal - use if player says deal
nodeal - use to continue opening cases when player does not wish to accept the offer
keep - when the cases to open comes up as "Switch?" player must keep or switch, use this to keep
switch - used at end of game to switch player's case with the final remaining case in the gallery. |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Tue Dec 11, 2007 10:01 am |
Is this set up to use statistically optimal bank offers, so that the house has enough of an advantage to make this worthwhile?
|
|
|
|
Guinn Wizard
Joined: 03 Mar 2001 Posts: 1127 Location: London
|
Posted: Tue Dec 11, 2007 10:43 am |
At 10k per game you'd be making a huge loss - the average win is 1,314,775 coins if you just stick with your box and refuse all offers.
Even if you mean entry is 10,000 pounds and the prizes are in pennies then the average would still be 13,148 coins.
To start turning a profit you'd want something morelike prizes of
1, 5, 10, 20, 30, 40, 50, 75, 100, 500, 1000, 2500, 5000, 7500, 10000, 20000, 30000, 40000, 50000
That'd give an average of 8781 with a 10,000 entry fee |
|
_________________ CMUD Pro, Windows Vista x64
Core2 Q6600, 4GB RAM, GeForce 8800GT
Because you need it for text... ;) |
|
|
|
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: Tue Dec 11, 2007 9:19 pm |
Well, considering I made this without caring about the win/loss statistics ;)
The end use I'm putting it to will be on an immortal, so it matters not at all what the average win rate is. :P |
|
_________________ CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Wed Dec 12, 2007 5:07 am |
...I think it does, man. With an average return of 131 coins per coin bet, players will be making an absolute ton of gold off you. They should have to work for their cash.
|
|
|
|
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: Wed Dec 12, 2007 5:40 am |
Nah, on the immortal version they don't have to buy in at all...
And there are 2 extra cases with quest points in them as well.
It's more of a "fun" thing I can toss out there when nothing else is really going on.
Besides, the MUD where I staff is... well lets say not very caring about such things.
It's very lax in the rules department as long as EVERYONE has fun.
That, and I'm not much for caring about such things at all these days. I wrote it to do it, how others use it is up to them :) |
|
_________________ CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate |
|
|
|
charneus Wizard
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Fri Dec 28, 2007 8:51 am |
Heh. I actually wrote a script for Deal or No Deal. It'll offer based off percentages automatically. Wrote it, then someone else improved on it some. :D I wonder, ralgith, what MUD you play...
Charneus |
|
|
|
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: Fri Dec 28, 2007 5:07 pm |
I wrote this entirely from scratch charn, but atm I'm not PLAYING any MUDs, I'm writing one :)
|
|
_________________ CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate |
|
|
|
wheelman Novice
Joined: 30 Jan 2006 Posts: 41
|
Posted: Thu Jan 03, 2008 6:17 am |
Code: |
#CLASS {DealOrNoDeal}
#ALIAS CaseMaker {#var Amounts "";#var CR "";#loop 26 {#ADDITEM CR %i};#while (%numitems( @Amounts) < 26) {#ADDITEM Amounts %item( @Cash, %random( 1, 26))};#CLASS {DealOrNoDeal|Cases};#loop 26 {#var Case%{i} %item( @Amounts, 1);#DELNITEM Amounts 1}}
#ALIAS Estimate { #var Offer 0;#var TotalValue 0;#loop %numitems( @CR) {#ADD TotalValue @{%concat( "Case", %item( @CR, %i))}};#MATH Offer %int( (@TotalValue / %numitems( @CR)) * @TurnNumber / 10);#var Offer %format( "&.0n", @Offer);#IF (@TurnNumber > 1) {#VAR ToShow %concat( @Offer, " Gold Coins (", %subchar( @PrevOffer, "|", "\"), ")");@chan The Banker's Current Offer Is: @ToShow} {@chan The Banker's Current Offer Is: @Offer Gold Coins};#VAR PrevOffer %push( @Offer, @PrevOffer);@chan Please say Deal or No Deal.}
#ALIAS Deal {@chan Player Accepts Banker's Offer Of: @Offer;#EXEC InitGame}
#ALIAS NoDeal {@chan Player says No Deal!;#ADD TurnNumber 1;#EXEC InPlay;@chan Cases Left To Choose From: %subchar( @CR, "|", " ");#VAR Picked 0;#EXEC ToOpen}
#ALIAS InitGame {#VAR TurnNumber 1;#VAR Picked 0;#VAR PrevOffer "";#VAR Offer 0;#VAR TotalValue 0;#EXEC CaseMaker}
#ALIAS PlayerCase {#VAR PCase %1;#DELITEM CR %1;#EXEC ToOpen}
#ALIAS Open {#IF (%ismember( %1, @CR) > 0) {@chan Case %1 Contains: @{%concat( "Case", %1) Gold Coins};#DELITEM CR %1;#ADD Picked 1} {@chan Case Already Chosen};#EXEC InPlay;@chan Cases Left To Choose From: %subchar( @CR, "|", " ");#EXEC ToOpen}
#ALIAS InPlay {#var LeftInPlay "";#loop %numitems( @CR) {#ADDITEM LeftInPlay @{%concat( "Case", %item( @CR, %i))}};#ADDITEM LeftInPlay @{%concat( "Case", @PCase)};#var CasesLeft @LeftInPlay;#EXEC NumSort;#var LeftInPlay %subchar( @LeftInPlay, "|", " ");@chan Amounts Left In Play: @LeftInPlay}
#ALIAS NumSort {#VAR LeftInPlay "";#while (%numitems( @CasesLeft)) {#var temp %item( @CasesLeft, 1);#loop %numitems( @CasesLeft) {#IF (%int( %item( @CasesLeft, %i)) < %int( @temp)) {#var temp %item( @CasesLeft, %i)}};#ADDITEM LeftInPlay @temp;#DELITEM CasesLeft @temp};#var CasesLeft @LeftInPlay;#var LeftInPlay "";#while %numitems( @CasesLeft) {#ADDITEM LeftInPlay %format( "&.0n", %item( @CasesLeft, 1));#DELNITEM CasesLeft 1}}
#ALIAS ToOpen {#CASE @TurnNumber {#VAR HowMany 6} {#VAR HowMany 5} {#VAR HowMany 4} {#VAR HowMany 3} {#VAR HowMany 2} {#VAR HowMany 1} {#VAR HowMany 1} {#VAR HowMany 1} {#VAR HowMany 1} {#VAR HowMany "Would you like to Keep or Switch your case?"};#IF (@TurnNumber < 10) {#MATH HowMany (@HowMany - @Picked)};#IF (@TurnNumber = 10) {@chan @HowMany} {@chan Cases Remaining To Open: @HowMany}}
#ALIAS Switch {@chan Player Chooses To Switch Cases, The Case Player Now Has Contains: @{%concat( "Case", @CR)};@chan The Last Remaining Case Contained: @{%concat( "Case", @PCase)}}
#ALIAS Keep {@chan Player Chooses To Keep Their Case, And It Contains: @{%concat( "Case", @PCase)};@chan The Last Remaining Case Contained: @{%concat( "Case", @CR)}}
#VAR Cash {1|10|50|100|250|500|750|1000|2000|3000|4000|5000|7500|10000|50000|100000|250000|500000|750000|1000000|2000000|3000000|4000000|5000000|7500000|10000000}
#VAR Amounts {}
#VAR CR {1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26}
#VAR Offer {} {}
#VAR TotalValue {} {}
#VAR TurnNumber {1}
#VAR Picked {0}
#VAR PCase {1}
#VAR HowMany {Would you like to Keep or Switch your case?}
#VAR LeftInPlay {}
#VAR PrevOffer {}
#VAR ToShow {} {}
#VAR CasesLeft {}
#VAR temp {2000}
#VAR chan {say}
#VAR contestant {}
#TRIGGER {You say 'Cases Remaining To Open: 0'} {Estimate} "" {case}
#TRIGGER {(%w) says '(%d)'} {#if (%1 = @contestant) {open %2} {@chan Sorry you are not the one playing.}}
#TRIGGER {^(%w) says 'Deal'} {#if (%1 = @contestant) {Deal} {@chan Sorry you are not the one playing.}} "" {case}
#TRIGGER {^(%w) says 'Keep'} {#if (%1 = @contestant) {Keep} {@chan Sorry you are not the one playing.}} "" {case}
#TRIGGER {^(%w) says 'No Deal'} {#if (%1 = @contestant) {NoDeal} {@chan Sorry you are not the one playing.}} "" {case}
#TRIGGER {^(%w) says 'Switch'} {#if (%1 = @contestant) {Switch} {@chan Sorry you are not the one playing.}}
#CLASS 0
#CLASS {DealOrNoDeal|Cases}
#VAR Case1 {4000000}
#VAR Case2 {7500}
#VAR Case3 {500}
#VAR Case4 {500000}
#VAR Case5 {2000}
#VAR Case6 {250000}
#VAR Case7 {10000}
#VAR Case8 {3000000}
#VAR Case9 {10}
#VAR Case10 {250}
#VAR Case11 {10000000}
#VAR Case12 {2000000}
#VAR Case13 {100}
#VAR Case14 {1000}
#VAR Case15 {750000}
#VAR Case16 {750}
#VAR Case17 {7500000}
#VAR Case18 {4000}
#VAR Case19 {5000000}
#VAR Case20 {1}
#VAR Case21 {50000}
#VAR Case22 {100000}
#VAR Case23 {1000000}
#VAR Case24 {5000}
#VAR Case25 {3000}
#VAR Case26 {50}
#CLASS 0
|
Here it is a little more automated. It may not be the fastest way to automate it, but i'm still learning how to script. |
|
|
|
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: Thu Jan 03, 2008 8:54 pm |
there is a problem with your automation of it...
all your triggers are off say, so what if you're playing over tells, chat, etc etc? Thats what the chan var is for. |
|
_________________ CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate |
|
|
|
wheelman Novice
Joined: 30 Jan 2006 Posts: 41
|
Posted: Fri Jan 04, 2008 3:10 am |
How would I do it so the says are @chan? I've tried
or would I have to use a regex expression?[/code]
|
|
|
|
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: Fri Jan 04, 2008 3:18 pm |
I'm thinking it would need to be at least 2 triggers for each, even if its a regex. For instance, on the MUD I wrote this one, all channels were in this format:
{Chat} Player: Message
But say, gtell, etc... those were all different. I suppose with good knowledge of regex you could get this all combined into one, but I've never played with regex like that, so you'll need to post in the zMUD general discussion about how to make a trigger that will capture all these different possible channels based off a single word in the chan variable (for instance if your channel is gtell, and your gtell output is Moron tells the group, 'stuff' then obviously you can't just use the contents of chan by itself. These are some of the reasons I didn't automate it, others are that it is illegal to script for gold and such on the MUD I played... and this would qualify :) |
|
_________________ CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate |
|
|
|
Leyline Wanderer
Joined: 03 Feb 2007 Posts: 64
|
Posted: Wed Jan 16, 2008 5:34 am |
Why did you use a whole set of case variables, instead of a list that you can %delnitem()?
You seem good with lists every where else.
I just think I would have approached this differently, I'm currently learning your script and seeing if it can be done easily.
Otherwise Quite cool!
I think the estimate math may need to be adjusted, I got an estimate, opened a case (2000) very low imho, and my estimate went down, instead of going up. /ponder
And what is the numsort doing that
%sort(22|24|26)
won't do?
I think you have a typo in your %subchar(string,"|"," ") or you meant to use replace.
The difference is replace can replace 1 to many characters, or many to 1 (or none)
but subchar should have equal length lists in the 2nd and 3rd param
so %subchar("stringabccba),"abc","123")
would replace a = 1 b = 2 c = 3 each character in it's list repsectivelly, outputting string123321 |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Wed Jan 16, 2008 5:54 am |
Take a look at %sort(2|22|34|3|20) and you'll see why it's important to be careful when sorting numbers. I'd've just added some 0s to the beginning of all the numbers, but that's just me.
|
|
|
|
Leyline Wanderer
Joined: 03 Feb 2007 Posts: 64
|
|
|
|
Leyline Wanderer
Joined: 03 Feb 2007 Posts: 64
|
Posted: Wed Jan 16, 2008 6:12 am |
Yes I would add zero's to the case numbers myself for sort to work,
Actually the more I go over this, the more and more places I see I'd like to learn the concept, then start from scratch.
Thanks for the flowchart tho, and still great idea!
(I'm just a sucker for less variables and more inline list / strings ) |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Wed Jan 16, 2008 6:25 am |
Thanks for that link, Leyline - my primary interest is in Economics and I find that risk-assessment stuff an interesting diversion :)
|
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Wed Jan 16, 2008 6:36 am |
%subchar has no requirement that the match and replace list be equal length. I frequently use things like this in my scripts
%subchar(@var," ,.!?()[]{}<>","|||||")
to replace cretain characters with a new one and remove other offensive characters at the same time. In this case all the different bracketting chracters are being removed. |
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
|
Leyline Wanderer
Joined: 03 Feb 2007 Posts: 64
|
Posted: Wed Jan 16, 2008 7:04 am |
Ahh cool )
But, using it on "|"," " would not replace | with 2 spaces, just 1 then? |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Wed Jan 16, 2008 7:09 am |
The one with two spaces would only replace it with one, yes - it's probably a typo, but it's a benign one. If you wanted to replace it with two spaces, you'll need to use %replace.
|
|
|
|
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: Wed Jan 16, 2008 3:47 pm |
Thanks for the input, but I've my reasons for doing it the way I did ;)
I COULD rewrite it with double string list (one for case numbers and one for amounts, then just each case number is matched by its position in the lists with an amount. |
|
_________________ CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate |
|
|
|
Leyline Wanderer
Joined: 03 Feb 2007 Posts: 64
|
Posted: Wed Jan 16, 2008 8:59 pm |
Yes cool, thx Rag, I think I will work on that.
|
|
|
|
Leyline Wanderer
Joined: 03 Feb 2007 Posts: 64
|
Posted: Thu Jan 17, 2008 3:51 am |
Hey Fang, you're welcome for that dond Economics link,
please if you come up with an idea for a good offer forumla, to possibly make this profitable I'd love to see it! )
I know anything I do may be hardcoding an offer array, and then using some of the board side balance, and fair deal value to pick a nearby array value.
But a more mathmatical solution would be divinely elegant. )
So where it has
{@chan The Banker's Current Offer Is: @Offer Gold Coins}
we should put {#exec @chan .... |
|
|
|
Leyline Wanderer
Joined: 03 Feb 2007 Posts: 64
|
Posted: Thu Jan 17, 2008 4:03 am |
P.S. Haha
I need to change alias Open
to opencase
because my game was going crazy every time I tried to open a door or a bag LOL
people were like WHAT is that!?
ROFL |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Thu Jan 17, 2008 4:05 am |
In answer to your question, yes you should use #exec.
|
|
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|