Computer Science  >  Research Paper  >  LeafPile (All)

LeafPile

Document Content and Description Below

Largest Leaf Pile CSC 385 Recursive Assignment - 100 Pts. For this assignment, you are provided with a main method (LeafPile.java) and the Ground enum (Ground.java). Do NOT change the Ground enum ... or the provided methods inside LeafPile.java. You may add all necessary methods to solve the problem that you need to inside main. Modifying the enum or the provided methods will cost you points. You may change the map[][] array in the main method to different sizes for testing purposes. Suppose you have an N x M grid in which either grass or a leaf is in each cell of the grid (but not both). Your assignment is to determine the largest leaf pile on the map. Your algorithm must utilize recursion to solve the problem. The grid internally is represented like this [GRASS LEAF LEAF GRASS GRASS LEAF GRASS LEAF LEAF ] In which GRASS and LEAF are the enum values from Ground.java and this is 3 x3 array. For the purposes of shortness, GRASS will be represented by the period symbol ‘ . ‘ and LEAF will be represented by the tilde symbol ‘ ~ ‘ for the rest of the matrices in this document. What constitutes a leaf pile? A leaf is part of a pile if it touches another leaf in the four cardinal directions of north, east, south and west. Leaves that touch diagonally are not part of the pile. So, from the matrix above the piles are pile1={(0,2)} pile 2={(1, 0) , (1,1) , (2,0 )} pile3={(2,2) } Each pile is represented as a list of tuples that contain the coordinates of a leaf in the form of (row, column). As you can see, the pile with most leaves is pile 2. Provided Files You are given two files, Ground.java and LeafPile.java. Ground.java contains a public enum which contains two types, LEAF and GRASS. If you are unfamiliar with enums, you may visit https://docs.oracle.com/javase/tutorial/java/javaOO/enum.html For a refresher. The main method contains the following utility methods printMap(Ground map[][]) - Which prints a 2 dimensional Ground type array with period symbol for GRASS and tilde symbol for LEAF. genearteRandomGround(Ground map[][]) - Takes in a 2 dimensional Ground array and generates a random map [Show More]

Last updated: 3 years ago

Preview 1 out of 3 pages

Buy Now

Instant download

We Accept:

Payment methods accepted on Scholarfriends (We Accept)
Preview image of LeafPile document

Buy this document to get the full access instantly

Instant Download Access after purchase

Buy Now

Instant download

We Accept:

Payment methods accepted on Scholarfriends (We Accept)

Reviews( 0 )

$6.00

Buy Now

We Accept:

Payment methods accepted on Scholarfriends (We Accept)

Instant download

Can't find what you want? Try our AI powered Search

70
0

Document information


Connected school, study & course


About the document


Uploaded On

Mar 30, 2021

Number of pages

3

Written in

All

Seller


Profile illustration for Muchiri
Muchiri

Member since 4 years

209 Documents Sold

Reviews Received
19
5
1
1
6
Additional information

This document has been written for:

Uploaded

Mar 30, 2021

Downloads

 0

Views

 70

Document Keyword Tags

Recommended For You

Get more on Research Paper »

$6.00
What is Scholarfriends

Scholarfriends.com Online Platform by Browsegrades Inc. 651N South Broad St, Middletown DE. United States.

We are here to help

We're available through e-mail, Twitter, Facebook, and live chat.
 FAQ
 Questions? Leave a message!

Follow us on
 Twitter

Copyright © Scholarfriends · High quality services·