Saturday, July 11, 2015

Captain's Log: Stardate 93127.98

So it's been again a while since i wrote my last post. But it's summer and festival season so i think that's ok. I'll try to check in as often as possible though. Fortunatly i had the time to take care about the project with my Blackjack app. So let's just update the status.

I wrote the basic html code for the app. It's nothing fancy, few div's here and there. Less than 100 lines from code. I would say nothing more to it 'cause the main thing is the javascript part of the app. Oh i almost forgot, i've done also the basic css to get some styling as well. It has become a little bit more than 100 lines. Maybe it'll grow a bit if i have to correct or expand it later.
About the js file... I've begin with declaring some global variables, some of them are array's. One of them holds all the cards of one deck. That's 52 card and every one of them is also an array with the properties of each card (spades, king, and the value). Then comes the object that i created for the app within this object ther are all the methods that controll the small parts of the app. I'll put some of the script in the end of the html code within the script tags. There should be all the DOM manipulation stuff which to be honest somehow not functioning or not all the things. So i thought i'll work on that later if i'm done with app and it's up and running. So far i made the method to controll the bet, if the user types in a bet and clicks on the 'hit' button then this method takes this value and puts it in the pot while the chip of the user gets less with that value.

I wrote also a method to create a random number that'll be the index for the card array. And the other method will take this random number search through the array for the specific card and put it into another array that take care about the handed out cards. I'm having some issues with this method though. I'm working on those right now. This method should do it twice at the beginning and than i have to re-use it to go further but only with one card. So i'll write another method that'll include this function and so it will be reusable without using the loop. That's the current standing.