Created
July 1, 2011 16:43
-
-
Save anonymous/1058902 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
start | |
declarations | |
arrFull_Deck [2,3,4,5,6,7,8,9,10,11,12,13,14, 2,3,4,5,6,7,8,9,10,11,12,13,14, 2,3,4,5,6,7,8,9,10,11,12,13,14, 2,3,4,5,6,7,8,9,10,11,12,13,14] | |
arrP1_hand [ ] | |
arrP2_hand [ ] | |
arrTable [ ] | |
num Full_DeckCardCount = 52 | |
num Table = 0 | |
num P1_CardValue | |
num P2_CardValue | |
num P1_CardCount = 26 | |
num P2_CardCount = 26 | |
num ran_num | |
<distributingCards> | |
while Full_DeckCardCount ! = 0 | |
rand_Num = random an index value from arrFull_Deck [ ] | |
P1_CardValue = arrFull_Deck [ran_num] //P1_CardValue = the value located at ran_num spot in arrFull_Deck[ ] | |
copy P1_CardValue to arrP1_hand [ ], delete P1_CardValue from arrFull_Deck [ ] | |
Full_DeckCardCount – 1 | |
rand_num = random an index value from arrFull_Deck [ ] | |
P2_CardValue = arrFull_Deck [ran_num] //P1_CardValue = the value located at ran_num spot in arrFull_Deck [ ] | |
copy P2_CardValue to arrP2_hand [ ] , Delete P2_CardValue from arrFull_Deck [ ] | |
Full_DeckCardCount – 1 | |
if Full_DeckCardCount != 0 then | |
Goto <distributingCards> | |
else Full_DeckCardCount = 0 | |
goto <Battle> | |
endif | |
endwhile | |
while P1_CardCount, P2_CardCount !=0 | |
goto <Battle> | |
endwhile | |
if P1_CardCount = 0 then | |
output “Player 2 is the winner!” | |
else P2_CardCount = 0 then | |
output “player 1 is the winner!” | |
endif | |
stop | |
<Battle> | |
1st value in arrP1_hand [ ] = P1_CardValue | |
1st value in arrP2_hand [ ] = P2_cardValue | |
P1_CardCount – 1 | |
P2_CardCount – 1 | |
Table + 2 | |
copy P1_CardValue to arrTable [ ], Delete P1_cardValue from arrP1_hand [ ] | |
copy P2_CardValue to arrTable [ ], delete P2_cardValue from arr P2_hand [ ] | |
if P1_CardValue > P2_CardValue then | |
copy all values in arrTable [ ] to arrP1_hand [ ], delete all values in arrTable [ ] | |
P1_CardCount + 2 | |
Table – 2 | |
goto <Battle> | |
endif | |
if P1_CardValue < P2_CardValue then | |
Copy all values in arrTable [ ] to arrP2_hand [ ], delete all values In arrTable [ ] | |
P2_Cardcount + 2 | |
Table – 2 | |
goto <Battle> | |
endif | |
if P1_CardValue = P2_CardValue then | |
Goto <WAR> | |
endif | |
<WAR> | |
copy the first 3 values from arrP1_hand [ ] to arrTable [ ], Delete the first 3 values from arrP1_hand | |
copy the first 3 values from arrP2_hand [ ] to arrTable [ ], Delete the first 3 values from arrP1_hand | |
P1_CardCount – 3 | |
P2_CardCount - 3 | |
Table + 6 | |
goto <Battle> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment