編程代寫有哪些平臺,python項目代做_ECS 170代做、代寫Python、data代做、代做Python程序代寫Web開發|代寫Database...

 2023-12-25 阅读 29 评论 0

摘要: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 t

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

版权声明:本站所有资料均为网友推荐收集整理而来,仅供学习和研究交流使用。

原文链接:https://hbdhgg.com/5/194602.html

发表评论:

本站为非赢利网站,部分文章来源或改编自互联网及其他公众平台,主要目的在于分享信息,版权归原作者所有,内容仅供读者参考,如有侵权请联系我们删除!

Copyright © 2022 匯編語言學習筆記 Inc. 保留所有权利。

底部版权信息