()
| 454 | |
| 455 | # ---- Setup Game ---- # |
| 456 | def setup_game(): |
| 457 | os.system('clear') |
| 458 | |
| 459 | # Name Input |
| 460 | Q1 = "Are you new here?\nWhat is your name? 🤖" |
| 461 | # Printing the question character by character |
| 462 | for char in Q1: |
| 463 | if char == " ": |
| 464 | sys.stdout.write(char) |
| 465 | sys.stdout.flush() |
| 466 | time.sleep(0.07) |
| 467 | else: |
| 468 | sys.stdout.write(char) |
| 469 | sys.stdout.flush() |
| 470 | time.sleep(0.05) |
| 471 | |
| 472 | player_name = input("\n> ") |
| 473 | |
| 474 | # Name Validation |
| 475 | if len(player_name) < 3: |
| 476 | print("\nYour name is too short.\nPlease enter a valid name. ⚠️\n") |
| 477 | setup_game() |
| 478 | |
| 479 | player.name = player_name |
| 480 | |
| 481 | # Username Input |
| 482 | Q2 = "\nWhat should we call you Cheif? 💬" |
| 483 | # Printing the question character by character |
| 484 | for char in Q2: |
| 485 | if char == " ": |
| 486 | sys.stdout.write(char) |
| 487 | sys.stdout.flush() |
| 488 | time.sleep(0.07) |
| 489 | else: |
| 490 | sys.stdout.write(char) |
| 491 | sys.stdout.flush() |
| 492 | time.sleep(0.05) |
| 493 | |
| 494 | player_username = input("\n> ") |
| 495 | |
| 496 | # Username Validation |
| 497 | if(len(player_username) < 3): |
| 498 | shortUsrname = "\nYour username is too short.\nPlease enter a valid username. ⚠️\n" |
| 499 | |
| 500 | for char in shortUsrname: |
| 501 | if char == " ": |
| 502 | sys.stdout.write(char) |
| 503 | sys.stdout.flush() |
| 504 | time.sleep(0.03) |
| 505 | else: |
| 506 | sys.stdout.write(char) |
| 507 | sys.stdout.flush() |
| 508 | time.sleep(0.02) |
| 509 | |
| 510 | # wait for user to press enter |
| 511 | print("\nPress any key on the keyboard to continue. ") |
| 512 | input("\n> ") |
| 513 |
no test coverage detected