Skip to content

Added implementation of the cake problem, tests for cake and three towers problem #265

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 27, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
Prev Previous commit
Added test for three_block_tower and fixed a bug in three_block_tower…
… code
  • Loading branch information
opensourceware committed Sep 26, 2016
commit 1f3b32f891cab2d8f40c48aa55ba035e78df65a2
5 changes: 2 additions & 3 deletions planning.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,15 +195,14 @@ def goal_test(kb):

## Actions
# Move
precond_pos = [expr('On(b, x)'), expr('Clear(b)'), expr('Clear(y)'), expr('Block(b)'),
expr('Block(y)'), expr('b != x'), expr('b != y'), expr('x != y')]
precond_pos = [expr('On(b, x)'), expr('Clear(b)'), expr('Clear(y)'), expr('Block(b)'), expr('Block(y)')]
precond_neg = []
effect_add = [expr('On(b, y)'), expr('Clear(x)')]
effect_rem = [expr('On(b, x)'), expr('Clear(y)')]
move = Action(expr('Move(b, x, y)'), [precond_pos, precond_neg], [effect_add, effect_rem])

# MoveToTable
precond_pos = [expr('On(b, x)'), expr('Clear(b)'), expr('Block(b)'), expr('b != x')]
precond_pos = [expr('On(b, x)'), expr('Clear(b)'), expr('Block(b)')]
precond_neg = []
effect_add = [expr('On(b, Table)'), expr('Clear(x)')]
effect_rem = [expr('On(b, x)')]
Expand Down
12 changes: 12 additions & 0 deletions tests/test_planning.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,18 @@ def test_spare_tire():

assert p.goal_test()

def test_three_block_tower():
p = three_block_tower()
assert p.goal_test() is False
solution = [expr("MoveToTable(C, A)"),
expr("Move(B, Table, C)"),
expr("Move(A, Table, B)")]

for action in solution:
p.act(action)

assert p.goal_test()

def test_have_cake_and_eat_cake_too():
p = have_cake_and_eat_cake_too()
assert p.goal_test() is False
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy