Reputation
4,265
Top tag
Next privilege 5,000 Rep.
Approve tag wiki edits
Badges
3 37 52
Newest
 Good Answer
Impact
~428k people reached

  • 0 posts edited
  • 0 helpful flags
  • 135 votes cast
Dec
11
comment If your algorithm is correct, does it matter how long it took you to write it?
I could make a recursive function that moves a piece into place, moves any blocking piece out of the way, then starts over with the next piece. Starting with the largest piece and working down to the last smallest piece. The "is it optimal" part comes from when you move a blocking piece. Depending on where you move it, it can create additional unnecessary steps. For example moving a 1 onto a 3 will then be blocking the 3 and need to be moved out of the way again when its time to move the 3. but depending on the current configuration this may not be avoidable.
Dec
10
comment If your algorithm is correct, does it matter how long it took you to write it?
@ThorbjørnRavnAndersen, I did not learn any programming in school. I am self taught, I learned on the job, by books, experimenting, etc. I was not familiar with the game (except for remembering a similar game being played in planet of the apes), I had to Google to even know it was called "Towers of Hanoi." I do understand recursion (at least I think I do) and I used it here. But simply solving the puzzle would have been much more easier for me, the harder part was "What pattern will yield the least amount of moves possible every time."
Dec
10
comment If your algorithm is correct, does it matter how long it took you to write it?
Thanks for your answer. To answer why it took me long, one part is because I had a bit of trouble comprehending what it was I actually needed to do, once I understood that part, I still had to think for a bit to come up with a plan. For example, if a disc is blocking the disc I want to move, and I need to move it first, where should I move it to. The actually programming part was the shortest, but it all added to the time.
Dec
10
comment If your algorithm is correct, does it matter how long it took you to write it?
@mouviciel I didn't exactly mean lower my aspirations of working with a big .com name but more like working for a company where programming is the primary role vs working at a company that does something else like retail where nobody understands what you do.
Dec
10
asked If your algorithm is correct, does it matter how long it took you to write it?
Dec
6
awarded  Popular Question
Dec
1
awarded  Enthusiast
Oct
5
awarded  Popular Question
Sep
21
accepted Why should you prevent a search engine from indexing your development server?
Sep
21
comment Why should you prevent a search engine from indexing your development server?
@Paperjam, thanks for the info, I was not aware of those issues.
Sep
21
comment Why should you prevent a search engine from indexing your development server?
Can you please give some examples of why it is bad to have a development server on the Internet? What if different people that need to work on or approve things are in remote locations?
Sep
21
asked Why should you prevent a search engine from indexing your development server?
Sep
15
awarded  Yearling
Aug
14
answered PHP framework most similar to ASP.NET MVC3?
Aug
9
accepted Is reinventing the wheel really all that bad?
Aug
7
comment How does Python's handling of line-breaks differ from JavaScript's automatic semicolons?
I put semicolons in JavaScript for same reason I use periods in sentences. Sure the interpreter can usually make sense of your statements without them but its just bad form.
Jul
27
awarded  Popular Question
Jul
27
awarded  Nice Question
Jun
28
comment Why is Mercurial considered to be easier than Git?
What made Mercurial easy for me was hginit. There is no gitinit that I am aware of.
Jun
27
comment What screen resolutions should we test on when developing for mobile devices?
@melee, good point, I have used that in the past.