This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds and have James Denton on-line!
See this thread for details.
Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

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: 9219
177
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!