Play around with this. It’s a Three card Poker game I wrote.
threeCardPoker r1 dealHand deck cat(“Bet=”,bet," ") cards cat("Player: “,cards[1:3],” ") play play while(play !=“Y” && play !=“y” && play !=“N”&& play !=“n”){ play play if(play==“Y” || play==“y”){play if(play){ cat("Dealer: “,cards[4:6],” ") cards num num pnum dnum if(pnum[1]==2 &&pnum[2]==3 &&pnum[3]==14){(pnum[1] if(dnum[1]==2 &&dnum[2]==3 &&dnum[3]==14){(dnum[1] suit psuit dsuit pflush pflushC if(psuit[1]==“D”&&psuit[2]==“D”&&psuit[3]==“D”){pflush if(psuit[1]==“S”&&psuit[2]==“S”&&psuit[3]==“S”){pflush if(psuit[1]==“H”&&psuit[2]==“H”&&psuit[3]==“H”){pflush if(psuit[1]==“C”&&psuit[2]==“C”&&psuit[3]==“C”){pflush if(pflush){pflushC dflush dflushC if(dsuit[1]==“D”&&dsuit[2]==“D”&&dsuit[3]==“D”){dflush if(dsuit[1]==“S”&&dsuit[2]==“S”&&dsuit[3]==“S”){dflush if(dsuit[1]==“H”&&dsuit[2]==“H”&&dsuit[3]==“H”){dflush if(dsuit[1]==“C”&&dsuit[2]==“C”&&dsuit[3]==“C”){dflush if(dflush){dflushC if(pflushC==dflushC && pflushC !=0){(pflushC if(pflushC==dflushC && pflushC !=0){(pflushC pstraight pstraightC if(pnum[3]-pnum[2]==1 &&pnum[2]-pnum[1]==1){(pstraight dstraight dstraightC if(dnum[3]-dnum[2]==1 &&dnum[2]-dnum[1]==1){(dstraight pstrfl pstrflC if(pflush==TRUE && pstraight==TRUE){(pstrfl dstrfl dstrflC if(dflush==TRUE && dstraight==TRUE){(dstrfl if(pstrfl){pstraight if(pstrfl){pflush if(dstrfl){dstraight if(dstrfl){dflush pthreekind pthreekindC if(pnum[3]==pnum[2] &&pnum[2]==pnum[1]){(pthreekind dthreekind dthreekindC if(dnum[3]==dnum[2] &&dnum[2]==dnum[1]){(dthreekind if(pthreekind==TRUE &&pflush==TRUE){pflush if(dthreekind==TRUE &&dflush==TRUE){dflush ppair ppairC if(pthreekind==FALSE){if(pnum[1]==pnum[2] || pnum[2]==pnum[3]){ppair if(pthreekind==FALSE){if(ppair){if(pnum[1]==pnum[2]){ppairC if(pthreekind==FALSE){if(ppair){if(pnum[2]==pnum[3]){ppairC dpair dpairC if(dthreekind==FALSE){if(dnum[1]==dnum[2] || dnum[2]==dnum[3]){dpair if(dthreekind==FALSE){if(dpair){if(dnum[1]==dnum[2]){dpairC if(dthreekind==FALSE){if(dpair){if(dnum[2]==dnum[3]){dpairC if(ppairC==dpairC && ppairC !=0){(ppairC phc if(pstrfl==FALSE && pflush==FALSE && pstraight==FALSE && pthreekind==FALSE && ppair==FALSE){phc dhc if(dstrfl==FALSE && dflush==FALSE && dstraight==FALSE && dthreekind==FALSE && dpair==FALSE){dhc if(phc==dhc &&phc!=0){(phc if(phc==dhc &&phc!=0){(phc dQual if(dstrfl==TRUE || dflush==TRUE || dstraight==TRUE || dthreekind==TRUE || dpair==TRUE || max(dnum)>11){dQual cat("Dealer Qualifies? “,dQual,” ") value pHand pHandC pHand dHand dHandC dHand pWin pname dname cat("Player: ") if(pname){cat("HIGH CARD: “) if(pname==11){pname if(pname==12){pname if(pname==13){pname if(pname==14){pname cat(pname,” “)} if(ppair){cat(“PAIR”,” “)} if(pflush){cat(“FLUSH”,” “)} if(pstraight){cat(“STRAIGHT”,” “)} if(pthreekind){cat(“THREE OF A KIND”,” “)} if(pstrfl){cat(“STRAIGHT FLUSH”,” ")} cat("Dealer: ") if(dname){cat("HIGH CARD: “) if(dname==11){dname if(dname==12){dname if(dname==13){dname if(dname==14){dname cat(dname,” “)} if(dpair){cat(“PAIR”,” “)} if(dflush){cat(“FLUSH”,” “)} if(dstraight){cat(“STRAIGHT”,” “)} if(dthreekind){cat(“THREE OF A KIND”,” “)} if(dstrfl){cat(“STRAIGHT FLUSH”,” ")} if(dQual){ if(max(pHand)>max(dHand)){pWin if(max(pHand) if(max(pHand)==max(dHand)){if(max(pHandC)>max(dHandC)){pWin if(max(pHand)==max(dHand)){if(max(pHandC) if(max(pHand)==max(dHand)&&max(pHand)==0){if(phc>dhc){pWin if(max(pHand)==max(dHand)&&max(pHand)==0){if(phc if(pstrfl>0){pWin if(pthreekind>0){pWin if(pstraight>0){pWin } if(dQual==FALSE){ pWin if(pstrfl>0){pWin if(pthreekind>0){pWin if(pstraight>0){pWin } if(max(dHand)>max(pHand)){ if(pstrfl>0){pWin if(pthreekind>0){pWin if(pstraight>0){pWin } }#end if loop if(play==“FALSE”){return(bet*-1)} else{return(pWin)} } p chips while (is.na(chips)) chips g w l maxDD minDD while§{ cat("Total Chips: “,chips,” ") b while(is.na(b)){b while(b>chips*.5){b tmp if(tmp>0){ cat("You won! “,tmp,” ") g w if(tmp<0){ cat("You lost: “,tmp,” ") g l if(tmp==0){ cat("Push: “,” “) g chips if(chips>maxDD){maxDD if(chips cat(“Total Chips: “,(chips),” “) if(chips==0){break} p p while(p!=“Y” && p!=“y” && p!=“N” && p!=“n”){ p p if(p==“Y” || p==“y”){p else{p cat(” “) }#end while cat(“G: “,g,” “) cat(“W: “, w, " “,paste(r1(w/g*100),”%”,sep=””, " “)) cat(“L: “,l,” “,paste(r1(l/g*100),”%”,sep=””,” “)) cat(“P: “,g-w-l,” “,paste(r1((g-w-l)/g*100),”%”,sep=””,” ")) cat("Max: “,maxDD,” ") cat("Min: “,minDD,” ") }