Win a copy of Machine Learning Systems: Designs that scale this week in the Scala forum
or Xamarin in Action: Creating native cross-platform mobile apps in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Question (non-spoiler) on assignment six  RSS feed

 
Ranch Hand
Posts: 231
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've been putzing through the Cattle Ranch assignments, and ran into ... discrepency, for lack of a better work. The assignment is to calculate the number of grains of wheat on each square of a chessboard (garnered from an ancient parable). The main objective was to find a certain API call. Easy enough, although I need to learn to read... would have made using this call a whole lot easier.

My question is this: the instructor's version took 35 lines to solve; whereas my solution was 7 lines of actual code plus three lines of '}' . What am I missing? Adding a pretty formatting to the output would only involve one or 2 more lines of code. So what did overlook. There are no detailed instructions; at least not that I can see.

If this is a fee-based question, or too much of a spoiler, I understand. But, I am curious as to what purpose of the additional 20some lines of code.

Regards,
Robert
 
Saloon Keeper
Posts: 8907
167
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Robert,

It's been a long time since I went through the nitpicking process myself, a quick solution I just wrote counts roughly 20 lines. That's including empty lines, boilerplate and braces. Admittedly, the style guide that the Cattle Drive uses is a bit less terse than what I usually write.

Your styling could be different from the one the nitpickers mandate, or you could be overlooking the fact that the output for the first square is a special case.

Either way, for a conclusive answer you should take it up with your nitpicker.
 
Bartender
Posts: 1817
12
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To solve the assignment and get the instructor solution, your solution may be different than the solution given by the trailboss.

The number of lines is a serving suggestion so folks don't go crazy writing too much code.
 
Robert D. Smith
Ranch Hand
Posts: 231
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Janeice DelVecchio wrote:The number of lines is a serving suggestion so folks don't go crazy writing too much code.



Ah, that's my problem; I took it as a challenge.
 
Trust God, but always tether your camel... to this tiny ad.
free 1 hour java lesson
https://coderanch.com/t/695988/free-hour-java-lesson
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!