Advertisement
maramizo

Untitled

Feb 18th, 2021 (edited)
972
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var current_card = cards.min; // start with the smallest card.
  2. var straight = 0;
  3. for(i=0;i==4;i++){
  4.     if(cards[i] == current_card + 1){
  5.         straight += 1;
  6.         current_card = cards[i];
  7.         i = -1; // resetting the loop.
  8.         continue;
  9.     }
  10.     if(straight === 5)
  11.         break;
  12. }
  13. if(straight === 5){
  14.     // You have a straight.
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement