<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Manikandan Murugan on Medium]]></title>
        <description><![CDATA[Stories by Manikandan Murugan on Medium]]></description>
        <link>https://medium.com/@manisekar1215?source=rss-c44d12b74cf------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*JSwnXmFxywvytpklmtpvMg.jpeg</url>
            <title>Stories by Manikandan Murugan on Medium</title>
            <link>https://medium.com/@manisekar1215?source=rss-c44d12b74cf------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 01:01:50 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@manisekar1215/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[What you know doesn’t matter, But what you do with what you know matters a lot.]]></title>
            <link>https://medium.com/reportbee/what-you-know-doesnt-matter-but-what-you-do-with-what-you-know-matters-a-lot-8a7c732e0e97?source=rss-c44d12b74cf------2</link>
            <guid isPermaLink="false">https://medium.com/p/8a7c732e0e97</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[report-bee]]></category>
            <category><![CDATA[games]]></category>
            <category><![CDATA[game-development]]></category>
            <category><![CDATA[college-projects]]></category>
            <dc:creator><![CDATA[Manikandan Murugan]]></dc:creator>
            <pubDate>Thu, 26 Apr 2018 06:32:20 GMT</pubDate>
            <atom:updated>2018-04-26T06:32:20.554Z</atom:updated>
            <content:encoded><![CDATA[<p>One thing i did during my Engineering, that was the first thing i had developed in the path of programming. Following words are about how i did it and What i learned and benefited through it.</p><p>One day afternoon my professor was teaching n-queens problem with n=8 for an example for <a href="https://en.wikipedia.org/wiki/Backtracking">Backtracking</a> algorithm. It was fully theoretical explanation. But, i thought of how it can be achieved practically and also how it can be made generic? Generic in the sense, how it can be extended to n, since the name itself tells that it is a game played with n queens..</p><p>So, Initially i framed an algorithm as follows.<br>1. Get a number (n) from user and display chess board (n*n) accordingly.<br>2. For each queen, the user is going to place, calculate all of its clashing places and store it.<br>3. At the end, using the stored data, find the clashing queens, display the result to the user.</p><p>Below is the implementation:</p><p>Step 1 - Getting one number from user and displaying the chess board.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Cw20kobwpsTFRJgPaxt0KQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CLNWKvP-cFaUWEPwqgwGcQ.png" /></figure><p>Step 2 - For each position of a Queen, to find all its clashing places, edge and next numbers, in the all 8 directions were required.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/88/1*5M3U20G-WzlUCJL-I06HLA.jpeg" /></figure><p>The problem here is position of the Queen placed ie. corner ( top-right, top-left, bottom-right, bottom-left), edge (top, bottom, left, right) or in the middle. Based on the position, there will one formula to find out the edge and next numbers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qxhy_7w2RwMGSXUL-DKcaQ.png" /></figure><p><strong>Top-left:</strong></p><pre><strong>Next no = </strong>(queen_position - 1) * i - board_size<br><strong>Edge:<br>    </strong>if ((next_num % board_size) == 1 )<br>      return true;<br>    else if (((next_num - 1) / board_size) == 0) <br>      return true;<br>    else<br>      return false;</pre><p><strong>Top-right:</strong></p><pre><strong>Next no = </strong>(queen_position + 1) * i - board_size<br><strong>Edge:<br></strong>    if ((next_num % board_size) == 0)<br>      return true;<br>    else if (((next_num - 1) / board_size) == 0)<br>      return true;<br>    else<br>      return false;</pre><p><strong>Bottom-left:</strong></p><pre><strong>Next no = </strong>(queen_position - 1) * i + board_size<strong><br>Edge:</strong><br>    if ((next_num % board_size) == 1)<br>       return true;<br>    else if (((next_num - 1) / board_size) == (board_size - 1))<br>       return true;<br>    else<br>       return false;</pre><h4><strong>Bottom-right:</strong></h4><pre><strong>Next no = </strong>(queen_position + 1) * i + board_size<br><strong>Edge:<br>    </strong>if ((next_num % board_size) == 0)<br>     return true;<br>    else if (((next_num - 1) / board_size) == (board_size - 1))<br>     return true;<br>    else<br>     return false;</pre><p><strong>Top:</strong></p><pre><strong>Next no = </strong>queen_position - (board_size * i)<br><strong>Edge:<br>    </strong>if((next_num — 1) / board_size == 0)<br>      return true;<br>    else<br>      return false</pre><p><strong>Bottom:</strong></p><pre><strong>Next No = </strong>queen_position + (board_size * i)<br><strong>Edge:<br>    </strong>if(((next_num — 1) / board_size) == (board_size - 1))<br>      return true;<br>    else<br>      return false;</pre><p><strong>Left:</strong></p><pre><strong>Next no = </strong>queen_position - 1 * i<br><strong>Edge:<br></strong>    if(next_num % board_size == 1)<br>      return true;<br>    else<br>      return false;</pre><p><strong>Right:</strong></p><pre><strong>Next no = </strong>queen_position +1 * i<br><strong>Edge:</strong><br>    if(next_num % board_size == 0)<br>      return true;<br>    else<br>      return false;</pre><p>There will be 8 arrays. For each queen, the above formulas will be applied and the result is pushed to corresponding array.</p><p>From these arrays, repetation-index will be calculated.</p><p>For each position in board, max repitation-index will be <br> - ‎0 for positions where queens has been placed.<br> - 4 for positions other than queens placed. Because a position in board can be non-clashable only when it is present, maximum 4 times in the all eight arrays.</p><p>Based on these repitation-index the final result will be calculated as follows:</p><p>If repitation-indexes corrosponding to all Queen’s places is 0, then the user won the game. Otherwise user lost the game and display color difference to show clasing Queen’s to the user by using repitation index.</p><p><strong>Things I learned:</strong></p><ol><li>How to approach a problem.</li><li>How to write modularized code.</li><li>Importance of code quality.</li><li>How to write scalable and reusable code.</li></ol><p><strong>Benefits:</strong><br>1. This was the first thing i had developed in programming, it gave me more confidence. With this, i did my final year project very well.</p><p>2. ‎I had something to say in the campus interviews.</p><blockquote>Programming is thinking, not typing.</blockquote><p><strong>Links:</strong></p><p><a href="https://github.com/manikandn/N-Queens-game"><em>Source Code</em></a><em> - </em><a href="https://manikandn.github.io/N-Queens-game/"><em>Link to Game</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8a7c732e0e97" width="1" height="1" alt=""><hr><p><a href="https://medium.com/reportbee/what-you-know-doesnt-matter-but-what-you-do-with-what-you-know-matters-a-lot-8a7c732e0e97">What you know doesn’t matter, But what you do with what you know matters a lot.</a> was originally published in <a href="https://medium.com/reportbee">reportbee</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>