Create a program that finds the solution

Assignment Help Programming Languages
Reference no: EM131650643

Guidelines -

This is a programming assignment. You will be provided sample inputs and outputs (attached). Please understand that the goal of the samples is to check that you can correctly parse the problem definitions, and generate a correctly formatted output. The samples are very simple and it should not be assumed that if your program works on the samples it will work on all test cases. There will be more complex test cases and it is your task to make sure that your program will work correctly on any valid input. You are encouraged to try your own test cases to check how your program would behave in some complex special case that you might think of. Since each homework is checked via an automated A.I. script, your output should match the specified format exactly. Failure to do so will most certainly cost some points. The output format is simple and examples are provided. You should upload and test your code on vocareum.com, and you will submit it there. You may use any of the programming languages provided by vocareum.

Project description -

You are a zookeeper in the reptile house. One of your rare South Pacific Tufted Wizzo lizards (Tufticus Wizzocus) has just had several babies. Your job is to find a place to put each baby lizard in a nursery.

However, there is a catch, the baby lizards have very long tongues. A baby lizard can shoot out its tongue and eat any other baby lizard before you have time to save it. As such, you want to make sure that no baby lizard can eat another baby lizard in the nursery (burp). For each baby lizard, you can place them in one spot on a grid. From there, they can shoot out their tongue up, down, left, right and diagonally as well. Their tongues are very long and can reach to the edge of the nursery from any location.

Figure 1 shows in what ways a baby lizard can eat another.

331_figure.png

Figure 1 (A) the baby lizard can attack any other lizard in a red square. Thus it can be seen that a baby lizard can eat another lizard to its top, bottom, left right or diagonal. (B) In this example setup, both lizards can eat each other. Your algorithm will try to avoid this.

In addition to baby lizards, your nursery may have some trees planted in it. Your lizards cannot shoot their tongues through the trees nor can you move a lizard into the same place as a tree. As such, a tree will block any lizard from eating another lizard if it is in the path. Additionally, the tree will block you from moving the lizard to that location.

Figure 2 shows some different valid arrangements of lizards.

827_figure2.png

Figure 2 Both nurseries have valid arrangements of baby lizards such that they cannot eat one another. (A) with no trees, no lizard is in a position to eat another lizard. (B) Two trees are introduced such that the lizard in the last column cannot eat the lizard in the second or fourth column.

You will write a program that will take an input file that has an arrangement of trees and will output a new arrangement of lizards (and trees; as already mentioned, you can't move the trees) such that no baby lizard can eat another one. You will be required to create a program that finds the solution. To find the solution you will use the following algorithms:

- Breadth-first search (BFS)

- Depth-first search (DFS)

- Simulated annealing (SA).

Attachment:- Assignment File.rar

Reference no: EM131650643

Questions Cloud

Advantages and drawbacks to capitalism : Research capitalism and socialism. What are some of the advantages and drawbacks to capitalism? How is socialism different from capitalism?
Explain way handshake process use to initiate tcp connection : Explain the three-way handshake process used to initiate TCP connections. Describe the three basic types of network topologies and provide a sample diagram.
What is public administration : What is public administration? define beaucracy and identify the job functions performed by agency members as expressed by the public will.
The reasoning behind issuing the preferred stock : Find a company that has within the past two years issued preferred stock. Explain the terms of contract and the reasoning behind issuing the preferred stock.
Create a program that finds the solution : You will be required to create a program that finds the solution. To find the solution you will use the following algorithms: BFS, DFS and SA
Explain damages for the loss of its cargo : Damages for the loss of its cargo, for the loss of the profits it was to earn, and for being improperly detained on the high seas
Identify potential hazards that might exist in the future : List and prioritize (e.g., theft of office equipment, wallet theft, theft from stockrooms). Identify potential hazards that might exist in the future.
Discuss various techniques used by emirates islamic bank : Discuss various techniques used by Emirates islamic bank for building relationship with these stakeholders
State the appropriate hypothesis for the slope : Cholesterol, finis. Based on the regression output seen in Exercise 8, create a 95% confidence interval for the slope of the regression line.

Reviews

len1650643

9/20/2017 4:52:32 AM

The following search algorithms must be used "BFS, DFS, SA" as stated on page 4. The 50 test cases must be ran in under 5 minutes. The online AI script "vocareum.com" will run/compile the code as stated on page 1. Your code will be tested as follows: Your program should not require any command-line argument. It should read a text file called "input.txt" in the current directory that contains a problem definition. It should write a file "output.txt" with your solution to the same current directory. Format for input.txt and output.txt is specified below. End-of-line character is LF (since vocareum is a Unix system and follows the Unix convention).

len1650643

9/20/2017 4:52:23 AM

The grading A.I. script will, 50 times: Create an input.txt file, delete any old output.txt file. Run your code. Check correctness of your program's output.txt file. If your outputs for all 50 test cases are correct, you get 100 points. If one or more test case fails, you get 50 - N points where N is the number of failed test cases. Note that if your code does not compile, or somehow fails to load and parse input.txt, or writes an incorrectly formatted output.txt, or no output.txt at all, or OuTpUt.TxT, you will get zero points. Anything you write to stdout or stderr will be ignored and is ok to leave in the code you submit (but it will likely slow you down). Please test your program with the provided sample files to avoid this.

len1650643

9/20/2017 4:52:18 AM

Notes and hints: Please name your program "homework.xxx" where ‘xxx' is the extension for the programming language you choose ("py" for python, "cpp" for C++, and "java" for Java). If you are using C++11, then the name of your file should be "homework11.cpp" and if you are using python3 then the name of your file should be "homework3.py". n (width and height of nursery) and p (number of lizards) will be 32-bit integers with values 1 or more, and they may take different values (n¹p) or not. If your output.txt does not contain exactly p lizards, that test case will fail irrespective of whether your output.txt says "OK" on the first line. If your output.txt is such that some lizards can eat each other, that test case will fail irrespective of whether your output.txt says "OK" on the first line.

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