Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit da79112

Browse files
committed
Reformat to fit in 80 columns.
1 parent a2dbf95 commit da79112

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

csp.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -342,8 +342,8 @@ def parse_neighbors(neighbors, vars=[]):
342342
UT: WY CO AZ; MT: ND SD WY; WY: SD NE CO; CO: NE KA OK NM; NM: OK TX;
343343
ND: MN SD; SD: MN IA NE; NE: IA MO KA; KA: MO OK; OK: MO AR TX;
344344
TX: AR LA; MN: WI IA; IA: WI IL MO; MO: IL KY TN AR; AR: MS TN LA;
345-
LA: MS; WI: MI IL; IL: IN KY; IN: OH KY; MS: TN AL; AL: TN GA FL; MI: OH IN;
346-
OH: PA WV KY; KY: WV VA TN; TN: VA NC GA; GA: NC SC FL;
345+
LA: MS; WI: MI IL; IL: IN KY; IN: OH KY; MS: TN AL; AL: TN GA FL;
346+
MI: OH IN; OH: PA WV KY; KY: WV VA TN; TN: VA NC GA; GA: NC SC FL;
347347
PA: NY NJ DE MD WV; WV: MD VA; VA: MD DC NC; NC: SC; NY: VT MA CT NJ;
348348
NJ: DE; DE: MD; MD: DC; VT: NH MA; MA: NH RI CT; CT: RI; ME: NH;
349349
HI: ; AK: """)
@@ -491,9 +491,9 @@ class Sudoku(CSP):
491491
for v in flatten(rows)])
492492

493493
def __init__(self, grid):
494-
"""Build a Sudoku problem from a string representing the grid: the digits
495-
1-9 denote a filled cell, '.' or '0' an empty one; other characters are
496-
ignored."""
494+
"""Build a Sudoku problem from a string representing the grid:
495+
the digits 1-9 denote a filled cell, '.' or '0' an empty one;
496+
other characters are ignored."""
497497
squares = iter(re.findall(r'\d|\.', grid))
498498
domains = dict((var, [int(ch)] if ch in '123456789' else range(1, 10))
499499
for var, ch in zip(flatten(self.rows), squares))

games.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def min_value(state, alpha, beta, depth):
105105
(lambda state,depth: depth>d or game.terminal_test(state)))
106106
eval_fn = eval_fn or (lambda state: game.utility(state, player))
107107
action, state = argmax(game.successors(state),
108-
lambda ((a, s)): min_value(s, -infinity, infinity, 0))
108+
lambda (a, s): min_value(s, -infinity, infinity, 0))
109109
return action
110110

111111
#______________________________________________________________________________

learning.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,8 +372,8 @@ def decision_list_learning(self, examples):
372372
return [(t, o)] + self.decision_list_learning(examples - examples_t)
373373

374374
def find_examples(self, examples):
375-
"""Find a set of examples that all have the same outcome under some test.
376-
Return a tuple of the test, outcome, and examples."""
375+
"""Find a set of examples that all have the same outcome under
376+
some test. Return a tuple of the test, outcome, and examples."""
377377
NotImplemented
378378
#______________________________________________________________________________
379379

utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,8 @@ def pop(self):
710710
return self.A.pop()[1]
711711

712712
## Fig: The idea is we can define things like Fig[3,10] later.
713-
## Alas, it is Fig[3,10] not Fig[3.10], because that would be the same as Fig[3.1]
713+
## Alas, it is Fig[3,10] not Fig[3.10], because that would be the same
714+
## as Fig[3.1]
714715
Fig = {}
715716

716717
#______________________________________________________________________________

0 commit comments

Comments
 (0)