Loading...

Messages

Proposals

Stuck in your homework and missing deadline? Get urgent help in $10/Page with 24 hours deadline

Get Urgent Writing Help In Your Essays, Assignments, Homeworks, Dissertation, Thesis Or Coursework & Achieve A+ Grades.

Privacy Guaranteed - 100% Plagiarism Free Writing - Free Turnitin Report - Professional And Experienced Writers - 24/7 Online Support

C battleship program

20/03/2021 Client: saad24vbs Deadline: 2 Day

CSCI-1200 Data Structures — Spring 2018 Homework 6 — Battleship Recursion

In this homework we will solve ship placement puzzles inspired by the pencil & paper “Battleship” game that was later made into a board game by Milton Bradley and then a puzzle that is a regular feature in Games magazine. You can read more about the history of the game and see examples here:

https://en.wikipedia.org/wiki/Battleship_(game)

https://en.wikipedia.org/wiki/Battleship_(puzzle)

This is a popular game with lots of material available online. You may not search for, study, or use any code related to the Battleship game or puzzle. Please carefully read the entire assignment and study the examples before beginning your implementation.

Battleship Puzzles - How to Play

Your program will accept one or two command line arguments. The first argument is the name of a battleship puzzle board file similar to the file shown below. This sample file begins with the dimensions of the board, in this case 4 rows and 5 columns. Next, we give the number of cells in each row and each column that are occupied by a ship. The other cells in the row are open water. Then, we have a simple list of the ships that must be placed on that board. All ships are 1 cell wide, but each ship type has a different length (# of cells): submarine = 1, destroyer = 2, cruiser = 3, battleship = 4, carrier = 5, cargo = 6, and tanker = 7.

board 4 5

rows 4 0 2 1

cols 1 2 1 2 1

cruiser

destroyer

submarine

submarine

4

1 2 1 2 1

1

2

0

Your task is to place the ships on the board satisfying the counts for each row. One important rule in placing the ships is that no two ships may occupy adjacent cells (including the diagonal). The sample puzzle above actually has two solutions. The diagram and sample output below show one of the solutions. Can you manually find the other?

Solution:

cruiser 0 0 horizontal

submarine 0 4

submarine 2 1

destroyer 2 3 vertical

+-----+

| o|4

| |0

| o ^ |2

| v |1

+-----+

12121

1

2

0

4

1 2 1 2 1

Output Formatting

To ensure full credit on the homework server, please format your solution exactly as shown above. The solution must begin with the keyword “Solution:”, followed by a line for each ship beginning with the ship type, the row and column of the upperleftmost cell occupied by the ship, and for non-submarine ships the orientation of the ship (“horizontal” or “vertical”). The ships may be listed in any order. After the ship

https://en.wikipedia.org/wiki/Battleship_(game)
https://en.wikipedia.org/wiki/Battleship_(puzzle)
placement details, you should make an ASCII art diagram of the solved board (this will help in debugging). However, this will be graded by the TAs not the automated grading on the homework server, so you may format your ASCII art diagram somewhat differently than the sample above.

If the optional second argument find_all_solutions is not specified, your program should output to std::cout any single valid solution to the puzzle. If the optional argument find_all_solutions is speci- fied, your program should output all valid, unique solutions (in any order) and then also print at the bottom the number of solutions found, e.g., “Found 2 solution(s)”. If the puzzle has no solutions, your program should print “No solutions”. When searching for all solutions, make sure you do not double count or du- plicate the same solution. For example, if a puzzle has two submarines, swapping the submarines does not make a “new” solution.

Puzzles with Cell Constraints

Some input puzzle files have one or more additional constraints placed on some of the cells. These will be listed in the input file after the ships. Here is an example:

board 4 5

rows 4 0 2 1

cols 1 2 1 2 1

cruiser

destroyer

submarine

submarine

constraint 0 2 <

1

2

0

4

1 2 1 2 1

Each constraint line begins with the keyword “constraint”, then the row and column, then one of 7 characters: ’o’ to represent a submarine; ’<’ or ’>’, to represent the left or right cells of a horizontal ship (length ≥ 2); ’^’, or ’v’, to represent the top or bottom cells of a vertical ship (length ≥ 2); ’X’ to represent a middle cell (not either end) of a ship with length ≥ 3; or ’_’ to represent open water. Your task is to limit the output to solutions that match these constraints.

Puzzles with Unknown Sums and/or Unknown Ship Types

The final twist for this assignment is that the input file may have some unspecified row and/or column sums (listed as ’?’) and/or some ships of unspecified type (listed as “unknown”), which may be any length from 1 to 7 cells. Here is an example input:

Homework is Completed By:

Writer Writer Name Amount Client Comments & Rating
Instant Homework Helper

ONLINE

Instant Homework Helper

$36

She helped me in last minute in a very reasonable price. She is a lifesaver, I got A+ grade in my homework, I will surely hire her again for my next assignments, Thumbs Up!

Order & Get This Solution Within 3 Hours in $25/Page

Custom Original Solution And Get A+ Grades

  • 100% Plagiarism Free
  • Proper APA/MLA/Harvard Referencing
  • Delivery in 3 Hours After Placing Order
  • Free Turnitin Report
  • Unlimited Revisions
  • Privacy Guaranteed

Order & Get This Solution Within 6 Hours in $20/Page

Custom Original Solution And Get A+ Grades

  • 100% Plagiarism Free
  • Proper APA/MLA/Harvard Referencing
  • Delivery in 6 Hours After Placing Order
  • Free Turnitin Report
  • Unlimited Revisions
  • Privacy Guaranteed

Order & Get This Solution Within 12 Hours in $15/Page

Custom Original Solution And Get A+ Grades

  • 100% Plagiarism Free
  • Proper APA/MLA/Harvard Referencing
  • Delivery in 12 Hours After Placing Order
  • Free Turnitin Report
  • Unlimited Revisions
  • Privacy Guaranteed

6 writers have sent their proposals to do this homework:

Top Grade Essay
ECFX Market
Innovative Writer
Helping Hand
Supreme Essay Writer
Quality Assignments
Writer Writer Name Offer Chat
Top Grade Essay

ONLINE

Top Grade Essay

You can award me any time as I am ready to start your project curiously. Waiting for your positive response. Thank you!

$71 Chat With Writer
ECFX Market

ONLINE

ECFX Market

Give me a chance, i will do this with my best efforts

$95 Chat With Writer
Innovative Writer

ONLINE

Innovative Writer

I am known as Unrivaled Quality, Written to Standard, providing Plagiarism-free woork, and Always on Time

$49 Chat With Writer
Helping Hand

ONLINE

Helping Hand

Give me a chance, i will do this with my best efforts

$21 Chat With Writer
Supreme Essay Writer

ONLINE

Supreme Essay Writer

Hello, I an ranked top 10 freelancers in academic and contents writing. I can write and updated your personal statement with great quality and free of plagiarism

$97 Chat With Writer
Quality Assignments

ONLINE

Quality Assignments

You can award me any time as I am ready to start your project curiously. Waiting for your positive response. Thank you!

$54 Chat With Writer

Let our expert academic writers to help you in achieving a+ grades in your homework, assignment, quiz or exam.

Similar Homework Questions

How to describe a solution - Account classification method - Material culture in a sentence - The flowers by alice walker theme - Thank you letter assignment - Weekly tax timetable australia - Do managers matter - 8085 microprocessor mini projects with program - An external website permitting users to browse and purchase widgets - Islamic Culture Reflection - Topic - Candy first aid kit - Theology sir is a fortress meaning - Report 5 - Multi level retaining wall - Diagnostic prescriptive evaluative dpe teaching - Saint jonathan patron saint of friendship - Iom leading change advancing health - Active Low Pass Filters - Wicked the untold story of the witches of oz book - Org Behavior Reflection, Discussion and Assignment - Complete guide to laboratory safety terry jo gile - reflect on the web article Big Data Means Big Potential, Challenges for Nurse Execs. Reflect on your own experience with complex health information access and management and consider potential challenges and risks  - Nick scali anzac highway - Business Ethics : 6 Case study and Journal Article Analysis - Volume to capacity conversion - Two quality control technicians measure the surface finish - Uncle pudgy's pizza west seneca menu - Chaucer uses the pilgrimage primarily as a device to - Social networking sites are a part of web 2.0 - Vladimir tatlin counter relief 1913 - Hungry for success scotland - What is the fastest type of mass wasting process - The human odyssey volume 3 - ( C/C++ ) Design and implement a Disassembler for the XE variant of the SIC/XE machines ( C/C++ ) - Thesis statement for film analysis - Bcg matrix volkswagen group - Week 1 Quiz - How to transfer spss output to word - Introduction to maternity and pediatric nursing pdf - Health - Do a bit of research on-line. Find a criminal case that involved Digital Forensics. - Chemistry exam - MACLA2 - Multicultural social justice counseling competencies - Fema history timeline - Cite examples of the research and development process. - Photosynthesis lab answer key - Nanda nursing diagnosis for necrotizing enterocolitis - Weighing of the heart ceremony worksheet - A farewell to arms thesis statement - Business continuity management framework - Baron baptiste yoga sequence - +91-8306951337 get your love back by vashikaran IN Erode - Gas laws pre lab answers - Vce psychology scientific poster - Winfield refuse management prezi - Lf meaning in construction - Introduction and problem statement - The enrique camarena case a forensic nightmare questions and answers - Sephora 2019 vib sale dates - Picaxe motor speed control - How to calculate annual depreciation straight line method - Biology final exam 2018 - Distance, Speed, and Acceleration - Asean strategic action plan for sme development 2016 2025 - Psychiatric nurse cover letter - True or false comic relief is only found in comedies - Example of a character description - 4 4 practice graphing a function rule - Cowdroy 1830mm triumph 4 leaf folding door track system - American golf corporation careers - Informative outline example - Master data services add in for excel - Rite aid pharmacy mission statement - 4/2-4 georgina parade camberwell - COMM 203 - Discussion - Apn professional development plan sample - Bacterial identification lab worksheet answers - Yo prefiero una langosta. yo preferí una langosta. - Maxwell 5 levels of leadership summary - Bella capelli demand force - Cessna 172 alternator failure - Use of potassium hydroxide in vanishing cream - Risk Management - Discussion - Power system analysis problems and solutions - Defense justification of usp - Bulk density of canola seed - Celf preschool 2 age range - W3Accounting - Cl luminaire ip65 tube - Evan company reports net income of - What is behaviour shaping in psychology - Home depot grout colors - History essay - Edith hollander frank biography - Dialog group annual report - Floor sander hire mansfield