From 91b3513df6d5821ef00a148295b43e025a3a5d46 Mon Sep 17 00:00:00 2001 From: Andrew Cooper Date: Wed, 27 Apr 2022 08:05:27 +1000 Subject: [PATCH] Make text mixed case --- 71_Poker/csharp/Games.cs | 151 ++++++++++++++++++++------------------- 1 file changed, 76 insertions(+), 75 deletions(-) diff --git a/71_Poker/csharp/Games.cs b/71_Poker/csharp/Games.cs index 0a6dcbe8..d6cb862a 100644 --- a/71_Poker/csharp/Games.cs +++ b/71_Poker/csharp/Games.cs @@ -1,4 +1,5 @@ using Poker.Resources; +using static System.StringComparison; internal class Game { @@ -74,7 +75,7 @@ _110: S=200; _120: P=0; _140: _io.WriteLine(); _150: if (C<=5) { Line_3670(); return false; } -_160: _io.WriteLine("THE ANTE IS $5. I WILL DEAL:"); +_160: _io.WriteLine("The ante is $5. I will deal:"); _170: _io.WriteLine(); _180: if (S>5) { goto _200; } _190: if (Line_3830()) { return false; } @@ -85,7 +86,7 @@ _230: for (Z=1; Z <= 10; Z++) { _240: Line_1740(); } -_260: _io.WriteLine("YOUR HAND:"); +_260: _io.WriteLine("Your hand:"); _270: N=1; _280: Line_1850(); _290: N=6; @@ -111,7 +112,7 @@ _480: if (FNA()>=2) { goto _500; } _490: goto _420; _500: Z=0; _510: K=0; -_520: _io.WriteLine("I CHECK."); +_520: _io.WriteLine("I check."); _530: goto _620; _540: if (U<=16) { goto _570; } _550: Z=2; @@ -119,7 +120,7 @@ _560: if (FNA()>=1) { goto _580; } _570: Z=35; _580: V=Z+FNA(); _590: if (Line_3480()) { return false; } -_600: _io.WriteLine($"I'LL OPEN WITH ${V}"); +_600: _io.WriteLine($"I'll open with ${V}"); _610: K=V; _620: if (Line_3050()) { return false; } _630: var response = Line_650(); @@ -135,19 +136,19 @@ _660: _io.WriteLine(); bool? Line_670() { -_670: _io.WriteLine("I WIN."); +_670: _io.WriteLine("I win."); _680: C=C+P; return Line_690(); } bool? Line_690() { -_690: _io.WriteLine($"NOW I HAVE ${C}AND YOU HAVE ${S}"); -_700: _io.Write("DO YOU WISH TO CONTINUE"); +_690: _io.WriteLine($"Now I have ${C}and you have ${S}"); +_700: _io.Write("Do you wish to continue"); _710: HS = _io.ReadString(""); -_720: if (HS=="YES") { return true; } -_730: if (HS=="NO") { return false; } -_740: _io.WriteLine("ANSWER YES OR NO, PLEASE."); +_720: if (HS.Equals("YES", InvariantCultureIgnoreCase)) { return true; } +_730: if (HS.Equals("NO", InvariantCultureIgnoreCase)) { return false; } +_740: _io.WriteLine("Answer Yes or No, please."); _750: goto _700; } @@ -160,7 +161,7 @@ _770: _io.WriteLine(); bool? Line_780() { -_780: _io.WriteLine("YOU WIN."); +_780: _io.WriteLine("You win."); _790: S=S+P; _800: return Line_690(); } @@ -171,20 +172,20 @@ _810: return null; } _820: _io.WriteLine(); -_830: _io.Write("NOW WE DRAW -- HOW MANY CARDS DO YOU WANT"); +_830: _io.Write("Now we draw -- How many cards do you want"); _840: T = _io.ReadNumber(""); _850: if (T==0) { goto _980; } _860: Z=10; _870: if (T<4) { goto _900; } -_880: _io.WriteLine("YOU CAN'T DRAW MORE THAN THREE CARDS."); +_880: _io.WriteLine("You can't draw more than three cards."); _890: goto _840; -_900: _io.WriteLine("WHAT ARE THEIR NUMBERS:"); +_900: _io.WriteLine("What are their numbers:"); _910: for (Q=1; Q <= T; Q++) { _920: U = _io.ReadNumber(""); _930: Line_1730(); } -_950: _io.WriteLine("YOUR NEW HAND:"); +_950: _io.WriteLine("Your new hand:"); _960: N=1; _970: Line_1850(); _980: Z=10+T; @@ -195,9 +196,9 @@ _1010: Line_1730(); _1020: ; } _1030: _io.WriteLine(); -_1040: _io.Write($"I AM TAKING{Z-10-T}CARD"); +_1040: _io.Write($"I am taking{Z-10-T}card"); _1050: if (Z==11+T) { goto _1090; } -_1060: _io.WriteLine("S"); +_1060: _io.WriteLine("s"); _1070: _io.WriteLine(); _1080: goto _1100; _1090: _io.WriteLine(); @@ -229,40 +230,40 @@ _1340: if (Line_3050()) { return false; } _1350: if (T!=.5) { goto _1450; } _1360: if (V==7) { goto _1400; } _1370: if (I!=6) { goto _1400; } -_1380: _io.WriteLine("I'LL CHECK"); +_1380: _io.WriteLine("I'll check"); _1390: goto _1460; _1400: V=Z+FNA(); _1410: if (Line_3480()) { return false; } -_1420: _io.WriteLine($"I'LL BET ${V}"); +_1420: _io.WriteLine($"I'll bet ${V}"); _1430: K=V; _1440: if (Line_3060()) { return false; } _1450: response = Line_650(); if (response.HasValue) { return response.Value; } _1460: _io.WriteLine(); -_1470: _io.WriteLine("NOW WE COMPARE HANDS:"); +_1470: _io.WriteLine("Now we compare hands:"); _1480: JS=HS; _1490: KS=IS; -_1500: _io.WriteLine("MY HAND:"); +_1500: _io.WriteLine("My hand:"); _1510: N=6; _1520: Line_1850(); _1530: N=1; _1540: Line_2170(); _1550: _io.WriteLine(); -_1560: _io.Write("YOU HAVE "); +_1560: _io.Write("You have "); _1570: K=D; _1580: Line_3690(); _1590: HS=JS; _1600: IS=KS; _1610: K=M; -_1620: _io.Write("AND I HAVE "); +_1620: _io.Write("and I have "); _1630: Line_3690(); _1640: if (B>U) { return Line_670().Value; } _1650: if (U>B) { return Line_780().Value; } -_1660: if (HS=="A FLUS") { goto _1700; } +_1660: if (HS=="A Flus") { goto _1700; } _1662: if (FNB(M)FNB(D)) { return Line_670().Value; } -_1670: _io.WriteLine("THE HAND IS DRAWN."); -_1680: _io.WriteLine($"ALL ${P}REMAINS IN THE POT."); +_1670: _io.WriteLine("The hand is drawn."); +_1680: _io.WriteLine($"All ${P}remains in the pot."); _1690: goto _140; _1700: if (FNB(M)>FNB(D)) { return Line_670().Value; } _1710: if (FNB(D)>FNB(M)) { return Line_780().Value; } @@ -297,7 +298,7 @@ _1850: for (Z = N; Z <= N+4; Z++) { _1860: _io.Write($"{Z}-- "); _1870: Line_1950(); -_1880: _io.Write(" OF"); +_1880: _io.Write(" of"); _1890: Line_2070(); _1900: if (Z/2!=(int)(Z/2)) { goto _1920; } _1910: _io.WriteLine(); @@ -316,13 +317,13 @@ _1950: K=FNB(AA[Z]); void Line_1960() { _1960: if (K!=9) { goto _1980; } -_1970: _io.Write("JACK"); +_1970: _io.Write("Jack"); _1980: if (K!=10) { goto _2000; } -_1990: _io.Write("QUEEN"); +_1990: _io.Write("Queen"); _2000: if (K!=11) { goto _2020; } -_2010: _io.Write("KING"); +_2010: _io.Write("King"); _2020: if (K!=12) { goto _2040; } -_2030: _io.Write("ACE"); +_2030: _io.Write("Ace"); _2040: if (K>=9) { goto _2060; } _2050: _io.Write(K+2); _2060: return; @@ -337,13 +338,13 @@ _2070: K=(int)(AA[Z]/100); void Line_2080() { _2080: if (K!=0) { goto _2100; } -_2090: _io.Write(" CLUBS"); +_2090: _io.Write(" Clubs"); _2100: if (K!=1) { goto _2120; } -_2110: _io.Write(" DIAMONDS"); +_2110: _io.Write(" Diamonds"); _2120: if (K!=2) { goto _2140; } -_2130: _io.Write(" HEARTS"); +_2130: _io.Write(" Hearts"); _2140: if (K!=3) { goto _2160; } -_2150: _io.Write(" SPADES"); +_2150: _io.Write(" Spades"); _2160: return; } @@ -361,8 +362,8 @@ _2230: ; _2240: if (U!=4) { goto _2310; } _2250: X=11111; _2260: D=AA[N]; -_2270: HS="A FLUS"; -_2280: IS="H IN"; +_2270: HS="A Flus"; +_2280: IS="h in"; _2290: U=15; _2300: return; _2310: for (Z=N; Z <= N+3; Z++) @@ -394,8 +395,8 @@ _2510: U=10; _2520: if (BB[N+1]+3!=BB[N+4]) { goto _2620; } _2530: if (U!=10) { goto _2600; } _2540: U=14; -_2550: HS="STRAIG"; -_2560: IS="HT"; +_2550: HS="Straig"; +_2560: IS="ht"; _2570: X=11111; _2580: D=AA[N+4]; _2590: return; @@ -403,8 +404,8 @@ _2600: U=10; _2610: X=11110; _2620: if (U>=10) { goto _2690; } _2630: D=AA[N+4]; -_2640: HS="SCHMAL"; -_2650: IS="TZ, "; +_2640: HS="Schmal"; +_2650: IS="tz, "; _2660: U=9; _2670: X=11000; _2680: goto _2740; @@ -421,32 +422,32 @@ _2750: return; { _2760: if (U>=11) { goto _2810; } _2770: U=11; -_2780: HS="A PAIR"; +_2780: HS="A Pair"; _2790: IS=" OF "; _2800: return; _2810: if (U!=11) { goto _2910; } _2820: if (BB[Z]!=BB[Z-1]) { goto _2870; } -_2830: HS="THREE"; +_2830: HS="Three"; _2840: IS=" "; _2850: U=13; _2860: return; -_2870: HS="TWO P"; -_2880: IS="AIR, "; +_2870: HS="Two P"; +_2880: IS="air, "; _2890: U=12; _2900: return; _2910: if (U>12) { goto _2960; } _2920: U=16; -_2930: HS="FULL H"; -_2940: IS="OUSE, "; +_2930: HS="Full H"; +_2940: IS="ouse, "; _2950: return; _2960: if (BB[Z]!=BB[Z-1]) { goto _3010; } _2970: U=17; -_2980: HS="FOUR"; +_2980: HS="Four"; _2990: IS=" "; _3000: return; _3010: U=16; -_3020: HS="FULL H"; -_3030: IS="OUSE, "; +_3020: HS="Full H"; +_3030: IS="ouse, "; _3040: return; } @@ -459,13 +460,13 @@ _3050: G=0; bool Line_3060() { _3060: _io.WriteLine(); - _io.Write("WHAT IS YOUR BET"); + _io.Write("What is your bet"); _3070: T = _io.ReadNumber(""); _3080: if ((T-(int)T)==0) { goto _3140; } _3090: if (K!=0) { goto _3120; } _3100: if (G!=0) { goto _3120; } _3110: if (T==.5) { return Line_3410(); } -_3120: _io.WriteLine("NO SMALL CHANGE, PLEASE."); +_3120: _io.WriteLine("No small change, please."); _3130: goto _3060; _3140: if (S-G-T>=0) { goto _3170; } _3150: if (Line_3830()) { return true; } @@ -474,7 +475,7 @@ _3170: if (T!=0) { goto _3200; } _3180: I=3; _3190: return Line_3380(); _3200: if (G+T>=K) { goto _3230; } -_3210: _io.WriteLine("IF YOU CAN'T SEE MY BET, THEN FOLD."); +_3210: _io.WriteLine("If you can't see my bet, then fold."); _3220: goto _3060; _3230: G=G+T; _3240: if (G==K) { return Line_3380(); } @@ -486,7 +487,7 @@ _3290: return Line_3420(); _3300: if (Z==1) { goto _3320; } _3310: if (T<=25) { return Line_3350(); } _3320: I=4; -_3330: _io.WriteLine("I FOLD."); +_3330: _io.WriteLine("I fold."); _3340: return false; } @@ -498,7 +499,7 @@ _3350: if (Z==2) { return Line_3430(); } bool Line_3360() { -_3360: _io.WriteLine("I'LL SEE YOU."); +_3360: _io.WriteLine("I'll see you."); _3370: K=G; return Line_3380(); } @@ -526,7 +527,7 @@ _3420: if (G>3*Z) { return Line_3350(); } { _3430: V=G-K+FNA(); _3440: if (Line_3480()) { return true; } -_3450: _io.WriteLine($"I'LL SEE YOU, AND RAISE YOU{V}"); +_3450: _io.WriteLine($"I'll see you, and raise you{V}"); _3460: K=G+V; _3470: return Line_3060(); } @@ -539,16 +540,16 @@ _3500: V=C; _3510: return false; _3520: if (C-G>=0) { return Line_3360(); } _3530: if (O % 2 != 0) { goto _3600; } -_3540: _io.Write("WOULD YOU LIKE TO BUY BACK YOUR WATCH FOR $50"); +_3540: _io.Write("Would you like to buy back your watch for $50"); _3550: JS = _io.ReadString(""); -_3560: if (JS[0]=='N') { goto _3600; } +_3560: if (JS.StartsWith("N", InvariantCultureIgnoreCase)) { goto _3600; } _3570: C=C+50; _3580: O=O/2; _3590: return false; _3600: if (O % 3!= 0) { return Line_3670(); } -_3610: _io.Write("WOULD YOU LIKE TO BUY BACK YOUR TIE TACK FOR $50"); +_3610: _io.Write("Would you like to buy back your tie tack for $50"); _3620: JS = _io.ReadString(""); -_3630: if (JS[0]=='N') { return Line_3670(); } +_3630: if (JS.StartsWith("N", InvariantCultureIgnoreCase)) { return Line_3670(); } _3640: C=C+50; _3650: O=O/3; _3660: return false; @@ -556,7 +557,7 @@ _3660: return false; bool Line_3670() { -_3670: _io.WriteLine("I'M BUSTED. CONGRATULATIONS!"); +_3670: _io.WriteLine("I'm busted. Congratulations!"); _3680: return true; // STOP } @@ -570,43 +571,43 @@ _3730: _io.WriteLine(); _3740: return; _3750: K=FNB(K); _3760: Line_1960(); -_3770: if (HS=="SCHMAL") { goto _3790; } -_3780: if (HS!="STRAIG") { goto _3810; } -_3790: _io.WriteLine(" HIGH"); +_3770: if (HS=="Schmal") { goto _3790; } +_3780: if (HS!="Straig") { goto _3810; } +_3790: _io.WriteLine(" High"); _3800: return; -_3810: _io.WriteLine("'S"); +_3810: _io.WriteLine("'s"); _3820: return; } bool Line_3830() { _3830: _io.WriteLine(); -_3840: _io.WriteLine("YOU CAN'T BET WITH WHAT YOU HAVEN'T GOT."); +_3840: _io.WriteLine("You can't bet with what you haven't got."); _3850: if (O/2 == (int)(O/2)) { goto _3970; } -_3860: _io.Write("WOULD YOU LIKE TO SELL YOUR WATCH"); +_3860: _io.Write("Would you like to sell your watch"); _3870: JS = _io.ReadString(""); -_3880: if (JS[0]=='N') { goto _3970; } +_3880: if (JS.StartsWith("N", InvariantCultureIgnoreCase)) { goto _3970; } _3890: if (FNA()>=7) { goto _3930; } -_3900: _io.WriteLine("I'LL GIVE YOU $75 FOR IT."); +_3900: _io.WriteLine("I'll give you $75 for it."); _3910: S=S+75; _3920: goto _3950; -_3930: _io.WriteLine("THAT'S A PRETTY CRUMMY WATCH - I'LL GIVE YOU $25."); +_3930: _io.WriteLine("That's a pretty crummy watch - I'll give you $25."); _3940: S=S+25; _3950: O=O*2; _3960: return false; _3970: if (O/3 != (int)(O/3)) { goto _4090; } -_3980: _io.WriteLine("WILL YOU PART WITH THAT DIAMOND TIE TACK"); +_3980: _io.WriteLine("Will you part with that diamond tie tack"); _3990: JS = _io.ReadString(""); -_4000: if (JS[0]=='N') { goto _4080; } +_4000: if (JS.StartsWith("N", InvariantCultureIgnoreCase)) { goto _4080; } _4010: if (FNA()>=6) { goto _4050; } -_4020: _io.WriteLine("YOU ARE NOW $100 RICHER."); +_4020: _io.WriteLine("You are now $100 richer."); _4030: S=S+100; _4040: goto _4070; -_4050: _io.WriteLine("IT'S PASTE. $25."); +_4050: _io.WriteLine("It's paste. $25."); _4060: S=S+25; _4070: O=O*3; _4080: return false; -_4090: _io.WriteLine("YOUR WAD IS SHOT. SO LONG, SUCKER!"); +_4090: _io.WriteLine("Your wad is shot. So long, sucker!"); _4100: return true; } }