Hi everyone. I am currently working on this problem.

================

Machine learning and data mining has become a very important part of computer science as huge datasets are becoming more and more prevalent.

This program is designed to help a computer “discover” the appropriate hit and stay percentages for blackjack. To implement this create an array of numbers that has indexes up to 21, and assign each location a starting value of .5. This indicates at the beginning that a computer would have a 50/50 chance of choosing to hit at that sum value of cards.

Decide on a way to draw cards (many times you can use a previously constructed deck class) and after dealing two cards, have the computer decide to hit/stay based on the percentage that it has stored at the index for the card sum. If the action does not result in going over 21, then reinforces that percentage (by adding a small amount). If you go over 21 then you should decrease the possibility of that action in the future.

After getting the program to work, run it for 100 trials and discuss the results, then run it for 200, 1000, 2000. Talk about how the increased number of trials give you better results, and what the computer “learned” from the trials.

============

import java.util.ArrayList; public class SimpleDeck { private int numberOfDecks = 40; private ArrayList<Integer> deck = new ArrayList<Integer>(52*numberOfDecks); public SimpleDeck() { for (int i = 0; i < 52*numberOfDecks; i++) { int value = (i+1) % 13; if ((value > 10) || (value == 0)) value = 10; deck.add(value); //values for cards ACE=1, JACK=QUEEN=KING=10 } } public int getACard() { if (deck.size() == 0) return 0; //if out of cards, return 0 int choice = (int)(deck.size() * Math.random()); int cardValue = deck.get(choice); //get card value deck.remove(choice); //remove chosen card from deck return cardValue; } public static void main() { int x; SimpleDeck d = new SimpleDeck(); //creates deck(s) do { x = d.getACard(); //pick a random card from deck(s) System.out.println(x); } while (x != 0); } }

I have this base code. Can someone help me to solve the question?

THanks !