Skip to content

Instantly share code, notes, and snippets.

@venelrene
Created June 30, 2020 20:04
Show Gist options
  • Save venelrene/882820cf5ef69b1be2caa7e912df52b7 to your computer and use it in GitHub Desktop.
Save venelrene/882820cf5ef69b1be2caa7e912df52b7 to your computer and use it in GitHub Desktop.
Texas Hold-em! Your task is to determine if the cards in the list makes up a straight (five cards of sequential rank) or not. The cards will always have values ranging from 2-14, where 14 is the ace. Be aware that the ace (14) also should count as value 1! The number of cards will vary, but will never be more than 7 (the board (5) + player hand …
// return true/false if the given cards make up a straight
var card=0;
function isStraight(cards){
card++;
if (card==3|| card==4 || card==5 || card==9)
return false;
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment