Comments (3)
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.
New 'Game Plan' for newGame
- Human player enters his/her name at the landing screen (i.e. NewPlayer form - not yet created)
onClick
action for the NewPlayer form's Okay button callsAppActions.newPlayer
and adds two new objects to the _playersList in GameStore: one for the human player, and one for the 'Dealer'- Once this is done,
_newGame
is immediately invoked, which sets up the default 'state' for the Game (e.g. minimumBet, turnCount, etc.) - 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 - Rename
_newGame
to_resetGame
- Call
_resetGame
for the Reset Game button in OptionsPanel
Interim until NewPlayer form exists
- Do call
_newPlayer
from within_newGame
in GameStore, once for each name passed to_newGame
from blackjack.
marking as invalid because this is not the right way to implement flux
from blackjack.
Related Issues (20)
- wire up _reset HOT 1
- Subscribe Table to listen for changes from GameStore
- getter methods for Stores HOT 1
- Refactor GameStore as an extension of FluxReduceStore
- Add missing dependent methods to GameStore
- Create DeckStore
- Migrate deck methods from Table to DeckStore
- Move player hands to DeckStore
- Migrate Game methods from Table to GameStore
- Hand class HOT 1
- on Deal, players' hands are not evaluating correctly HOT 1
- Hit causes the app to crash HOT 1
- Implement currentplayer as a property of Players class HOT 1
- Implement StateMachine class to handle game evaluation HOT 2
- Resolve named / default exports confusion
- Card numbers are on the same side of the suit icon on the top & bottom
- Upgrade components to TypeScript HOT 1
- PlayerStore and DeckContext both track player hands redundantly HOT 3
- controllingPlayer(Key) is redundant with currentPlayerKey HOT 1
- ActivityLogStore is still not TypeScript
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from blackjack.