Write a python program or any other language

Assignment Help Programming Languages
Reference no: EM132066703

Assume you have a truck which has to travel across a desert from the base camp at position 0 (left) to the target camp at position n (right). The intermediate positions 1,2, and 3 are desert camps, and have at the beginning of the process no fuel. The truck is able to take 3 units of fuel with it. Each move 1 field to the right (towards the target camp, Fig. 1) or 1 field to the left (towards the base camp) uses up 1 unit of fuel. If not all fuel is used up in a move, and the move has not reached the target camp, the remaining fuel is dropped at the current position for later use.

There is arbitrary amount of fuel at the base camp (of which the truck can take at most 3 units), and when the truck has reached position n (target camp), the puzzle is completed. However, when the truck is at one of the positions 1,2,3, it can take only as much fuel with it as there is present at the given position. The goal is to allow the truck to travel through the desert to the target camp.

The Formal Rules for the Desert Crossing Task

The following are the rules for the movement of the truck.

1. In the base camp (position 0), the truck can load as much fuel as its carrying capacity (i.e. 3).

2. In the target camp (position n), the truck has nothing more to do. The task is solved.

3. Arriving in a desert camp (position 1,2 or 3) the truck will unload whatever fuel was remaining from the trip. For instance, if the truck started at base camp (0), with 3 units of fuel, arriving at 1, it will unload 2 units.

4. Leaving from a desert camp (position 1,2 or 3), the truck will choose how much fuel it will pick up from there. It will then make a move (left or right), at most as far as the fuel picked up permits. As the move is completed, it proceeds according to rule 1,2 or 3.

The Task

Write a Python program or any other language of your choice, that starts from the starting state (truck in base camp) and moves according to the rules until it reaches the goal state (truck in target camp).

For this, you have to adapt the search algorithms and write a Desert class.

[Hint]: You can use the breadth- first-search for this.

Reference no: EM132066703

Questions Cloud

Create a pareto diagram that reflects potential customer : CST 281. A big challenge facing iterative projects is to estimate what work efforts should be undertaken in individual iterations.
What percent of our population has normal triglycerides : Normal triglycerides level is anything below 150 mg/dL. What percent of our population has normal triglycerides level?
What is the mean and standard deviation of event : You take 5 balls with replacement randomly from the bag and count how many orange balls you get. What is the mean and standard deviation of this event?
Confidence interval for the population proportion : A pharmaceutical company proposes a new drug treatment for alleviating symptoms of PMS? (premenstrual syndrome). In the first stages of a clinical? trial
Write a python program or any other language : Write a Python program or any other language of your choice, that starts from the starting state (truck in base camp) and moves according to the rules until
How does creating a shortage benefit a company : How does creating a shortage benefit a company, especially during the short holiday shopping season? If the product is not available, no money is being made.
Create a use case diagram that captures the scenario : CST 281. As part of what is called the E-Gov Initiative,government agencies at the Federal, state and local level are working to pay their bills electronically.
Do you think the decline in the use of facebook : Do you think the decline in the use of Facebook because social media is a fad and it is just running its course? Of did the teen generation find a social media.
What measures could be employed on projects to assess : CST 281:It is popular these days to talk about both "ceremony" and "discipline" when discussing software development.

Reviews

Write a Review

Programming Languages Questions & Answers

  Write a haskell program to calculates a balanced partition

Write a program in Haskell which calculates a balanced partition of N items where each item has a value between 0 and K such that the difference b/w the sum of the values of first partition,

  Create an application to run in the amazon ec2 service

In this project you will create an application to run in the Amazon EC2 service and you will also create a client that can run on local machine and access your application.

  Explain the process to develop a web page locally

Explain the process to develop a Web page locally

  Write functions

These 14 questions covers java class, Array, link list , generic class.

  Programming assignment

If the user wants to read the input from a file, then the output will also go into a different file . If the user wants to read the input interactively, then the output will go to the screen .

  Write a prolog program using swi proglog

Write a Prolog program using swi proglog

  Create a custom application using eclipse

Create a custom Application Using Eclipse Android Development

  Create a application using the mvc architecture

create a application using the MVC architecture. No scripting elements are allowed in JSP pages.

  Develops bespoke solutions for the rubber industry

Develops bespoke solutions for the rubber industry

  Design a program that models the worms behavior

Design a program that models the worm's behavior.

  Writing a class

Build a class for a type called Fraction

  Design a program that assigns seats on an airplane

Write a program that allows an instructor to keep a grade book and also design and implement a program that assigns seats on an airplane.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd