<?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: Adeyemoade</title>
    <description>The latest articles on DEV Community by Adeyemoade (@adeshina).</description>
    <link>https://dev.to/adeshina</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%2F1094241%2F2b333b7a-be86-4d7f-a97b-94a64d2a7feb.jpg</url>
      <title>DEV Community: Adeyemoade</title>
      <link>https://dev.to/adeshina</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/adeshina"/>
    <language>en</language>
    <item>
      <title>Blackjack Game</title>
      <dc:creator>Adeyemoade</dc:creator>
      <pubDate>Wed, 21 Jun 2023 14:46:13 +0000</pubDate>
      <link>https://dev.to/adeshina/blackjack-game-378l</link>
      <guid>https://dev.to/adeshina/blackjack-game-378l</guid>
      <description>&lt;h2&gt;
  
  
  How to create a blackjack game
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--md-UIT6l--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p1iwhkhj0lb5t2qx5uig.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--md-UIT6l--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p1iwhkhj0lb5t2qx5uig.PNG" alt="Image description" width="241" height="408"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;To create a blackjack game with html css and javaScript:&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;First of all create a folder which you should name blackjack so as to be easy for you to find. Create three files in it save each as index.html, style.css and index.js respectively and open the files with your text editor.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;On the  html file, if you are using vscode just click on the exclamation mark and press enter, vscode will load the basic html tags for you which looks like this.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--loaspnOt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/md1qg78ur0pcyekpi570.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--loaspnOt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/md1qg78ur0pcyekpi570.png" alt="Image description" width="800" height="664"&gt;&lt;/a&gt;&lt;br&gt;
You're good to go now change the title from document to &lt;strong&gt;Blackjack&lt;/strong&gt; and link the html file to the css file then go to the body tag and create one h1 tag, in the tag type Blackjack below the h1 tag add three p tags, give the first p tag and id of &lt;strong&gt;message-el&lt;/strong&gt; the second p tag an id of &lt;strong&gt;cards-el&lt;/strong&gt; and the third p tag an id of &lt;strong&gt;sum-el&lt;/strong&gt;. The text in the first p tag is &lt;strong&gt;Want to play a round&lt;/strong&gt;, the second tag &lt;strong&gt;Cards:&lt;/strong&gt; and the third tag &lt;strong&gt;Sum:&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Now add two button tags which will be the &lt;strong&gt;Start Game&lt;/strong&gt; and &lt;strong&gt;New Game&lt;/strong&gt; button give the Start Game an onclick of &lt;strong&gt;startGame()&lt;/strong&gt; and the New Game an onclick of &lt;strong&gt;newGame()&lt;/strong&gt;. &lt;em&gt;Lastly&lt;/em&gt; add two more tags a p tag and the script tag which will link you to the javaScript file, give the p tag an id of &lt;strong&gt;player-el&lt;/strong&gt; and the script tag src of &lt;strong&gt;index.js&lt;/strong&gt;. Your html file should look like this&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0HHB8pkQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5svy69v6ttqnfqvhsgl3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0HHB8pkQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5svy69v6ttqnfqvhsgl3.png" alt="Image description" width="800" height="581"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;On the css file&lt;/strong&gt;&lt;br&gt;
You're only styling four tags. The whole body, the h1 tag , button-el, and the button tag.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Start by styling the body tag first&lt;/strong&gt;&lt;br&gt;
Set the font to your desired font, the background image you like to use, set the background-size to cover, background-position to center and background-repeat to no-repeat. text-align to center this will make everything in the blackjack game to be at the center of the page, color and font-weight to white and bold respectively.  &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;The h1 tag&lt;/strong&gt;&lt;br&gt;
The only thing to do here is to change the color. You can use any color you want but I will be using goldenrod&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;message-el&lt;/strong&gt; &lt;br&gt;
Set the font style and font size to italic and 22px respectively&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;The button tag&lt;/strong&gt;&lt;br&gt;
Give it a background color, width of 150px, border of 0px solid, padding top and bottom to 5px each, font weight to bold, border-radius to 2px, margin-bottom to 4px. Your css file should look like the codes in the image below.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4Gcxg_VA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xm2bnsjubbz2muxt9hac.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4Gcxg_VA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xm2bnsjubbz2muxt9hac.png" alt="Image description" width="800" height="559"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Lastly on the index.js file.&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;The first step is to use the let key.&lt;/strong&gt; 
Set the card to non [] for now, the sum to zero, let hasBlackJack and isAlive to false and true respectively, message to "" since there is no message yet, player name and chips to whalez and 150. Then &lt;strong&gt;let messageEl = document.getElementById("message-el"), let sumEl = document.querySelector("#sum-el"), let cardEl = document.getElementById("card-el"), let playerEl = document.getElementById("player-el"), playerEl.textContent = player.name + ": $" + player.chips.&lt;/strong&gt; 
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--K0Tforb3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ykzh6mtbijtevzt7t7ka.png" alt="Image description" width="800" height="599"&gt;&lt;em&gt;&lt;strong&gt;Note this are the default settings that is you're telling javaScript to carry on this operation before either of the buttons were clicked&lt;/strong&gt;&lt;/em&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Before you give start game and and new game function you will need random numbers to make the blackjack game more fun to play. To get random number from 1 to 13 on javaScript use &lt;em&gt;&lt;strong&gt;Math.floor( Math.random() * 13) + 1&lt;/strong&gt;&lt;/em&gt; &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Now create a get random card &lt;strong&gt;function&lt;/strong&gt;, in it &lt;strong&gt;let random =  Math.floor( Math.random() * 13) + 1&lt;/strong&gt;, use the &lt;strong&gt;if&lt;/strong&gt; key so that if random number is greater than &lt;strong&gt;10&lt;/strong&gt; it should &lt;strong&gt;return 10&lt;/strong&gt;. Then use the &lt;strong&gt;else if&lt;/strong&gt; key so as to &lt;strong&gt;return 11&lt;/strong&gt; when random number is equal to &lt;strong&gt;1&lt;/strong&gt; use &lt;strong&gt;else&lt;/strong&gt; key to &lt;strong&gt;return random number&lt;/strong&gt; if random number is not greater than &lt;strong&gt;10&lt;/strong&gt; and not equal to &lt;strong&gt;11&lt;/strong&gt;. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Next Thing to do is to have another function which is render game.&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This will tell javaScript what it should do when sum is less than 20 or equal to 20, what it should do when sum is equal to 21 and what it should do when sum is more than 21.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--b6oR8Dbg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/loygyeai5vvpu6kgnbnp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--b6oR8Dbg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/loygyeai5vvpu6kgnbnp.png" alt="Image description" width="800" height="658"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Start Game function&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--kwcV1UuI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6ywkbzucfp1jg4z90fl1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--kwcV1UuI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6ywkbzucfp1jg4z90fl1.png" alt="Image description" width="800" height="498"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;New Game function&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--vOCGb4yP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s4zp1wty9kgwgwee6eck.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vOCGb4yP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s4zp1wty9kgwgwee6eck.png" alt="Image description" width="800" height="423"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;The link to Blackjack Game&lt;/strong&gt;&lt;/em&gt;&lt;br&gt;
    &lt;a href="https://adeyemoade.github.io/Black-jack-game/"&gt;https://adeyemoade.github.io/Black-jack-game/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>html</category>
      <category>css</category>
      <category>javascript</category>
    </item>
    <item>
      <title>A simple Subway counter-app</title>
      <dc:creator>Adeyemoade</dc:creator>
      <pubDate>Mon, 05 Jun 2023 11:22:32 +0000</pubDate>
      <link>https://dev.to/adeshina/a-simple-subway-counter-app-2c31</link>
      <guid>https://dev.to/adeshina/a-simple-subway-counter-app-2c31</guid>
      <description>&lt;p&gt;Hi there !&lt;br&gt;
