<?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: AaronASB</title>
    <description>The latest articles on DEV Community by AaronASB (@aaronasb).</description>
    <link>https://dev.to/aaronasb</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%2F2973446%2F802cb611-5d94-4d1f-81f8-f3c91dbcc388.jpg</url>
      <title>DEV Community: AaronASB</title>
      <link>https://dev.to/aaronasb</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/aaronasb"/>
    <language>en</language>
    <item>
      <title>My Blackjack Terminal Game</title>
      <dc:creator>AaronASB</dc:creator>
      <pubDate>Tue, 25 Mar 2025 01:51:41 +0000</pubDate>
      <link>https://dev.to/aaronasb/my-blackjack-terminal-game-1end</link>
      <guid>https://dev.to/aaronasb/my-blackjack-terminal-game-1end</guid>
      <description>&lt;p&gt;Hello everyone, my name is Aaron!&lt;/p&gt;

&lt;p&gt;As a part of my Codecademy &lt;strong&gt;Portfolio Project: Python Terminal Game&lt;/strong&gt;, I made a simple &lt;strong&gt;Blackjack game&lt;/strong&gt; coded in python. I picked Blackjack because it's a fun game that I enjoy playing. It also helped me practice Object-Oriented Programming (OOP) in python.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How It Works:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Asks for the players name.&lt;/li&gt;
&lt;li&gt;You have $100 as your starting balance.&lt;/li&gt;
&lt;li&gt;Asks the player to place a bet.&lt;/li&gt;
&lt;li&gt;Deals the cards to you and the dealer.&lt;/li&gt;
&lt;li&gt;Lets the player hit or stand. &lt;/li&gt;
&lt;li&gt;Once the player stands, the dealer goes.&lt;/li&gt;
&lt;li&gt;Whoever is closer to 21 and doesn't go over, wins.&lt;/li&gt;
&lt;li&gt;If tied with dealer, you get your money back.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;What I've Learned:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;How to use classes and objects in Python.&lt;/li&gt;
&lt;li&gt;Working with lists and randomization.&lt;/li&gt;
&lt;li&gt;Writing clean and readable code.&lt;/li&gt;
&lt;li&gt;Creating a Github Repo and how to push my code.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;You can check the code on Github here:&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://github.com/AaronASB/Blackjack-Terminal-Game/blob/main/Blackjack-Game.py" rel="noopener noreferrer"&gt;https://github.com/AaronASB/Blackjack-Terminal-Game/blob/main/Blackjack-Game.py&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;Here's a sample: *&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Code Snippet: Player Class
&lt;/h2&gt;

&lt;p&gt;Here's a look at the &lt;code&gt;Player&lt;/code&gt; class that manages the user’s betting, and wins:&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
python
import random
# The player class represents the player and the dealer.
class Player:
    def __init__(self, name, balance):
        self.name = name
        self.balance = balance
        self.wins = 0
        self.hand = []

#Placing a Bet
    def bet(self, amount):
        if amount &amp;gt; self.balance:
            return False #Not enough money to bet.
        self.balance -= amount
        return True


#Win counter and adds to your balance when you win.
    def win(self, amount):
        self.balance += amount
        self.wins += 1
        return "{name} wins ${amount}. New balance: ${balance}.".format(
            name=self.name, 
            amount=amount, 
            balance=self.balance
        )
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>python</category>
      <category>beginners</category>
      <category>portfolio</category>
    </item>
  </channel>
</rss>
