} // End method BulkGameSpins private static void IndividualGames() { LM962 game = new LM962 { PrintGameboard = true, PrintPaylines = true }; while (true) { Console.Clear(); Console.WriteLine("\nPlaying {0} active paylines.\n", game.ActivePaylines); game.Spin(); game.Stats.DisplayGameStats(); game.Stats.ResetGameStats(); Console.WriteLine("Press the P key to change the number of pay lines"); Console.WriteLine("Press the Escape key to return to the Main Menu"); Console.WriteLine("\nPress any other key to continue playing."); ConsoleKeyInfo cki = Console.ReadKey(true); if (cki.KeyChar == 'p' || cki.KeyChar == 'P') { game.ActivePaylines = GetIntValue("\nEnter the new number of active paylines (1 through 15): ", 1, 15, () => Console.WriteLine("\n***ERROR: Please enter a positive number between 1 and 15 !!!")); } if (cki.Key == ConsoleKey.Escape) { break; } } }
} // End method TestMetrics private static void BulkGameSpins(long numSpins, int numPayLines) { LM962 game = new LM962() { ActivePaylines = numPayLines }; DateTime start_t = DateTime.Now; Console.WriteLine("\nPlaying {0} active paylines.\n", game.ActivePaylines); Console.WriteLine("Progress Bar ({0:N0} spins)\n", numSpins); Console.WriteLine("10% 100%"); Console.WriteLine("|---+----|"); if (numSpins <= 10) { Console.WriteLine("**********"); // 10 markers for (long i = 1; i <= numSpins; i++) { game.Spin(); } } else { int marks = 1; // Number of printed marks long markerEvery = (long)Math.Ceiling((double)numSpins / (double)10); // print progression marker at every 1/10th of total _spins. for (long i = 1; i <= numSpins; i++) { game.Spin(); if ((i % markerEvery == 0)) { Console.Write("*"); marks++; } } for (int i = marks; i <= 10; i++) { Console.Write("*"); } } Console.WriteLine(); game.Stats.DisplaySessionStats(numPayLines); DateTime end_t = DateTime.Now; TimeSpan runtime = end_t - start_t; Console.WriteLine("\nRun completed in {0:t}\n", runtime); } // End method BulkGameSpins
} // End method BulkGameSpins private static void IndividualGames() { LM962 game = new LM962 { printGameboard = true, printPaylines = true }; for (; ;) // ever { Console.Clear(); // clear the console screen Console.WriteLine("\nPlaying {0} active paylines.\n", game.activePaylines); game.Spin(); game.stats.DisplayGameStats(); game.stats.ResetGameStats(); Console.WriteLine("Press the P key to change the number of pay lines"); Console.WriteLine("Press the Escape key to return to the Main Menu"); Console.WriteLine("\nPress any other key to continue playing."); ConsoleKeyInfo cki = Console.ReadKey(true); if (cki.KeyChar == 'p') { getPayLines: Console.Write("\nEnter the new number of active paylines (1 through 15): "); int paylines; try { paylines = Convert.ToInt32(Console.ReadLine()); // convert to an int if (paylines < 1 || paylines > 15) { throw new ArgumentOutOfRangeException(); } } catch (Exception) { Console.WriteLine("\n***ERROR: Please enter a positive number between 1 and 15 !!!"); goto getPayLines; } game.activePaylines = paylines; } // end if cki.KeyChar == 'p' if (cki.Key == ConsoleKey.Escape) // quit when you hit the escape key { break; } } // end for ever } // End method IndividualGames
private static void TestMetrics() { int count = 1; do { LM962 game = new LM962() { // All properties relevant to LM962.TestMetrics() -- set to default values PrintReels = false, PrintPaylines = false, // will write to a text file paylines.txt if true UseRandomReelLayout = false // if true, use fixed reels with 96.25% payback, 5.15% hit frequency }; Console.WriteLine("\nRunning Session {0} game metrics ...\n", count); game.TestMetrics(); count++; } while (count <= 1); Console.Write("\nPress Enter to continue to Main Menu..."); Console.ReadLine(); } // End method TestMetrics