Skip to content

Commit b14bc06

Browse files
committed
Merge branch 'upstream/main' into fix/math-projects-guidelines to resolve conflicts
2 parents 33e833a + 5e2a2c4 commit b14bc06

22 files changed

Lines changed: 4041 additions & 682 deletions

.prettierrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"semi": true,
3+
"singleQuote": false,
4+
"tabWidth": 2,
5+
"trailingComma": "es5",
6+
"printWidth": 80,
7+
"bracketSpacing": true,
8+
"arrowParens": "always"
9+
}

README.md

Lines changed: 45 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,12 @@ python-mini-project/
328328
<sub><b>@PragatiNigam29</b></sub>
329329
</a>
330330
</td>
331+
<td align="center" width="120">
332+
<a href="https://github.com/Pratikshya32">
333+
<img src="https://github.com/Pratikshya32.png?size=100" width="100" height="100" style="border-radius:50%; border:2px solid #555;" alt="Pratikshya32" /><br />
334+
<sub><b>@Pratikshya32</b></sub>
335+
</a>
336+
</td>
331337
<td align="center" width="120">
332338
<a href="https://github.com/Quantum3600">
333339
<img src="https://github.com/Quantum3600.png?size=100" width="100" height="100" style="border-radius:50%; border:2px solid #555;" alt="Quantum3600" /><br />
@@ -346,14 +352,14 @@ python-mini-project/
346352
<sub><b>@Sanjhivvarshan-b-s</b></sub>
347353
</a>
348354
</td>
355+
</tr>
356+
<tr>
349357
<td align="center" width="120">
350358
<a href="https://github.com/SathvikaTalari">
351359
<img src="https://github.com/SathvikaTalari.png?size=100" width="100" height="100" style="border-radius:50%; border:2px solid #555;" alt="SathvikaTalari" /><br />
352360
<sub><b>@SathvikaTalari</b></sub>
353361
</a>
354362
</td>
355-
</tr>
356-
<tr>
357363
<td align="center" width="120">
358364
<a href="https://github.com/Shashank-8p">
359365
<img src="https://github.com/Shashank-8p.png?size=100" width="100" height="100" style="border-radius:50%; border:2px solid #555;" alt="Shashank-8p" /><br />
@@ -384,14 +390,14 @@ python-mini-project/
384390
<sub><b>@Sparshjoshi-iit</b></sub>
385391
</a>
386392
</td>
393+
</tr>
394+
<tr>
387395
<td align="center" width="120">
388396
<a href="https://github.com/Sreekuttan-007">
389397
<img src="https://github.com/Sreekuttan-007.png?size=100" width="100" height="100" style="border-radius:50%; border:2px solid #555;" alt="Sreekuttan-007" /><br />
390398
<sub><b>@Sreekuttan-007</b></sub>
391399
</a>
392400
</td>
393-
</tr>
394-
<tr>
395401
<td align="center" width="120">
396402
<a href="https://github.com/Suhani-ai-dev">
397403
<img src="https://github.com/Suhani-ai-dev.png?size=100" width="100" height="100" style="border-radius:50%; border:2px solid #555;" alt="Suhani-ai-dev" /><br />
@@ -422,14 +428,14 @@ python-mini-project/
422428
<sub><b>@Vanshikakhasat</b></sub>
423429
</a>
424430
</td>
431+
</tr>
432+
<tr>
425433
<td align="center" width="120">
426434
<a href="https://github.com/Vinanthi07">
427435
<img src="https://github.com/Vinanthi07.png?size=100" width="100" height="100" style="border-radius:50%; border:2px solid #555;" alt="Vinanthi07" /><br />
428436
<sub><b>@Vinanthi07</b></sub>
429437
</a>
430438
</td>
431-
</tr>
432-
<tr>
433439
<td align="center" width="120">
434440
<a href="https://github.com/abdullahxyz85">
435441
<img src="https://github.com/abdullahxyz85.png?size=100" width="100" height="100" style="border-radius:50%; border:2px solid #555;" alt="abdullahxyz85" /><br />
@@ -460,14 +466,14 @@ python-mini-project/
460466
<sub><b>@artic2702</b></sub>
461467
</a>
462468
</td>
469+
</tr>
470+
<tr>
463471
<td align="center" width="120">
464472
<a href="https://github.com/ash-heinz">
465473
<img src="https://github.com/ash-heinz.png?size=100" width="100" height="100" style="border-radius:50%; border:2px solid #555;" alt="ash-heinz" /><br />
466474
<sub><b>@ash-heinz</b></sub>
467475
</a>
468476
</td>
469-
</tr>
470-
<tr>
471477
<td align="center" width="120">
472478
<a href="https://github.com/aspartic-gthb">
473479
<img src="https://github.com/aspartic-gthb.png?size=100" width="100" height="100" style="border-radius:50%; border:2px solid #555;" alt="aspartic-gthb" /><br />
@@ -498,14 +504,14 @@ python-mini-project/
498504
<sub><b>@codewithakshyaaa</b></sub>
499505
</a>
500506
</td>
507+
</tr>
508+
<tr>
501509
<td align="center" width="120">
502510
<a href="https://github.com/developer-yash03">
503511
<img src="https://github.com/developer-yash03.png?size=100" width="100" height="100" style="border-radius:50%; border:2px solid #555;" alt="developer-yash03" /><br />
504512
<sub><b>@developer-yash03</b></sub>
505513
</a>
506514
</td>
507-
</tr>
508-
<tr>
509515
<td align="center" width="120">
510516
<a href="https://github.com/dhanushrajvr">
511517
<img src="https://github.com/dhanushrajvr.png?size=100" width="100" height="100" style="border-radius:50%; border:2px solid #555;" alt="dhanushrajvr" /><br />
@@ -536,14 +542,20 @@ python-mini-project/
536542
<sub><b>@itsdakshjain</b></sub>
537543
</a>
538544
</td>
545+
</tr>
546+
<tr>
547+
<td align="center" width="120">
548+
<a href="https://github.com/jbkun069">
549+
<img src="https://github.com/jbkun069.png?size=100" width="100" height="100" style="border-radius:50%; border:2px solid #555;" alt="jbkun069" /><br />
550+
<sub><b>@jbkun069</b></sub>
551+
</a>
552+
</td>
539553
<td align="center" width="120">
540554
<a href="https://github.com/jeetrouth">
541555
<img src="https://github.com/jeetrouth.png?size=100" width="100" height="100" style="border-radius:50%; border:2px solid #555;" alt="jeetrouth" /><br />
542556
<sub><b>@jeetrouth</b></sub>
543557
</a>
544558
</td>
545-
</tr>
546-
<tr>
547559
<td align="center" width="120">
548560
<a href="https://github.com/jyotish6699">
549561
<img src="https://github.com/jyotish6699.png?size=100" width="100" height="100" style="border-radius:50%; border:2px solid #555;" alt="jyotish6699" /><br />
@@ -568,6 +580,8 @@ python-mini-project/
568580
<sub><b>@mahi-8758</b></sub>
569581
</a>
570582
</td>
583+
</tr>
584+
<tr>
571585
<td align="center" width="120">
572586
<a href="https://github.com/mrinmoyChakraborty-mrinox">
573587
<img src="https://github.com/mrinmoyChakraborty-mrinox.png?size=100" width="100" height="100" style="border-radius:50%; border:2px solid #555;" alt="mrinmoyChakraborty-mrinox" /><br />
@@ -580,8 +594,6 @@ python-mini-project/
580594
<sub><b>@n1o5</b></sub>
581595
</a>
582596
</td>
583-
</tr>
584-
<tr>
585597
<td align="center" width="120">
586598
<a href="https://github.com/nene-hana">
587599
<img src="https://github.com/nene-hana.png?size=100" width="100" height="100" style="border-radius:50%; border:2px solid #555;" alt="nene-hana" /><br />
@@ -606,6 +618,8 @@ python-mini-project/
606618
<sub><b>@parasmani-dev</b></sub>
607619
</a>
608620
</td>
621+
</tr>
622+
<tr>
609623
<td align="center" width="120">
610624
<a href="https://github.com/parulpaliwal01">
611625
<img src="https://github.com/parulpaliwal01.png?size=100" width="100" height="100" style="border-radius:50%; border:2px solid #555;" alt="parulpaliwal01" /><br />
@@ -618,8 +632,6 @@ python-mini-project/
618632
<sub><b>@pragya-manna</b></sub>
619633
</a>
620634
</td>
621-
</tr>
622-
<tr>
623635
<td align="center" width="120">
624636
<a href="https://github.com/prasad-0007">
625637
<img src="https://github.com/prasad-0007.png?size=100" width="100" height="100" style="border-radius:50%; border:2px solid #555;" alt="prasad-0007" /><br />
@@ -644,6 +656,8 @@ python-mini-project/
644656
<sub><b>@rashiaggarwal06</b></sub>
645657
</a>
646658
</td>
659+
</tr>
660+
<tr>
647661
<td align="center" width="120">
648662
<a href="https://github.com/rishit537">
649663
<img src="https://github.com/rishit537.png?size=100" width="100" height="100" style="border-radius:50%; border:2px solid #555;" alt="rishit537" /><br />
@@ -656,8 +670,12 @@ python-mini-project/
656670
<sub><b>@sakshicoded1111</b></sub>
657671
</a>
658672
</td>
659-
</tr>
660-
<tr>
673+
<td align="center" width="120">
674+
<a href="https://github.com/samarthchawla2005">
675+
<img src="https://github.com/samarthchawla2005.png?size=100" width="100" height="100" style="border-radius:50%; border:2px solid #555;" alt="samarthchawla2005" /><br />
676+
<sub><b>@samarthchawla2005</b></sub>
677+
</a>
678+
</td>
661679
<td align="center" width="120">
662680
<a href="https://github.com/sanzzzz-g">
663681
<img src="https://github.com/sanzzzz-g.png?size=100" width="100" height="100" style="border-radius:50%; border:2px solid #555;" alt="sanzzzz-g" /><br />
@@ -676,6 +694,8 @@ python-mini-project/
676694
<sub><b>@shimonenator</b></sub>
677695
</a>
678696
</td>
697+
</tr>
698+
<tr>
679699
<td align="center" width="120">
680700
<a href="https://github.com/shreyasarote7717-cyber">
681701
<img src="https://github.com/shreyasarote7717-cyber.png?size=100" width="100" height="100" style="border-radius:50%; border:2px solid #555;" alt="shreyasarote7717-cyber" /><br />
@@ -694,8 +714,6 @@ python-mini-project/
694714
<sub><b>@siri-004</b></sub>
695715
</a>
696716
</td>
697-
</tr>
698-
<tr>
699717
<td align="center" width="120">
700718
<a href="https://github.com/snehacodes-2906">
701719
<img src="https://github.com/snehacodes-2906.png?size=100" width="100" height="100" style="border-radius:50%; border:2px solid #555;" alt="snehacodes-2906" /><br />
@@ -714,6 +732,8 @@ python-mini-project/
714732
<sub><b>@steam-bell-92</b></sub>
715733
</a>
716734
</td>
735+
</tr>
736+
<tr>
717737
<td align="center" width="120">
718738
<a href="https://github.com/sujitsingh8">
719739
<img src="https://github.com/sujitsingh8.png?size=100" width="100" height="100" style="border-radius:50%; border:2px solid #555;" alt="sujitsingh8" /><br />
@@ -732,8 +752,6 @@ python-mini-project/
732752
<sub><b>@twinkle0tech</b></sub>
733753
</a>
734754
</td>
735-
</tr>
736-
<tr>
737755
<td align="center" width="120">
738756
<a href="https://github.com/vedansht2211">
739757
<img src="https://github.com/vedansht2211.png?size=100" width="100" height="100" style="border-radius:50%; border:2px solid #555;" alt="vedansht2211" /><br />
@@ -752,6 +770,8 @@ python-mini-project/
752770
<sub><b>@vedikabajaj05</b></sub>
753771
</a>
754772
</td>
773+
</tr>
774+
<tr>
755775
<td align="center" width="120">
756776
<a href="https://github.com/vivekCS007">
757777
<img src="https://github.com/vivekCS007.png?size=100" width="100" height="100" style="border-radius:50%; border:2px solid #555;" alt="vivekCS007" /><br />
@@ -765,6 +785,9 @@ python-mini-project/
765785
</a>
766786
</td>
767787
<td width="120"></td>
788+
<td width="120"></td>
789+
<td width="120"></td>
790+
<td width="120"></td>
768791
</tr>
769792
</table>
770793
<!-- CONTRIBUTORS_END -->

