Giter Site home page Giter Site logo

pursuit-core-ios-unit1-assessment's Introduction

Unit 1 Assessment - BlackJack command-line macOS application

Github Instructions

  1. Fork this repo
  2. Clone your Fork
  3. Complete the requirements in Xcode
  4. Commit often
  5. Open a pull request
  6. Submit a link of your Fork to Canvas

App Description

In this assessment, your task will be to build a BlackJack command-line app. The MVP (minimal viable product, basic requirements) of this project will be a one-player game against the computer.

You are free to use Google, StackOverflow, your notes in working through this assessment. Best of luck, address each problem as a sub-task and keep chipping away. You all got this! 

Project Overview

Card.swift

In keeping with object-oriented programming in our BlackJack game a card will be the main data of the game.

  • The Card has 4 instance properties suit, value, isFaceCard and face
    • suit is a diamond, heart, spade or club
    • value represents the score value of a card 2 - 10 represent their face value, jack, queen, and king's value is 10. Ace can be 1 or 11.
    • isFaceCard is used in the creation of the cards array
    • face is an optional FaceCard again only used during the creation of the cards in the newDeck() method
  • The Card has a type method newDeck(:_) that returns an array of 52 cards [Card]. Since an Ace card can have a value of 1 or 11 you can decide by passing in 1 or 11 as an argument when calling newDeck()
  • The stringyfy() method returns a String representation of the current card instance. e.g "10♣️" or "4♦️"

Suit.swift

  1. Create a new Swift file called Suit, create an enum of the same name that has a diamond, heart, spade and club case.
  2. Make the raw value a String.
  3. Assign the diamond case "♦️", heart case "♥️", spade "♠️" and club "♣️"
  4. Make sure your enum conforms to CaseIterable in order for the newDeck() method to work.

FaceCard.swift

  1. Create a new Swift file called FaceCard, create an enum of the same name that has a jack, queen and king case.
  2. Make the raw value a String.
  3. Assign the jack case "🎃", queen case "👸" and king "🤴"
  4. Make sure your enum conforms to CaseIterable in order for the newDeck() method to work.

Player.swift

  1. Create a new Swift file called Player, create a struct of the same name.
  2. Add the following properties score of type Int, cards array of type [Card] and playerName of type String.

Game.swift

Create a new Swift file called Game, create a class of the same name.

The Game object has the following instance properties:

  • deck is an array of [Card]
  • player is a Player
  • hitPlayeris a Bool

The Game object has the following computed properties:

  • hasMoreCards returns a Bool
  • randomComputerScore returns an Int

The Game object has the following methods:

  • newGame() resets the game
  • stopHits() called if the user wishes to pass their turn. In that case the computer draws a random number and a winner is chosen between the computer's score and the player's score.
  • hitMe() called as the user requests more cards from the deck
  • computerVsPlayer() draws a random number for the computer and determines the winner of the game.
  • gameStatus() takes in the player's card and determines the current score. Here the player score options can be, BlackJack, Bust or Continue playing as their status is still valid for game play.

main.swift

  1. Create an instance of the Game()
  2. Call newGame on the newly created instance above.
  3. Create a gameOver instance and set it to false. This will be used in your repeat-while to determine if game play should stop.
  4. Use a repeat-while to allow the user options between getting new cards by calling the hitMe() method or passing by calling the stopHits() method.
  5. When the player has won or lost ask them if they would wish to continue playing another round.

MVP Gif

mvp

Rubric

rubric

Bonus Gif

Refactor your app so it is a two player game.

bonus gif

pursuit-core-ios-unit1-assessment's People

Contributors

alexpaul avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.