Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 15 additions & 10 deletions Psuedocode.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
pseudo-code for UNO:
public variable countModifier = 1;
public variable countModifier = 1; //This modifier is never used in the code
start of game:
get number of players;
give each player 7 random cards;
put remaining cards in stack;
setup playerOrder;
do

while(no one has a score that is more than or equal to 500) /* You don't need a do while loop if the condition always starts as false - just a while loop will do
{
for(whoNeedsToPlay = playerCount; whoNeedsToPlay > 0 && whoNeedsToPlay < playerCount + 1; whoNeedsToPlay -= 1)
for(CurrentPlayer = 0; CurrentPlayer < playerCount; CurrentPlayer++)
{
for(currentCard = 0; amountOfCardsPlayerHas > currentCard; currentCard++)
{
Expand All @@ -19,19 +20,20 @@ do
if(it's a wildDrawFour)
card's score++;
}
topCard = card with highest score;
}
if(they have a card with a score of more than zero)
{
topCard = card with highest score;
switch(cardType)

switch(topCard.cardType)
{
case numberCard;
break;
case Skip:
countModifier--;
break;
case DrawTwo:
player who is next in whoNeedsToPlay index needs to take 2 cards from the stack;
CurrentPlayer++ (or Player 0 if CurrentPlayer = playerCount-1) needs to take 2 cards from the stack;
break;
case Reverse:
countModifier *= -1;
Expand All @@ -40,17 +42,20 @@ do
topCard.color = playerInput;
break;
case wildDrawFour;
player who is next in whoNeedsToPlay index takes 4 cards;
CurrentPlayer++ (or Player 0 if CurrentPlayer = playerCount-1) takes 4 cards;
topCard.color = playerInput;
break;
}
}
else {
while(drawnCorrectCard == false){
player takes card from stack;
current player's score = 0;
for(int currentPlayer = 0; playerlist.length > currentPlayer; currentPlayer++)
}
current player's score = 0; //WHY?

for(int currentPlayer = 0; playerlist.length > currentPlayer; currentPlayer++) //The player only gets points if they draw cards, but every time they draw a card their score gets set to 0. This game will never end.
{
current counted player's score += current checked player's score;
}
}
}while(no one has a score that is more than or equal tos 500)
}