{"id":1283,"date":"2015-04-01T00:01:01","date_gmt":"2015-04-01T07:01:01","guid":{"rendered":"http:\/\/c-for-dummies.com\/blog\/?p=1283"},"modified":"2015-04-09T07:34:36","modified_gmt":"2015-04-09T14:34:36","slug":"board-of-chess","status":"publish","type":"post","link":"https:\/\/c-for-dummies.com\/blog\/?p=1283","title":{"rendered":"Board of Chess"},"content":{"rendered":"<p>Thanks to Mr. Spock (and God bless you, Mr. Nimoy!), many people think of Chess when they think of computer programming. Unlike mankind&#8217;s favorite Vulcan, coding your own computer chess game would be a tremendous undertaking. Even so, you can start with the basics and write a program that outputs a chessboard.<br \/>\n<!--more--><br \/>\nMore specifically, your challenge for the month of April is to write code that generates a square game board, like a checkerboard, but one of variable size.<\/p>\n<p>For review, a chessboard features 64 squares arranged in 8 rows by 8 columns. And you could write code that simply barfs out that board by cramming a host of <em>printf()<\/em> statements into the <em>main()<\/em> function. Or you could be clever and use a loop. Or you could obey my directions and craft code that outputs a variable size chessboard.<\/p>\n<p>Your code must read the command line arguments, of which only one is valid: A value from 1 to <em>n<\/em> that indicates the number of rows\/columns on the chessboard. When a value isn&#8217;t specified (or the value is out of range or just weird), output an 8-by-8 board.<\/p>\n<p>Figure 1 illustrates the output from my solution, although your code&#8217;s output doesn&#8217;t need to be identical. In fact, I&#8217;ve merely included a link to Figure 1 so that if you don&#8217;t want to peek at my code&#8217;s output, you can dive right into the Exercise.<\/p>\n<p><a href=\"http:\/\/c-for-dummies.com\/blog\/wp-content\/uploads\/2015\/03\/04exercise-output.png\">Figure 1.<\/a><\/p>\n<p><a href=\"http:\/\/c-for-dummies.com\/blog\/?p=1310\">Click here<\/a> to view my solution. Please consider trying this exercise on your own before you do so.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Make Mr. Spock proud with a chessboard generating program. <a href=\"https:\/\/c-for-dummies.com\/blog\/?p=1283\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-1283","post","type-post","status-publish","format-standard","hentry","category-exercise"],"_links":{"self":[{"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1283","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1283"}],"version-history":[{"count":5,"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1283\/revisions"}],"predecessor-version":[{"id":1327,"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1283\/revisions\/1327"}],"wp:attachment":[{"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1283"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1283"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1283"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}