I'm writing a poker game in Javascript that's supposed to take stdin as follows:
The first line of input will contain a single integer representing the number of players. This number will always be greater than 0 and less than 8.
The following n lines, where n is the number of players, will contain a single integer representing the id of the player, followed by three space-separated cards representing a hand belonging to a player.
The output, printed to stdout, will be the ID of the winning player.
But my function is in Javascript so... how do I convert this stdin to say an integer and an object like so:
function playPoker(n, cardsDealt){
// functionality
}
const num = 3;
const hands = {
'0': ['4c,', '5c', '6c'],
'1': ['Kd', '5d,', '6d'],
'2': ['Jc', 'Qd,', 'Ks'],
}
playPoker(num, hands);
I got as far as playing around with process.stdin like so but not sure how to interpret the input as Javascript:


