<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Skelly92</title>
    <description>The latest articles on DEV Community by Skelly92 (@skelly92).</description>
    <link>https://dev.to/skelly92</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F640898%2Fb6907ef9-9793-493d-ac81-d8e2f2bd5677.png</url>
      <title>DEV Community: Skelly92</title>
      <link>https://dev.to/skelly92</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/skelly92"/>
    <language>en</language>
    <item>
      <title>How I made a Battleship Terminal Game using python 3 - Final Project</title>
      <dc:creator>Skelly92</dc:creator>
      <pubDate>Sat, 05 Jun 2021 12:27:19 +0000</pubDate>
      <link>https://dev.to/skelly92/how-i-made-a-battleship-terminal-game-using-python-3-final-project-2igl</link>
      <guid>https://dev.to/skelly92/how-i-made-a-battleship-terminal-game-using-python-3-final-project-2igl</guid>
      <description>&lt;p&gt;As part of my final project for the computer science path in codecademy, I made a single player battleship game in the terminal. I thought it would be interesting to make and would be a challenge as I was entirely sure of how I would accomplish this.  The program is written in python 3. &lt;/p&gt;

&lt;p&gt;It works by having the 10x10 grid as a dictionary in python 3 with the key being the grid letter and number configuration and the value being "A" by default. I changed the value when I set the battleship in the grid to their own letter which allows me to know if they have been attacked and when it is attacked and it has a battleship on it the value changes to "X" but if it doesn't the value changes to "O".&lt;/p&gt;

&lt;p&gt;By using a for loop I went through the dictionaries keys and checked to see if the input the player set was the same as the key and that the value was equal to letter I had assigned to each battleship and if so it would output "KaBoom" if it was successful.&lt;/p&gt;

&lt;p&gt;One of the issues I had while programming the game was how I was going to know if a player had successfully sunk a battleship. What I came up with was that when I set up the battleships on the main grid, I would copy in the key:value pairs to a separate dictionary which would allow me to remove them when successfully hit and then if the dictionary was empty the battleship has been sunk by the player.&lt;/p&gt;

&lt;p&gt;I feel having been through the process of making this game that I have gained a lot of confidence in coding using python 3 and has helped me to get a better understanding of how to code and I am looking forward to coding a different project in the future.&lt;/p&gt;

&lt;p&gt;You can view the game in action here as GIF: &lt;a href="https://imgur.com/a/H8L1gdF"&gt;https://imgur.com/a/H8L1gdF&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you are interested in trying the game you can find it here: &lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--i3JOwpme--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/github-logo-ba8488d21cd8ee1fee097b8410db9deaa41d0ca30b004c0c63de0a479114156f.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/Skelly92"&gt;
        Skelly92
      &lt;/a&gt; / &lt;a href="https://github.com/Skelly92/Battleship_Terminal"&gt;
        Battleship_Terminal
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Single Player Battleship on the Terminal
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;
 

</description>
      <category>python</category>
      <category>github</category>
      <category>bash</category>
    </item>
  </channel>
</rss>
