Another card game
Description:
Twelve cards with grades from 0
to 11
randomly divided among 3
players: Frank, Sam, and Tom, 4
cards each. The game consists of 4
rounds.
The goal of the round is to move by the card with the most points.
In round 1
, the first player who has a card with 0
points, takes the first turn, and he starts with that card.
Then the second player (queue - Frank -> Sam -> Tom -> Frank, etc.) can move with any of his cards (each card is used only once per game, and there are no rules that require players to make only the best moves).
The third player makes his move after the second player, and he sees the previous moves.
The winner of the previous round then makes the first move in the next round with any remaining card.
The player who wins 2
rounds first, wins the game.
Task
Return true
if Frank has a chance of winning the game.
Return false
if Frank has no chance.
Input
3
arrays of 4
unique numbers in each (numbers in array are sorted in ascending order).
Input is always valid, no need to check.
Example
Round 1
: Frank 2 5 8 11
, Sam 1 4 7 10
, Tom 0 3 6 9
.
Tom has to start from 0
. Frank is risking nothing and goes 2
.
Sam gets lucky and wins round by throwing 4
.
Round 2
: Frank 5 8 11
, Sam 1 7 10
, Tom 3 6 9
.
Sam starts from 1
. Tom goes 3
, Frank wins with 5
.
Round 3
: Frank 8 11
, Sam 7 10
, Tom 6 9
.
Frank starts from 11
and wins the round either way.
Frank is the first to win 2
rounds and therefore wins the game, the answer is true
.
One more example
Frank 0 1 2 3
, Sam 6 7 8 11
, Tom 4 5 9 10
.
With these cards Frank has no chance, the answer is false
.
Tip
Players can actually play DUMB moves, especially Sam and Tom.
Similar Kata:
Stats:
Created | Oct 1, 2022 |
Published | Oct 1, 2022 |
Warriors Trained | 7879 |
Total Skips | 245 |
Total Code Submissions | 21813 |
Total Times Completed | 1228 |
C# Completions | 137 |
JavaScript Completions | 370 |
Python Completions | 403 |
Java Completions | 179 |
Go Completions | 70 |
Haskell Completions | 25 |
Ruby Completions | 36 |
Rust Completions | 48 |
PowerShell Completions | 16 |
PHP Completions | 41 |
VB Completions | 10 |
Crystal Completions | 6 |
Lua Completions | 11 |
Scala Completions | 6 |
Dart Completions | 10 |
Total Stars | 137 |
% of votes with a positive feedback rating | 78% of 148 |
Total "Very Satisfied" Votes | 101 |
Total "Somewhat Satisfied" Votes | 28 |
Total "Not Satisfied" Votes | 19 |
Total Rank Assessments | 8 |
Average Assessed Rank | 7 kyu |
Highest Assessed Rank | 6 kyu |
Lowest Assessed Rank | 8 kyu |