MatLab-BlackJack game problem help please!

Create a Matlab program that allows a user to play blackjack (sometimes called "21"). For those of you unfamiliar with the popular casino game, the rules can be found here and on many other websites. Blackjack essentially is a game of chicken between a player and a dealer to see who can get closest to 21 without going over.

The player may start with a maximum of 1000 chips and the maximum bet per hand is 100 chips.

There are some special rules that vary from casino to casino. In your Matlab casino, the following rules apply:

- If you get dealt a "blackjack" you get paid 3-to-2 instead of 1-to-1. If the dealer has a blackjack too you "push" and do not get paid.

- The dealer hits on a "soft-17" and stays on a "hard-17."

- You may "split" your cards only once per turn. Once you split your cards, you may play out both hands normally (you may "hit" until you get to 21 or over, "stay" and receive no more cards, or "double down" on the first two cards of each hand)

- You may "double down" on your first two cards. If you split your hand, you may double down on the first two cards of both hands.

- You may take "insurance" equal to half the original bet. If you win the insurance bet you get paid 2-to-1.

- If you dislike your first two cards, you may "surrender" for half your bet and start another hand.

The user may decide to play against a dealer who deals (1) an infinite deck or (2) a finite number of decks which the user selects (in Vegas, you can find blackjack tables that use 1-8 decks). If the user chooses option (2), reshuffle the decks after 70% of the cards have been used.