Skip to content

kimberlyz/PrismTechAssessment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

PrismTechAssessment

##Deck of Cards

I chose to make a Card class and a Deck class in order to keep the code more clean and understandable. The Card class would solely need to know its suit and rank. The Deck class would generate the objects of the Card class and hold all those Cards inside an array (which would comprise the deck).

I decided that calling GetNextCard() wouldn't actually modify the contents of the cards array in Deck. It would simply return the value of the next card, not remove the item from the array. Thus, my Shuffle method, which returns all the cards to the deck, took this information into account. If Shuffle is called a second time, it doesn't shuffle a deck of cards that is perfectly in order. It shuffles the deck from its current shuffled state (the state when you called Shuffle for the first time) by simply resetting the variable that keeps track of where the top card is.

I would determine that my framework is working correctly by including a function that prints out the values of all the cards of the deck, and double check that all suits and ranks are represented. I would also compare a list of cards generated by calling GenNextCard 52 times with the shuffled deck to see if GenNextCard correctly outputs the next card in the deck.

##The Vacationing Salesman

You can run the script by calling: python Vacationing-Salesman-Solution.py if you're on Windows, or python3 Vacationing-Salesman-Solution.py if you're on a Mac.

I chose Python because it is the language I am most familiar with, and writing Python tends to be faster than other languages. This is because Python doesn't need semicolons, parentheses, brackets, or a declaration of the type of a variable.

I decided to make sure the user inputs a valid filename, so the program wouldn't crash as easily. In the future, I would also hope to double check that the information in the text file is valid. To keep the code from getting cluttered and to keep it more organized, I decided that the actual calculation of the distances between subsequent cities would happen in a function outside of main. Main would handle the the user interface, mainly the input of the user's text file and the output of the results of their itinerary.

I went the wrong route and used Google's Distance Matrix API to calculate the distance between places. I thought this would be beneficial because I would be able to potentially calculate driving, walking, or transit times or distances if I had the time to implement them. However, I failed to see that the API prevents me from calculating the distance between places on different continents using their built-in distance calculator. I decided to continue using my current method to solely calculate the distances between places on the same continent because I was running out of time. If I to make a quick fix to this, I would generate the latitude and longitude of the places using Google's API. Then, I would use a formulat to calculate the distance between the latitude and longitude of the two places.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages