ECS 170代做、代写Python、data代做、代做Python程序代写Web开发|代写DatabaseECS 170: Spring 2020Homework Assignment 2Due Date:No later than Sunday, May 3, 11:59pm PDT. Note that your next homework assignmentmay be posted before then. You are expected to do this assignment on your own, notwith another person.The assignment:The puzzle called Rush Hour (c. ThinkFun, Inc., www.thinkfun.com) beginswith a six-by-six grid of squares. Little plastic cars and trucks are distributedacross the grid in such a way as to prevent one special car from moving off thegrid, thereby escaping the traffic jam. The initial configuration of cars and trucksis preordained by a set of cards, each containing a different starting pattern. Aplayer draws a card from the deck of cards, sets up the cars and trucks accordingto the pattern, and then tries to move the special car off the grid by sliding thecars and trucks up and down or left and right, depending on the startingorientation of the cars and trucks.The grid looks something like this:Cars occupy two contiguous squares, while trucks occupy three contiguoussquares. All vehicles are oriented horizontally or vertically, never on thediagonal. Vehicles that are oriented horizontally may only move horizontally;vehicles that are oriented vertically may only move vertically. Vehicles may notbe lifted from the grid, and there is never any diagonal movement. Vehicles maynot be partially on the grid and partially off the grid.The special car is called the X car. Well represent it on the grid as twocontiguous squares with the letter X in them. (Well represent all other cars and trucks with different letters of the alphabet, but the special car will always belabeled with the letter X.) The X car is always oriented horizontally on the thirdrow from the top; otherwise, the X car could never escape. If it were the only caron the grid, it might look like this (although it could start anywhere on that thirdrow):Lets put a blocking car and a blocking truck on the grid now too. Well label thecar as A and the truck as B:Car A is oriented horizontally on the fourth row, and it can slide only left orright. Truck B is oriented vertically in the third column from the left, and it canslide only up or down. If this configuration were the starting state for a puzzle, itwould be pretty simple for us to solve it. To slide the X car all the way to theright and off the grid, wed have to move the B truck out of the way. But to movethe B truck, well first have to move the A car out of the B trucks path. So thefirst solution step might be to move the A car to the right by one square:Note that moving the A car further to the right works, as does moving it twosquares to the left, but the best solution would move the X car off the grid in the fewestmoves possible. When any car or truck is moved one square in any direction, thatadds one to the total number of moves. If a car or truck is moved one square inone direction, then later is moved back one square to where it started, that countsas two moves.The next step would be to slide the B truck down three squares:Now its possible to move the X car all the way to the right and off the grid. Itsnot necessary to move it off the grid though; its sufficient to move the X car tocover the rightmost two squares of the third row from the top:Now weve solved the puzzle. Lets take another look at solving this RushHour puzzle, but this time from the perspective of a best-first search. The initialstate in the state space may be any configuration of cars and trucks such that theX car is always oriented horizontally on the third row from the top. The goalstate is any configuration of cars and trucks that can be obtained through correctapplication of the operators, such that the X car covers the rightmost two squaresof the third row from the top. The operators are simply these: move ahorizontally-oriented vehicle one square to the left, move a horizontally-orientedvehicle one square to the right, move a vertically-oriented vehicle one square up,and move a vertically-oriented vehicle one square down.Your assignment is to use Python to write a program called rushhour whichemploys best-first search with the A* algorithm to solve a Rush Hour puzzlewith any legal initial state. Your rushhour program expects two arguments.The second argument is a description of the initial-state as a list of six strings,each string containing six characters. For this initial configuration:the list of strings passed to rushhour would look like this:[--B---,--B---,XXB---,--AA--,------,------]The first string corresponds to the top row, the second string corresponds to thenext row down, and so on. If this list were formatted nicely, it would look morelike the grid above:We dont need to pass the goal state, as it will always be the same regardless ofthe initial state. The goal state will always be a legally-obtained configuration ofcars and trucks with the X car on the rightmost two squares of the third row.When (if?) the goal has been reached, rushhour should terminate and print alist of sucECS 170作业代做、代写Python实验作业、data课程作业代做、代做Python程序作业