In this article I will be explaining how to build a simple subway counter app, the purpose and it ability.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The subway counter-app&lt;/strong&gt; is a simple counter app that can easily be used to take records of the numbers of people entering a subway station daily. Note it can also be used in other places depending on what we need it to do for us.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;I will be dropping the link to the website after explaining each steps to build the counter app at the end of this article&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;This is what we will be building below&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--JOSWHeLT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/81d9yvbhswsstp1makxe.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--JOSWHeLT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/81d9yvbhswsstp1makxe.jpg" alt="Image description" width="607" height="1080"&gt;&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;The steps to take when building the simple counter app from scratch&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The first step is to create a folder on your desktop page and name it subway counter app, in the folder you should copy the image you wants to use as the subway counter app background image. Then go to your text editor and open the folder you created, then save three files  in it. The three files should be the index.html file, style.css file and the index.js file. The index.html file should contain your html file, the style.css file is where your css styling should be and index.js file should be your javascript file.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;On the html file&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;On the html file the first thing to do is to run the html code. if you are using vscode as your text editor it will be very easy for you just click on the exclamation mark on your desktop and press enter, Vscode will load the html code for you.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--VZt8h4I9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/shdlpo36klipaf7lpl76.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--VZt8h4I9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/shdlpo36klipaf7lpl76.png" alt="Image description" width="800" height="664"&gt;&lt;/a&gt;&lt;strong&gt;It should look like this&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Since the html page is now ready you start coding by linking your css file to the html file first by writing this line of code  above the title tag, then change the title from document to subway counter-app. Then proceeded to the body element and open an h1 tag, inside of it you should write People who entered in it and  close the tag. Move on, below the h1 tag open another tag which is the h2 tag and close it inside the tag  put the figure 0 in it then give the tag an id of count-el.Then open two button tags which you should named INCREMENT and SAVE, give the increment button an id of increment-btn and an onclick of increment [INCREMENT] and the save button an id of save-btn and an onclick of save [SAVE ], below the buttons open a p tag and give it an id of save-el and name it Previous entries:.&lt;/p&gt;

&lt;p&gt;Finally below the p tag open a script tag and give it an src index.js [], with this you are done with the html page. &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--cnmcAkSC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/948t2vqhr2uzusjr5upi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--cnmcAkSC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/948t2vqhr2uzusjr5upi.png" alt="Image description" width="800" height="831"&gt;&lt;/a&gt;&lt;strong&gt;Your html file should look like this&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The next thing is to style your counter app&lt;/strong&gt;&lt;br&gt;
  In the css file the first thing you should do is to set the margin and padding to zero so as to erase the browser default settings. Then start by styling the body, set the background-image to the image you already saved in the folder, then set the background-size, background-position and background-repeat to cover, center and to no-repeat respectively, the height to 100vh, text-align and color to center and white respectively. With this you are done with the  background styling, proceeded to style the h1 and h2 tags, then the button tag and lastly each id you give the buttons. &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--A8D02uez--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7zqc2uh9hxbxs1kv1quc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--A8D02uez--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7zqc2uh9hxbxs1kv1quc.png" alt="Image description" width="800" height="1420"&gt;&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;Your css file should look like this&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The html and css of the subway counter-app are now perfect but not responsive and functioning, to make it function you have to go to the idex.js file to breathe life into the subway counter-app.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Remember you have already link the html fie to the javaScript so anything you are doing on the javaScript file will affect both the html file and css file.&lt;/p&gt;

&lt;p&gt;First thing you should do is to change the count-el to countEl in the javaScript file using the let code and document.getElementById [ let countEl = document.getElementById ("count-el") ] code because javaScript wont allow hyphen that is why you have to change the count-el to countEl in the javaScript file. Where do you get the count-el from? remember in the html page you gave the h2 tag an id of count-el that is where you got it from and on javaScript we cant use hyphen that is why we have to change it to countEl. Why do you need the id count-el on the javaScript file? you need it because the h2 tag has to change from 0 as the increment button is being clicked. Below it set count to 0 [ let count = 0 ], then repeat what you did to the id count-el to save-el [ let saveEl = document.getElementById("save-el") ].&lt;/p&gt;

&lt;p&gt;Now the increment button: give it a function [ function increment() ]  then set the count to increase by one anytime the button is being clicked   [ count += 1 ]  but still before the zero in the h2 tag can increase I had to change the count to countEl.textContent [ countEl.textContent = count ].This will make the h2 tag to increase from zero whenever the increment button is being clicked.&lt;br&gt;
  Finally the save button: Give it a function [ function save() ], then set countSave to count + " - " [ let countsave = count + " - " ] then set the id save-el to be the value of countsave [ saveEl.textContent += countsave ], change the countEl and count to zero, so that anytime the increment button is being clicked after the save button the count changes back to zero [countEl.textContent = 0  count = 0 ]. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--dODZrvGy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2bevm5imnccd9oqqtfez.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--dODZrvGy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2bevm5imnccd9oqqtfez.png" alt="Image description" width="800" height="591"&gt;&lt;/a&gt;&lt;strong&gt;Your javascript file should look like this&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;These are the steps to take to build a simple subway counter-app. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://adeyemoade.github.io/Subway-counter-app/"&gt;https://adeyemoade.github.io/Subway-counter-app/&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
