Question: can you write the code in c# i would appreciate it if you do it I will give thumbs up. this is what i have

can you write the code in c# i would appreciate it if you do it I will give thumbs up.

this is what i have can you check the code and fix the errors and complete missing impletended can you write the code in c# i would appreciate it if

namespace ElevensBoardGame { /** * The ElevensBoard class represents the board in a game of Elevens. */ class ElevensBoard {

/** * The size (number of cards) on the board. */ private static const int BOARD_SIZE = 9;

/** * The cards on this board. */ private Card[] cards;

/** * The deck of cards being used to play the current game. */ private Deck deck;

/** * Flag used to control debugging print statements. */ private static const bool I_AM_DEBUGGING = false;

/** * Creates a new ElevensBoard instance. */ public ElevensBoard() { cards = new Card[BOARD_SIZE]; deck = new Deck(); if (I_AM_DEBUGGING) { deck.print(); cout

/** * Start a new game by shuffling the deck and * dealing some cards to this board. */ public void newGame() { deck.shuffle(); dealMyCards(); }

/** * Accesses the size of the board. * Note that this is not the number of cards it contains, * which will be smaller near the end of a winning game. * @return the size of the board */ public int size() { return BOARD_SIZE; }

/** * Determines if the board is empty (has no cards). * @return true if this board is empty; false otherwise. */ public bool isEmpty() { for (int k = 0; k

/** * Deal a card to the kth position in this board. * If the deck is empty, the kth card is set to null. * @param k the index of the card to be dealt. */ public void deal(int k) { cards[k] = deck.deal(); }

/** * Accesses the deck's size. * @return the number of undealt cards left in the deck. */ public int deckSize() { return deck.size(); }

/** * Accesses a card on the board. * @return the card at position k on the board. * @param k is the board position of the card to return. */ public Card cardAt(int k) { return cards[k]; }

/** * Replaces selected cards on the board by dealing new cards. * @param selectedCards is a list of the indices of the * cards to be replaced. */ public void replaceSelectedCards(List selectedCards) { foreach (int k in selectedCards) { deal(k); } }

/** * Gets the indexes of the actual (non-null) cards left on the board. * Note: the number of cards will be 0 if you win * @return a List that contains the locations (indexes) * of the non-null entries on the board. The list is * used to generate permutations of 2 or 3 card indices, * when you test if there is a legal play */ public List cardIndexes() { List selected = new List(); for (int k = 0; k

/** * Generates and returns a string representation of this board. * @return the string version of this board. */ public String printBoardCards() { String s = ""; for (int k = 0; k

/** * Determine whether or not the game has been won, * i.e. neither the board nor the deck has any more cards. * @return true when the current game has been won; * false otherwise. */ public bool gameIsWon() { if (deck.isEmpty()) { foreach (Card c in cards) { if (c != null) { return false; } } return true; } return false; }

/** * Determines if the selected cards form a valid group for removal. * In Elevens, the legal groups are (1) a pair of non-face cards * whose values add to 11, and (2) a group of three cards consisting of * a jack, a queen, and a king in some order. * @param selectedCards the list of the indices of the selected cards. * @return true if the selected cards form a valid group for removal; * false otherwise. */ public boolean isLegal(List selectedCards) { if (containsPairSum11(selectedCards) == true || containsJQK(selectedCards) == true) { return true; } else { return false; } }

/** * Determine if there are any legal plays left on the board. * In Elevens, there is a legal play if the board contains * (1) a pair of non-face cards whose values add to 11, or (2) a group * of three cards consisting of a jack, a queen, and a king in some order. * @return true if there is a legal play left on the board; * false otherwise. */ public boolean anotherPlayIsPossible() { if (((containsPairSum11(cardIndexes())) == true) || ((containsJQK(cardIndexes())) == true)) { return true; } else { return false; } }

/** * Deal 9 cards to this board to start the game. */ private void dealMyCards() { /* *** TO BE IMPLEMENTED *** */ }

Deal 9 cards to this board to start the game. */ private void dealMyCards() { **** TO BE IMPLEMENTED *** } *** Check for an 11-pair in the selected cards. @param selectedCards selects a subset of this board. It is list of indexes into this board that are searched to find an 11-pair. @return true if the board entries in selectedCards contain an 11-pair; false otherwise. 7 private bool containsPairSum11(List selectedCards) /**** TO BE IMPLEMENTED *** * } Check for a JQK in the selected cards. @param selectedCards selects a subset of this board. It is list of indexes into this board that are searched to find a JQK group. @return true if the board entries in selectedCards include a jack, a queen, and a king; false otherwise. */ private bool contains JQK(List selectedCards) { /* *** TO BE IMPLEMENTED ****/ } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!