Slots
Slots
CC#
Created by Slots on 5/26/2024 in #help
writing a program to calculate losses and victory in a war game for social media
https://paste.mod.gg/ibvjrtpjsjua/0 I have completed the victory randomizer part and the hit points calculation, now I need to calculate the losses using those hit points. i'm going off the below text for it: "it then calculates the losses of each side using a double randomizer, and it chooses a percentage in the form of a float ranging from 0.01 to 1. this calculation is done twice for both sides, and after multiplying the hit points of each side by the other sides chosen loss float the numbers are rounded to the nearest 1 and the final loss results are the total losses for each side, both losses kept seperate." my current issue is how i would start to calculate it, as the calculations are done inside of 2 if/else statements for all 4 possible offensive/defensive scenarios.
80 replies
CC#
Created by Slots on 5/26/2024 in #help
writing a program to calculate losses and victory in a war game for social media
Well, the good news is that the primary issue is solved, and I am able to move on with the program. Thank you.
80 replies
CC#
Created by Slots on 5/26/2024 in #help
writing a program to calculate losses and victory in a war game for social media
This: !int.TryParse(troops1, out conTroops1 or this:
Console.WriteLine("Failed to parse troops1!"); return;
Console.WriteLine("Failed to parse troops1!"); return;
80 replies
CC#
Created by Slots on 5/26/2024 in #help
writing a program to calculate losses and victory in a war game for social media
What its trying to do here is say "if the converted troops value is not an integer, spit this error." However, the "int" is invalid.
80 replies
CC#
Created by Slots on 5/26/2024 in #help
writing a program to calculate losses and victory in a war game for social media
if (conTroops1 != int)
{
Console.WriteLine("Please enter a number.");
}
if (conTroops1 != int)
{
Console.WriteLine("Please enter a number.");
}
80 replies
CC#
Created by Slots on 5/26/2024 in #help
writing a program to calculate losses and victory in a war game for social media
I updated the paste code: https://paste.mod.gg/gczqzmpbdcuh/0
80 replies
CC#
Created by Slots on 5/26/2024 in #help
writing a program to calculate losses and victory in a war game for social media
Console.WriteLine("How many troops on Side 1?");
String troops1 = Console.ReadLine();
if (troops1 != /*[a number string]*/])
{
Console.WriteLine("Please enter a number.")
}
Console.WriteLine("How many troops on Side 1?");
String troops1 = Console.ReadLine();
if (troops1 != /*[a number string]*/])
{
Console.WriteLine("Please enter a number.")
}
80 replies
CC#
Created by Slots on 5/26/2024 in #help
writing a program to calculate losses and victory in a war game for social media
if/else statement time.
80 replies
CC#
Created by Slots on 5/26/2024 in #help
writing a program to calculate losses and victory in a war game for social media
Exceptions are annoying, so I can see how its a great thing. Especially if you dont understand what is immediately wrong with the code.
80 replies
CC#
Created by Slots on 5/26/2024 in #help
writing a program to calculate losses and victory in a war game for social media
Spit an error at them. Value "Side505" is invalid.
80 replies
CC#
Created by Slots on 5/26/2024 in #help
writing a program to calculate losses and victory in a war game for social media
Good to know.
80 replies
CC#
Created by Slots on 5/26/2024 in #help
writing a program to calculate losses and victory in a war game for social media
Thanks!
80 replies
CC#
Created by Slots on 5/26/2024 in #help
writing a program to calculate losses and victory in a war game for social media
Wow, that was an easy fix.
80 replies
CC#
Created by Slots on 5/26/2024 in #help
writing a program to calculate losses and victory in a war game for social media
No description
80 replies
CC#
Created by Slots on 5/26/2024 in #help
writing a program to calculate losses and victory in a war game for social media
Thank you for what you've told me so far.
80 replies
CC#
Created by Slots on 5/26/2024 in #help
writing a program to calculate losses and victory in a war game for social media
I'm telling you the objective.
80 replies
CC#
Created by Slots on 5/26/2024 in #help
writing a program to calculate losses and victory in a war game for social media
I know this.
80 replies
CC#
Created by Slots on 5/26/2024 in #help
writing a program to calculate losses and victory in a war game for social media
The finished product is meant to take in values from two sides, troops, tanks and artillery on one side, and the same on the other. Based off which side is on the offensive or the defensive, it calculates the losses, and should use a randomizer to decide which side wins. TL;DR, calculates losses, randomizes the victory
80 replies
CC#
Created by Slots on 5/26/2024 in #help
writing a program to calculate losses and victory in a war game for social media
if (!int.TryParse(troops1, out conTroops1))
{
Console.WriteLine("Failed to parse troops1!");
return;
}
int myValue1 = conTroops1 + 100;
Console.WriteLine(myValue1);
if (!int.TryParse(troops1, out conTroops1))
{
Console.WriteLine("Failed to parse troops1!");
return;
}
int myValue1 = conTroops1 + 100;
Console.WriteLine(myValue1);
80 replies
CC#
Created by Slots on 5/26/2024 in #help
writing a program to calculate losses and victory in a war game for social media
No description
80 replies