Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
wumpus-tessaris
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lanti Davide
wumpus-tessaris
Commits
d70ed1d3
Commit
d70ed1d3
authored
5 years ago
by
Tessaris Sergio
Browse files
Options
Downloads
Patches
Plain Diff
Enable multiple gold objects
parent
ce12d020
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
examples/wumpus-usage.py
+1
-1
1 addition, 1 deletion
examples/wumpus-usage.py
wumpus/wumpus.py
+3
-4
3 additions, 4 deletions
wumpus/wumpus.py
with
4 additions
and
5 deletions
examples/wumpus-usage.py
+
1
−
1
View file @
d70ed1d3
...
...
@@ -70,7 +70,7 @@ WUMPUS_WORLD = '''
"
pits
"
: [[4, 0], [3, 1], [2, 2], [6, 2], [4, 4], [3, 5], [4, 6], [5, 6]],
"
wumpuses
"
: [[1, 2]],
"
exits
"
: [[0, 0]],
"
golds
"
: [[6, 3]],
"
golds
"
: [[6,
3], [3,
3]],
"
blocks
"
: []
}
'''
...
...
This diff is collapsed.
Click to expand it.
wumpus/wumpus.py
+
3
−
4
View file @
d70ed1d3
...
...
@@ -91,7 +91,7 @@ class Hunter(Agent):
self
.
_arrow
:
bool
=
True
self
.
_done
:
bool
=
False
self
.
_bump
:
bool
=
False
self
.
_has_gold
:
bool
=
False
self
.
_has_gold
:
int
=
0
@property
def
world
(
self
)
->
'
WumpusWorld
'
:
...
...
@@ -214,14 +214,13 @@ class Hunter(Agent):
reward
-=
1
gold
=
self
.
world
.
isGold
(
self
.
location
)
if
gold
:
self
.
_has_gold
=
True
self
.
_has_gold
+
=
1
self
.
world
.
removeObject
(
gold
)
elif
action
==
self
.
Actions
.
CLIMB
:
reward
-=
1
if
self
.
world
.
isExit
(
self
.
location
):
self
.
_done
=
True
if
self
.
_has_gold
:
reward
+=
1000
reward
+=
1000
*
self
.
_has_gold
else
:
raise
ValueError
(
'
Unrecognised action {}
'
.
format
(
action
))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment