# Matlab Blackjack Report

## Abstract

Blackjack is one of the most popular card games in the world with relatively simple rules. The player must try to beat the dealer by having a higher score without going over 21 points. In this project, are goal was to recreate a blackjack simulator. First we read about the casino rules for blackjack where the player is against the dealer. Next, we planned out our project by thinking of what programs we would need to make and implement. After we had written all the programs, we did many test and added more lines of code to make sure that everything was working properly.

## Introduction

Our main goal for this final project was to create an accurate Blackjack simulator. Understanding how to efficiently and effectively use Matlab was often frustrating through the year, so we wanted to use this final project as a way to get extra practice with the program. We wanted to better understand coding techniques and thought making a game like blackjack would be a fun way to do so. Since blackjack is a betting game, we thought it would be interesting to create a simulator where we can bet chips instead.

## Background/Theory

### Extended Rules of Blackjack

As briefly mentioned, in order to win blackjack against a dealer, the player must have more points than the dealer without going over 21 points. The player and dealer are both felt two cards but only one of the dealer's is faced up initially. Cards are worth their number value with jacks through kings also being ten points and aces can be eleven or one points depending on which works better. First, it it the player's turn and the user can decide to hit (get another card) or stand (end their turn). If the player goes over 21 points, he/she busts and automatically loses. Otherwise, it will then be the dealer's turn who will flip over his second card and must continue to hit until he either busts or has 17 points or greater. If neither the player or dealer bust, then the winner is the person with more points and that person will win the bet. It the player gets a blackjack, which is a ten-value card along with an ace, the player automatically wins 1.5 times his bet. If the player and dealer tie a round, then the bet is split and nobody loses or gains money.

### Programming Ideas

After fully understanding the rules of blackjack, it immediately became clear than many if statements and while loops were going to be needed.