代写Web开发|代写Dcessive states that constitutes the path from the initial state to the goalstate. So, if your TA invokes rushhour in this way (well explain that integer inthe first argument later):>>> rushhour(0, [--B---,--B---,XXB---,--AA--,------,------])your program should print a solution like this:Total states explored: 37OK, I made up that last number. But Ill explain later what your program shouldput there. One more thing to be explained later.The result above reflects the fact that youll be using operators that move vehiclesonly one square in any direction at a time. Do not employ additional operatorsthat move a vehicle two, three, or four squares at a time. Keep it simple.If you wish, you can convert my representation for the Rush Hour puzzle intoany other representation of your choice if you think that would make your lifeeasier. I make no claim that the representation Im using above for passing thestart state to your program is necessarily a great representation to use in solvingthe problem. It just happens to be convenient for representing the start state. Solike I said, if you think things might go easier for you if you use a differentrepresentation, please feel free to do so. However, you still have to deal with myrepresentation as input to your function as specified above.In your program, we want to see lots of well-abstracted, well-named, cohesive,and readable functions. Comments are required at the beginning of everyfunction and must provide a brief description of what the function does, whatarguments are expected by the function, and what is returned by the function.Additional comments that help the TA who grades your program understandhow your program works may make the TA happy, and happy graders aregenerous graders.What about the heuristics? You must implement two different h(n) functions.One is called the blocking heuristic, in which h(n) returns zero for the goal state,or one plus the number of cars or trucks blocking the path to the exit for all otherstates. For the sample state given at the beginning of this document, there is onetruck blocking the path to the exit, so h(n) in this case would be two. To activatethis heuristic, the first argument in the call to rushhour will be a 0. (See, I toldyou wed explain that first argument.)The other heuristic is one of your own design. You should try for a heuristic thatis at least as effective as the blocking heuristic. A trivial heuristic will not getcredit. To activate this heuristic, the first argument in the call to rushhour willbe a 1.Speaking of things to be explained later, heres what we want your program toprint after it has printed the solution to the puzzle:Total moves: 8Total states explored: 37The first value should be obvious - its the number of moves used in the solution.The second value is the number of times a node is removed from the front of the frontier and examined (see the algorithm in Episode 6). This gives us an idea ofhow much work is being done to find the solution. One would hope that betterheuristics would result in smaller values here.Additional Notes:• The X car (the one to be moved off the grid) will always be indicated by theletter X, and will always be somewhere on the third row.• The number of other cars and trucks on the grid is limited only by theavailable space on the grid. Do not assume that there will be only one othercar and one other truck just because thats whats shown in the example.• The other cars and trucks will be labeled with single letters from the alphabet,but dont assume that those letters will always be taken from the beginning ofthe alphabet.• Implement best first search with the A* algorithm. Do not implementsomething else, even if you think you have a better way to do it.• Comments in your code should make it easy for the TAs to find your best-firstsearch code and your two heuristics. You should use comments to explainhow your newly-created heuristic works and why you think it might be betterthan the blocking heuristic. If the TAs cant find what they will be looking for,you will not get the grade that you are looking for.• There are many resources on the Internet and elsewhere that might help youwith this assignment. Weve seen them, and we know some of you will lookfor them. (Yes, its true...the CS department even has its own Chegg account.)I strongly advise you to read the UC Davis Code of Academic Conduct andthe syllabus for ECS 170 so that you thoroughly understand what behavior isand is not acceptable. I strongly advise against looking at any code you mightfind, because if it ends up in your submission, what Ive intended to be a funcourse for you will turn into something remarkably un-fun for you in a hurry.• I have tried to anticipate every possible question, but I know thats impossible.You will come up with things that I didnt anticipate, or youll findinconsistencies or ambiguities, and I may have to make adjustments to theassignment as the days go by. Once again, please try to be flexible.转自:http://www.daixie0.com/contents/3/4999.html

