Skip to main content
replaced http://codegolf.stackexchange.com/ with https://codegolf.stackexchange.com/
Source Link

I'm a newcomer to C++, from C#. I wrote a program that prints an ASCII checkerboard with a side length of the number passed to it (link to original Code Golf questionlink to original Code Golf question).

I'm a newcomer to C++, from C#. I wrote a program that prints an ASCII checkerboard with a side length of the number passed to it (link to original Code Golf question).

I'm a newcomer to C++, from C#. I wrote a program that prints an ASCII checkerboard with a side length of the number passed to it (link to original Code Golf question).

edited tags
Link
Jamal
  • 34.9k
  • 13
  • 133
  • 237
deleted 28 characters in body
Source Link
Jamal
  • 34.9k
  • 13
  • 133
  • 237

Draw an ASCII checkerboard (Code Golf)

I'm a newcomer to C++, from C#. I wrote a program that prints an ASCII checkerboard with a side length of the number passed to it (link to original Code Golf question). Here is its code (VC++):

stdafx.hstdafx.h

Checkers.cppCheckers.cpp

  • I intentionally had a little fun optimizing prematurely here, i.e. generating the header ("+--+") and body ("|##| |") strings only once instead of every loop. What could I do to increase readability without getting rid of each-loop optimizations like this?

  • When is it okay to use non-type template parameters, like I did in body? This means that you always have to rewrite your code when you want to offer a non-template alternative, correct?

  • Any other comments / suggestions?

Thanks!

(This is not an entry for the Code Golf contest, it is way too long for that.)

Draw an ASCII checkerboard (Code Golf)

I'm a newcomer to C++, from C#. I wrote a program that prints an ASCII checkerboard with a side length of the number passed to it (link to original Code Golf). Here is its code (VC++):

stdafx.h

Checkers.cpp

  • I intentionally had a little fun optimizing prematurely here, i.e. generating the header ("+--+") and body ("|##| |") strings only once instead of every loop. What could I do to increase readability without getting rid of each-loop optimizations like this?

  • When is it okay to use non-type template parameters, like I did in body? This means that you always have to rewrite your code when you want to offer a non-template alternative, correct?

  • Any other comments / suggestions?

Thanks!

(This is not an entry for the Code Golf contest, it is way too long for that.)

Draw an ASCII checkerboard

I'm a newcomer to C++, from C#. I wrote a program that prints an ASCII checkerboard with a side length of the number passed to it (link to original Code Golf question).

stdafx.h

Checkers.cpp

  • I intentionally had a little fun optimizing prematurely here, i.e. generating the header ("+--+") and body ("|##| |") strings only once instead of every loop. What could I do to increase readability without getting rid of each-loop optimizations like this?

  • When is it okay to use non-type template parameters, like I did in body? This means that you always have to rewrite your code when you want to offer a non-template alternative, correct?

Source Link
James Ko
  • 439
  • 2
  • 8
Loading