Coder Social home page Coder Social logo

janken's Introduction

Janken「じゃんけん」| Rock, Papers, Scissors

Reflection:

House Keeping

Project specifications:

Index for Checklist:

  • = TO-DO
  • = COMPLETED

User Story

  • this is provided by specifications
  1. Each turn of the game the app will randomly pick either rock, paper, or scissors.
  2. Each turn the app will alternate between prompting the player to win or lose.
  3. The player must then tap the correct move to win or lose the game.
  4. If they are correct they score a point; otherwise they lose a point.
  5. The game ends after 10 questions, at which point their score is shown.
  • If the app chose “Rock” and “Win” the player would need to choose “Paper”, but if the app chose “Rock” and “Lose” the player would need to choose “Scissors”.

Checklist | Challenge Specifications (CS)

  • 1. Start with an App template, then create a property to store the three possible moves: rock, paper, and scissors.
  • 2. You’ll need to create two @State properties to store the app’s current choice and whether the player should win or lose.
  • 3. You can use Int.random(in:) to select a random move. You can use it for whether the player should win too if you want, but there’s an even easier choice: Bool.random() is randomly true or false. After the initial value, use toggle() between rounds so it’s always changing.
  • [s] 4. Create a VStack showing the player’s score, the app’s move, and whether the player should win or lose. You can use if shouldWin to return one of two different text views.
  • 5. The important part is making three buttons that respond to the player’s move: Rock, Paper, or Scissors.
  • [s] 6. Use the font() modifier to adjust the size of your text. If you’re using emoji for the three moves, they also scale. Tip: You can ask for very large system fonts using .font(.system(size: 200)) – they’ll be a fixed size, but at least you can make sure they are nice and big!

Checklist | Personal Specifications (PS) Have the language options either be in Japanese or English! - This comes through as a toggle. - Info on Janken and eng-japanese translation: - https://www.tofugu.com/japan/janken/

  • 1. Create toggle button that switches between English and Japanese
    • This might need a separate enum for English and Japanese?
    • Maybe use tenary operation if it works?
      • Possibly, use @State and a bool to switch between languages
        • Limitations: This only works for two languages. A different work around would be needed when three or more languages are options.
    • Placement to be determined(TBD). Possible placement: top-right(top trailing)?
  • Create two enums for English and Japanese versions of rock, paper, scissor
    • Created an array of strings for both languages as it is logically easier to handle at the moment.
      • Plus for scaling, it'll be easier if additional languages are added.

janken's People

Contributors

seikahirori avatar

Watchers

 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.