Git Product home page Git Product logo

Comments (3)

codegard1 avatar codegard1 commented on September 27, 2024

At this point I am realizing that I need to think a little harder about the flow of actions in my code.

For example: in Table, _newGame calls _newPlayer once for each item in an array called players that is defined locally. This was done to make _newGame more legible and because starting a new game and adding a new player to the game are idiomatically different tasks for the "game engine". So it makes sense to separate them.

In the context of flux, this difference is especially clear, since the unidirectional data flow means I must decide whether to keep the two methods dependent on one another or figure out a more functional approach.

from blackjack.

codegard1 avatar codegard1 commented on September 27, 2024

New 'Game Plan' for newGame

  1. Human player enters his/her name at the landing screen (i.e. NewPlayer form - not yet created)
  2. onClick action for the NewPlayer form's Okay button calls AppActions.newPlayer and adds two new objects to the _playersList in GameStore: one for the human player, and one for the 'Dealer'
  3. Once this is done, _newGame is immediately invoked, which sets up the default 'state' for the Game (e.g. minimumBet, turnCount, etc.)
  4. In this scenario, _newGame is identical to _resetgame in Table since all it does is set the default values for the state, independent of the players
  5. Rename _newGame to _resetGame
  6. Call _resetGame for the Reset Game button in OptionsPanel

Interim until NewPlayer form exists

  1. Do call _newPlayer from within _newGame in GameStore, once for each name passed to _newGame

from blackjack.

codegard1 avatar codegard1 commented on September 27, 2024

marking as invalid because this is not the right way to implement flux

from blackjack.

Related Issues (20)

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.