当前位置:天才代写 > Python代写,python代做代考-价格便宜,0时差服务 > CS代写之Python实现算法:Homework Shortest Path use Dijkstra’s algorithm

CS代写之Python实现算法:Homework Shortest Path use Dijkstra’s algorithm

2018-04-01 08:00 星期日 所属: Python代写,python代做代考-价格便宜,0时差服务 浏览:1167

Homework Shortest Path

Description

In this assignment, you will use Dijkstra's algorithm to solve a shortest path problem in the context of a 2D game. In this game, an avatar moves inside a building that has walls, doorways, and other obstacles. provides Python code to read in a building map and convert it into a data structure containing line segments. The starter code also has displays the environment and the path returned by your function.

You are to complete the getShortestPath(environment) function in main.py. This function should return a list of Point2 objects, corresponding to the shortest path from the starting point to the ending point. That is, the element [0] should be the starting point and [-1] should be the ending point. The other points in the path should represent a sequence of avatar movements is consistent with the configuration of walls (i.e., can't walk thru a wall).

Environment Data Structure

An environment is used to store the position of the walls and obstacles. The data members of this class:

widthheight – the outer dimensions of the structure.
doorWidth – the width of all doors.
startend – Point2 objects denoting the starting position of the avatar and its desired ending position.
shooterPos – Point2 object denoting the position of the shooter.
boundaryWalls – List of 4 LineSegments corresponding to the outer walls of the building
boundaryWallsPonts – List of 4 Point2 objects corresponding to the corners of the building
interiorWalls – List of LineSegments, each corresponding to a planar surface of the wall. Walls have thickness; each wall component will have 4 LineSegments.
interiorWallsPonts – List of Point2 objects, each corresponding to a corner a wall component. Each wall will have 4 Point2s.
doorPoints – List of Point2 objects. each corresponding to the center of a doorway.
obstacleWalls –  List of LineSegments, each corresponding to a surface of an obstacle.
obstaclesWallsPoints – List of Point2 objects, each corresponding to a corner of an obstacle.

Notes

· The Points of walls and obstacles have been moved slightly into the interior of the room. This will ensure that the avatar is not directly on a wall.

· The avatar can move only to the points defined in the room (i.e., corners of obstacles and walls).

· The building will be rectangular in shape.

· The interior walls will start and end at the intersection of other walls.

· Doorways are all the same width and will not be at the end of a wall.

· Obstacles will be convex and not overlap.

· Shooter cannot shoot or see through a wall.

Scoring

· (75) Provide the shortest path using only obstacles. That is, the avatar can move through walls.

· (13) Provide the shortest path using both walls and obstacles.

· (5) Provide path that provides the shooter with the least opportunity to shoot, while factoring in walls and obstacles. In this problem, the distance traveled is not considered. Instead, the algorithm should minimize the distance traveled where the avatar is in danger of being shot.

· (7) Report. Write a report that explicitly lists what aspects of your program work and what does not. Provide a paragraph that describes what you had to do to get Dijkstra's to work in this application.

 

代写CS&Finance|建模|代码|系统|报告|考试

编程类:C++,JAVA ,数据库,WEB,Linux,Nodejs,JSP,Html,Prolog,Python,Haskell,hadoop算法,系统 机器学习

金融类统计,计量,风险投资,金融工程,R语言,Python语言,Matlab,建立模型,数据分析,数据处理

服务类:Lab/Assignment/Project/Course/Qzui/Midterm/Final/Exam/Test帮助代写代考辅导

E-mail:850190831@qq.com   微信:BadGeniuscs  工作时间:无休息工作日-早上8点到凌晨3点


如果您用的手机请先保存二维码到手机里面,识别图中二维码。如果用电脑,直接掏出手机果断扫描。

qr.png

 

    关键字:

天才代写-代写联系方式