Advertisement
Guest User

"casinor"

a guest
Nov 2nd, 2017
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 9.15 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace casinor
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             string user, name1, name2;
  14.             int cash1, cash2, opcion, pass1, pass2;
  15.             cash1 = 0;
  16.             cash2 = 0;
  17.             Console.WriteLine("welcome to casino Royale");
  18.             Console.WriteLine("Please input your name, password and amount of money youll start with");
  19. //user 1 pass is 123 and user 2 pass is 321
  20.  
  21.             Console.Write("Write your name user 1: ");
  22.             name1 = Console.ReadLine();
  23.  
  24.             Console.Write("password: ");
  25.             pass1= int.Parse(Console.ReadLine());
  26.             if (pass1== 123)
  27.             {
  28.                 Console.WriteLine("Correct password");
  29.  
  30.                 Console.Write("How much money are you willing to spend: ");
  31.                 cash1 = int.Parse(Console.ReadLine());
  32.             }
  33.             else
  34.             {
  35.                 Console.Clear();
  36.                 Console.WriteLine("Wrong password please try again");
  37.             }
  38.             Console.Clear();
  39.  
  40.             Console.Write("Write tour name user 2: ");
  41.             name2 = Console.ReadLine();
  42.  
  43.             Console.Write("Ingresa la clave: ");
  44.             pass2= int.Parse(Console.ReadLine());
  45.             if (pass2== 321)
  46.             {
  47.                 Console.WriteLine("Correct Password");
  48.  
  49.                 Console.Write("How much money are you willing to spend: ");
  50.                 cash2 = int.Parse(Console.ReadLine());
  51.             }
  52.             else
  53.             {
  54.                 Console.Clear();
  55.                 Console.WriteLine("Wrong password please try again");
  56.             }
  57.  
  58.  
  59.  
  60.             Console.Clear();
  61.             string menu;
  62.             menu = "y";
  63.             do
  64.             {
  65.  
  66.  
  67.                 Console.WriteLine("Elige una de las opciones del menu que deas desplegar");
  68.                 Console.WriteLine("1) Guess the number");
  69.                 Console.WriteLine("2) Blackjack");
  70.                 Console.WriteLine("3) Roulette");
  71.                 Console.WriteLine("4) VIP card");
  72.                 Console.WriteLine("5) Exchange center");
  73.                 Console.WriteLine("6) Exit");
  74.  
  75.  
  76.                 opcion = Convert.ToInt32(Console.ReadLine());
  77.                 while (opcion == 1)
  78.                 {
  79.                     Console.Clear();
  80.                     Console.WriteLine("GUESS THE NUMBER");
  81.                     string dec;
  82.                     int intot1 = 0, intot2 = 0;
  83.  
  84.                     dec = "y";
  85.  
  86.  
  87.                     while (dec == "y")
  88.                     {
  89.  
  90.                         Console.WriteLine("que usuario esta jugando?");
  91.                         user = Console.ReadLine();
  92.  
  93.                         if (user == name1)
  94.                         {
  95.                             Console.Clear();
  96.                             Random random = new Random();
  97.                             int num01 = random.Next(1, 10);
  98.                             int num, intentos;
  99.  
  100.                             Console.WriteLine("Guess a number between 1 and 10");
  101.                             num = int.Parse(Console.ReadLine());
  102.                             intentos = 1;
  103.                             while (num != num01)
  104.                             {
  105.                                 if (num < num01)
  106.                                 {
  107.                                     intentos = intentos + 1;
  108.                                     Console.WriteLine("Too low, Try again");
  109.                                     num = int.Parse(Console.ReadLine());
  110.                                     intot1 = intot1 + 1;
  111.  
  112.                                 }
  113.                                 else if (num > num01)
  114.                                 {
  115.                                     intentos = intentos + 1;
  116.                                     Console.WriteLine("Too high, Try again");
  117.                                     num = int.Parse(Console.ReadLine());
  118.                                     intot1 = intot1 + 1;
  119.                                 }
  120.                                 if (num == num01)
  121.                                 {
  122.                                     Console.WriteLine("Congratulations! you're right");
  123.                                 }
  124.                             }
  125.  
  126.                             if (intentos == 1 && num == num01)
  127.                             {
  128.                                 Console.WriteLine("Congratulations! you're right");
  129.                                 Console.WriteLine("you won 300 points");
  130.                                 cash1 = cash1 + 300;
  131.                             }
  132.                             else if (intentos < 4 && intentos > 1 && num == num01)
  133.                             {
  134.                                 Console.WriteLine("you won 100 points");
  135.                                 cash1 = cash1 + 100;
  136.  
  137.                             }
  138.                             else if (intentos == 4 || intentos == 5 && num == num01)
  139.                             {
  140.                                 Console.WriteLine("you won 50 points");
  141.                                 cash1 = cash1 + 50;
  142.  
  143.                             }
  144.                             else if (intentos > 5)
  145.                             {
  146.                                 Console.WriteLine("No points");
  147.                                 cash1 = cash1 + 0;
  148.  
  149.                             }
  150.                         }
  151.  
  152.                         else if (user == name2)
  153.                         {
  154.                             Console.Clear();
  155.                             Random random = new Random();
  156.                             int num01 = random.Next(1, 10);
  157.                             int num, intentos;
  158.  
  159.                             Console.WriteLine("Guess a number between 1 and 10");
  160.                             num = int.Parse(Console.ReadLine());
  161.                             intentos = 1;
  162.                             while (num != num01)
  163.                             {
  164.                                 if (num < num01)
  165.                                 {
  166.                                     intentos = intentos + 1;
  167.                                     Console.WriteLine("Too low, Try again");
  168.                                     num = int.Parse(Console.ReadLine());
  169.                                     intot2 = intot2 + 1;
  170.                                 }
  171.                                 else if (num > num01)
  172.                                 {
  173.                                     intentos = intentos + 1;
  174.                                     Console.WriteLine("Too high, Try again");
  175.                                     num = int.Parse(Console.ReadLine());
  176.                                     intot2 = intot2 + 1;
  177.                                 }
  178.                                 if (num == num01)
  179.                                 {
  180.                                     Console.WriteLine("Congratulations! you're right");
  181.                                 }
  182.                             }
  183.  
  184.                             if (intentos == 1 && num == num01)
  185.                             {
  186.                                 Console.WriteLine("Congratulations! you're right");
  187.                                 Console.WriteLine("You won 300 points");
  188.                                 cash2 = cash2 + 300;
  189.                             }
  190.                             else if (intentos < 4 && intentos > 1 && num == num01)
  191.                             {
  192.                                 Console.WriteLine("You won 100 points");
  193.                                 cash2 = cash2 + 100;
  194.  
  195.                             }
  196.                             else if (intentos == 4 || intentos == 5 && num == num01)
  197.                             {
  198.                                 Console.WriteLine("You won 50 points");
  199.                                 cash2 = cash2 + 50;
  200.  
  201.                             }
  202.                             else if (intentos > 5)
  203.                             {
  204.                                 Console.WriteLine("No points");
  205.                                 cash2 = cash2 + 0;
  206.  
  207.                             }
  208.                         }
  209.                         else if (user != name1 && user != name2)
  210.                         {
  211.                             Console.WriteLine("Game Over! input a valid user");
  212.  
  213.                         }
  214.  
  215.                         Console.Write("play again? (y/n)?");
  216.                         dec = Console.ReadLine();
  217.  
  218.                        //it just plays again even if i say no
  219.                     }
  220.  
  221.                     Console.Clear();
  222.                     if (intot1 > intot2)
  223.                     {
  224.                         Console.WriteLine(name1 + " is the winner");
  225.                     }
  226.                     else if (intot2 > intot1)
  227.                     {
  228.                         Console.WriteLine(name2 + " is the winner");
  229.                     }
  230.                 }
  231.  
  232.                 Console.WriteLine("return to menu? (y/n");
  233.                 menu = Console.ReadLine();
  234.              
  235.  
  236.             } while (menu == "n");
  237.  
  238.             Console.ReadKey();
  239.         }
  240.  
  241.     }
  242. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement