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

Skip to content

Commit 08ad660

Browse files
committed
fixed typos
1 parent 181d257 commit 08ad660

File tree

3 files changed

+29
-18
lines changed

3 files changed

+29
-18
lines changed

logic.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -128,13 +128,13 @@ def program(percept):
128128
return action
129129

130130
def make_percept_sentence(percept, t):
131-
return Expr("Percept")(percept, t)
131+
return Expr('Percept')(percept, t)
132132

133133
def make_action_query(t):
134-
return expr("ShouldDo(action, {})".format(t))
134+
return expr('ShouldDo(action, {})'.format(t))
135135

136136
def make_action_sentence(action, t):
137-
return Expr("Did")(action[expr('action')], t)
137+
return Expr('Did')(action[expr('action')], t)
138138

139139
return program
140140

@@ -325,7 +325,7 @@ def pl_true(exp, model={}):
325325
elif op == '^': # xor or 'not equivalent'
326326
return pt != qt
327327
else:
328-
raise ValueError("illegal operator in logic expression" + str(exp))
328+
raise ValueError('Illegal operator in logic expression' + str(exp))
329329

330330

331331
# ______________________________________________________________________________
@@ -1933,7 +1933,7 @@ def tell(self, sentence):
19331933
if is_definite_clause(sentence):
19341934
self.clauses.append(sentence)
19351935
else:
1936-
raise Exception("Not a definite clause: {}".format(sentence))
1936+
raise Exception('Not a definite clause: {}'.format(sentence))
19371937

19381938
def ask_generator(self, query):
19391939
return fol_bc_ask(self, query)
@@ -2085,7 +2085,7 @@ def diff(y, x):
20852085
elif op == 'log':
20862086
return diff(u, x) / u
20872087
else:
2088-
raise ValueError("Unknown op: {} in diff({}, {})".format(op, y, x))
2088+
raise ValueError('Unknown op: {} in diff({}, {})'.format(op, y, x))
20892089

20902090

20912091
def simp(x):
@@ -2146,7 +2146,7 @@ def simp(x):
21462146
if u == 1:
21472147
return 0
21482148
else:
2149-
raise ValueError("Unknown op: " + op)
2149+
raise ValueError('Unknown op: ' + op)
21502150
# If we fall through to here, we can not simplify further
21512151
return Expr(op, *args)
21522152

planning.py

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,9 @@ class Action:
173173
Precondition and effect are both lists with positive and negative literals.
174174
Negative preconditions and effects are defined by adding a 'Not' before the name of the clause
175175
Example:
176-
precond = [expr("Human(person)"), expr("Hungry(Person)"), expr("NotEaten(food)")]
177-
effect = [expr("Eaten(food)"), expr("Hungry(person)")]
178-
eat = Action(expr("Eat(person, food)"), precond, effect)
176+
precond = [expr('Human(person)'), expr('Hungry(Person)'), expr('NotEaten(food)')]
177+
effect = [expr('Eaten(food)'), expr('Hungry(person)')]
178+
eat = Action(expr('Eat(person, food)'), precond, effect)
179179
"""
180180

181181
def __init__(self, action, precond, effect, domain=None):
@@ -1371,7 +1371,12 @@ def execute(self, display=True):
13711371
self.constraints = self.protect((act0, G, act1), action, self.constraints)
13721372

13731373
if step > 200:
1374-
print("Couldn't find a solution")
1374+
print('Couldn'
1375+
t
1376+
find
1377+
a
1378+
solution
1379+
')
13751380
return None, None
13761381

13771382
if display:
@@ -1450,12 +1455,18 @@ def do_action(self, job_order, available_resources, kb, args):
14501455
if not self.has_consumable_resource(available_resources):
14511456
raise Exception('Not enough consumable resources to execute {}'.format(self.name))
14521457
if not self.inorder(job_order):
1453-
raise Exception("Can't execute {} - execute prerequisite actions first".
1454-
format(self.name))
1455-
kb = super().act(kb, args) # update knowledge base
1456-
for resource in self.consumes: # remove consumed resources
1457-
available_resources[resource] -= self.consumes[resource]
1458-
self.completed = True # set the task status to complete
1458+
raise Exception('Can'
1459+
t
1460+
execute
1461+
{} - execute
1462+
prerequisite
1463+
actions
1464+
first
1465+
'.format(self.name))
1466+
kb = super().act(kb, args) # update knowledge base
1467+
for resource in self.consumes: # remove consumed resources
1468+
available_resources[resource] -= self.consumes[resource]
1469+
self.completed = True # set the task status to complete
14591470
return kb
14601471

14611472
def has_consumable_resource(self, available_resources):

search.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1412,7 +1412,7 @@ class BoggleFinder:
14121412

14131413
def __init__(self, board=None):
14141414
if BoggleFinder.wordlist is None:
1415-
BoggleFinder.wordlist = Wordlist(open_data("EN-text/wordlist.txt"))
1415+
BoggleFinder.wordlist = Wordlist(open_data('EN-text/wordlist.txt'))
14161416
self.found = {}
14171417
if board:
14181418
self.set_board(board)

0 commit comments

Comments
 (0)