• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

Question (non-spoiler) on assignment six  RSS feed

 
Ranch Hand
Posts: 235
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
 
Bartender
Posts: 9558
189
  • 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: 235
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.
 
Oh the stink of it! Smell my tiny ad!
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!