519 lines
14 KiB
C++
Raw Permalink Normal View History

2025-02-09 23:25:50 +01:00
/*
*
2025-02-09 23:27:22 +00:00
* NyscoCasino
* Created by Nyosic | (C) 2025
* https://gitea.lossless.win/nyosic │
2025-02-09 23:25:50 +01:00
*
*
* (\_/)
* (o.o)
* (> <)
*
* Version: 1.1.3
* Date: [2025-02-09]
*/
2025-02-07 12:35:03 +01:00
#include <iostream>
#include <cstdlib>
#include <ctime>
#include <Windows.h>
2025-02-07 12:35:03 +01:00
using namespace std;
2025-02-07 23:12:37 +00:00
char end_choice;
2025-02-07 12:35:03 +01:00
int balance = 0;
2025-02-07 23:12:37 +00:00
int bank_balance = 10000;
int save_depo = 0;
2025-02-07 12:35:03 +01:00
2025-02-10 13:16:05 +01:00
void display_balance(){
cout << "Your current casino balance: " << balance << " NyscoCoins" << endl;
}
2025-02-12 10:39:28 +01:00
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;
}
}
2025-02-07 12:35:03 +01:00
void coinflip() {
2025-02-07 23:12:37 +00:00
srand(time(0)); // Seed the random number generator
2025-02-07 12:35:03 +01:00
int bet_amount;
char user_choice;
2025-02-10 13:16:05 +01:00
display_balance();
2025-02-07 12:35:03 +01:00
cout << "Enter the amount of money you want to bet on the coin flip: ";
cin >> bet_amount;
// Check if the user has enough balance
2025-02-12 10:39:28 +01:00
if (!check_balance(bet_amount)) {
return;
2025-02-07 12:35:03 +01:00
}
// Deduct the bet amount from the balance
balance -= bet_amount;
cout << "Choose your side: (H) for Heads or (T) for Tails: ";
cin >> user_choice;
// Validate user input
if (user_choice != 'H' && user_choice != 'h' && user_choice != 'T' && user_choice != 't') {
cout << "Invalid choice. Please enter either H for Heads or T for Tails." << endl;
balance += bet_amount; // Return the bet amount if invalid input
2025-02-07 23:12:37 +00:00
coinflip();
2025-02-07 12:35:03 +01:00
}
// Generate a random result: 0 for Heads, 1 for Tails
int flip_result = rand() % 2;
// Show the result
cout << "The coin is flipping..." << endl;
// Wait a moment to simulate flipping
Sleep(3000);
2025-02-07 12:35:03 +01:00
if (flip_result == 0) {
cout << "The result is Heads!" << endl;
}
2025-02-08 00:55:04 +01:00
else {
2025-02-07 12:35:03 +01:00
cout << "The result is Tails!" << endl;
}
// Check if the user won or lost
if ((user_choice == 'H' || user_choice == 'h') && flip_result == 0) {
2025-02-09 22:55:03 +01:00
system("cls");
2025-02-07 12:35:03 +01:00
cout << "Congratulations! You won! You get double the bet amount." << endl;
balance += 2 * bet_amount;
}
2025-02-08 00:55:04 +01:00
else if ((user_choice == 'T' || user_choice == 't') && flip_result == 1) {
2025-02-09 22:55:03 +01:00
system("cls");
2025-02-07 12:35:03 +01:00
cout << "Congratulations! You won! You get double the bet amount." << endl;
balance += 2 * bet_amount;
}
2025-02-08 00:55:04 +01:00
else {
2025-02-09 22:55:03 +01:00
system("cls");
2025-02-07 12:35:03 +01:00
cout << "Sorry! You lost the bet. Better luck next time!" << endl;
}
cout << "Your new balance is: " << balance << " NyscoCoins" << endl;
2025-02-07 23:12:37 +00:00
cout << "Play again? (Y/N): ";
cin >> end_choice;
2025-02-07 23:12:37 +00:00
if (end_choice == 'y' || end_choice == 'Y') {
2025-02-09 22:55:03 +01:00
system("cls");
2025-02-07 23:12:37 +00:00
coinflip();
}
2025-02-08 00:55:04 +01:00
else {
2025-02-09 22:55:03 +01:00
system("cls");
2025-02-07 23:12:37 +00:00
}
2025-02-07 12:35:03 +01:00
}
void slots() {
2025-02-07 23:12:37 +00:00
srand(time(0));
int bet_amount;
char end_choice;
2025-02-10 13:16:05 +01:00
display_balance();
2025-02-07 23:12:37 +00:00
cout << "Enter the amount of money you want to bet on slots: ";
cin >> bet_amount;
2025-02-12 10:39:28 +01:00
if (!check_balance(bet_amount)) {
return;
2025-02-07 23:12:37 +00:00
}
balance -= bet_amount;
cout << "Spinning the slots..." << endl;
Sleep(2000);
2025-02-07 23:12:37 +00:00
int slot1 = rand() % 5 + 1;
int slot2 = rand() % 5 + 1;
int slot3 = rand() % 5 + 1;
cout << "| " << slot1 << " | " << slot2 << " | " << slot3 << " |" << endl;
if (slot1 == slot2 && slot2 == slot3) {
cout << "JACKPOT! You won triple your bet amount!" << endl;
balance += 3 * bet_amount;
}
2025-02-08 00:55:04 +01:00
else if (slot1 == slot2 || slot2 == slot3 || slot1 == slot3) {
2025-02-07 23:12:37 +00:00
cout << "Nice! You won double your bet amount!" << endl;
balance += 2 * bet_amount;
}
2025-02-08 00:55:04 +01:00
else {
2025-02-07 23:12:37 +00:00
cout << "You lost! Better luck next time!" << endl;
}
cout << "Your new balance is: " << balance << " NyscoCoins" << endl;
cout << "Play again? (Y/N): ";
cin >> end_choice;
2025-02-07 23:12:37 +00:00
if (end_choice == 'y' || end_choice == 'Y') {
2025-02-09 22:55:03 +01:00
system("cls");
2025-02-07 23:12:37 +00:00
slots();
}
2025-02-08 00:55:04 +01:00
else {
2025-02-09 22:55:03 +01:00
system("cls");
2025-02-07 23:12:37 +00:00
}
}
void blackjack() {
srand(time(0));
int playerCard1 = rand() % 11 + 1;
int playerCard2 = rand() % 11 + 1;
int dealerCard1 = rand() % 11 + 1;
int dealerCard2 = rand() % 11 + 1;
int playerTotal = playerCard1 + playerCard2;
int dealerTotal = dealerCard1 + dealerCard2;
int bet_amount;
char end_choice;
cout << "Your cards: " << playerCard1 << " and " << playerCard2 << " (Total: " << playerTotal << ")" << endl;
cout << "Dealer's visible card: " << dealerCard1 << endl;
2025-02-10 13:16:05 +01:00
display_balance();
2025-02-07 23:12:37 +00:00
cout << "Enter your bet amount: ";
cin >> bet_amount;
2025-02-12 10:39:28 +01:00
if (!check_balance(bet_amount)) {
return;
2025-02-07 23:12:37 +00:00
}
balance -= bet_amount;
char choice;
do {
cout << "Do you want to hit (H) or stand (S)? ";
cin >> choice;
if (choice == 'H' || choice == 'h') {
int newCard = rand() % 11 + 1;
playerTotal += newCard;
cout << "You drew a " << newCard << ". Your total is now " << playerTotal << "." << endl;
if (playerTotal > 21) {
cout << "You bust! Dealer wins." << endl;
}
}
}
2025-02-08 00:55:04 +01:00
while (choice == 'H' || choice == 'h');
2025-02-07 23:12:37 +00:00
cout << "Dealer's turn. Dealer's total is " << dealerTotal << "." << endl;
while (dealerTotal < 17) {
int newCard = rand() % 11 + 1;
dealerTotal += newCard;
cout << "Dealer drew a " << newCard << ". Dealer's total is now " << dealerTotal << "." << endl;
}
if (dealerTotal > 21 || playerTotal > dealerTotal) {
cout << "You win! You gain " << bet_amount << " NyscoCoins." << endl;
balance += 2 * bet_amount; // Win pays 2:1
}
2025-02-08 00:55:04 +01:00
else if (playerTotal < dealerTotal) {
2025-02-07 23:12:37 +00:00
cout << "Dealer wins! You lose your bet." << endl;
}
2025-02-08 00:55:04 +01:00
else {
2025-02-07 23:12:37 +00:00
cout << "It's a tie! Your bet is returned." << endl;
balance += bet_amount; // Return bet
}
cout << "Your new balance is: " << balance << " NyscoCoins" << endl;
2025-02-07 23:12:37 +00:00
cout << "Play again? (Y/N): ";
cin >> end_choice;
2025-02-07 23:12:37 +00:00
if (end_choice == 'y' || end_choice == 'Y') {
2025-02-09 22:55:03 +01:00
system("cls");
2025-02-07 23:12:37 +00:00
blackjack();
}
2025-02-08 00:55:04 +01:00
else {
2025-02-09 22:55:03 +01:00
system("cls");
2025-02-07 23:12:37 +00:00
}
}
void roulette() {
cout << "Roulette game logic coming soon!" << endl;
}
void diceRoll() {
srand(time(0));
int bet_amount, outcome;
char end_choice;
2025-02-10 13:16:05 +01:00
display_balance();
2025-02-07 23:12:37 +00:00
cout << "Enter the amount of money you want to bet on dice roll: ";
cin >> bet_amount;
2025-02-12 10:39:28 +01:00
if (!check_balance(bet_amount)) {
return;
}
2025-02-07 23:12:37 +00:00
cout << "Guess the outcome: ";
cin >> outcome;
if (outcome > 12) {
cout << "There are only two dices max number is 12" << endl;
Sleep(3000);
2025-02-07 23:12:37 +00:00
diceRoll();
}
balance -= bet_amount;
cout << "Rolling the dice..." << endl;
Sleep(2000);
2025-02-07 23:12:37 +00:00
int dice1 = rand() % 6 + 1;
int dice2 = rand() % 6 + 1;
int total = dice1 + dice2;
cout << "You rolled: " << dice1 << " and " << dice2 << " (Total: " << total << ")" << endl;
2025-02-08 00:30:46 +01:00
if (total == outcome) {
2025-02-07 23:12:37 +00:00
cout << "Congratulations! You won double your bet amount!" << endl;
balance += 2 * bet_amount;
}
2025-02-08 00:55:04 +01:00
else {
2025-02-07 23:12:37 +00:00
cout << "You lost! Better luck next time!" << endl;
}
cout << "Your new balance is: " << balance << " NyscoCoins" << endl;
cout << "Play again? (Y/N): ";
cin >> end_choice;
2025-02-07 23:12:37 +00:00
if (end_choice == 'y' || end_choice == 'Y') {
2025-02-09 22:55:03 +01:00
system("cls");
2025-02-07 23:12:37 +00:00
diceRoll();
}
2025-02-08 00:55:04 +01:00
else {
2025-02-09 22:55:03 +01:00
system("cls");
2025-02-07 23:12:37 +00:00
}
}
void higherOrLower() {
srand(time(0));
int bet_amount;
char outcome;
char end_choice;
2025-02-10 13:16:05 +01:00
display_balance();
cout << "Enter the amount of money you want to bet on higer or lower: ";
cin >> bet_amount;
int start_number = rand() % 100 + 1;
cout << "Starting number: " << start_number << endl;
cout << "Guess the outcome (H-Higher/L-Lower): ";
cin >> outcome;
2025-02-12 10:39:28 +01:00
if (!check_balance(bet_amount)) {
return;
}
balance -= bet_amount;
cout << "Generating the output number.." << endl;
Sleep(2000);
int end_number = rand() % 100 + 1;
if(start_number > end_number) {
cout << "You guessed: " << outcome << " (The outcome is: " << end_number << " and its lower!)" << endl;
}
else if(start_number < end_number) {
cout << "You guessed: " << outcome << " (The outcome is: " << end_number << " and its higher!)" << endl;
}
if (outcome == 'H' || outcome == 'h') {
if (start_number < end_number) {
cout << "Congratulations! You won double your bet amount!" << endl;
balance += 2 * bet_amount;
}
else {
cout << "You lost! Better luck next time!" << endl;
}
}
else if (outcome == 'L' || outcome == 'l') {
if (start_number > end_number) {
cout << "Congratulations! You won double your bet amount!" << endl;
balance += 2 * bet_amount;
}
else {
cout << "You lost! Better luck next time!" << endl;
}
}
cout << "Your new balance is: " << balance << " NyscoCoins" << endl;
cout << "Play again? (Y/N): ";
cin >> end_choice;
if (end_choice == 'y' || end_choice == 'Y') {
2025-02-09 22:55:03 +01:00
system("cls");
higherOrLower();
}
else {
2025-02-09 22:55:03 +01:00
system("cls");
}
2025-02-07 12:35:03 +01:00
}
void deposit() {
int deposit_amount;
2025-02-09 23:02:18 +01:00
cout << "Current money in bank: " << bank_balance;
2025-02-07 12:35:03 +01:00
cout << "Enter the amount of money you want to deposit: ";
cin >> deposit_amount;
2025-02-07 23:12:37 +00:00
if (bank_balance >= deposit_amount) {
balance += deposit_amount;
bank_balance -= deposit_amount;
2025-02-09 22:55:03 +01:00
system("cls");
2025-02-07 23:12:37 +00:00
cout << "Deposit successful! Your new balance is: " << balance << " NyscoCoins"<< endl;
Sleep(3000);
2025-02-09 22:55:03 +01:00
system("cls");
2025-02-07 23:12:37 +00:00
}
else {
2025-02-09 22:55:03 +01:00
system("cls");
2025-02-07 23:12:37 +00:00
cout << "You don't have enough money in your bank account!" << endl;
Sleep(3000);
2025-02-09 22:55:03 +01:00
system("cls");
2025-02-07 23:12:37 +00:00
}
}
void withdraw() {
int withdraw_amount;
2025-02-09 23:02:18 +01:00
cout << "Current NyscoCoin balance: " << balance;
cout << "Enter the amount of money you want to withdraw: ";
2025-02-07 23:12:37 +00:00
cin >> withdraw_amount;
if (balance >= withdraw_amount) {
balance -= withdraw_amount;
bank_balance += withdraw_amount;
2025-02-09 22:55:03 +01:00
system("cls");
cout << "Deposit successful! Your new bank balance is: " << bank_balance << "$" << endl;
Sleep(3000);
2025-02-09 22:55:03 +01:00
system("cls");
2025-02-07 23:12:37 +00:00
}
else {
2025-02-09 22:55:03 +01:00
system("cls");
2025-02-07 23:12:37 +00:00
cout << "You don't have enough NyscoCoins to withdraw!" << endl;
Sleep(3000);
2025-02-09 22:55:03 +01:00
system("cls");
2025-02-07 23:12:37 +00:00
}
2025-02-07 12:35:03 +01:00
}
2025-02-08 00:55:04 +01:00
void work() {
int work_days;
cout << "How many days do you want to work (days = seconds): ";
cin >> work_days;
cout << "Working..." << endl;
for (int i = 0; i < work_days; i++) {
2025-02-09 22:55:03 +01:00
system("cls");
2025-02-08 00:55:04 +01:00
cout << "\rWorking... " << i + 1 << " days" << endl;
Sleep(1000);
2025-02-08 00:55:04 +01:00
}
2025-02-09 22:55:03 +01:00
system("cls");
2025-02-08 00:55:04 +01:00
cout << "\nWork done!" << endl;
Sleep(3000);
2025-02-08 01:13:31 +01:00
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(3000);
2025-02-09 22:55:03 +01:00
system("cls");
2025-02-08 00:55:04 +01:00
}
2025-02-07 12:35:03 +01:00
int main() {
2025-02-09 22:55:03 +01:00
system("cls");
2025-02-07 12:35:03 +01:00
char game_choice;
do {
cout << R"(
_ __ ______ _
/ | / /_ ________________ / ____/___ ______(_)___ ____
2025-02-07 12:35:03 +01:00
/ |/ / / / / ___/ ___/ __ \ / / / __ `/ ___/ / __ \/ __ \
/ /| / /_/ (__ ) /__/ /_/ / / /___/ /_/ (__ ) / / / / /_/ /
/_/ |_/\__, /____/\___/\____/ \____/\__,_/____/_/_/ /_/\____/
2025-02-07 12:35:03 +01:00
/____/
--------------------------------------------------------------------------
2025-02-07 23:12:37 +00:00
)" << endl;
2025-02-07 12:35:03 +01:00
2025-02-07 23:12:37 +00:00
cout << "Your current bank balance: " << bank_balance << "$" << endl;
cout << "Your current casino balance: " << balance << " NyscoCoins" << endl;
cout << "--------------------" << endl;
2025-02-07 12:35:03 +01:00
cout << "CHOOSE THE GAME: " << endl;
2025-02-07 23:12:37 +00:00
cout << "--------------------" << endl;
2025-02-07 12:35:03 +01:00
cout << "(C) - Coinflip" << endl;
cout << "(S) - Slots" << endl;
2025-02-07 23:12:37 +00:00
cout << "(B) - Blackjack" << endl;
2025-02-09 23:02:18 +01:00
cout << "(R) - Roulette (Coming soon!)" << endl;
2025-02-07 23:12:37 +00:00
cout << "(D) - Dice Roll" << endl;
2025-02-09 23:02:18 +01:00
cout << "(H) - Higher or Lower" << endl;
2025-02-07 23:12:37 +00:00
cout << "--------------------" << endl;
2025-02-09 23:02:18 +01:00
cout << "(J) - Go To Work" << endl;
2025-02-08 00:55:04 +01:00
cout << "--------------------" << endl;
2025-02-07 23:12:37 +00:00
cout << "(M) - Deposit Money" << endl;
cout << "(W) - Withdraw NyscoCoins" << endl;
cout << "--------------------" << endl;
cout << "(Q) - Quit" << endl;
2025-02-07 12:35:03 +01:00
cout << "Enter your choice: ";
cin >> game_choice;
switch (game_choice) {
2025-02-07 23:12:37 +00:00
case 'C': case 'c':
2025-02-09 22:55:03 +01:00
system("cls");
2025-02-07 12:35:03 +01:00
coinflip();
break;
2025-02-07 23:12:37 +00:00
case 'S': case 's':
2025-02-09 22:55:03 +01:00
system("cls");
2025-02-07 12:35:03 +01:00
slots();
break;
2025-02-07 23:12:37 +00:00
case 'B': case 'b':
2025-02-09 22:55:03 +01:00
system("cls");
2025-02-07 23:12:37 +00:00
blackjack();
break;
case 'R': case 'r':
2025-02-09 22:55:03 +01:00
system("cls");
2025-02-07 23:12:37 +00:00
roulette();
break;
case 'D': case 'd':
2025-02-09 22:55:03 +01:00
system("cls");
2025-02-07 23:12:37 +00:00
diceRoll();
break;
case 'H': case 'h':
2025-02-09 22:55:03 +01:00
system("cls");
2025-02-07 23:12:37 +00:00
higherOrLower();
break;
case 'M': case 'm':
2025-02-09 22:55:03 +01:00
system("cls");
2025-02-07 12:35:03 +01:00
deposit();
break;
2025-02-07 23:12:37 +00:00
case 'W': case 'w':
2025-02-09 22:55:03 +01:00
system("cls");
2025-02-07 23:12:37 +00:00
withdraw();
break;
2025-02-08 00:55:04 +01:00
case 'J': case 'j':
2025-02-09 22:55:03 +01:00
system("cls");
2025-02-08 00:55:04 +01:00
work();
break;
2025-02-07 23:12:37 +00:00
case 'Q': case 'q':
2025-02-07 12:35:03 +01:00
cout << "Thanks for playing!" << endl;
break;
default:
cout << "Invalid choice. Please try again." << endl;
break;
}
}
2025-02-08 00:55:04 +01:00
while (game_choice != 'Q' && game_choice != 'q');
2025-02-07 12:35:03 +01:00
2025-02-07 23:12:37 +00:00
system("pause");
2025-02-07 12:35:03 +01:00
return 0;
}