PICHU.
double WinChance = 0.5f;
double LossChance = 0.5f;
foreach (char x in track)
{
if (x == 'w'
{
WinChance /= 2.0;
LossChance = 1.0 - WinChance;
Console.WriteLine(WinChance);
}
else if (x == 'l'
{
LossChance /= 2.0;
WinChance = 1.0 - LossChance;
Console.WriteLine(WinChance);
}
}
Console.WriteLine("Therefore, the odds of you winning are exactly " + WinChance * 100 + "% and your chances of loosing are exactly " + LossChance * 100 + "%.");
PICHU.
double WinChance = 0.5f;
double LossChance = 0.5f;
foreach (char x in track)
{
if (x == 'w'
{
WinChance /= 2.0;
LossChance = 1.0 - WinChance;
Console.WriteLine(WinChance);
}
else if (x == 'l'
{
LossChance /= 2.0;
WinChance = 1.0 - LossChance;
Console.WriteLine(WinChance);
}
}
Console.WriteLine("Therefore, the odds of you winning are exactly " + WinChance * 100 + "% and your chances of loosing are exactly " + LossChance * 100 + "%.");
using System;
using System.Collections.Generic;
using System.Text;
namespace Hiscalc
{
class Program
{
static void Main(string[] args)
{
// take in user input
Console.WriteLine("Enter the sequence of your win/loss record, using a lowercase 'w' to mark wins, and a lowercase 'l' to mark losses:\n");
string userInput = Console.ReadLine();
// create a list of characters (similar to an array) to store the user input in a useful form
List<char> track = new List<char>();
// loop through each character in the userInput string, adding each character to the list
foreach (char x in userInput)
{
track.Add(x);
}
// call the calculate function
Calculate(track);
}
// calculate function is private and static, returns no values - takes a character list as a parameter
private static void Calculate(List<char> track)
{
// create two doubles to hold the initial value (50% or .5)
// they'll also be used later to hold new values
double WinChance = 0.5f;
double LossChance = 0.5f;
// loop through each character in the char list (called track)
foreach (char x in track)
{
// determine if its a w for win, or l for loss
if (x == 'w'
{
// perform calculations in event of win
WinChance /= 2.0;
LossChance = 1.0 - WinChance;
// print the odds of winning
Console.WriteLine(WinChance);
}
else if (x == 'l'
{
// perform calculations in event of loss
LossChance /= 2.0;
WinChance = 1.0 - LossChance;
// print the odds of winning
Console.WriteLine(WinChance);
}
}
// Finally, print the odds of winning and the odds of losing
// Write them as percentages (hence the * 100).
Console.WriteLine("Therefore, the odds of you winning are exactly " + WinChance * 100 + "% and your chances of loosing are exactly " + LossChance * 100 + "%.");
Console.ReadKey(); // ReadKey to allow user time to read the information
}
}
}
PICHU.
using System;
using System.Collections.Generic;
using System.Text;
namespace Hiscalc
{
class Program
{
static void Main(string[] args)
{
// take in user input
Console.WriteLine("Enter the sequence of your win/loss record, using a lowercase 'w' to mark wins, and a lowercase 'l' to mark losses:\n");
string userInput = Console.ReadLine();
// create a list of characters (similar to an array) to store the user input in a useful form
List<char> track = new List<char>();
// loop through each character in the userInput string, adding each character to the list
foreach (char x in userInput)
{
track.Add(x);
}
// call the calculate function
Calculate(track);
}
// calculate function is private and static, returns no values - takes a character list as a parameter
private static void Calculate(List<char> track)
{
// create two doubles to hold the initial value (50% or .5)
// they'll also be used later to hold new values
double WinChance = 0.5f;
double LossChance = 0.5f;
// loop through each character in the char list (called track)
foreach (char x in track)
{
// determine if its a w for win, or l for loss
if (x == 'w'
{
// perform calculations in event of win
WinChance /= 2.0;
LossChance = 1.0 - WinChance;
// print the odds of winning
Console.WriteLine(WinChance);
}
else if (x == 'l'
{
// perform calculations in event of loss
LossChance /= 2.0;
WinChance = 1.0 - LossChance;
// print the odds of winning
Console.WriteLine(WinChance);
}
}
// Finally, print the odds of winning and the odds of losing
// Write them as percentages (hence the * 100).
Console.WriteLine("Therefore, the odds of you winning are exactly " + WinChance * 100 + "% and your chances of loosing are exactly " + LossChance * 100 + "%.");
Console.ReadKey(); // ReadKey to allow user time to read the information
}
}
}

Copyright © 2026, NextGenUpdate.
All Rights Reserved.