<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>atoms | Learn C Games Programming Blog</title>
	<atom:link href="https://learncgames.com/tag/atoms/feed/" rel="self" type="application/rss+xml" />
	<link>https://learncgames.com</link>
	<description>A blog about C, programming games and my ebook(s).</description>
	<lastBuildDate>Sat, 02 Jan 2021 10:24:44 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://learncgames.com/wp-content/uploads/2020/03/cropped-favicon-32x32.png</url>
	<title>atoms | Learn C Games Programming Blog</title>
	<link>https://learncgames.com</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">181446779</site>	<item>
		<title>Tutorial on Atoms added</title>
		<link>https://learncgames.com/tutorial-on-atoms-added/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=tutorial-on-atoms-added</link>
		
		<dc:creator><![CDATA[David]]></dc:creator>
		<pubDate>Sat, 02 Jan 2021 00:00:21 +0000</pubDate>
				<category><![CDATA[C]]></category>
		<category><![CDATA[tutorials]]></category>
		<category><![CDATA[atoms]]></category>
		<guid isPermaLink="false">https://learncgames.com/?p=2279</guid>

					<description><![CDATA[<p>This is my alternative approach to learning C. Show code, explain what it does in depth rather than explaining the C language feature-by-feature. I&#8217;ve created a 90 line skeleton program for atoms. The full file is on GitHub, The file is called atoms.c. All this does is setup the board and let you enter your move. [&#8230;]</p>
The post <a href="https://learncgames.com/tutorial-on-atoms-added/">Tutorial on Atoms added</a> first appeared on <a href="https://learncgames.com">Learn C Games Programming Blog</a>.]]></description>
										<content:encoded><![CDATA[<div class='__iawmlf-post-loop-links' style='display:none;' data-iawmlf-post-links='[{&quot;id&quot;:119,&quot;href&quot;:&quot;https:\/\/github.com\/David-H-Bolton\/LearnCCode&quot;,&quot;archived_href&quot;:&quot;http:\/\/web-wp.archive.org\/web\/20250213114359\/https:\/\/github.com\/David-H-Bolton\/LearnCCode&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2026-02-06 11:59:25&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-10 22:04:22&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-15 22:42:55&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-19 03:42:57&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-23 00:07:14&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-27 11:04:46&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-02 22:28:38&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-06 01:11:43&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-09 06:32:12&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-14 23:28:58&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-24 21:49:09&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-28 21:29:06&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-02 12:52:18&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-06 03:59:21&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-11 22:58:43&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-15 00:56:11&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-18 04:43:26&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-21 12:23:33&quot;,&quot;http_code&quot;:206}],&quot;broken&quot;:false,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-04-21 12:23:33&quot;,&quot;http_code&quot;:206},&quot;process&quot;:&quot;done&quot;}]'></div>
<p><img fetchpriority="high" decoding="async" class="alignleft size-full wp-image-2280" src="https://learncgames.com/wp-content/uploads/2020/12/atoms-command-line.png" alt="Atoms command line" width="312" height="437" srcset="https://learncgames.com/wp-content/uploads/2020/12/atoms-command-line.png 312w, https://learncgames.com/wp-content/uploads/2020/12/atoms-command-line-214x300.png 214w" sizes="(max-width: 312px) 100vw, 312px" />This is my alternative approach to learning C. Show code, <a title="Link to tutorial one on Atoms" href="https://learncgames.com/tutorials/atoms-game-tutorial-one-intro-to-c-programming/" target="_blank" rel="nofollow noopener">explain what it does</a> in depth rather than explaining the C language feature-by-feature. I&#8217;ve created a 90 line skeleton program for atoms. The full file is on <a title="Link to LearnC files on GitHub." href="https://github.com/David-H-Bolton/LearnCCode" target="_blank" rel="nofollow noopener">GitHub,</a> The file is called atoms.c.</p>
<p>All this does is setup the board and let you enter your move. I&#8217;ve tested it on Windows and it calls _getch() to read the keyboard so it&#8217;s fast to enter moves and you don&#8217;t have to press enter/return. It then validates the move and updates the board and draws it. No chain reactions yet or computer play but those will be in future tutorials.</p>
<p>In the screenshot you can see I added one atom to (3,3) and then (5,6).</p>
<p>The board uses three characters for each cell with atoms prefixed by P or C for player and computer.  Trying to have the computer play well will be an interesting bit of programming.</p>
<p>&nbsp;</p>The post <a href="https://learncgames.com/tutorial-on-atoms-added/">Tutorial on Atoms added</a> first appeared on <a href="https://learncgames.com">Learn C Games Programming Blog</a>.]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2279</post-id>	</item>
		<item>
		<title>First new C Tutorial has been added</title>
		<link>https://learncgames.com/first-new-c-tutorial-has-been-added/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=first-new-c-tutorial-has-been-added</link>
		
		<dc:creator><![CDATA[David]]></dc:creator>
		<pubDate>Thu, 31 Dec 2020 00:00:45 +0000</pubDate>
				<category><![CDATA[C]]></category>
		<category><![CDATA[Game]]></category>
		<category><![CDATA[tutorials]]></category>
		<category><![CDATA[atoms]]></category>
		<category><![CDATA[schedule]]></category>
		<guid isPermaLink="false">https://learncgames.com/?p=2244</guid>

					<description><![CDATA[<p>As promised, I&#8217;ve added the first C Tutorial using the Atoms (aka Chain Reaction) game. However this is just a very easy intro to the Atoms game and doesn&#8217;t have a line of C code in it. We&#8217;ll save that for the next tutorial. The planned tutorials for this are: Intro to the Atoms game. [&#8230;]</p>
The post <a href="https://learncgames.com/first-new-c-tutorial-has-been-added/">First new C Tutorial has been added</a> first appeared on <a href="https://learncgames.com">Learn C Games Programming Blog</a>.]]></description>
										<content:encoded><![CDATA[<p><img decoding="async" class="alignleft size-full wp-image-2245" src="https://learncgames.com/wp-content/uploads/2020/12/atoms-board.png" alt="Atomes board" width="199" height="235" />As promised, I&#8217;ve added the<a title="Link to Atoms C Tutorial one" href="https://learncgames.com/atoms-game-aka-chain-reaction-an-alternative-c-tutorial/" target="_blank" rel="nofollow noopener"> first C Tutorial</a> using the Atoms (aka Chain Reaction) game. However this is just a very easy intro to the Atoms game and doesn&#8217;t have a line of C code in it. We&#8217;ll save that for the next tutorial.</p>
<p>The planned tutorials for this are:</p>
<ol>
<li>Intro to the Atoms game.</li>
<li>Drawing the Atoms board.</li>
<li>Reading the keyboard and making a move.</li>
<li>Handling explosions and checking if the game is over.</li>
<li>Programming the computer player AI.</li>
<li>Drawing a high-score table.</li>
</ol>
<p>These will each include a C listing and an explanation of what the new C code does.</p>
<p>&nbsp;</p>The post <a href="https://learncgames.com/first-new-c-tutorial-has-been-added/">First new C Tutorial has been added</a> first appeared on <a href="https://learncgames.com">Learn C Games Programming Blog</a>.]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2244</post-id>	</item>
		<item>
		<title>Thinking about future C tutorials</title>
		<link>https://learncgames.com/thinking-about-future-c-tutorials/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=thinking-about-future-c-tutorials</link>
		
		<dc:creator><![CDATA[David]]></dc:creator>
		<pubDate>Wed, 30 Dec 2020 00:00:32 +0000</pubDate>
				<category><![CDATA[C]]></category>
		<category><![CDATA[tutorials]]></category>
		<category><![CDATA[atoms]]></category>
		<category><![CDATA[chain reaction]]></category>
		<category><![CDATA[tutorial]]></category>
		<guid isPermaLink="false">https://learncgames.com/?p=2229</guid>

					<description><![CDATA[<p>The tutorials I&#8217;ve done have followed a fairly &#8220;standard&#8221; model. Learn a feature, learn a new feature and so on. But what if this isn&#8217;t the best way to try and teach C? I can&#8217;t remember how I learnt C. I&#8217;m not actually sure that I did which sounds weird but I learnt C++ nearly [&#8230;]</p>
The post <a href="https://learncgames.com/thinking-about-future-c-tutorials/">Thinking about future C tutorials</a> first appeared on <a href="https://learncgames.com">Learn C Games Programming Blog</a>.]]></description>
										<content:encoded><![CDATA[<div class='__iawmlf-post-loop-links' style='display:none;' data-iawmlf-post-links='[{&quot;id&quot;:285,&quot;href&quot;:&quot;https:\/\/pixabay.com\/users\/anandkz-3271136\/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=2111539&quot;,&quot;archived_href&quot;:&quot;&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[],&quot;broken&quot;:false,&quot;last_checked&quot;:null,&quot;process&quot;:&quot;done&quot;},{&quot;id&quot;:286,&quot;href&quot;:&quot;https:\/\/pixabay.com\/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=2111539&quot;,&quot;archived_href&quot;:&quot;http:\/\/web-wp.archive.org\/web\/20260205102120\/https:\/\/pixabay.com\/?utm_source=link-attribution&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2026-02-06 13:29:54&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-02-13 03:33:49&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-02-23 16:08:35&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-02-28 04:10:04&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-04 16:22:22&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-10 06:34:14&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-03 10:42:47&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-15 09:30:07&quot;,&quot;http_code&quot;:403}],&quot;broken&quot;:true,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-04-15 09:30:07&quot;,&quot;http_code&quot;:403},&quot;process&quot;:&quot;done&quot;},{&quot;id&quot;:287,&quot;href&quot;:&quot;https:\/\/www.reddit.com\/r\/C_Programming\/comments\/kl2l0b\/what_do_you_guys_think_its_the_best_way_to&quot;,&quot;archived_href&quot;:&quot;http:\/\/web-wp.archive.org\/web\/20230617023700\/https:\/\/www.reddit.com\/r\/C_Programming\/comments\/kl2l0b\/what_do_you_guys_think_its_the_best_way_to\/&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2026-02-06 13:29:56&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-02-13 03:33:49&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-23 16:08:35&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-02-28 04:10:05&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-04 16:22:22&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-10 06:34:15&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-03 10:35:41&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-15 09:30:07&quot;,&quot;http_code&quot;:206}],&quot;broken&quot;:false,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-04-15 09:30:07&quot;,&quot;http_code&quot;:206},&quot;process&quot;:&quot;done&quot;}]'></div>
<figure id="attachment_2232" aria-describedby="caption-attachment-2232" style="width: 300px" class="wp-caption alignleft"><img decoding="async" class="size-medium wp-image-2232" src="https://learncgames.com/wp-content/uploads/2020/12/molecules-2111539_640-300x169.jpg" alt="Molcules" width="300" height="169" srcset="https://learncgames.com/wp-content/uploads/2020/12/molecules-2111539_640-300x169.jpg 300w, https://learncgames.com/wp-content/uploads/2020/12/molecules-2111539_640.jpg 640w" sizes="(max-width: 300px) 100vw, 300px" /><figcaption id="caption-attachment-2232" class="wp-caption-text">Image by <a href="https://pixabay.com/users/anandkz-3271136/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=2111539">Anand Kumar</a> from <a href="https://pixabay.com/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=2111539">Pixabay</a></figcaption></figure>
<p>The tutorials I&#8217;ve done have followed a fairly &#8220;standard&#8221; model. Learn a feature, learn a new feature and so on. But what if this isn&#8217;t the best way to try and teach C?</p>
<p>I can&#8217;t remember how I learnt C. I&#8217;m not actually sure that I did which sounds weird but I learnt C++ nearly 28 years ago (<em>I bought a book on C++ programming while on a weekend holiday in York</em>). I learnt more C++ four years later when I was working on a football game. That project lasted six months and then the designer of the game decided to visit India and never came back and the whole thing fell though.</p>
<p>Fast forward to 2006 when I started writing the About C, C++ and C# column for about.com. Because I knew C++, I sort of knew C without explicitly having learnt it, Back then C++ was a superset of C. It still mostly is but there is the odd divergence.</p>
<p>This morning I was reading <a title="Link to best way to learn thread in the C Reddit" href="https://www.reddit.com/r/C_Programming/comments/kl2l0b/what_do_you_guys_think_its_the_best_way_to/" target="_blank" rel="nofollow noopener">this thread on reddit</a>. &#8220;<em>What do you guys think its the best way to improve your coding</em>?&#8221; and it got me thinking about the C tutorials. I know that I like to learn by working on small projects. Most games are too big for a tutorial (heck you can get a book out of them).</p>
<p>So I got to thinking, what is a simple game that would make for a good set of C tutorials? I even dug out the two books <strong>BASIC Computer games</strong> and <strong>More BASIC Computer games </strong>for inspiration. However in the end I decided on the game atoms. Here are the rules.</p>
<h3>Rules for Atoms (aka Chain Reaction)</h3>
<p>This takes place on an 8 x 8 board. Each turn you and then your opponent. Add 1 to any cell on the board. At the start all cells are empty with a value of 0. When you add 1 to a cell, it turns red or blue if the computer is playing. If a cell reaches 4 then it is cleared to 0 and all four cells around it (horizontal and vertical) have 1 added to them and become the player&#8217;s colour.  Cells in the corner only need to reach 2 to explode while cells at edges need 3.</p>
<p>When there are enough atoms on the board, a chain reaction can take place and you win if your atoms replace your opponents or lose in the opposite case.</p>
<p>To keep the tutorials simple this will be a console game. Each cell will be blank or show the number of atoms in the cell followed by a C (for computer) or P for Player instead of colours.  I&#8217;ll start the first tutorial tomorrow.</p>
<p>&nbsp;</p>The post <a href="https://learncgames.com/thinking-about-future-c-tutorials/">Thinking about future C tutorials</a> first appeared on <a href="https://learncgames.com">Learn C Games Programming Blog</a>.]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2229</post-id>	</item>
	</channel>
</rss>
