Compare commits
6 Commits
main
...
windows-bu
Author | SHA1 | Date | |
---|---|---|---|
b33a371b83 | |||
bb0953bfe3 | |||
9be01f4faa | |||
|
0cffa95dc3 | ||
|
f1dc2afc36 | ||
|
7a0c3adc4b |
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,2 +1 @@
|
||||
.vscode/
|
||||
.Makefile/
|
||||
main.exe
|
||||
|
166
main.cpp
166
main.cpp
@ -1,7 +1,22 @@
|
||||
/*
|
||||
* ┌──────────────────────────────────────────────────┐
|
||||
* │ NyscoCasino │
|
||||
* │ Created by Nyosic | (C) 2025 │
|
||||
* │ https://gitea.lossless.win/nyosic │
|
||||
* └──────────────────────────────────────────────────┘
|
||||
*
|
||||
* (\_/)
|
||||
* (o.o)
|
||||
* (> <)
|
||||
*
|
||||
* Version: 1.1.3
|
||||
* Date: [2025-02-09]
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include <ctime>
|
||||
#include <unistd.h>
|
||||
#include <Windows.h>
|
||||
|
||||
using namespace std;
|
||||
char end_choice;
|
||||
@ -9,19 +24,34 @@ int balance = 0;
|
||||
int bank_balance = 10000;
|
||||
int save_depo = 0;
|
||||
|
||||
void display_balance(){
|
||||
cout << "Your current casino balance: " << balance << " NyscoCoins" << endl;
|
||||
}
|
||||
|
||||
bool check_balance(int bet_amount) {
|
||||
if (bet_amount > balance) {
|
||||
cout << "Insufficient funds. Please deposit more money." << endl;
|
||||
Sleep(3000);
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
void coinflip() {
|
||||
srand(time(0)); // Seed the random number generator
|
||||
|
||||
int bet_amount;
|
||||
char user_choice;
|
||||
|
||||
display_balance();
|
||||
cout << "Enter the amount of money you want to bet on the coin flip: ";
|
||||
cin >> bet_amount;
|
||||
|
||||
// Check if the user has enough balance
|
||||
if (bet_amount > balance) {
|
||||
cout << "You don't have enough NyscoCoins! Please try again with a lower amount." << endl;
|
||||
sleep(3);
|
||||
if (!check_balance(bet_amount)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Deduct the bet amount from the balance
|
||||
@ -44,7 +74,7 @@ void coinflip() {
|
||||
cout << "The coin is flipping..." << endl;
|
||||
|
||||
// Wait a moment to simulate flipping
|
||||
sleep(3);
|
||||
Sleep(3000);
|
||||
|
||||
if (flip_result == 0) {
|
||||
cout << "The result is Heads!" << endl;
|
||||
@ -55,17 +85,17 @@ void coinflip() {
|
||||
|
||||
// Check if the user won or lost
|
||||
if ((user_choice == 'H' || user_choice == 'h') && flip_result == 0) {
|
||||
system("clear");
|
||||
system("cls");
|
||||
cout << "Congratulations! You won! You get double the bet amount." << endl;
|
||||
balance += 2 * bet_amount;
|
||||
}
|
||||
else if ((user_choice == 'T' || user_choice == 't') && flip_result == 1) {
|
||||
system("clear");
|
||||
system("cls");
|
||||
cout << "Congratulations! You won! You get double the bet amount." << endl;
|
||||
balance += 2 * bet_amount;
|
||||
}
|
||||
else {
|
||||
system("clear");
|
||||
system("cls");
|
||||
cout << "Sorry! You lost the bet. Better luck next time!" << endl;
|
||||
}
|
||||
|
||||
@ -75,11 +105,11 @@ void coinflip() {
|
||||
cin >> end_choice;
|
||||
|
||||
if (end_choice == 'y' || end_choice == 'Y') {
|
||||
system("clear");
|
||||
system("cls");
|
||||
coinflip();
|
||||
}
|
||||
else {
|
||||
system("clear");
|
||||
system("cls");
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,18 +118,18 @@ void slots() {
|
||||
int bet_amount;
|
||||
char end_choice;
|
||||
|
||||
display_balance();
|
||||
cout << "Enter the amount of money you want to bet on slots: ";
|
||||
cin >> bet_amount;
|
||||
|
||||
if (bet_amount > balance) {
|
||||
cout << "You don't have enough NyscoCoins! Please try again with a lower amount." << endl;
|
||||
sleep(3);
|
||||
if (!check_balance(bet_amount)) {
|
||||
return;
|
||||
}
|
||||
|
||||
balance -= bet_amount;
|
||||
|
||||
cout << "Spinning the slots..." << endl;
|
||||
sleep(2);
|
||||
Sleep(2000);
|
||||
|
||||
int slot1 = rand() % 5 + 1;
|
||||
int slot2 = rand() % 5 + 1;
|
||||
@ -125,11 +155,11 @@ void slots() {
|
||||
cin >> end_choice;
|
||||
|
||||
if (end_choice == 'y' || end_choice == 'Y') {
|
||||
system("clear");
|
||||
system("cls");
|
||||
slots();
|
||||
}
|
||||
else {
|
||||
system("clear");
|
||||
system("cls");
|
||||
}
|
||||
}
|
||||
|
||||
@ -148,12 +178,12 @@ void blackjack() {
|
||||
cout << "Your cards: " << playerCard1 << " and " << playerCard2 << " (Total: " << playerTotal << ")" << endl;
|
||||
cout << "Dealer's visible card: " << dealerCard1 << endl;
|
||||
|
||||
display_balance();
|
||||
cout << "Enter your bet amount: ";
|
||||
cin >> bet_amount;
|
||||
|
||||
if (bet_amount > balance) {
|
||||
cout << "You don't have enough NyscoCoins! Please try again with a lower amount." << endl;
|
||||
sleep(3);
|
||||
if (!check_balance(bet_amount)) {
|
||||
return;
|
||||
}
|
||||
|
||||
balance -= bet_amount;
|
||||
@ -201,11 +231,11 @@ void blackjack() {
|
||||
cin >> end_choice;
|
||||
|
||||
if (end_choice == 'y' || end_choice == 'Y') {
|
||||
system("clear");
|
||||
system("cls");
|
||||
blackjack();
|
||||
}
|
||||
else {
|
||||
system("clear");
|
||||
system("cls");
|
||||
}
|
||||
}
|
||||
|
||||
@ -218,28 +248,27 @@ void diceRoll() {
|
||||
int bet_amount, outcome;
|
||||
char end_choice;
|
||||
|
||||
display_balance();
|
||||
cout << "Enter the amount of money you want to bet on dice roll: ";
|
||||
cin >> bet_amount;
|
||||
|
||||
if (!check_balance(bet_amount)) {
|
||||
return;
|
||||
}
|
||||
|
||||
cout << "Guess the outcome: ";
|
||||
cin >> outcome;
|
||||
|
||||
if (bet_amount > balance) {
|
||||
cout << "You don't have enough NyscoCoins! Please try again with a lower amount." << endl;
|
||||
sleep(3);
|
||||
diceRoll();
|
||||
}
|
||||
|
||||
if (outcome > 12) {
|
||||
cout << "There are only two dices max number is 12" << endl;
|
||||
sleep(3);
|
||||
Sleep(3000);
|
||||
diceRoll();
|
||||
}
|
||||
|
||||
balance -= bet_amount;
|
||||
|
||||
cout << "Rolling the dice..." << endl;
|
||||
sleep(2);
|
||||
Sleep(2000);
|
||||
|
||||
int dice1 = rand() % 6 + 1;
|
||||
int dice2 = rand() % 6 + 1;
|
||||
@ -261,11 +290,11 @@ void diceRoll() {
|
||||
cin >> end_choice;
|
||||
|
||||
if (end_choice == 'y' || end_choice == 'Y') {
|
||||
system("clear");
|
||||
system("cls");
|
||||
diceRoll();
|
||||
}
|
||||
else {
|
||||
system("clear");
|
||||
system("cls");
|
||||
}
|
||||
}
|
||||
|
||||
@ -276,6 +305,7 @@ void higherOrLower() {
|
||||
char outcome;
|
||||
char end_choice;
|
||||
|
||||
display_balance();
|
||||
cout << "Enter the amount of money you want to bet on higer or lower: ";
|
||||
cin >> bet_amount;
|
||||
|
||||
@ -285,22 +315,14 @@ void higherOrLower() {
|
||||
cout << "Guess the outcome (H-Higher/L-Lower): ";
|
||||
cin >> outcome;
|
||||
|
||||
if (bet_amount > balance) {
|
||||
cout << "You don't have enough NyscoCoins! Please try again with a lower amount." << endl;
|
||||
sleep(3);
|
||||
higherOrLower();
|
||||
}
|
||||
|
||||
if (outcome > 100 || outcome < 1) {
|
||||
cout << "The range is from 1 to 100" << endl;
|
||||
sleep(3);
|
||||
higherOrLower();
|
||||
if (!check_balance(bet_amount)) {
|
||||
return;
|
||||
}
|
||||
|
||||
balance -= bet_amount;
|
||||
|
||||
cout << "Generating the output number.." << endl;
|
||||
sleep(2);
|
||||
Sleep(2000);
|
||||
|
||||
int end_number = rand() % 100 + 1;
|
||||
|
||||
@ -336,11 +358,11 @@ void higherOrLower() {
|
||||
cin >> end_choice;
|
||||
|
||||
if (end_choice == 'y' || end_choice == 'Y') {
|
||||
system("clear");
|
||||
system("cls");
|
||||
higherOrLower();
|
||||
}
|
||||
else {
|
||||
system("clear");
|
||||
system("cls");
|
||||
}
|
||||
}
|
||||
|
||||
@ -352,16 +374,16 @@ void deposit() {
|
||||
if (bank_balance >= deposit_amount) {
|
||||
balance += deposit_amount;
|
||||
bank_balance -= deposit_amount;
|
||||
system("clear");
|
||||
system("cls");
|
||||
cout << "Deposit successful! Your new balance is: " << balance << " NyscoCoins"<< endl;
|
||||
sleep(3);
|
||||
system("clear");
|
||||
Sleep(3000);
|
||||
system("cls");
|
||||
}
|
||||
else {
|
||||
system("clear");
|
||||
system("cls");
|
||||
cout << "You don't have enough money in your bank account!" << endl;
|
||||
sleep(3);
|
||||
system("clear");
|
||||
Sleep(3000);
|
||||
system("cls");
|
||||
}
|
||||
}
|
||||
|
||||
@ -373,16 +395,16 @@ void withdraw() {
|
||||
if (balance >= withdraw_amount) {
|
||||
balance -= withdraw_amount;
|
||||
bank_balance += withdraw_amount;
|
||||
system("clear");
|
||||
system("cls");
|
||||
cout << "Deposit successful! Your new bank balance is: " << bank_balance << "$" << endl;
|
||||
sleep(3);
|
||||
system("clear");
|
||||
Sleep(3000);
|
||||
system("cls");
|
||||
}
|
||||
else {
|
||||
system("clear");
|
||||
system("cls");
|
||||
cout << "You don't have enough NyscoCoins to withdraw!" << endl;
|
||||
sleep(3);
|
||||
system("clear");
|
||||
Sleep(3000);
|
||||
system("cls");
|
||||
}
|
||||
}
|
||||
|
||||
@ -394,22 +416,22 @@ void work() {
|
||||
|
||||
cout << "Working..." << endl;
|
||||
for (int i = 0; i < work_days; i++) {
|
||||
system("clear");
|
||||
system("cls");
|
||||
cout << "\rWorking... " << i + 1 << " days" << endl;
|
||||
sleep(1);
|
||||
Sleep(1000);
|
||||
}
|
||||
system("clear");
|
||||
system("cls");
|
||||
cout << "\nWork done!" << endl;
|
||||
sleep(3);
|
||||
Sleep(3000);
|
||||
int money_recieved = work_days * 120;
|
||||
bank_balance += money_recieved * 0.88;
|
||||
cout << "\nYou recieved " << money_recieved * 0.88 << "$ (after tax) for working " << work_days << " days." << endl;
|
||||
sleep(3);
|
||||
system("clear");
|
||||
Sleep(3000);
|
||||
system("cls");
|
||||
}
|
||||
|
||||
int main() {
|
||||
system("clear");
|
||||
system("cls");
|
||||
char game_choice;
|
||||
|
||||
do {
|
||||
@ -446,39 +468,39 @@ int main() {
|
||||
|
||||
switch (game_choice) {
|
||||
case 'C': case 'c':
|
||||
system("clear");
|
||||
system("cls");
|
||||
coinflip();
|
||||
break;
|
||||
case 'S': case 's':
|
||||
system("clear");
|
||||
system("cls");
|
||||
slots();
|
||||
break;
|
||||
case 'B': case 'b':
|
||||
system("clear");
|
||||
system("cls");
|
||||
blackjack();
|
||||
break;
|
||||
case 'R': case 'r':
|
||||
system("clear");
|
||||
system("cls");
|
||||
roulette();
|
||||
break;
|
||||
case 'D': case 'd':
|
||||
system("clear");
|
||||
system("cls");
|
||||
diceRoll();
|
||||
break;
|
||||
case 'H': case 'h':
|
||||
system("clear");
|
||||
system("cls");
|
||||
higherOrLower();
|
||||
break;
|
||||
case 'M': case 'm':
|
||||
system("clear");
|
||||
system("cls");
|
||||
deposit();
|
||||
break;
|
||||
case 'W': case 'w':
|
||||
system("clear");
|
||||
system("cls");
|
||||
withdraw();
|
||||
break;
|
||||
case 'J': case 'j':
|
||||
system("clear");
|
||||
system("cls");
|
||||
work();
|
||||
break;
|
||||
case 'Q': case 'q':
|
||||
|
Loading…
x
Reference in New Issue
Block a user