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

  Design program to ask user to enter amount of purchase

Design a program that will ask the user to enter the amount of a purchase. The program should then compute the state and county sales tax.

  Run-stack and activation record management

Though looking very efficient in terms of a quick jump to distant code why may it cause some efficiency problems during execution? Explain - Show (draw) the runtime-stack with AR(s) for the following. Include static and dynamic link information

  Front end applications

How does a compiled binary executable store on the client computer?

  Write program to merge two files that contain polynomials

Write a program that merges two files that contain polynomials. To merge two files, the input files must be in sorted order.

  Write an application to calculate the factorials

Write an application that calculates the factorials of 1 through 20. use type long. Display the results in tabular format. What difficulty might prevent you from calculating the factorial of 100?

  Write down public static method using public interface

Using only public interface of UnorderedLinkedList class, write down a method: public static void reverse(UnorderedLinkedList staff) that reverses the entries in a linked list.

  Program prompt teacher to input student number

The program must prompt teacher to input student number. Quiz score for that student will be displayed. Program can prompt for each quiz score.

  Write a function prime that takes a single integer

Write a higher order function list To that takes a function f and a number n and uses list comprehension to return a list of all the numbers from 1 to n for which the function f evaluates to True.

  Write down an application with three labeled text elds one

write an application with three labeled text ?elds one each for the initial amount of a savings account the annual

  Write a c function called values that returns void

Write a C function called values that returns void and takes two double precision arguments (called a and b) and one double precision array argument.

  Super call for constructor to allot value of attribute

We have given a super call, which does some work of constructor. Your code must complete constructor by allotting the value of g to gpa attribute.

  Write and debug a mips program

Write and debug a MIPS program that performs the given operations - Display one of the following statements depending on if a>b, or a=b or a

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