Too be worked upon: 1: Add splitting pairs 2: Add duouble down 3: Maybe adding surrender 4: maybe insurance 5: Bets and thus money have to be part of - done vers. 0.4 the game... Later! 6: The first cards should be dealt! 1. card to the player, 2. card to the dealer, etc. 7: Hmm... Is there more to it? Wish list: 1: Maybe a few sounds. 2: Actually shufling the deck and then just deal from the top of the deck 3: Well, I'll come up with more... ################################################## Blackjack ver. 0.5 started 26 july 2003 ################################################## First of all all filenames have been changed, so they now consist of lower-case letters only. This has been done to make it easier to link to the different files. The shufle function has now been changed to include 6 decks of cards bringing that to a total of (6*4=) 24 colours. Experimentation was done on a recursive function to create the stack, but in the end a foor-loop was used due to the compact size of it. Some difficulties arose during the new design of copying the colours to the stack. What happened was that if you just made a straight copy of a list, and deleted an element with one of the copies, this would delete the same element in all the other copies. using a for-loop and a slicing index prevents this for happening. Bugs found: 1: when both dealer and player holds a blackjack dealer wins. it should be a push corrected: With lack of foresight the win_lose function was told to treat dealer hand if holding BlackJack as a sure win. This has been fixed so that it now tests to see if the player holds a BlackJack. ################################################## BlackJack Alpha Version 0.4 started 21 June 2003 finished 22 June 2003 ################################################## The update for this version is quite notisable, the game loop has been dumped and instead there now is a betting loop. Well there's more, cause if you bet 0 (zero), this means that you will quit. Also the minimum and maximum bets has been set to 5 and 50 respectively. Sys is now also imported, to fix a slight bug that apeared when first typing a wrong value as a bet i.e. a string or a floating point, and then tried to quit by typing 0, you would then be asked to place your bet again (because of control flow). But now if you do the same, the sys.exit makes sure that the game shuts down. Some try/except has also made an apearence to make sure the game does not crash in case the user tries to bet a string! It works inside a while loop and only exits that loop if value of the bet is an integer. The player has a default of 100 $ (units) to bet with. But he can bet more than he has, e.g. if (s)he bets more than (s)he has, (s)he will get kicked out of the game if (s)he losses, as in 'Game over'. As a sidenote the script now spans more than a quarter of thousands lines of code (>250). Which coincedecially might be more than my biggest essay ;-), well at least its alot ,ore than first imagined. ################################################## BlackJack Alpha Version 0.3 started 9 June 2003 finished 14 June 2003 ################################################## Well as previous stated some testing were necesary and it certainly was! For some reason a bit of code had dissapeared over the transition from the last version, this meant which meant that if the sum(hand) returned a tuple an error would occur becuase of the tuple couldn't be converted to the text string. Well it is part of the reason for the lenght of time for this version. But concerning the last additions (the dealer and win/lose function) both had some minor faults: The win_lose func. had a problem because of a mistake that involved a test to see if the sum of hand was a tuple (more than one result), unfortunately it didn't test its type but only its value! But its now workink so now worries. Another proplem occured when (either the dealer or the player) holding a BlackJack you would automaticaly lose, this was due to a test to make sure the hand was not above 21, but because BlackJack returns a string and strings out-rank integers in python, the win lose function would treat BlackJack as a bust. bugs found: 1: Dealer wins if player has BlackJack, and vice versa. This fault has been located. The win lose function. It happens when winlose checks to see that the value of the hand is less then 22. "BlackJack" being a string, and then seen as to be worth more than 21 i.e. bust 2: Dealer hits holding 9 and ace which is more than soft 17. Has been fixed, wrong value had been given in the dealer function. changed/added: Test for bust. Was originally placed outside the game loop and thus if you bust your first game the dealer would not play any games as the bust variable was not reset. ################################################## BlackJack Alpha version 0.2.1 finished 3 June 2003 ################################################## A dealer has been added to the game. Basicly he is function returning 1 (true) if he is to take a new card. Rules has more or less been decided on, and on the point on the dealer its been decided that dealer will hit on soft 17. A further function has been added to verify the winner of the game called win_lose. It seems to work however it will require a bit of testing. Also the scipt tests if player busts, and if so dealer will not play. As stated above rules has been decided upon and can be found at http://www.blackjackinfo.com. http://www.blackjackinfo.com/bjrules.htm contains the specific rules, what there still is to decide upon is all the different insurence and thus like. Of less importance the shufling will now take place if there are less than 20 cards, as five cards would not be enough, in later versions (even 20 might be too few!). For next version there will be some testing to see if everything works as planned. I think the jump to ver. 0.3A is justified by the inclusion of the dealer if it works. ################################################## BlackJack Alpha version 0.2 finished 1 June 2003 ################################################## As noticed in the previous(first) update of the game, there were problems with the sum-function, these have been dealt with. The bug was due to the sum-function returning a tuple if the hand has two values, i.e. the player holding at least one ace. This is not really a problem until it is imported into a string which was the case. The fix is made by testing to see if sum returns a tuple or not, if so counter meassures are made. The sum-function has been changed more so that if the player busts instead of returning 'Bust' it now just returns the value of the hand. This is for the player to see the value of the hand. The bust-thing has instead been moved to the script itself so that if the value is higher than 21... BUST... A bug was also found in the deal-func that was apparent when the deck became small and one of the colours was emptied, e.g. the last heart had been dealt. This resulted in a randrange error, when a random card of that colour was to be picked. It has been fixed for now by testing to see if the colour picked has any card left, and if not then that particular colour is then deleted and a new colour is picked. This might not be pretty but it seems to work for now (testet ok). The sleep mode has been imported for the shufling to take three seconds, this is for show only, I might add sound later if possible. More importantly (maybe) is that I have added another loop to the script this for the player to quit the game. However as it is for now the player will be prompted if (s)he wants to keep playing. Needless to say this is a bit tiresome, and has already been commeted out, for testing purposes. Furthermore I have made alot of comments through- out most of the code. Plus I have added doc- strings to all of the functions (well except hit_or_stand that would have seemed wasted). Work already begun on the next version, in which I will try to incorprate a Dealer to play against or I wil try to build in more rules, e.g. split and double. Research wil be made to what rules to follow, too. That should be it for now. ################################################## BlackJack Alpha version 0.1 finished 26 Mai 2003 ################################################## The players can play against themselves. A virtual deck excist from where cards are taken. This is done with the two functions, shuffle and deal, where shuffle creates the stack, with four colours with 13 cards each. The deal function is the actual shuffling machince taking out random cards of the deck, the deal function adds the card to the players hand, and then removes that card from the deck (52 cards only). The count function is there to make sure that there are always cards in the deck and the script will execute the shuffle function if there are less than five cards in the deck. The sum function does not work correctly at this time, there is a problem if the player holds two aces, but this will get fixed ASAP.