games/Dots-Boxes-AI/Dots-Boxes-AI.py

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# Title
1515
print(BOLD + CYAN)
1616
print("=" * 70)
17-
print("🔲 DOTS & BOXES AI - ADVANCED VERSION 🔲")
17+
print("🔲 DOTS & BOXES AI - ADVANCED VERSION 🔲")
1818
print("=" * 70)
1919
print(RESET)
2020

@@ -266,32 +266,33 @@ def ai_move():
266266
print(RED + "❌ Invalid direction!" + RESET)
267267
continue
268268

269-
row = input("📍 Enter row: ")
270-
col = input("📍 Enter column: ")
269+
row_in = input("📍 Enter row: ")
270+
col_in = input("📍 Enter column: ")
271271

272-
if not row.isdigit() or not col.isdigit():
273-
print(RED + "❌ Invalid position!" + RESET)
272+
# Check if empty, or starts with a negative sign, or isn't numeric
273+
if not row_in.strip() or not col_in.strip() or '-' in row_in or '-' in col_in or not row_in.isdigit() or not col_in.isdigit():
274+
print(RED + "❌ Invalid input! Rows and columns must be positive numbers." + RESET)
274275
continue
275276

276-
row, col = int(row), int(col)
277+
row, col = int(row_in), int(col_in)
277278

