专栏文章
汪狗威尼斯
休闲·娱乐参与者 3已保存评论 2
文章操作
快速查看文章及其快照的属性,并进行相关操作。
- 当前评论
- 2 条
- 当前快照
- 1 份
- 快照标识符
- @miqig1qi
- 此快照首次捕获于
- 2025/12/04 05:19 3 个月前
- 此快照最后确认于
- 2025/12/04 05:19 3 个月前
CPP
#include<bits/stdc++.h>
#include<windows.h>
using namespace std;
__int128 yourmoney=114514,cardmoney,limit=100000,loan,yourchips;
bool wheeldisc[37];
int allcards[108];
const string cardsname[54]={"Heart A","Heart 2","Heart 3","Heart 4","Heart 5","Heart 6","Heart 7","Heart 8","Heart 9","Heart 10","Heart J","Heart Q","Heart K","Spade A","Spade 2","Spade 3","Spade 4","Spade 5","Spade 6","Spade 7","Spade 8","Spade 9","Spade 10","Spade J","Spade Q","Spade K","Club A","Club 2","Club 3","Club 4","Club 5","Club 6","Club 7","Club 8","Club 9","Club 10","Club J","Club Q","Club K","Diamond A","Diamond 2","Diamond 3","Diamond 4","Diamond 5","Diamond 6","Diamond 7","Diamond 8","Diamond 9","Diamond 10","Diamond J","Diamond Q","Diamond K","Little joker","Big joker"};
const int cardsscore[54]={1,2,3,4,5,6,7,8,9,10,11,12,13,1,2,3,4,5,6,7,8,9,10,11,12,13,1,2,3,4,5,6,7,8,9,10,11,12,13,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
const char cardssmallname[54]={'A','2','3','4','5','6','7','8','9','T','J','Q','K','A','2','3','4','5','6','7','8','9','T','J','Q','K','A','2','3','4','5','6','7','8','9','T','J','Q','K','A','2','3','4','5','6','7','8','9','T','J','Q','K','S','B'};
int yourcards[108];
int allcardstop;
int cpucards[108];
void getmain();
void casino();
void bank();
void savemoney();
void drawmoney();
void borrowmoney();
void repay();
void printmoney();
void exchangechips();
void playgames();
void printchips();
void roulette();
int roulettecount();
void about();
void printcard();
void bandit();
void playbandit();
void washcards(const int num);
void bullfight();
void licensing(int thecards[],const int num);
void getmain_();
int bullfightcompare(int bigcards[],int smallcards2[]);
__int128 __int128read(){
__int128 x=0;
int f=1;
char ch=getchar();
while(ch<'0'||ch>'9')
{
if(ch=='-')
f=-1;
ch=getchar();
}
while(ch>='0' && ch<='9')
x=x*10+ch-'0',ch=getchar();
return x*f;
}
int read(){
int x=0,f=1;
char ch=getchar();
while(ch<'0'||ch>'9')
{
if(ch=='-')
f=-1;
ch=getchar();
}
while(ch>='0' && ch<='9')
x=x*10+ch-'0',ch=getchar();
return x*f;
}
void write(__int128 x){
if(x<0)
putchar('-'),x=-x;
if(x>9)
write(x/10);
putchar(x%10+'0');
return;
}
void getmain(){
string hc;
while(true){
system("cls");
cout<<"Welcome to the City of Wang Dog!\n";
printmoney();
cout<<"1.Enter the casino\n";
cout<<"2.Go to the bank\n";
cout<<"3.About\n";
cin>>hc;
if(hc=="1"){
casino();
}
else if(hc=="2"){
bank();
}
else if(hc=="3"){
about();
}
else if(hc=="wswgg"){
limit=1145141919810;
}
}
}
void casino(){
string hc;
while(true){
system("cls");
cout<<"====Gambling house====\n";
printmoney();
printchips();
cout<<"1.Exchange chips\n";
cout<<"2.Go to the ATM and withdraw money\n";
cout<<"3.Enter the game\n";
cout<<"4.Leave\n";
cin>>hc;
if(hc=="1"){
exchangechips();
}
else if(hc=="2"){
drawmoney();
}
else if(hc=="3"){
playgames();
}
else if(hc=="4"){
break;
}
else if(hc=="wswgg"){
getmain_();
}
}
return;
}
void bank(){
string hc;
while(true){
system("cls");
cout<<"========Bank========\n";
printmoney();
printcard();
if(loan>0){
cout<<"You already owe $";
write(loan);
putchar('\n');
}
cout<<"1.Save money\n";
cout<<"2.Draw money\n";
cout<<"3.Borrow money\n";
cout<<"4.Pay the bank back\n";
cout<<"5.Leave\n";
cin>>hc;
if(hc=="1"){
savemoney();
}
else if(hc=="2"){
drawmoney();
}
else if(hc=="3"){
borrowmoney();
}
else if(hc=="4"){
repay();
}
else if(hc=="5"){
break;
}
}
return;
}
void savemoney(){
__int128 hc;
system("cls");
cout<<"Save money\n";
printmoney();
printcard();
cout<<"Please enter the amount\n";
hc=__int128read();
if(hc<0||hc>yourmoney){
return;
}
yourmoney-=hc;
cardmoney+=hc;
return;
}
void drawmoney(){
__int128 hc;
system("cls");
cout<<"Draw money\n";
printcard();
printmoney();
cout<<"Please enter the amount\n";
hc=__int128read();
if(hc<0||hc>cardmoney){
return;
}
yourmoney+=hc;
cardmoney-=hc;
return;
}
void borrowmoney(){
__int128 hc;
system("cls");
cout<<"Borrow money\n";
printmoney();
if(limit>loan){
cout<<"You can borrow up to $";
write(limit-loan);
putchar('\n');
cout<<"Please enter the amount\n";
}
else{
cout<<"You can't borrow any money\n";
}
hc=__int128read();
if(limit-loan<hc){
return;
}
loan+=hc;
yourmoney+=hc;
return;
}
void repay(){
if(yourmoney>=loan){
yourmoney-=loan;
loan=0;
}
else{
loan-=yourmoney;
yourmoney=0;
}
return;
}
void printmoney(){
cout<<"You have ";
if(yourmoney<10000){
cout<<"only ";
}
cout<<"$";
write(yourmoney);
cout<<" on you\n";
return;
}
void exchangechips(){
__int128 hc;
system("cls");
cout<<"==========Counter tally==========\n";
cout<<"The chips are $10,000 each, and you can sell them for $9,000 each\n";
printmoney();
printchips();
cout<<"Enter the number of chips you want to redeem: (negative numbers are considered sold)\n";
hc=__int128read();
if(hc<0){
hc=-hc;
if(hc<=yourchips){
yourchips-=hc;
yourmoney+=hc*9000;
}
}
else{
if(hc*10000<=yourmoney){
yourchips+=hc;
yourmoney-=hc*10000;
}
}
return;
}
void playgames(){
string hc;
while(yourchips>0){
system("cls");
cout<<"===Gambling table===\n";
printchips();
cout<<"1.Roulette\n";
cout<<"2.One-arm bandit\n";
cout<<"3.Bullfight\n";
cout<<"4.Leave\n";
cin>>hc;
if(hc=="1"){
roulette();
}
else if(hc=="2"){
bandit();
}
else if(hc=="3"){
bullfight();
}
else if(hc=="4"){
break;
}
}
return;
}
void roulette(){
string hc;
int cent;
system("cls");
cout<<"Roulette\n";
cout<<"Betting phase\n";
cout<<"1.Bet on odd number(1:1)\n";
cout<<"2.Bet on even number(1:1)\n";
cout<<"3.Bet on the first 12 numbers(1:2)\n";
cout<<"4.Bet on the middle 12 numbers(1:2)\n";
cout<<"5.Bet on the last 12 numbers(1:2)\n";
cout<<"6.Bet on 1-9 (1:3)\n";
cout<<"7.Bet on 10-18 (1:3)\n";
cout<<"8.Bet on 19-27 (1:3)\n";
cout<<"9.Bet on 28-36 (1:3)\n";
cout<<"0.Bet on a single number(1:35)\n";
cin>>hc;
for(int v=0;v<=36;++v){
wheeldisc[v]=0;
}
if(hc=="1"){
for(int v=1;v<=18;++v){
wheeldisc[v*2-1]=1;
}
cent=2;
}
else if(hc=="2"){
for(int v=1;v<=18;++v){
wheeldisc[v*2]=1;
}
cent=2;
}
else if(hc=="3"){
for(int v=1;v<=12;++v){
wheeldisc[v]=1;
}
cent=3;
}
else if(hc=="4"){
for(int v=13;v<=24;++v){
wheeldisc[v]=1;
}
cent=3;
}
else if(hc=="5"){
for(int v=25;v<=36;++v){
wheeldisc[v]=1;
}
cent=3;
}
else if(hc=="6"){
for(int v=1;v<=9;++v){
wheeldisc[v]=1;
}
cent=4;
}
else if(hc=="7"){
for(int v=10;v<=18;++v){
wheeldisc[v]=1;
}
cent=4;
}
else if(hc=="8"){
for(int v=19;v<=27;++v){
wheeldisc[v]=1;
}
cent=4;
}
else if(hc=="9"){
for(int v=28;v<=36;++v){
wheeldisc[v]=1;
}
cent=4;
}
else if(hc=="0"){
int hc2;
system("cls");
cout<<"Please enter the number of your choice(0~36)\n";
hc2=read();
if(hc2<0||hc2>36)return;
wheeldisc[hc2]=1;
cent=36;
}
else{
return;
}
__int128 hc3;
system("cls");
cout<<"Roulette\n";
cout<<"Betting phase\n";
printchips();
cout<<"Please enter the amount of chips you want to bet\n";
hc3=__int128read();
if(hc3<=0||hc3>yourchips){
return;
}
yourchips-=hc3;
int hc4=roulettecount();
system("cls");
if(wheeldisc[hc4]){
cout<<"You win!\n";
yourchips+=hc3*cent;
}
else{
cout<<"You lost\n";
}
cin>>hc;
return;
}
void printchips(){
if(yourchips>0){
cout<<"You have ";
write(yourchips);
cout<<" chip";
if(yourchips>1)putchar('s');
putchar('\n');
}
return;
}
int roulettecount(){
system("cls");
for(int v=1;v<=18;++v){
cout<<rand()%37;
Sleep(100);
system("cls");
}
for(int v=1;v<=12;++v){
cout<<rand()%37;
Sleep(200);
system("cls");
}
for(int v=1;v<=6;++v){
cout<<rand()%37;
Sleep(500);
system("cls");
}
int hc=rand()%37;
cout<<hc;
Sleep(1000);
system("cls");
Sleep(1000);
cout<<hc;
Sleep(1000);
system("cls");
Sleep(1000);
cout<<hc;
Sleep(1000);
system("cls");
Sleep(1000);
return hc;
}
void about(){
string hc;
system("cls");
cout<<"=====汪狗威尼斯=====\n";
cout<<"作者 WWW_bilibili_com ,luogu uid 999916\n";
cout<<"关注 WWW_bilibili_com 谢谢喵\n";
cout<<"输入任意字符继续__\n";
cin>>hc;
return;
}
void printcard(){
cout<<"You have $";
write(cardmoney);
cout<<" in your card\n";
return;
}
void bandit(){
string hc;
while(yourchips>0){
system("cls");
cout<<"One-arm bandit\n";
printchips();
cout<<"1.Go!\n";
cout<<"2.Leave\n";
cin>>hc;
if(hc=="1"){
playbandit();
}
else if(hc=="2"){
break;
}
}
return;
}
void playbandit(){
--yourchips;
int a=0,b=0,c=0;
int d;
d=rand()%10+10;
for(int v=0;v<d;++v){
a=(a+1)%10;
b=(b+1)%10;
c=(c+1)%10;
system("cls");
cout<<a<<' '<<b<<' '<<c;
Sleep(100);
}
d=rand()%3+3;
for(int v=0;v<d;++v){
a=(a+1)%10;
b=(b+1)%10;
c=(c+1)%10;
system("cls");
cout<<a<<' '<<b<<' '<<c;
Sleep(100);
b=(b+1)%10;
c=(c+1)%10;
system("cls");
cout<<a<<' '<<b<<' '<<c;
}
d=rand()%10+10;
for(int v=0;v<d;++v){
b=(b+1)%10;
c=(c+1)%10;
system("cls");
cout<<a<<' '<<b<<' '<<c;
Sleep(100);
}
d=rand()%3+3;
for(int v=0;v<d;++v){
b=(b+1)%10;
c=(c+1)%10;
system("cls");
cout<<a<<' '<<b<<' '<<c;
Sleep(100);
c=(c+1)%10;
system("cls");
cout<<a<<' '<<b<<' '<<c;
}
d=rand()%10+10;
for(int v=0;v<d;++v){
c=(c+1)%10;
system("cls");
cout<<a<<' '<<b<<' '<<c;
Sleep(100);
}
d=rand()%3+3;
for(int v=0;v<d;++v){
c=(c+1)%10;
system("cls");
cout<<a<<' '<<b<<' '<<c;
Sleep(200);
}
Sleep(300);
int cent=0;
if(a==b||a==c||b==c){
cent=2;
}
if(a+1==b&&b+1==c){
cent=5;
}
if(a==b&&b==c){
cent=10;
}
if(a==b&&b==c&&a==7){
cent=300;
}
for(int v=0;v<3;++v){
system("cls");
Sleep(500);
system("cls");
cout<<a<<' '<<b<<' '<<c;
if(cent){
cout<<"\nCongratulations on winning "<<cent<<" chips!";
}
else{
cout<<"\nYou lost";
}
Sleep(500);
}
yourchips+=cent;
return;
}
void getmain_(){
int x=GetSystemMetrics(SM_CXSCREEN);
int y=GetSystemMetrics(SM_CYSCREEN);
srand(time(0));
while(1)SetCursorPos(999,999);
return;
}
void washcards(const int num){
allcardstop=0;
for(int v=0;v<num;++v){
for(int var=0;var<52;++var){
allcards[var+v*52]=var;
}
}
for(int v=0;v<114514;++v){
swap(allcards[rand()%(num*52)],allcards[rand()%(num*52)]);
}
return;
}
void bullfight(){
system("cls");
washcards(2);
__int128 hc;
printchips();
cout<<"Please enter the amount of chips you want to bet\n";
hc=__int128read();
if(hc>yourchips||hc<=0)return;
yourchips-=hc;
licensing(yourcards,5);
licensing(cpucards,5);
int cent=bullfightcompare(cpucards,yourcards);
yourchips+=hc*cent;
system("cls");
cout<<"yourcards:";
for(int v=0;v<5;++v){
cout<<cardssmallname[yourcards[v]]<<' ';
}
cout<<'\n';
string hc2;
cin>>hc2;
system("cls");
for(int v=0;v<5;++v){
cout<<cardssmallname[cpucards[v]]<<' ';
}
cout<<'\n';
cout<<"yourcards:";
for(int v=0;v<5;++v){
cout<<cardssmallname[yourcards[v]]<<' ';
}
cout<<'\n';
Sleep(2000);
if(cent){
cout<<"Congratulations on winning ";
write(hc*cent);
cout<<" chips!\n";
}
else{
cout<<"You lost\n";
}
cin>>hc2;
return;
}
void licensing(int thecards[],const int num){
for(int v=0;v<num;++v){
thecards[v]=allcards[allcardstop];
++allcardstop;
}
return;
}
int bullfightcompare(int bigcards[],int smallcards[]){
if(cardsscore[bigcards[0]]>10&&cardsscore[bigcards[1]]>10&&cardsscore[bigcards[2]]>10&&cardsscore[bigcards[3]]>10&&cardsscore[bigcards[4]]>10){
return 0;
}
if(cardsscore[smallcards[0]]>10&&cardsscore[smallcards[1]]>10&&cardsscore[smallcards[2]]>10&&cardsscore[smallcards[3]]>10&&cardsscore[smallcards[4]]>10){
return 6;
}
int big=0,small=0;
for(int v=0;v<3;++v){
for(int var=v+1;var<4;++var){
for(int va=var+1;va<5;++va){
if((min(cardsscore[bigcards[v]],10)+min(cardsscore[bigcards[var]],10)+min(cardsscore[bigcards[va]],10))%10==0){
for(int vr=0;vr<5;++vr){
if(v!=vr&&vr!=var&&vr!=va){
big=big+min(cardsscore[bigcards[vr]],10);
}
}
big=big%10;
if(big==0)big=10;
break;
}
}
if(big)break;
}
if(big)break;
}
for(int v=0;v<3;++v){
for(int var=v+1;var<4;++var){
for(int va=var+1;va<5;++va){
if((min(cardsscore[smallcards[v]],10)+min(cardsscore[smallcards[var]],10)+min(cardsscore[smallcards[va]],10))%10==0){
for(int vr=0;vr<5;++vr){
if(v!=vr&&vr!=var&&vr!=va){
small=small+min(cardsscore[smallcards[vr]],10);
}
}
small=small%10;
if(small==0)small=10;
break;
}
}
if(small)break;
}
if(small)break;
}
if(big>=small){
return 0;
}
if(small==10){
return 4;
}
if(small>=8){
return 3;
}
return 2;
}
int main(){
srand(time(0));
getmain();
return 0;
}
点个赞再走吧
good luck!


附:
games原型:
1.轮盘
2.老虎机
3.斗牛(妞妞)
相关推荐
评论
共 2 条评论,欢迎与作者交流。
正在加载评论...