Skip to content

Commit 7c35b39

Browse files
committed
intial commit
1 parent 0ab9d8f commit 7c35b39

File tree

2 files changed

+44
-1
lines changed

2 files changed

+44
-1
lines changed

bagels.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def main():
3434
numGuesses = 1
3535
while numGuesses <= MAX_GUESSES:
3636
guess = ''
37-
#keep ;ooking until they enter a valid guess:
37+
#keep looking until they enter a valid guess:
3838
while len(guess) != NUM_DIGITS or not guess.isdecimal():
3939
print('Guess #{}: '.format(numGuesses))
4040
guess = input('>')

carrot_in_box.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
"""Carrot in a Box, Alsweigart al@invent with python.com
2+
A silly bluffing game between two human players. Based on the game
3+
from the show 8 Out of 10 Cats.
4+
View this code at https://nostarch.com/big-book-small-python-projects
5+
Tags: large beginner, game, two-player"""
6+
7+
import random
8+
9+
print('''Carrot in a Box, by Al Sweigart [email protected]
10+
11+
This is a bluffing game for two human players. Each player has a box.
12+
One box has a carrot in it. To win, you must have the box with the
13+
carrot in it.
14+
15+
This is a very simple and silly game.
16+
17+
The first player lok into their box (the second player must close
18+
their eye during this). The first player then says "There is a carrot
19+
in my box" or "There is not a carrot in my box". The second player then
20+
gets to decide if theu want to swap boxes or not.
21+
''')
22+
input('Press Enter to begin...')
23+
24+
25+
p1Name = input('Human player 1, enter your name: ')
26+
p2Name = input('Human player2, enter your name: ')
27+
playerNames = p1Name[:11].center(11) + ' ' + p2Name[:11].center(11)
28+
29+
print(''' HERE ARE TWO BOXES:
30+
31+
+--------------+ +--------------+
32+
/| /| /| /|
33+
/ | / | / | / |
34+
*--+-----------* | *--+-----------* |
35+
| | | | | | | |
36+
| | | | | | | |
37+
| | | | | | | |
38+
| +-----------+--+ | +-----------+--+
39+
| / | / | / | /
40+
|/ |/ |/ |/
41+
*--------------* *--------------*
42+
43+
''')

0 commit comments

Comments
 (0)