278-
try:
279-
if direction == 'h':
280-
if horizontal_lines[row][col]:
281-
print(YELLOW + "⚠️ Line already taken!" + RESET)
282-
continue
283-
horizontal_lines[row][col] = True
284-
else:
285-
if vertical_lines[row][col]:
286-
print(YELLOW + "⚠️ Line already taken!" + RESET)
287-
continue
288-
vertical_lines[row][col] = True
289-
except IndexError:
290-
print(RED + "❌ Position out of range!" + RESET)
291-
continue
292-
except ValueError:
293-
print(RED + "❌ Invalid input!" + RESET)
294-
continue
279+
# Explicit Boundaries Check Before Modifying Array
280+
if direction == 'h':
281+
if row < 0 or row >= (size + 1) or col < 0 or col >= size:
282+
print(RED + f"❌ Position out of range! For 'h', Row must be 0-{size} and Col must be 0-{size-1}." + RESET)
283+
continue
284+
if horizontal_lines[row][col]:
285+
print(YELLOW + "⚠️ Line already taken!" + RESET)
286+
continue
287+
horizontal_lines[row][col] = True
288+
else:
289+
if row < 0 or row >= size or col < 0 or col >= (size + 1):
290+
print(RED + f"❌ Position out of range! For 'v', Row must be 0-{size-1} and Col must be 0-{size}." + RESET)
291+
continue
292+
if vertical_lines[row][col]:
293+
print(YELLOW + "⚠️ Line already taken!" + RESET)
294+
continue
295+
vertical_lines[row][col] = True
295296

296297
symbol = 'P' if current_player == 1 else 'A'
297298
got_box = check_boxes(symbol)

0 commit comments

Comments
 (0)