Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var current_card = cards.min; // start with the smallest card.
- var straight = 0;
- for(i=0;i==4;i++){
- if(cards[i] == current_card + 1){
- straight += 1;
- current_card = cards[i];
- i = -1; // resetting the loop.
- continue;
- }
- if(straight === 5)
- break;
- }
- if(straight === 5){
- // You have a straight.
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement