Quantcast
Channel: Questions in topic: "count"
Viewing all articles
Browse latest Browse all 187

Voting System Using List (C#)

$
0
0
Good morrow to you all. I've been making this card game, and encountered a problem that I myself can't solve. So, there is a deck of cards (list of strings, the game doesn't require anything more complex), and a list of players. Every player can vote a player once, and in a function I want to calculate how many votes each player gets. for (int i = 0; i < playerAmount; i++) { if (votedPlayers.Contains(players[i])) { voteCounts[i]++; } } votedPlayers contains a string for what player the voter voted for. voteCounts contains an int for how many votes a player gets. This really isn't the proper way to do it since it does not work, so I am asking if the humble community of Unity would know how to help me. Best Regards, Kirei

Viewing all articles
Browse latest Browse all 187

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>