C
C#•3y ago
Squirtle

Need help for loop

I need help i want to make a program that makes people infected and the infected people infect others and so on
55 Replies
Squirtle
SquirtleOP•3y ago
so if have 1 infected that one infects another one and is now 2 and now those 2 infect 2 others and is now 4 and so on
Squirtle
SquirtleOP•3y ago
pastemyst | (untitled)
a powerful website for storing and sharing text and code snippets. completely free and open source.
Squirtle
SquirtleOP•3y ago
my code
Squirtle
SquirtleOP•3y ago
pastemyst | (untitled)
a powerful website for storing and sharing text and code snippets. completely free and open source.
Squirtle
SquirtleOP•3y ago
pastemyst | (untitled)
a powerful website for storing and sharing text and code snippets. completely free and open source.
Squirtle
SquirtleOP•3y ago
the classes
Unknown User
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Squirtle
SquirtleOP•3y ago
when run the for statements all people get infected and i dont want that i want 2 people to get infected because one from the original and one new and then i want those 2 to infect 4 others but somehow all people is infected any clues?
Unknown User
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Squirtle
SquirtleOP•3y ago
doesnt matter
Unknown User
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Squirtle
SquirtleOP•3y ago
pastemyst | (untitled)
a powerful website for storing and sharing text and code snippets. completely free and open source.
Squirtle
SquirtleOP•3y ago
this is where i infect others put it in another class
Squirtle
SquirtleOP•3y ago
pastemyst | (untitled)
a powerful website for storing and sharing text and code snippets. completely free and open source.
Squirtle
SquirtleOP•3y ago
and row 50 im using it but that isnt the way im supposed to use it cause everyone gets infected
Unknown User
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Squirtle
SquirtleOP•3y ago
yeah but after one gets infected i want it to double so lets say 1 is infected he infects another one now its 2 infector and those 2 infector infects 2 more now its 4 infector
Unknown User
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Squirtle
SquirtleOP•3y ago
PERFECTTT THANKSSSSSSS ❤️ int toContamine = persons.Count(x => x.Infected) * 2; never seen that line before and deleted the *2 and it worked as i wanted 😄 so the code was int toContamine = persons.Count(x => x.Infected)
Unknown User
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Squirtle
SquirtleOP•3y ago
ahhhhh thanksss ❤️ is x a int ?
Unknown User
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Squirtle
SquirtleOP•3y ago
ah thanks ❤️ hey sorry @zonedetec to bother but is it possible to get the info on how many people is infected? Console.WriteLine(persons.Count(x => x.Infected) + " is infected"); ive done this but it shows incorrect at 19 it is supposed to show 18
Unknown User
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Squirtle
SquirtleOP•3y ago
thinking because of this if (Smittade >= 20) { Smittade = 20; } it resets to 20 and then it takes -1 from there in my other class but if i dont include that when it goes above 20 it crashes
Unknown User
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Squirtle
SquirtleOP•3y ago
when i come to 15 it is correct and then it turns into 19 instead of 18 no i dont want it to crash :S
Unknown User
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Squirtle
SquirtleOP•3y ago
made some changes to the code want me to send the new one ?
Unknown User
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Squirtle
SquirtleOP•3y ago
hahahahahaa aight where can i do that ?
Unknown User
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Unknown User
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Squirtle
SquirtleOP•3y ago
the first is just for display can remove that wanted to see the maths behind it you can remove it if you wanna
Unknown User
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Squirtle
SquirtleOP•3y ago
how ? 😮
Unknown User
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Squirtle
SquirtleOP•3y ago
yup
Unknown User
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Squirtle
SquirtleOP•3y ago
still same at 6 hours, it still 19 infected and if you count it, its 18 20 people -2 18 and at 7 hours it displays 17 infected when it should be 16
Unknown User
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Squirtle
SquirtleOP•3y ago
no at 6 it should be 18 since 2 people get unsick OH MB HAHAHAH MB B MB wait it was 21 people mb so it was correct lmfao so 21-2
Unknown User
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Squirtle
SquirtleOP•3y ago
is 19 hahahahaha mb
Unknown User
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Squirtle
SquirtleOP•3y ago
sorry 😳 thank youuu
Unknown User
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Squirtle
SquirtleOP•3y ago
really appreciate your help man ❤️ nope ? :/
Unknown User
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Squirtle
SquirtleOP•3y ago
yeah
Unknown User
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Kouhai
Kouhai•3y ago
Adding to what csharp co-founder said, have a look at this
Squirtle
SquirtleOP•3y ago
😮 thanksss really appreciate the tips and help ❤️
Want results from more Discord servers?
Add your server