Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Flatland
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
yoogottamk
Flatland
Commits
a1d5dbe7
Commit
a1d5dbe7
authored
5 years ago
by
Erik Nygren
Browse files
Options
Downloads
Patches
Plain Diff
catch non-straight line in connect_line function
parent
84854ef8
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
flatland/envs/grid4_generators_utils.py
+15
-1
15 additions, 1 deletion
flatland/envs/grid4_generators_utils.py
with
15 additions
and
1 deletion
flatland/envs/grid4_generators_utils.py
+
15
−
1
View file @
a1d5dbe7
...
...
@@ -80,7 +80,21 @@ def connect_basic_operation(
def
connect_line
(
rail_trans
,
grid_map
,
start
,
end
,
openend
=
False
):
# Set start cell
"""
Generates a straight rail line from start cell to end cell.
Diagonal lines are not allowed
:param rail_trans:
:param grid_map:
:param start: Cell coordinates for start of line
:param end: Cell coordinates for end of line
:param openend: If True then the transition at start and end is set to 0: An empty cell
:return: A list of all cells in the path
"""
# Assert that a straight line is possible
if
not
(
start
[
0
]
==
end
[
0
]
or
start
[
1
]
==
end
[
1
]):
print
(
"
No line possible
"
)
return
[]
current_cell
=
start
path
=
[
current_cell
]
new_trans
=
grid_map
.
grid
[
current_cell
]
...
...
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