Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
337 commits
Select commit Hold shift + click to select a range
b9e9364
Translation to Polish, chapter 6, some new paragraphs
Jan 14, 2015
74b0f9e
Merge remote-tracking branch 'upstream/master'
Jan 14, 2015
852f902
Fixing a few typos in the Spanish and English chapters.
asweigart Jan 14, 2015
97b5910
Typo corrections in Spanish files.
asweigart Jan 16, 2015
7a61a1d
Translated es_chapter17.figures.txt. Partial translation of es_chapte…
alfredocarella Jan 16, 2015
418d200
Spanish translation corrections.
asweigart Jan 17, 2015
5c5fc56
Translation correction
asweigart Jan 17, 2015
8d435e8
Fixing spanish translation issues
asweigart Jan 17, 2015
a823a37
typos
asweigart Jan 17, 2015
4174335
Spanish typo correction
asweigart Jan 17, 2015
bdf3b52
Spanish typo corrections in chapter 10
asweigart Jan 18, 2015
4bf83ec
Chapter 9 translated into German.
denniskb Jan 18, 2015
3091b77
Merge branch 'dennis'
denniskb Jan 18, 2015
5badac8
Merge branch 'master' of https://github.com/asweigart/inventwithpytho…
denniskb Jan 18, 2015
7d8aca2
Chapter 9 translated into German.
denniskb Jan 18, 2015
687a985
Merge pull request #81 from denniskb/master
asweigart Jan 19, 2015
4b28153
Spanish typo corrections
asweigart Jan 19, 2015
611a977
Spanish typos
asweigart Jan 19, 2015
cff380e
Finished translating Chapter 6 to Polish
Jan 21, 2015
e0d7b91
Merge remote-tracking branch 'upstream/master'
Jan 21, 2015
eeb931c
Fixed typo
Jan 21, 2015
f1fa9dd
Little corrections
Jan 21, 2015
d0e9f1c
Merge pull request #82 from michal-niklas/master
asweigart Jan 22, 2015
1ab130f
Partial translation of chapter 17 (up to line 160)
alfredocarella Jan 22, 2015
c6b4002
Deleted Translator 'Christian von Aster', this is an artifact of my G…
schmittens Jan 25, 2015
b4b4e1d
Updated README.md with comments for Chapter 7 and revised Chapter 7. …
schmittens Jan 25, 2015
3bb7887
Merge branch 'master' of https://github.com/asweigart/inventwithpytho…
denniskb Jan 26, 2015
21cd12f
Removed temporary file.
denniskb Jan 28, 2015
adb269f
German translation of tictactoe source code
kikithegecko Jan 28, 2015
6e2db23
Added myself to translatos as well as some opinions.
kikithegecko Jan 28, 2015
61732ee
Another comment in the Readme regarding wording.
kikithegecko Jan 29, 2015
72ea5c4
Started translating chapter 10
kikithegecko Jan 29, 2015
1552c60
Chapter 7 done
dfleury2 Jan 29, 2015
8d5dae9
Chapter 7 done - adds bogue.py
dfleury2 Jan 29, 2015
a5d2d48
Merge pull request #83 from dfleury2/master
asweigart Jan 29, 2015
764a51f
Started translating chapter 9.5
aleperno Feb 6, 2015
a543482
Partial translation of chapter 17 (up to line 261)
alfredocarella Feb 6, 2015
5f67a0c
Merge branch 'master' of https://github.com/asweigart/inventwithpytho…
denniskb Feb 7, 2015
ce67a13
Partial translation of chapter 17 (up to line 366). Corrected a typo …
alfredocarella Feb 8, 2015
4d346a9
Edit Chapter 1 of Chinese translation according to the final draft
Feb 8, 2015
35deff8
Edit chapter 2 of Chinese translation according to the final draft
Feb 8, 2015
84d9d0d
Partial translation of chapter 17 (up to line 528). Corrected typos i…
alfredocarella Feb 8, 2015
4240071
Merge pull request #84 from 7bitex/master
asweigart Feb 8, 2015
3d86559
Finished Spanish translation for chapter 17
alfredocarella Feb 9, 2015
78a5b59
Merge https://github.com/asweigart/inventwithpython3rded
alfredocarella Feb 9, 2015
55883bc
Merge pull request #85 from alfredocarella/master
asweigart Feb 9, 2015
06d7b99
Merge branch 'al'
aleperno Feb 10, 2015
01b79de
Finished translating chapter 9.5
aleperno Feb 10, 2015
2577703
Removed un translated 9.5 chapter.
aleperno Feb 10, 2015
8d8001e
Translated figures file name
aleperno Feb 10, 2015
c0e6411
Modified some terms to comply with Alfredo's translations.
aleperno Feb 10, 2015
39223c2
Merge pull request #86 from aleperno/master
asweigart Feb 10, 2015
30eaa83
Translated chapter 12
aleperno Feb 11, 2015
0eb66b9
Merge pull request #87 from aleperno/master
asweigart Feb 11, 2015
ac01e79
Merge branch 'master' of https://github.com/asweigart/inventwithpytho…
denniskb Feb 12, 2015
8a43ac9
Updated spanish chapter 12, removed the english files from the es fol…
asweigart Feb 13, 2015
f153860
Fixing untranslated section title.
asweigart Feb 15, 2015
31187de
Adding German chapter 8. Thanks Frank!
asweigart Feb 16, 2015
f1fb6c2
Partial translation of Chapter 18 (up to line 156). Correction of typ…
alfredocarella Feb 16, 2015
62e0f94
Partial translation of Chapter 18 (up to line 303). Correction of typ…
alfredocarella Feb 17, 2015
e373401
Continued translating chapter 10 (to German)
kikithegecko Feb 17, 2015
045148f
Merge branch 'master' of https://github.com/asweigart/inventwithpytho…
denniskb Feb 18, 2015
1b0b4ec
Partial translation of Chapter 18 (up to line 448). Correction of one…
alfredocarella Feb 18, 2015
46f0650
Partial translation of Chapter 18 (up to line 500). Correction of one…
alfredocarella Feb 19, 2015
156126c
Edited Chapter 3 to fit the final draft
Feb 20, 2015
3b048de
Merge pull request #88 from 7bitex/master
asweigart Feb 20, 2015
a22bebe
Minor quotation fix.
asweigart Feb 20, 2015
f8c3cd0
Finished Spanish translation of Chapter 18. Correction of small typos…
alfredocarella Feb 21, 2015
1bbc85b
Merge https://github.com/asweigart/inventwithpython3rded
alfredocarella Feb 21, 2015
4915d7e
Partial translation of Chapter 19 (up to line 25).
alfredocarella Feb 22, 2015
8b4f8e7
Merge branch 'master' of https://github.com/asweigart/inventwithpytho…
denniskb Feb 22, 2015
b6d7b7c
Merge pull request #89 from alfredocarella/master
asweigart Feb 22, 2015
0003a1d
Partial translation of Chapter 19 (up to line 175).
alfredocarella Feb 23, 2015
683bbe8
Partial translation of Chapter 19 (up to line 239).
alfredocarella Feb 24, 2015
f0ff4ad
continued translating chapter 10 to German
kikithegecko Feb 24, 2015
7120f05
Chapter 19 translated to Spanish.
alfredocarella Feb 25, 2015
26b9f9c
Merge https://github.com/asweigart/inventwithpython3rded
alfredocarella Feb 25, 2015
f74734d
Merge pull request #90 from alfredocarella/master
asweigart Feb 25, 2015
e2e5190
First paragraphs of chapter 7
Feb 25, 2015
d22743d
Merge branch 'master' of https://github.com/asweigart/inventwithpytho…
denniskb Feb 25, 2015
a937f3d
Partial translation of Chapter 20 (up to line 22). Minor corrections …
alfredocarella Feb 26, 2015
59bfa3e
Fixes for the German chapter 1 and Polish Chapters 1 and 2.
asweigart Feb 28, 2015
9649566
Merge branch 'master' of github.com:asweigart/inventwithpython3rded
asweigart Feb 28, 2015
70ea072
Partial translation of Chapter 20 (up to line 235).
alfredocarella Feb 28, 2015
14f73e2
Merge branch 'master' of https://github.com/asweigart/inventwithpytho…
denniskb Mar 1, 2015
2e54e9d
Merge pull request #91 from denniskb/master
asweigart Mar 3, 2015
6bb1b00
Merge remote-tracking branch 'upstream/master'
Mar 3, 2015
3b71ffc
Chapter 7, new paragraphs in Polish
Mar 3, 2015
74a05ce
Partial translation of Chapter 20 (up to line 301).
alfredocarella Mar 4, 2015
6f89579
Partial translation of Chapter 20 (up to line 339).
alfredocarella Mar 5, 2015
df23e36
Partial translation of Chapter 20 (up to line 387).
alfredocarella Mar 6, 2015
c5715b7
Partial translation of Chapter 20 (up to line 450).
alfredocarella Mar 7, 2015
a33737a
Partial translation of Chapter 20 (up to line 500).
alfredocarella Mar 8, 2015
bdd529f
Partial translation of Chapter 20 (up to line 551).
alfredocarella Mar 9, 2015
00fb03c
Partial translation of Chapter 20 (up to line 601).
alfredocarella Mar 10, 2015
e02ac00
Partial translation of Chapter 20 (up to line 651).
alfredocarella Mar 11, 2015
068559c
Partial translation of Chapter 20 (up to line 711).
alfredocarella Mar 12, 2015
df82061
Partial translation of Chapter 20 (up to line 750).
alfredocarella Mar 12, 2015
872c701
Translated Chapter 20 to Spanish.
alfredocarella Mar 13, 2015
2bf9821
Merge https://github.com/asweigart/inventwithpython3rded
alfredocarella Mar 13, 2015
6d85f22
Updated list of German translators.
denniskb Mar 13, 2015
2fa6841
Update title of German translation.
denniskb Mar 13, 2015
59b2172
Added glossary to German readme file.
denniskb Mar 13, 2015
9503338
Updated the list of difficult to translate terms.
denniskb Mar 13, 2015
bb76ae4
Reviewed chapter 9.
denniskb Mar 13, 2015
db482d0
Merge branch 'dennis'
denniskb Mar 13, 2015
95e2dbc
Merge pull request #92 from alfredocarella/master
asweigart Mar 13, 2015
49ae716
Reviewed chapter 1.
denniskb Mar 14, 2015
099785b
Added terms to the glossary.
denniskb Mar 14, 2015
b0d7a56
Reviewed chapter 5.
denniskb Mar 14, 2015
3e4110d
Updated glossry.
denniskb Mar 14, 2015
5c6972e
Reviewed chapter 6.
denniskb Mar 14, 2015
b5f7380
Merge pull request #93 from denniskb/master
asweigart Mar 14, 2015
0237907
Partial translation of Chapter 14 (up to line 30).
alfredocarella Mar 14, 2015
1a5c0ac
Partial translation of Chapter 14 (up to line 38).
alfredocarella Mar 15, 2015
f3b337c
Partial translation of Chapter 14 (up to line 96).
alfredocarella Mar 16, 2015
4589f84
Merge remote-tracking branch 'upstream/master'
Mar 16, 2015
e5abfdb
New paragraphs of Polish chapter 7
Mar 16, 2015
cb0d525
Partial translation of Chapter 14 (up to line 219). Small corrections…
alfredocarella Mar 17, 2015
f164252
Partial translation of Chapter 14 (up to line 268).
alfredocarella Mar 18, 2015
a6dd3d0
Partial translation of Chapter 14 (up to line 317). Small corrections…
alfredocarella Mar 19, 2015
c0c2b33
Partial translation of Chapter 14 (up to line 375). Typo correction o…
alfredocarella Mar 20, 2015
da9bdb1
Partial translation of Chapter 14 (up to line 466).
alfredocarella Mar 21, 2015
40255f1
Translated Chapter 14 to Spanish.
alfredocarella Mar 22, 2015
91bfc23
Merge https://github.com/asweigart/inventwithpython3rded
alfredocarella Mar 22, 2015
2ad18e7
Partial translation of chapter 15 to Spanish (up to line 149). Correc…
alfredocarella Mar 23, 2015
6795333
Merge pull request #94 from alfredocarella/master
asweigart Mar 24, 2015
4d0eebb
Merge remote-tracking branch 'upstream/master'
Mar 24, 2015
67df2eb
Partial translation of chapter 15 to Spanish (up to line 194). Correc…
alfredocarella Mar 24, 2015
90d45e4
Partial translation of chapter 15 to Spanish (up to line 250).
alfredocarella Mar 24, 2015
33f751f
Started chapter 13 spanish translation
aleperno Mar 24, 2015
024c2be
Merge branch 'al'
aleperno Mar 24, 2015
3f2e76b
Continued chapter 13 translation
aleperno Mar 24, 2015
605d244
Partial translation of chapter 15 to Spanish (up to line 503).
alfredocarella Mar 25, 2015
22d075a
Partial translation of chapter 15 to Spanish (up to line 552).
alfredocarella Mar 26, 2015
c493433
Polish translation: some new paragraphs of chapter 7
Mar 26, 2015
d25dac8
Partial translation of chapter 15 to Spanish (up to line 608).
alfredocarella Mar 27, 2015
fbd1cee
Polish translation: some new paragraphs of chapter 7
Mar 27, 2015
8051aa9
Partial translation of chapter 15 to Spanish (up to line 658).
alfredocarella Mar 28, 2015
af9569d
Partial translation of chapter 15 to Spanish (up to line 717).
alfredocarella Mar 28, 2015
05896e7
Partial translation of chapter 15 to Spanish (up to line 766).
alfredocarella Mar 30, 2015
a9077bb
Partial translation of chapter 15 to Spanish (up to line 823).
alfredocarella Mar 31, 2015
d11462c
Translation adapted to revised text.
matsrorbecker Mar 31, 2015
29f2016
Partial translation of chapter 15 to Spanish (up to line 872).
alfredocarella Apr 1, 2015
2b0f6c2
Translated to Swedish.
matsrorbecker Apr 1, 2015
85feed1
Started translating.
matsrorbecker Apr 1, 2015
0bcc5f9
Chapter 4 partially translated.
matsrorbecker Apr 1, 2015
d959ffd
Partial translation of chapter 15 to Spanish (up to line 920).
alfredocarella Apr 1, 2015
3bd6e30
Partial translation of chapter 15 to Spanish (up to line 974).
alfredocarella Apr 2, 2015
c5ecb68
Partial translation of chapter 15 to Spanish (up to line 1035).
alfredocarella Apr 3, 2015
c0474ca
Translated to Swedish.
matsrorbecker Apr 4, 2015
3fc03a3
Merge pull request #95 from matsrorbecker/sv
asweigart Apr 5, 2015
a5dbb4e
Partial translation of chapter 15 to Spanish (up to line 1086).
alfredocarella Apr 5, 2015
410cb7a
Partial translation of chapter 15 to Spanish (up to line 1139).
alfredocarella Apr 6, 2015
635e343
Updated glossary.
denniskb Apr 6, 2015
1fcb30f
Reviewed chapter 4.
denniskb Apr 6, 2015
200a41a
Merge pull request #99 from denniskb/master
asweigart Apr 7, 2015
d99d1f6
Finished translation of chapter 15 to Spanish.
alfredocarella Apr 7, 2015
35e2c29
Merge https://github.com/asweigart/inventwithpython3rded
alfredocarella Apr 7, 2015
34443b6
Started translation of chapter 16 to Spanish.
alfredocarella Apr 7, 2015
2d61e02
Updated glossary.
denniskb Apr 7, 2015
6734c26
Corrected spelling.
denniskb Apr 7, 2015
4021321
Reviewed chapter 7.
denniskb Apr 7, 2015
2c86029
Merge branch 'master' of https://github.com/asweigart/inventwithpytho…
denniskb Apr 7, 2015
84b90b4
Merge pull request #101 from denniskb/master
asweigart Apr 8, 2015
8acb8ab
Merge pull request #100 from alfredocarella/master
asweigart Apr 8, 2015
65a91bc
Partial translation of chapter 16 to Spanish (up to line 68).
alfredocarella Apr 8, 2015
41ac615
Partial translation of chapter 16 to Spanish (up to line 110). Correc…
alfredocarella Apr 9, 2015
5b8312a
Partial translation of chapter 16 to Spanish (up to line 161). Correc…
alfredocarella Apr 10, 2015
2f9a4e6
Partial translation of chapter 16 to Spanish (up to line 210). Correc…
alfredocarella Apr 11, 2015
71bc710
Partial translation of chapter 16 to Spanish (up to line 262).
alfredocarella Apr 12, 2015
4c196e2
Partial translation of chapter 16 to Spanish (up to line 352).
alfredocarella Apr 13, 2015
f86f833
Updated german glossary.
denniskb Apr 13, 2015
8803caf
Merge branch 'master' of https://github.com/asweigart/inventwithpytho…
denniskb Apr 13, 2015
b9ea24f
Updated german glossary.
denniskb Apr 13, 2015
03fc451
Reviewed German, chapter 8.
denniskb Apr 13, 2015
4e2cb82
Merge pull request #102 from denniskb/master
asweigart Apr 13, 2015
935e6c6
Finished Chapter 13 translation to Spanish
aleperno Apr 14, 2015
2510f9d
Merge branch 'al'
aleperno Apr 14, 2015
703eb79
Partial translation of chapter 16 to Spanish (up to line 403).
alfredocarella Apr 14, 2015
53470ca
Merge pull request #103 from aleperno/master
asweigart Apr 14, 2015
1acd040
Partial translation of chapter 16 to Spanish (up to line 451).
alfredocarella Apr 15, 2015
ad2ac66
Merge remote-tracking branch 'upstream/master'
Apr 15, 2015
c29c89b
Polish translation: some new paragraphs of chapter 7
Apr 15, 2015
100ab49
Finished translation of Chapter 16 to Spanish
alfredocarella Apr 16, 2015
62e6122
Merge https://github.com/asweigart/inventwithpython3rded
alfredocarella Apr 16, 2015
78c3dde
Merge pull request #104 from alfredocarella/master
asweigart Apr 16, 2015
df99782
Polish translation: finished chapter 7
Apr 17, 2015
92447b2
Merge remote-tracking branch 'upstream/master'
Apr 17, 2015
f1ea6ab
Merge pull request #105 from michal-niklas/master
asweigart Apr 17, 2015
d13fcf9
Fixing various typos in the spanish translation.
asweigart Apr 18, 2015
912caf8
Merge pull request #2 from asweigart/master
map0logo Apr 18, 2015
e918721
More spanish translation typo fixes
asweigart Apr 19, 2015
aa0aad5
Spanish typo fixes
asweigart Apr 19, 2015
9743588
Añadir capitulo 9 - figuras
map0logo Apr 19, 2015
e8c753b
Añadir capitulo 9 - traducción de las secciones Código Fuente, Cómo f…
map0logo Apr 19, 2015
76f11cb
Typo corrections.
asweigart Apr 19, 2015
eaa544b
Traducción de las secciones Variables Constantes y Listas
map0logo Apr 20, 2015
55bb54f
Traducción de las secciones Índices, IndexError y Concatenación de li…
map0logo Apr 22, 2015
67a20c0
Traducción de las secciones Operador in y Lista de Listas
map0logo Apr 24, 2015
7145af9
Traducción de la sección métodos
map0logo Apr 25, 2015
9a4cdb5
Rename to add accent mark
asweigart Apr 26, 2015
985b7dd
Spanish typo corrections.
asweigart Apr 26, 2015
03c8dd8
Updated german glossary.
Apr 28, 2015
cc9c577
Reviewed partial german translation of chapter 10.
denniskb Apr 28, 2015
a14c8bf
Create chap 12
AnyColourYouLike Apr 29, 2015
5dc60fc
Create chap 1
AnyColourYouLike Apr 29, 2015
653eccb
Merge pull request #107 from AnyColourYouLike/patch-3
asweigart Apr 30, 2015
21eacd5
Merge pull request #106 from AnyColourYouLike/patch-2
asweigart Apr 30, 2015
714ebcc
Create chap 13
AnyColourYouLike Apr 30, 2015
241663b
Create exemplo 01.txt
AnyColourYouLike Apr 30, 2015
6957b43
Create fullSourceCode.txt
AnyColourYouLike Apr 30, 2015
2608038
Merge pull request #111 from AnyColourYouLike/patch-6
asweigart May 1, 2015
7100bc9
Merge pull request #110 from AnyColourYouLike/patch-5
asweigart May 1, 2015
c4d0d09
Merge pull request #109 from AnyColourYouLike/patch-4
asweigart May 1, 2015
ec97ba2
Fixed issue #114. Thanks Dennis!
asweigart May 5, 2015
001022b
Merge branch 'master' of github.com:asweigart/inventwithpython3rded
asweigart May 5, 2015
da21113
Started working on Chapter 11
schmittens May 7, 2015
6615017
Translating list methods section.
map0logo May 8, 2015
51f2b6a
Update on Chapter 11
schmittens May 13, 2015
0f8e5bf
El método split()
map0logo May 26, 2015
a5ab2e4
Secciones Como funciona el código, funciones range() y list(), los bu…
map0logo May 27, 2015
a0c374e
Correcting some Spanish typos.
asweigart May 27, 2015
ce6f8be
Merge pull request #115 from map0logo/master
asweigart May 28, 2015
5065879
Merge branch 'master' of github.com:asweigart/inventwithpython3rded
asweigart May 28, 2015
43f07de
Desde la línea 646 hasta el final!
map0logo May 30, 2015
80666e6
Typo corrections to spanish chapter 9
asweigart May 30, 2015
4d23253
Merge pull request #116 from map0logo/master
asweigart May 31, 2015
9250986
Merge branch 'master' of github.com:asweigart/inventwithpython3rded
asweigart May 31, 2015
34499de
Adding the original Word files.
asweigart Jun 12, 2015
4cdd7a8
Renaming Spanish chapter 9 files.
asweigart Jun 15, 2015
3e3d769
Spanish chapter 9 typo fixes.
asweigart Jun 16, 2015
8830d16
Pygame's pygame.mixer.music.load() function can't handle unicdoe file…
asweigart Jun 17, 2015
e88766a
Chapter 6 translated to Swedish
matsrorbecker Jun 3, 2015
8921a47
Translated some figure texts to Swedish
matsrorbecker Jun 3, 2015
d71594e
Chapter 5 translated to Swedish.
matsrorbecker Jun 4, 2015
8afc6ab
Fixed some typos in chapters 1-6
matsrorbecker Jun 4, 2015
555c70b
Started translating chapter 7 to Swedish
matsrorbecker Jun 9, 2015
082d1d7
Updated Swedish translation of Chapter 2.
jmalm Nov 17, 2014
3e44a4e
Translation of chapter 2 adapted to revised text
matsrorbecker Jun 13, 2015
75786d6
Parts of chapter 7 translated to Swedish
matsrorbecker Jun 14, 2015
606ffae
Chapter 7 translated to Swedish
matsrorbecker Jun 19, 2015
ecabc1e
Merge pull request #117 from matsrorbecker/sv
asweigart Jun 19, 2015
8966d2d
Merge branch 'master' of github.com:asweigart/inventwithpython3rded
asweigart Aug 23, 2015
68da7cd
Adding the Word docx for the Spanish translation.
asweigart Aug 24, 2015
d8076d0
Updates to spanish doc
asweigart Aug 26, 2015
b766346
Chapter 4 translated to Chinese, and some modifications to the format
beta Oct 13, 2015
2cb423d
Name changed :)
beta Oct 13, 2015
a7bf671
Merge pull request #118 from beta/master
asweigart Oct 13, 2015
cbbc5ec
Merge branch 'master' of github.com:denniskb/inventwithpython3rded
denniskb Mar 23, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,13 @@ Special Thanks