python项目代做_ECS 170代做、代写Python、data代做、代做Python程序代写Web开发|代写Database...相关推荐

  1. python项目开发实战-给缺少Python项目实战经验的人

    我们在学习过程中最容易犯的一个错误就是:看的多动手的少,特别是对于一些项目的开发学习就更少了! 没有一个完整的项目开发过程,是不会对整个开发流程以及理论知识有牢固的认知的,对于怎样将所学的理论知识应用 ...

  2. 给缺少Python项目实战经验的人

    我们在学习过程中最容易犯的一个错误就是:看的多动手的少,特别是对于一些项目的开发学习就更少了! 没有一个完整的项目开发过程,是不会对整个开发流程以及理论知识有牢固的认知的,对于怎样将所学的理论知识应用 ...

  3. pycharm导入python环境是空的_PyCharm导入python项目并配置虚拟环境的教程详解

    PyCharm导入python项目并配置虚拟环境的教程详解 进入PyCharm后,点击File→Open,然后在弹窗中选择需要导入项目的文件夹: 打开了python项目后,需要配置该项目对应的pyth ...

  4. 15个针对初学者的Python项目创意

    15个适合初学者的Python项目构想-在完成Python编程课程之后,每个初学者都应转向可帮助您发展编码技能的python项目.我知道您在想什么,我们是初学者,我们将如何完成这些python项目?今 ...

  5. Linux(Centos)部署 Python项目

    一.前言 我的项目不大就是一个main.py,由于上级要求需要部署到Linux中,第一次做linux部署python,很多都不懂,找了很多资料,也走了很多弯路,所以把整个部署过程记录下. 首先想要在l ...

  6. 霸榜GitHub!这个Python项目有人刷到头秃

    来源:开源前线(ID:OpenSourceTop) 猿妹 整编 综合自:https://github.com/Python-World/python-mini-projects 近日,IEEE Spe ...

  7. Python项目打包发布到pypi

    最近心血来潮,想把自己的写的python项目打包到pypi,也让广大朋友能够通过pip来安装我的python包. 第一次尝试,中间遇到了一些问题,记录下来,方便其他感兴趣的朋友. 项目组织架构 # t ...

  8. python 创意项目_5个很酷的Python项目创意灵感

    python 创意项目 在过去的几年中,Python在全球范围内享有很高的声誉. 如今,Python在IT行业中享有盛誉. 那么为何不? Python拥有使它成为"地球上最需要的编程语言&q ...

  9. 80个python项目下载_80个Python经典资料(教程+源码+工具)汇总——下载目录

    小弟根据资料的热度和好评收集了80个Python资料,分享给Python开发的同学.内容包括1个Python专题.66个学习资料.7套Python源码和6个相关软件.附件较多,无法一一分享,只能为大家 ...

  10. Flask Web开发:基于Python的Web应用开发实战

    <Flask Web开发:基于Python的Web应用开发实战> 虽然简单的网站(Flask+Python+SAE)已经上线,但只是入门.开发大型网站,系统地学习一遍还是有必要的. 201 ...

最新文章

  1. Ubuntu 14.04 64位机上配置Android Studio操作步骤
  2. 伸缩门遥控器c语言程序,急求求c++编程高手,求50的阶乘,要求结果是精确的整数,打印在屏幕上。...
  3. ERC721关于NFT的学习和理解
  4. 从SAP Leonardo到SAP Data Intelligence
  5. 【渝粤题库】广东开放大学 商务合同 形成性考核
  6. HTTP状态码415 springboot项目
  7. php执行多个存储过程
  8. 【Liunx】Linux 简介
  9. Windows 7如何限制运行特定的应用程序(转载)
  10. python文件操作的方法_python中文件操作的基本方法
  11. OpenCV的第一个小程序:读取图像并显示
  12. 将 N 叉树编码为二叉树
  13. matlab求导图形,用MATLAB图形使高等数学问题直观化
  14. 机器视觉运动控制一体机应用例程|橡胶密封圈检测
  15. 条码软件如何修改条码标签的字体格式
  16. 本地测试微信授权登录
  17. ipone5 无法安装ipa软件
  18. 虚拟机ping通主机步骤_6在购买虚拟主机服务之前,请按照操作步骤进行操作
  19. python一维数组转置_Python 矩阵转置的几种方法小结
  20. 浅谈强化学习二之马尔卡夫决策过程与动态规划

热门文章

  1. C++编程语言中类对象的赋值与复制介绍(一)
  2. [Swift]LeetCode874. 模拟行走机器人 | Walking Robot Simulation
  3. 【模板】线性筛法求素数
  4. 零基础自学用Python 3开发网络爬虫(二): 用到的数据结构简介以及爬虫Ver1.0 alpha...
  5. 企业发展如何启动云的力量
  6. 【WPF】对Frame控件的Content属性做绑定时出现的一个小问题
  7. Python3 正则表达式学习
  8. 各种推荐算法的 benchmark
  9. Surprise 使用本地数据
  10. 实战必备!文本分类中的一些经验和 tricks