# [Python 2], 47 bytes <!-- language-all: lang-python --> lambda a,b:[61>60-a>b<3+max(19,a)for b in-~b,b] [Try it online!][TIO-jtqf8srs] [Python 2]: https://docs.python.org/2/ [TIO-jtqf8srs]: https://tio.run/##jZZPb9tGFMTv/hS8WUYlgLP/N6gDBEgOBYoee3F9oGBJFeDIhqsUzaVf3ZXezJoUkwC9PPnR2vk9UjvDff56/PPp4F63t3@8Pg6f1w9DNyzX7@4S3qd@Nbxf/@x/@jz8s0BdDjfbp5du3e0Pq3/Xy/X969Xzy/5w7K7/Hh73D93m8LB5eHeti9tF1y87h5u3Hu6ydzj1ftKXZef7SV/ZX1L2h@75cfg643STdcbtL7lwM@58Djdy9gcjTQir81dQxyWr09O40OhW52/M7tXN7mXyf99f3ms4fT9MngV6Q/ZnBi9e/f7h118@3t7d9cv@fnmqsOqseqvBarSarGarxWrlKi3manA5uB4UABVACVADFAFVHFXcWQVLVmfVWw1Wo9VkNVstVitX9fyQBpeD60EBUAGUADVAEVDFUcUmcTaDsxmczeBsBmczOJvB2QzOZnCcwXEGxxkcZ3CcwXEGxxkcZ3CcwXEGxxkcZ/BG90b3RvdG90b3RvdG96R70j3pnnRPuifdk@5J96R70j3pnvRg3GDcYNxg3GDcYNxAbiA3kBvIDeQGcgO5gdxAbiA3kBvIjUaMRoxGjEaMRowkRhIjiZHESGIkMZIYSYwkRhIjiZHEZKxkrGSsZKxEViIrkZXISmQlshJZiaxEViIrkZXIykbJRslGyaRkUjIpmZRMSiYlk5JJyaRkUjIpmZRi@sX0C/UL9Qv1C/UL9Qv1C/UL9Qv1C/UL9Qv1qylXKlcqVypXKlcqVypXKlcqVypXKlcqVyWAYgXKFShYoGSBogXKFihcoHSB4gXKFyhg0BKmpUSLiZYTLShaUrSoaFnRwqKlRYsL5QVkecjzkOkh10O2h3wPGR9yPmR9yPuQeyH7Qv6FDAw5GLIw5GHIxJCLIRtCPoSMCDkRsiLkRciMkBshN0F2gvwEGQpyFGQpyFOQJSBPQKaAXAHZAvIFtKuhbQ3ta2hjQzsb2pbQvoQ2JrQzoV0FbStoXzntA9ePvUV0y3uMvWW2U@/G3kLcq/djb6ke1Iext5iP6uPYW@4n9Wns7UWQ1eextzdDUV/eem/3U9XXc39/dfXpt4@f@GrXG7W9zjCNdiWt4k/JpOiQw5sdm23aNm/bs22vtk3az95@zvZztZ/lm8c@f6zzxzZ/LLPb5u3ubicHzeOX58fNYrs4/X0zO@u9ncD@2hwXO/vG@QB6@jyfAu081E5M15eHz@8usKf8tmD3tD/s/geh22@7u9OF@@7wdJzI/Oi0OFM6r3gZDrvNYhVPZ7P@pmtnaF0e7OIcwpt7/Q8 "Python 2 – Try It Online" Outputs a list of two Booleans. Thanks to [TFeld][1] for writing a test suite in [their answer][2] that made it easy to check my solution. ended: [False, True] going: [True, True] invalid: [False, False] The key insight is that a valid score ends the game exactly if increasing the higher value `b` makes the score invalid. So, we just code up the validity condition, and check it for `(a,b+1)` in addition to `(a,b)` to see if the game has ended. Validity is checked via three conditions that are chained together: - `b<3+max(19,a)`: Checks that the higher score `b` isn't past winning, with either `b<=21` or `b<=a+2` (win by two) - `60-a>b`: Equivalent to `a+b<=59`, ensuring the score isn't above `(29,30)` - `61>60-a`: Equivalent to `a>=0`, ensures the lower score is non-negative [1]: https://codegolf.stackexchange.com/users/38592/tfeld [2]: https://codegolf.stackexchange.com/a/182248/20260 ---- # [Python 2], 45 bytes <!-- language-all: lang-python --> lambda a,b:(-1<a<30)*~cmp(2+max(19,a)-a/29,b) [Try it online!][TIO-jtqgmh55] [Python 2]: https://docs.python.org/2/ [TIO-jtqgmh55]: https://tio.run/##jZbNbuNGEITvfgreLCUSwur54yzWhwC7hwBBjrk4PtBrSyvAlg3HCLKXvLojddWYEpMAubTRNKe@JjVVnOdvr1@f9va2ufrt7WF8vL0bu3F1@2GxxsfxY@iX3/315fF5Yd8/jn8uUFfjcj3@YHV1u3y7eH7Z7V@7yz/Gh91dd7@/u7/7cKmLm0XXrzrD8r2HnfeGQx9O@mHVH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