Here is an inevitably incomplete list of MUCH-APPRECIATED CONTRIBUTORS -- people who have submitted patches, reported bugs, added translations, helped answer newbie questions, and generally made Invent Your Own Computer Games with Python that much better:

**Dutch Translation:**

- Marjo Hanh

**Simplified Chinese Translation:**

- Bitex Kuang https://github.com/7bitex
- Beta Kuang https://github.com/beta

**French Translation:**

Expand Down
2 changes: 1 addition & 1 deletion src/AISim3.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ def getRandomMove(board, tile):


def isOnSide(x, y):
return x == 0 or x == 7 or y == 0 or y ==7
return x == 0 or x == 7 or y == 0 or y == 7


def getCornerSideBestMove(board, tile):
Expand Down
Binary file added text/c0.docx
Binary file not shown.
Binary file added text/c1.docx
Binary file not shown.
Binary file added text/c10.docx
Binary file not shown.
Binary file added text/c11.docx
Binary file not shown.
Binary file added text/c12.docx
Binary file not shown.
Binary file added text/c13.docx
Binary file not shown.
Binary file added text/c14.docx
Binary file not shown.
Binary file added text/c15.docx
Binary file not shown.
Binary file added text/c16.docx
Binary file not shown.
Binary file added text/c17.docx
Binary file not shown.
Binary file added text/c18.docx
Binary file not shown.
Binary file added text/c19.docx
Binary file not shown.
Binary file added text/c2.docx
Binary file not shown.
Binary file added text/c20.docx
Binary file not shown.
Binary file added text/c3.docx
Binary file not shown.
Binary file added text/c4.docx
Binary file not shown.
Binary file added text/c5.docx
Binary file not shown.
Binary file added text/c6.docx
Binary file not shown.
Binary file added text/c7.docx
Binary file not shown.
Binary file added text/c8.docx
Binary file not shown.
Binary file added text/c9.5.docx
Binary file not shown.
Binary file added text/c9.docx
Binary file not shown.
2 changes: 1 addition & 1 deletion text/chapter10.txt
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ True or <<<anything>>> always evaluates to True

So Python stops checking the rest of the expression and doesn’t even bother evaluating the not isSpaceFree(board, int(move)) part. This means the int() and the isSpaceFree() functions are never called as long as move not in '1 2 3 4 5 6 7 8 9'.split() is True.

This works out well for the program, because if the right side is True then move isn’t a string in number form. That would cause int() to give us an error. The only times move not in '1 2 3 4 5 6 7 8 9'.split() evaluates to False are when move isn’t a single-digit string. In that case, the call to int() would not give us an error.
This works out well for the program, because if the left side is True then move isn’t a string in number form. That would cause int() to give us an error. The only times move not in '1 2 3 4 5 6 7 8 9'.split() evaluates to False are when move isn’t a single-digit string. In that case, the call to int() would not give us an error.

An Example of Short-Circuit Evaluation

Expand Down
6 changes: 3 additions & 3 deletions text/chapter14.txt
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ The getMode() function will let the user type in if they want encryption or decr

This list is ['encrypt', 'e', 'decrypt', 'd'], but it is easier for the programmer to type 'encrypt e decrypt d'.split() and not type in all those quotes and commas. Use whichever is easiest for you; they both evaluate to the same list value.

This function will return the first character in mode as long as mode is equal to 'encrypt', 'e', 'decrypt', or 'd'. Therefore, getMode() will return the string 'e' or the string 'd' (but the user can type in either “e”, “encrypt”, “d”, or “decrypt”.)
This function will return the string in mode as long as mode is equal to 'encrypt', 'e', 'decrypt', or 'd'. Therefore, getMode() will return the string 'e' or the string 'd' (but the user can type in either “e”, “encrypt”, “d”, or “decrypt”.)

Getting the Message from the Player

Expand Down Expand Up @@ -368,7 +368,7 @@ In decrypting mode, then key would be negative. The special case would be where

Line 47 concatenates the encrypted/decrypted character to the translated string.

If the symbol was not an uppercase or lowercase letter, then line 48 concatenates the original symbol to the translated string. Therefore, spaces, numbers, punctuation marks, and other characters won’t be encrypted or decrypted.
If the symbol was not an uppercase or lowercase letter, then line 49 concatenates the original symbol to the translated string. Therefore, spaces, numbers, punctuation marks, and other characters won’t be encrypted or decrypted.

50. return translated

Expand Down Expand Up @@ -430,7 +430,7 @@ This code will let the user select “brute force” as a mode. Modify and add t

These changes ask the user for a key if they are not in “brute force” mode. The original getTranslatedMessage() call is made and the translated string is printed.

However, if the user is in “brute force” mode then getTranslatedMessage() loop that iterates from 1 all the way up to MAX_KEY_SIZE (which is 26). Remember that when the range() function returns a list of integers up to, but not including, the second parameter, which is why you have + 1. This program will print every possible translation of the message (including the key number used in the translation). Here is a sample run of this modified program:
However, if the user is in “brute force” mode then getTranslatedMessage() is executed in a loop that iterates from 1 all the way up to MAX_KEY_SIZE (which is 26). Remember that the range() function returns a list of integers up to, but not including, the second parameter, which is why you have + 1. This program will print every possible translation of the message (including the key number used in the translation). Here is a sample run of this modified program:

Do you wish to encrypt or decrypt or brute force a message?
brute
Expand Down
26 changes: 13 additions & 13 deletions text/chapter15.txt
Original file line number Diff line number Diff line change
Expand Up @@ -512,8 +512,8 @@ This character can either be a ' ' space character (to represent a blank space),
Importing Other Modules

1. # Reversi
2. import random
3. import sys
3. import random
4. import sys

Line 2 imports the random module for its randint() and choice() functions. Line 3 imports the sys module for its exit() function.

Expand Down Expand Up @@ -643,12 +643,12 @@ Checking if a Move is Valid
47. # If it is a valid move, returns a list of spaces that would become the player's if they made a move here.
48. if board[xstart][ystart] != ' ' or not isOnBoard(xstart, ystart):
49. return False
50. board[xstart][ystart] = tile # temporarily set the tile on the board.
51. if tile == 'X':
52. otherTile = 'O'
53. else:
54. otherTile = 'X'
55. tilesToFlip = []
51. board[xstart][ystart] = tile # temporarily set the tile on the board.
53. if tile == 'X':
54. otherTile = 'O'
55. else:
56. otherTile = 'X'
58. tilesToFlip = []

Given a board data structure, the player’s tile, and the XY coordinates for player’s move, isValidMove() should return True if the Reversi game rules allow a move to those coordinates and False if they don’t.

Expand Down Expand Up @@ -956,7 +956,7 @@ Getting the Computer’s Move
216. # move and return that move as a [x, y] list.
217. possibleMoves = getValidMoves(board, computerTile)

getComputerMove() and is where the AI algorithm is implemented. Normally you use the results from getValidMoves() for hints mode. Hints mode will print '.' period characters on the board to show the player all the potential moves they can make.
getComputerMove() is where the AI algorithm is implemented. Normally you use the results from getValidMoves() for hints mode. Hints mode will print '.' period characters on the board to show the player all the potential moves they can make.

But if getValidMoves() is called with the computer AI’s tile (in computerTile), it will also find all the possible moves that the computer can make. The AI will select the best move from this list.

Expand Down Expand Up @@ -991,15 +991,15 @@ Get a List of the Best Scoring Moves

If there are no corner moves, loop through the entire list and find out which move results in the highest score. Line 229’s for loop will set x and y to every move in possibleMoves. bestMove is set to the highest scoring move the code has found so far, and bestScore is set to the best move’s score.

When the code in the loop finds a move that scores higher than bestScore, line 233 to 235 will store that move and score as the new values in bestMove and bestScore.
When the code in the loop finds a move that scores higher than bestScore, lines 233 to 235 will store that move and score as the new values in bestMove and bestScore.

Simulate All Possible Moves on Duplicate Board Data Structures

Before simulating a move, line 230 makes a duplicate game board data structure by calling getBoardCopy(). You’ll want a copy so you can modify without changing the real game board data structure stored in the board variable.

Then line 231 calls makeMove(), passing the duplicate board (stored in dupeBoard) instead of the real board. This will simulate what would happen on the real board if this move was made. makeMove() will handle placing the computer’s tile and the flipping the player’s tiles on the duplicate board.

Line 232 calls getScoreOfBoard()with the duplicate board, which returns a dictionary where the keys are 'X' and 'O', and the values are the scores.
Line 232 calls getScoreOfBoard() with the duplicate board, which returns a dictionary where the keys are 'X' and 'O', and the values are the scores.

For example, pretend that getScoreOfBoard() returns the dictionary {'X':22, 'O':8} and computerTile is 'X'. Then getScoreOfBoard(dupeBoard)[computerTile] would evaluate to {'X':22, 'O':8}['X'], which would then evaluate to 22. If 22 is larger than bestScore, bestScore is set to 22 and bestMove is set to the current x and y values.

Expand Down Expand Up @@ -1078,7 +1078,7 @@ Handling the Quit or Hints Commands
273. else:
274. makeMove(mainBoard, playerTile, move[0], move[1])

If the player typed in the string 'quit' for their move, then getPlayerMove() would have returned the string 'quit'. In that case, line 269 calls the sys.exit() to terminate the program.
If the player typed in the string 'quit' for their move, then getPlayerMove() would have returned the string 'quit'. In that case, line 269 calls sys.exit() to terminate the program.

If the player typed in the string 'hints' for their move, then getPlayerMove() would have returned the string 'hints'. In that case, you want to turn hints mode on (if it was off) or off (if it was on).

Expand Down Expand Up @@ -1122,7 +1122,7 @@ Finally, pass x and y, along with the game board data structure and the computer

Lines 289 to 292 are similar to lines 276 to 279. After the computer has made its move, line 289 checks if there exist any valid moves the human player can make. If getValidMoves() returns an empty list, then there are no valid moves. That means the game is over, and line 290 breaks out of the while loop.

Otherwise, there’s at least one possible move the player should make. The turn variable is to 'player'. There is no more code in the while-block after line 292, so execution loops back to the while statement on line 257.
Otherwise, there’s at least one possible move the player should make. The turn variable is set to 'player'. There is no more code in the while-block after line 292, so execution loops back to the while statement on line 257.

Drawing Everything on the Screen

Expand Down
12 changes: 6 additions & 6 deletions text/chapter16.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Topics Covered In This Chapter:

The Reversi AI algorithm was simple, but it beats me almost every time I play it. This is because the computer can process instructions fast, so checking each possible position on the board and selecting the highest scoring move is easy for the computer. It would take a long time for me to find the best move this way.

The Reversi program in Chapter 14 had two functions, getPlayerMove() and getComputerMove() which both returned the move selected as a two-item list like [x, y]. The both also had the same parameters, the game board data structure and which tile they were. getPlayerMove() decided which [x, y] move to return by letting the player type in the coordinates. getComputerMove() decided which [x, y] move to return by running the Reversi AI algorithm.
The Reversi program in Chapter 14 had two functions, getPlayerMove() and getComputerMove() which both returned the move selected as a two-item list like [x, y]. They both also had the same parameters, the game board data structure and which tile they were. getPlayerMove() decided which [x, y] move to return by letting the player type in the coordinates. getComputerMove() decided which [x, y] move to return by running the Reversi AI algorithm.

What happens when we replace the call to getPlayerMove() with a call to getComputerMove()? Then the player never types in a move, it is decided for them! The computer is playing against itself!

Expand All @@ -26,7 +26,7 @@ You can either type these changes in yourself, or download them from the book’

Making the Computer Play Against Itself

Save the old reversi.py file as AISim1.py by clicking on File ► Save As, and then entering AISim1.py for the file name and clicking Ok. This will create a copy of our Reversi source code as a new file that you can make changes to, while leaving the original Reversi game the same (you may want to play it again). Change the following code in AISim1.py:
Save the old reversi.py file as AISim1.py by clicking on File ► Save As, and then entering AISim1.py for the file name and clicking Save. This will create a copy of our Reversi source code as a new file that you can make changes to, while leaving the original Reversi game the same (you may want to play it again). Change the following code in AISim1.py:

266. move = getPlayerMove(mainBoard, playerTile)

Expand Down Expand Up @@ -235,7 +235,7 @@ Displaying the Statistics
294. tiepercent = round(((ties / numGames) * 100), 2)
295. print('X wins %s games (%s%%), O wins %s games (%s%%), ties for %s games (%s%%) of %s games total.' % (xwins, xpercent, owins, opercent, ties, tiepercent, numGames))

The code at the bottom of the program will show the user how many wins X and O had, how many ties there were, and how what percentages these make up. Statistically, the more games you run, the more accurate your percentages will be for finding the best AI algorithm. If you only ran ten games, and X won three of them, then it would seem that X’s algorithm only wins 30% of the time. However, if you run a hundred, or even a thousand games, then you may find that X’s algorithm wins closer to 50% (that is, half) of the games.
The code at the bottom of the program will show the user how many wins X and O had, how many ties there were, and what percentages these make up. Statistically, the more games you run, the more accurate your percentages will be for finding the best AI algorithm. If you only ran ten games, and X won three of them, then it would seem that X’s algorithm only wins 30% of the time. However, if you run a hundred, or even a thousand games, then you may find that X’s algorithm wins closer to 50% (that is, half) of the games.

To find the percentages, divide the number of wins or ties by the total number of games. Then multiply the result by 100. However, you may end up with a number like 66.66666666666667. So pass this number to the round() function with the second parameter of 2 to limit the precision to two decimal places, so it will return a float like 66.67 instead (which is much more readable).

Expand Down Expand Up @@ -274,7 +274,7 @@ AISim3.py
248.
249.
250. def isOnSide(x, y):
251. return x == 0 or x == 7 or y == 0 or y ==7
251. return x == 0 or x == 7 or y == 0 or y == 7
252.
253.
254. def getCornerSideBestMove(board, tile):
Expand Down Expand Up @@ -365,7 +365,7 @@ getCornerWorstMove() Take a corner space, if available. If not, use the getWo

Comparing the Random Algorithm Against the Regular Algorithm

Now the only thing to do is replace one of the getComputerMove() calls in the main part of the program with one of the new functions. Then you can run several games and see how often one algorithm wins over the other. First, let’s replace O’s algorithm with the one in getComputerMove() with getRandomMove() on line 351:
Now the only thing to do is replace one of the getComputerMove() calls in the main part of the program with one of the new functions. Then you can run several games and see how often one algorithm wins over the other. First, let’s replace O’s algorithm with the one in getRandomMove() on line 351:

351. x, y = getRandomMove(mainBoard, 'O')

Expand All @@ -388,7 +388,7 @@ Wow! X won far more often than O did. That means that the algorithm in getComput

Comparing the Random Algorithm Against Itself

What if we changed O’s algorithm to also use the algorithm in getRandomMove()? Let’s find out by changing O’s function call on line 351 from getComputerMove() to getRandomMove() and running the program again.
What if we changed X’s algorithm to also use the algorithm in getRandomMove()? Let’s find out by changing X’s function call on line 346 from getComputerMove() to getRandomMove() and running the program again.

Welcome to Reversi!
Enter number of games to run: 100
Expand Down
8 changes: 4 additions & 4 deletions text/chapter17.txt
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ The pygame.draw.ellipse() function is similar to the pygame.draw.circle() functi
• The Surface object to draw the ellipse on.
• The color of the ellipse.
• A tuple of four integers is passed for the left, top, width, and height of the ellipse.
• Optionally, an integer for the width. A width of 0 means that the circle will be filled in.
• Optionally, an integer for the width. A width of 0 means that the ellipse will be filled in.

Line 42 draws a red ellipse on the Surface object.

Expand Down Expand Up @@ -375,7 +375,7 @@ The blit() Method for Surface Objects
52. # draw the text onto the surface
53. windowSurface.blit(text, textRect)

The blit() method will draw the contents of one Surface object onto another Surface object. Line 54 will draw the “Hello world!” Surface object in text and draws it to the Surface object stored in the windowSurface variable.
The blit() method will draw the contents of one Surface object onto another Surface object. Line 53 will draw the “Hello world!” Surface object in text and draws it to the Surface object stored in the windowSurface variable.

The second parameter to blit() specifies where on the windowSurface surface the text surface should be drawn. Pass the Rect object you got from calling text.get_rect() on line 23.

Expand Down Expand Up @@ -567,7 +567,7 @@ Setting Up Constant Variables for Direction

We will use the keys on the number pad of the keyboard to remind us which belongs to which direction. This is similar to the Tic Tac Toe game. 1 is down and left, 3 is down and right, 7 is up and left, and 9 is up and right. However, it may be hard to remember this, so instead use constant variables instead of these integer values.

You could have used any value you wanted for these directions instead of using a constant variable. For example, you could use the string 'downleft' to represent the down and left diagonal direction. However, if you ever mistype the 'downleft' string (for example, as 'fownleft'), Python would not recognize that you meant to type 'downleft' instead of 'downleft'. This bug would cause your program to behave strangely, but the program would not crash.
You could have used any value you wanted for these directions instead of using a constant variable. For example, you could use the string 'downleft' to represent the down and left diagonal direction. However, if you ever mistype the 'downleft' string (for example, as 'fownleft'), Python would not recognize that you meant to type 'downleft' instead of 'fownleft'. This bug would cause your program to behave strangely, but the program would not crash.

But if you use constant variables, and accidentally type the variable name FOWNLEFT instead of the name DOWNLEFT, Python would notice that there’s no such variable named FOWNLEFT and crash the program with an error. This would still be a pretty bad bug, but at least you would know about it immediately and could fix it.

Expand Down Expand Up @@ -650,7 +650,7 @@ The new value to set the left and top attributes to depends on the block’s dir

If the direction of the block is DOWNRIGHT or UPRIGHT, you want to increase the left attribute. If the direction is DOWNLEFT or UPLEFT, you want to decrease the left attribute.

Change the value of these attributes by the integer stored in MOVESPEED. MOVESPEED stores how many pixels over blocks move on each iteration of the game loop, and was set on line19.
Change the value of these attributes by the integer stored in MOVESPEED. MOVESPEED stores how many pixels over blocks move on each iteration of the game loop, and was set on line 19.

Checking if the Block has Bounced

Expand Down
Loading