Apps Home
|
Create an App
Stripjack
Author:
rubzombie
Description
Source Code
Launch App
Current Users
Created by:
Rubzombie
// startof CBSv2 module - not for re-compilation (function(a,k){function g(a){this.message=a}g.prototype=Error();g.prototype.name="InvalidCharacterError";a.btoa||(a.btoa=function(a){a=String(a);for(var f,b,n=0,c=k,q="";a.charAt(n|0)||(c="=",n%1);q+=c.charAt(63&f>>8-n%1*8)){b=a.charCodeAt(n+=.75);if(255<b)throw new g('"btoa" failed: The string to be encoded contains characters outside of the Latin1 range.');f=f<<8|b}return q});a.atob||(a.atob=function(a){a=String(a).replace(/=+$/,"");if(1==a.length%4)throw new g('"atob" failed: The string to be decoded is not correctly encoded.'); for(var f=0,b,n,c=0,q="";n=a.charAt(c++);~n&&(b=f%4?64*b+n:n,f++%4)?q+=String.fromCharCode(255&b>>(-2*f&6)):0)n=k.indexOf(n);return q})})("undefined"===typeof exports?this:exports,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="); (function(a){var k=cb.onMessage,g=null,u=null,f,b="#"+(cb.settings.hasOwnProperty("slot")?cb.settings.slot:"")+"CBSv2",n=/^\/#[0-3]CBSv2\//;cb.log("CBS::v2::CB app/bot data Save/restore::20170923.009::Release");cb.onMessage=function(c){if("function"!==typeof c)throw new TypeError(c+" is not a function");k(function(k){var d=k.m.replace(/\s*/g,"").split("/");if(3<d.length&&""===d[0]&&d[1]===b){if(g&&u&&k.user===cb.room_slug){var p=d[2];if(4===d.length)d[3]="?",k.m=d.join("/");else if(6===d.length){if(!(f|| {}).hasOwnProperty(p)){var q=g();f={};f[p]=a.btoa(a.unescape(a.encodeURIComponent(q)));q||cb.log("onSave returned no data.")}f.hasOwnProperty(p)&&(q=parseInt(d[3],10),p=f[p].slice(q,q+512),d[4]=p,d[5]=p.length,k.m=d.join("/"))}else 7===d.length&&("0"===d[3]&&(f={},f[p]=""),f.hasOwnProperty(p)&&(d[3]=f[p].length,d[6]=d[4].length,k.m=d.join("/"),d[4]?f[p]+=d[4]:(q=a.decodeURIComponent(a.escape(a.atob(f[p]))),u(q),cb.chatNotice("Previously Saved Data Restored.",cb.room_slug))))}k["X-Spam"]=!0}else n.test(k.m)&& (k["X-Spam"]=!0);return c(k)});return c};cb.onRestore=function(a){if("function"!==typeof a)throw new TypeError(a+" is not a function");return u=a};cb.onSave=function(a){if("function"!==typeof a)throw new TypeError(a+" is not a function");return g=a};cb.onMessage(function(a){return a})})("undefined"===typeof exports?this:exports); // endof CBSv2 module - not for re-compilation var x=function(){function y(a,b){a=a||0;return a.toString()+" "+(1===a?b:b+"s")}function g(a){if(a&&"string"===typeof a){g.hasOwnProperty("log")||(g.log=[]);var b=/(..)(:..)(:..)/.exec(new Date),c=b[1]%12||12;g.log.push((10>c?"0"+c:c)+b[2]+b[3]+" "+(12>b[1]?"A":"P")+"M : "+a);25<g.log.length&&g.log.shift();a=("Stripjack: "+a).replace(/\+/g,"\uff0b").replace(/&/g,encodeURIComponent("&"))}g.hasOwnProperty("log")||cb.log(a.replace(/(\r\n|\n|\r|\\n)/gm," ").trim())}function z(a){var b=Array.prototype.slice.call(arguments), c,e=0,g;a&&"string"===typeof a&&("Enable"===cb.settings.multi_line_safe&&(c=a.split(/ *\n */),e=c.length,a=c[0]),b[0]=("Stripjack: "+a.replace(/\+/g,"\uff0b")).replace(/&/g,encodeURIComponent("&")));cb.chatNotice.apply(cb,b);for(g=1;g<e;g++)b[0]=c[g].replace(/\+/g,"\uff0b").replace(/&/g,encodeURIComponent("&")),cb.chatNotice.apply(cb,b)}function l(a,b){var c=Array.prototype.slice.call(arguments);b&&"string"===typeof b&&b.length&&(c[0]=""+a,z.apply(W,c))}function O(a){switch(a%13){case 0:return"A"; case 10:return"J";case 11:return"Q";case 12:return"K";default:return(a%13+1).toString()}}function P(a){switch(Math.floor(a/13)){case 0:return"\u2663";case 1:return"\u2666";case 2:return"\u2665";case 3:return"\u2660";default:return"?"}}function Q(a){return(10>a%13?a%13:9)+1}function u(a){var b,c,e=0,g=0;for(b=0;b<a.length;b++)c=Q(a[b]),1===c&&(g++,e+=10),e+=c;for(;0<g--&&21<e;)e-=10;return e}function R(a){var b=u(a),c,e=[];for(c=0;c<a.length;c++)e.push(O(a[c])+P(a[c]));return e.join(", ")+" ("+b+ (21<b?" busted!":21===b&&2===a.length?" stripjack!":"")+")"}function E(a){function b(a){return a}var c=u(f),e=u(A);a=a||b;return 21<c?a(!0,"Player hand bust (over 21)"):21<e?a(!1,"Dealer hand bust (over 21)"):c===e?21===e&&2===A.length&&2<f.length?a(!0,"Dealer stripjack beats player 21"):a(!1,"Player wins tied hand"):c>e?a(!1,"Player hand scores more than dealer"):a(!0,"Dealer hand scores more than player")}function F(a){a=a||"";var b;b="#"+(cb.settings.game_title||"").toLowerCase().replace(/[^a-z0-9_]+/g, "-")+" ";b=a.length?b+(" "+a):b+(" Game #"+C+(B?" over! Dealer "+(E()?"wins!":"forfeits!"):""));S!==b&&(g("Changing subject to: "+b),cb.changeRoomSubject(b),S=b)}function G(){var a=u(f),b="",c,e=0;if(B){if(b="Game over! Dealer "+(E()?"wins":"forfeits"),h&&!L){E()?l("Yay! You won. Time to put something back on ;)",cb.room_slug,"#f2f9fd"):l("Aww! You lost. Time to take something off ;)",cb.room_slug,"#f2f9fd");for(c in v)v.hasOwnProperty(c)&&(e+=v[c]);l(["Tokens tipped so far during play: "+e,"Type /deal to start a new game."].join("\nStripjack: "), cb.room_slug,"#f2f9fd");L=!0}}else b+="/tip "+a+" to "+(21===a?"Win!":"Stand, /tip 1 to Hit");I.row1_value=b;I.row2_value="Dealer "+R(A);I.row3_value=(q&&null!==k?(12<k.length?k.substring(0,11)+"\u2026":k)+" ":"Player"+(q?" ":"s "))+R(f)}function T(a){a<f.length?f[a]=m.a():f.push(m.a());!0===(B=21<u(f))&&(h&&l("Player hand bust (over 21). Dealer wins.",cb.room_slug,"#f2f9fd"),F(" Game #"+C+" over! Dealer wins!"),J++);G();cb.drawPanel()}function X(){for(var a=u(A),b=u(f);a<b&&21>a;)A.push(m.a()),a= u(A);B=!0;E(function(a,b){h&&l(b+". Dealer "+(a?"wins.":"forfeits."),cb.room_slug,"#f2f9fd");return a})?(F(" Game #"+C+" over! Dealer wins!"),J++):(F(" Game #"+C+" over! Dealer forfeits!"),M++);G();cb.drawPanel()}function Y(a){g("setTitle()\nstr: "+a);a=a||cb.settings.game_title||H.i||"";a=a.replace(/^\s+|\s+$/g,"");1>a.length||cb.settings.game_title===a||(cb.settings.game_title=a,l("game title set: "+a,cb.room_slug,"#d5ebf8"),F())}function U(){g("newGame()");var a;C++;m.v()&&m.o();A=[];f=[];f.push(m.a()); A.push(m.a());f.push(m.a());k=null;L=B=!1;G();cb.drawPanel();a="Game #"+C;F(a);z(a+"\nType /help for help, /tip to play.","","#f2f9fd")}function Z(){g("toggleModControl()");var a;t=!t;cb.settings.mod_control=t?"Yes":"No";a="Mod control "+(t?"enabled":"disabled")+".";h&&(a+=" Type /mods again to "+(t?"disable it.":"allow room moderators to /deal and set /oneplay mode on and off."));l(a,cb.room_slug,"#f2f9fd")}function aa(){g("toggleExtraHelp()");var a;h=!h;cb.settings.xhelp=h?"Yes":"No";a="Extended Game messages "+ (h?"enabled":"disabled")+".";a+=" Type /xhelp again to "+(h?"disable them.":"receive additional app help during play.");l(a,cb.room_slug,"#f2f9fd")}function ba(){g("toggleOneplay()");var a;q=!q;cb.settings.oneplay=q?"Yes":"No";a="One-play mode "+(q?"enabled":"disabled")+".";h?l(a+" Type /oneplay again, to "+(q?"allow anyone to play a hand.":"re-enable it."),cb.room_slug,"#f2f9fd"):l(a,cb.room_slug,"#f2f9fd");z(a+(q?" Next person to tip takes control of the current hand.":" Anyone may now tip to play the current hand."), "","#d5ebf8");k=null;G();cb.drawPanel()}function V(a){function b(a,c){z("Result: "+c+". Dealer "+(a?"wins.":"forfeits."),p||k&&t?"":w,"#f2f9fd")}function c(){var a=h.replace(/[\W_]/g,"").toLowerCase(),c=a.replace(/[aeiou]/g,""),b,d,f=!1;b=h;d=w;f=!1;d=d.replace(/_[0-9a-f]+/ig,"");e.hasOwnProperty("echo_user")&&e.hasOwnProperty("echo_text")&&(f=e.echo_text===b&&e.echo_user===d);e.echo_user=d;e.echo_text=b;!0===f&&g("SpamBlockerAd: echo match");b=0;for(d=r.f.length;!f&&b<d&&!(c.length<r.f[b].length);b++)!0=== (f=-1!==c.indexOf(r.f[b]))&&g("SpamBlockerAd: simple match ("+b+"): "+r.f[b]);b=0;for(d=r.text.length;!f&&b<d;b++)!0===(f=r.text[b].test(h))&&g("SpamBlockerAd: text match ("+b+"): "+r.text[b].source);b=0;for(d=r.h.length;!f&&b<d;b++)!0===(f=r.h[b].test(a))&&g("SpamBlockerAd: plain match ("+b+"): "+r.h[b].source);b=0;for(d=r.g.length;!f&&b<d;b++)!0===(f=(new RegExp("(?:^|\\s):"+r.g[b]+"(?=\\s|$)","")).test(h))&&g("SpamBlockerAd: blacklist emoticons match ("+b+"): "+r.g[b]);f&&(l(["Message from the author:\n\u00a0\u00a0Thanks for using my "+ (K?"app":"bot")+" :)\n\u00a0\u00a0By the way, visitor "+w+" has just spammed your chat!\n\u00a0\u00a0To stop them doing it again, launch my spam blocker, No\u00a0Grey\u00a0Spammers.\n\u00a0\u00a0See this "+(K?"app":"bot")+"'s Description for a link ;)","End of Message"].join("\nStripjack: "),cb.room_slug,"#f37e7e"),D=!1)}var e=V,f=(new Date).valueOf(),h=a.m,w=a.user,q="rubzombie"===w,p=w===cb.room_slug,k=a.is_mod,u=/\/(stripjack|sj|#[0-3])?(deal|x?help|mods|oneplay|play|result|rules|stats|title|tokens)\s*([^\/]*)/ig, n,d,m;if(D)if(p||k){if(/\/(sh|sphammer|#[0-3])?(english|enonly|sphammered)/i.test(h)||/\/(sh|sphammer)(help|spam)/i.test(h))D=!1,g("SpamBlockerAd: SpHammer detected");/\/(ngs|nogreyspammers)(help|spam|\?)/i.test(h)&&(D=!1,g("SpamBlockerAd: No Grey Spammers detected"))}else/<<<( has been SPAM HAMMERED| spHammer hit#)/.test(h)&&"#595959"===a.background&&"#999999"===a.c&&(D=!1,g("SpamBlockerAd: SpHammer detected"));if(!a["X-Spam"]&&"/"===h.trim()[0])for(;null!==(n=u.exec(h));)if(d=(n[1]||"sj").toLowerCase(), "sj"===d||"stripjack"===d||d===N)switch(a["X-Spam"]=!0,d=(n[3]||"").trim(),n=n[2].toLowerCase(),n){case "deal":case "play":(p||k&&t)&&U();break;case "help":n=[];d="";q&&n.push("version: 2016/03/05.0\nStrip card game. Tip to play.");n.push("Help:\nBeat the dealer hand to win dealer forfeits.\nTip to add cards to the players hand.\nObtain a score of 21 or less that is higher than the dealer's hand to win.\nStripjacks (two card hands of 21) always win.\nSwap a card for one from the deck by tipping its value.\nStand the players hand by tipping its total score, and see if the dealer can beat it.\nIn one-play mode, take control of a hand by being the first to tip for it."); d+="In-chat commands:\n";if(p||k&&t)d+="\u00a0\u00a0/deal - deal a new hand\n";p&&(d+="\u00a0\u00a0/mods - toggle mod control on and off\n");if(p||k&&t)d+="\u00a0\u00a0/oneplay - toggle one-play mode on and off\n";d+="\u00a0\u00a0/tip card_value - to swap (exchange dealt card for another)\n\u00a0\u00a0/tip hand_value - to stand (end turn)\n\u00a0\u00a0/tip 1 or any_other_value - to hit (take another card)\n";p&&(d+="\u00a0\u00a0/title text - set the game title to text\n\u00a0\u00a0/tokens\n\u00a0\u00a0/stats - show game statistics\n"); d+="\u00a0\u00a0/result - explain game result\n\u00a0\u00a0/rules - complete list of game rules\n\u00a0\u00a0/help - show this help message\n";p&&(d+="\u00a0\u00a0/xhelp - toggle additional in-game help on and off\n");d+="For more details, see "+(K?"app":"bot")+" Description.";n.push(d);l(n.join("\nStripjack: "),w,"#f2f9fd");break;case "mods":p&&Z();break;case "oneplay":(p||k&&t)&&ba();break;case "result":B?E(b):z("Result: None. Game in play.",p||k&&t?"":w,"#f2f9fd");break;case "rules":d="Rules:\nThe object of stripjack is to beat the dealer.\nTo beat the dealer the player must first not bust (go over 21) and second either outscore the dealer or have the dealer bust.\nHere are the full rules of the game.\n1. Stripjack is played with one 52-card deck.\n2. Aces may be counted as 1 or 11 points, 2 to 9 according to pip value, and tens and face cards count as ten points.\n3. The value of a hand is the sum of the point values of the individual cards. Except, a 'stripjack' is the highest hand, consisting of an ace and any 10-point card, and it outranks all other 21-point hands.\n4. Two cards are dealt to the player, and one to the dealer.\n5. Play proceeds with the following choices available to the player:\n\u00a0\u00a0\u00a0\u00a0Stand: Player stands pat with their cards, by tipping their total score.\n\u00a0\u00a0\u00a0\u00a0Hit: Player draws another card (and more if they wish) by tipping one token. If this card causes the player's total points to exceed 21 (known as 'breaking' or 'busting') then they lose.\n\u00a0\u00a0\u00a0\u00a0Swap: Player draws another card in place of one from their hand by tipping its value (an ace's value being taken to be 11). Again, if the card causes the player's total points to exceed 21, they lose.\n6. After the player has had their turn, the dealer will draw cards until their total points exceed that of the players or 21.\n7. If the dealer goes over 21 points, then they lose and forfeit.\n8. If the dealer does not bust, then the higher point total between the player and dealer will win.\n9. If the points total ties between the player and dealer, the player will win unless the dealer has a stripjack and the player does not.\n"; l(d,w,"#f2f9fd");break;case "title":p&&Y(d);break;case "stats":case "tokens":if(p){n=[];d=0;for(m in v)v.hasOwnProperty(m)&&(d+=v[m],n.push(m+": "+v[m]));n.length?(n.push("Tokens tipped so far during play: "+d),l("Stats:\nTipper List:\n"+n.join("\n")+"\nDealer: "+y(J,"win")+", "+y(M,"forfeit")+".",w,"#f2f9fd")):l("Stats:\nTipper list is empty.",w,"#f2f9fd")}break;case "xhelp":p&&aa()}p||a["X-Spam"]||D&&c();g("onMessage: "+((new Date).valueOf()-f)+"ms");return a}var H={i:"Stripjack - Let's Get Nekkid!", j:!1,l:!1,s:!0},r={text:[/[^\u0000-\u0080\u00ad\u2605\u2606\u2654\u2655\u265a\u265b]/],h:[],f:"dlnws mcmcm rtmnt chnskv cht4fr frtkns wgwgwg bst4cms httpggl lv4prty lvtrffn nd4strp prfllsn bnjknntt kkmlvlns nsxyjngs pssy4shw vcmsssns wlchstdt 100kstnls chnnmnwhr cmsssnscm grls4prty prmmchtcm rgclsngsn sndtdrtch tknsgnrtr tmrqrllh1 tpgmscrck bfrtsptchd glsmtrprtl mnhndynmmr schnmnprfl schtglbntr snddrtchlv wwwsxchtsr knntjmlgckn lslsnndmldn stdchlngwlg strmngnkdcm wtchmcmgrls chbnnjngsgls dtschmtrprtl fndfrtknshck hrgldtschkrl pyplrwstrnnn schfdsmwgdch wsnddglnpmml wstrnnnrpypl jckjxshrngnds kstnlsndhnrsk llrdngsnchthr mncmstjtztchn wndmrmnfrrlds dknnmnglbwchsn mprdndstrngtrk n1gnhmpgstfrtg chtwththswsmgrl stdnglchnnmnwhr wnnjrktwthmfrfr fsllnghtpcsndvds dsthtdstwchmmrsnd hbknfnnzllnntrssn nrnchbzckmtdntpps schfcktrffnndcmsx fdrstdnglchnnmnwhr llnfssthnmprflvnmr nynwnnjrktwthmfrfr vrllmsndfstnrdtsch glbdgbtsgrnchtmhrdr snddwskstnlsndglrst wsnddnnnndglndtschn chtrbtknnmndchvrgssn ftzstmgglndbrchtshrt mchvrdrcmllswshrwllt nynhrdrmstfckldrmlfs mchnchtlngwrtnndkmmzmr wrbckhtknnmchdjmlbschn kstnlsdtngprtlndtschlnd ntrssntbrmchfndstdnmnmprfl wnnjschtnmnprflndkntktrtmchdrt hbthrgntlchdhlfschlgschffthrvlldtn thsmnstrlysnfbtchsllngthmtfhsgrlfrnd dspmmrsndnfchzdmmvnjdmmdwrdnsgbnntndnsnstnflltdchknrfsnbldsnngwrbngrn".split(" "), g:"anarchy dance69 endlesspoop exbf extremevomit extremevomit2 extremevomitscat FISTING fuckass1 gape420 gay gay6 gaybj gayfuck2 gayfuck5 gaysuck2 goats3 gross kena kisshug55 kisshug56 kisshug57 powerbottom prolapse56 prolapse57 prolapse58 shit50 shit55 shithead takeit tubgirl3 vbutt wag".split(" ")},W=this,N=null,K,C,A,f,B,L,S="",t=H.j,q=H.l,k=null,v={},J,M,h=H.s,I={template:"3_rows_11_21_31",row1_value:"Stripjack",row2_value:"...",row3_value:"..."},D=!0,m=function(){var a,b,c=[],e=0,f=Array.prototype.slice.call(arguments)[0]|| 1;for(a=0;a<f;a++)for(b=0;52>b;b++)c.push(b);return{a:function(){return c[e++%c.length]},v:function(){return e>3*c.length/4},o:function(a){g("Deck.shuffle()\nr: "+a);var b,f,k,m;h&&l("Every day I'm shuffling!",cb.room_slug,"#f2f9fd");a=a||10;for(b=0;b<a;b++)for(f=c.length-1;0<f;f--)k=Math.floor((f+1)*Math.random()),m=c[k],c[k]=c[f],c[f]=m;e=0}}}();return{b:H,u:function(){g("version: 2016/03/05.0");cb.settings.hasOwnProperty("slot")&&(N="#"+cb.settings.slot);K="#0"===N;g("init()\ngame_description: "+ cb.settings.game_title+"\noneplay: "+cb.settings.oneplay);q="Yes"===cb.settings.oneplay;t="Yes"===cb.settings.mod_control;h="Yes"===cb.settings.xhelp;v={};m.o();M=J=C=0;U()},w:function(a){a=a.user;!B&&q&&k===a&&(k=null,h&&l(a+" has left the room and loses control of the hand.",cb.room_slug,"#f2f9fd"),G(),cb.drawPanel(),z(a+" has lost control of the hand. Next tipper will take over play.","","#d5ebf8"))},onMessage:V,A:function(a){var b=(new Date).valueOf(),c=a.from_user,e=a.amount;v[c]=v.hasOwnProperty(c)? v[c]+e:e;q&&null===k&&(k=c,h&&l(c+" has taken control of the hand. Type /oneplay to toggle one-play mode off, or /deal to start a new game if you think "+c+" abandons the hand.",cb.room_slug,"#f2f9fd"));if(B)z("Sorry, the current game is over. But, thank you for tipping :)",c,"#d5ebf8"),h&&l(c+" tipped after the current game ended. Type /deal to start a new game.",cb.room_slug,"#f2f9fd");else if(q&&k!==c)z("Sorry, you don't have control of this hand. But, thank you for tipping :)",c,"#d5ebf8"), h&&l(c+" tipped while "+k+" has control of the hand. Type /oneplay to toggle one-play mode off, or /deal to start a new game if you think "+c+" has abandoned his hand.",cb.room_slug,"#f2f9fd");else if(e===u(f))h&&l(c+" has stood the hand.",cb.room_slug,"#f2f9fd"),X();else if(1===e)T(f.length);else{e-=11===e?10:0;for(a=0;a<f.length;a++)if(e===Q(f[a])){h&&l(c+" has tipped to swap the "+O(f[a])+P(f[a])+".",cb.room_slug,"#f2f9fd");break}T(a)}g("onTip: "+((new Date).valueOf()-b)+"ms")},B:I}}(); cb.settings_choices=[{defaultValue:x.b.i,label:"Game Title",maxLength:255,minLength:1,name:"game_title",required:!1,type:"str"},{choice1:"Yes",choice2:"No",defaultValue:x.b.l?"Yes":"No",label:"Enable single player per hand (one-play) mode",name:"oneplay",required:!1,type:"choice"},{choice1:"Yes",choice2:"No",defaultValue:x.b.j?"Yes":"No",label:"Allow room moderators to issue /deal and /oneplay commands",name:"mod_control",required:!1,type:"choice"},{choice1:"Yes",choice2:"No",defaultValue:x.b.s?"Yes": "No",label:"Receive additional app help during play",name:"xhelp",required:!1,type:"choice"},{choice1:"Enable",choice2:"Disable",defaultValue:"Disable",label:"(Multi-line Safe Mode)",name:"multi_line_safe",type:"choice"}];cb.onDrawPanel(function(){return x.B});cb.onLeave(function(y){return x.w(y)});cb.onMessage(function(y){return x.onMessage(y)});cb.onTip(function(y){x.A(y)});x.u();
© Copyright Chaturbate 2011- 2026. All Rights Reserved.