Giter VIP home page Giter VIP logo

cat-area-generator's Introduction

Cat-Area-Generator

The main target of this Java program to generate random cats first, and check if they are living in the same location. If they are in the same location, then our program will change the location of the cat which is living there for least months. And it will put that cat to a location which has no cats. So, it looks quite simple but we need a bunch of methods to detect the locations and move the cats.

By CatInfoGenerator we can generate random ArrayLists for cat names, locations and months. We have these three methods here which returns ArrayLists: getRandomNameList, getRandomLocationList, getRandomMonthList. We will use those in the other document, Cat Generator Main.

So, the main part is the file called Cat Generator Main. You can generate as many cats as you want by using the methods from our previous file. And in the main we print both the cats before moving and after moving to see the changes. We have some methods to move the cats successfully:

doesIntersect: Takes two locations as String and checks if those two locations intersect. We find the locations by creating substrings and then converting them to double. (Since location String is as "134,213" for an example.)

countIntersecting: Takes a String location and ArrayList locations. Controls the location with each element from locations and count every intersection.

displayIntersections: Displays the cats which intersects if there is any.

findMinMonthsAtLocation:

findRandomLocation: Generates random location between the given border.

moveCats: The most important method since it moves cats to a location which has no cats. So, first it controls if any cats are intersecting. And then detect which one of the intersecting cats has the least month. And then put that cat to another location. To find a location without any other cat, we are using a loop.

With the help of all these methods, our program runs successfully.

I would love to see your comments, suggestions and upgrades for this project! Hope you like it.

Here you can contact me easily: [email protected] https://twitter.com/Anlpolt

cat-area-generator's People

Contributors

eapolat avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.