public IActionResult Game(string i, string j) { //logic for checking each wallet (if new game or continue) double player = Convert.ToDouble(i); double cpu = Convert.ToDouble(j); DealCards dc = new DealCards(); if (player == 0) { dc.Deal(500, cpu); } else if (cpu <= 0) { dc.Deal(player, 10000); } else { dc.Deal(player, cpu); } //again mapping object to model to pass to view Game data = new Game(); data.result = dc.result; data.playerHand = dc.RenameHands(dc.FirstPlayerHand); data.cpuHand = dc.RenameHands(dc.FirstComputerHand); data.flop = dc.RenameHands(dc.FlopHand); data.playerWallet = dc.playerWallet; data.cpuWallet = dc.cpuWallet; data.playerResult = Convert.ToString(dc.winningPlayerHand); data.cpuResult = Convert.ToString(dc.winningCpuHand); return(View(data)); }
public IActionResult Game(int?id, string i, string j) { if (id == null) { return(NotFound()); } var table = _context.Table.FirstOrDefault(m => m.ID == id); if (table == null) { return(NotFound()); } var user = _context.Member.FirstOrDefault(m => m.ID == 1); //logic for checking each wallet (if new game or continue) double player = Convert.ToDouble(i); double cpu = Convert.ToDouble(j); DealCards dc = new DealCards(); //jei nebeturi pinigu, ismest is zaidimo if (player == 0) { //dc.Deal(500, cpu); return(RedirectToAction("GoBack", "Game", new { id = table.ID, credits = 0 })); } else if (cpu <= 0) { dc.Deal(player, 10000); } else { dc.Deal(player, cpu); } //again mapping object to model to pass to view Game data = new Game(); data.result = dc.result; data.playerHand = dc.RenameHands(dc.FirstPlayerHand); data.cpuHand = dc.RenameHands(dc.FirstComputerHand); data.flop = dc.RenameHands(dc.FlopHand); data.playerWallet = dc.playerWallet; data.cpuWallet = dc.cpuWallet; data.playerResult = Convert.ToString(dc.winningPlayerHand); data.cpuResult = Convert.ToString(dc.winningCpuHand); data.table = table; return(View("Views/Game/GameScreen.cshtml", data)); }
public IActionResult Game(int?id) { if (id == null) { return(NotFound()); } var table = _context.Table.FirstOrDefault(m => m.ID == id); if (table == null) { return(NotFound()); } var user = _context.Member.FirstOrDefault(m => m.ID == 1); DealCards dc = new DealCards(); dc.Deal(user.Credits, 5000); Game data = new Game(); data.result = dc.result; data.playerHand = dc.RenameHands(dc.FirstPlayerHand); data.cpuHand = dc.RenameHands(dc.FirstComputerHand); data.flop = dc.RenameHands(dc.FlopHand); data.playerWallet = dc.playerWallet; data.cpuWallet = dc.cpuWallet; data.playerResult = Convert.ToString(dc.winningPlayerHand); data.cpuResult = Convert.ToString(dc.winningCpuHand); data.table = table; return(View("Views/Game/GameScreen.cshtml", data)); }
public IActionResult Game() { //instantiate new game and deal with player starting on 500 and phil on 5000 DealCards dc = new DealCards(); dc.Deal(500, 5000); // - For debugging specific hands - //int turns = 0; //while(Convert.ToString(dc.winningPlayerHand) != "StraightFlush") //{ // dc.Deal(500, 5000); // turns++; //} //Console.WriteLine(turns); /*create new model and map the values from the Dealcards object to game. * Considered using AutoMapper but didn't think it was worth it since this is * the only model being mapped.*/ Game data = new Game(); data.result = dc.result; data.playerHand = dc.RenameHands(dc.FirstPlayerHand); data.cpuHand = dc.RenameHands(dc.FirstComputerHand); data.flop = dc.RenameHands(dc.FlopHand); data.playerWallet = dc.playerWallet; data.cpuWallet = dc.cpuWallet; data.playerResult = Convert.ToString(dc.winningPlayerHand); data.cpuResult = Convert.ToString(dc.winningCpuHand); return(View(data)); }
public static void InitGame() { DealCards initgame = new DealCards(); initgame.Deal(); //This is only used for testing my app. Deck mydeck = new Deck(); mydeck.SetDeck(); Card[] pablodeck = new Card[52]; pablodeck = mydeck.getDeck; //Card5.ImageUrl = "~/Content/cards/10_of_clubs.png"; }
public IEnumerable <PokerHandsResults> Get(string p1 = "", string p2 = "") { if (p1.Length == 0) { p1 = "Player1"; } if (p2.Length == 0) { p1 = "Player2"; } DealCards dc = new DealCards(); return(dc.Deal(p1, p2).ToArray()); }
// GET: DealCards public ActionResult PokerGame() { var dealer = new DealCards(); dealer.Deal(); ViewBag.playerCards = dealer.sortedPlayerCards; ViewBag.computerCards = dealer.sortedComputerCards; ViewBag.Winner = dealer.whoWins; var playerRanker = new HandRanker(ViewBag.playerCards); var computerRanker = new HandRanker(ViewBag.computerCards); Hand playerHand = playerRanker.EvaluateHand(); Hand computerHand = computerRanker.EvaluateHand(); ViewBag.playerHand = playerHand; ViewBag.computerHand = computerHand; return(View()); }
static void Main(string[] args) { _playPoker = new DealCards(); bool Quit = false; while (!Quit) { _playPoker.Deal(); char selection = ' '; while (!selection.Equals('Y') && !selection.Equals('N')) { if (_playPoker.GameOff) { Console.WriteLine("Not enought currency in one of players wallets to play!"); Console.ReadKey(); return; } Console.SetCursorPosition(0, 10); Console.WriteLine("Play again? (Y)es or (N)o"); var selectedKey = Console.ReadLine().ToUpper(); if (char.TryParse(selectedKey, out _)) { selection = Convert.ToChar(selectedKey); } if (selection.Equals('Y')) { Quit = false; } else if (selection.Equals('N')) { Quit = true; } else { Console.WriteLine("Wrong key pressed, please try again"); } } } }