- Vue.js 2 Web Development Projects
- Guillaume Chau
- 138字
- 2021-07-02 22:34:37
Drawing cards
Before drawing the cards, we will need to add two properties to the app state in the state.js file:
var state = {
// ...
drawPile: pile,
discardPile: {},
}
The drawPile property is the pile of cards that can be drawn by the players. It is initialized with the pile object defined in the cards.js file. Each key is the ID of a card definition, and the value is the amount of cards of this type in the pile.
The discardPile property is the equivalent of the drawPile property, but it serves a different purpose--all the cards played by the player will be removed from their hand and put into the discard pile. At some point, if the draw pile is empty, it will be refilled with the discard pile (which will be emptied).
推薦閱讀
- Java程序設計實戰教程
- JavaScript+DHTML語法與范例詳解詞典
- LabVIEW Graphical Programming Cookbook
- Android項目開發入門教程
- 跟“龍哥”學C語言編程
- Java程序員面試算法寶典
- Backbone.js Blueprints
- Linux命令行與shell腳本編程大全(第4版)
- ASP.NET程序設計教程
- 從0到1:Python數據分析
- Mastering JBoss Enterprise Application Platform 7
- Advanced Oracle PL/SQL Developer's Guide(Second Edition)
- 從Excel到Python:用Python輕松處理Excel數據(第2版)
- 區塊鏈項目開發指南
- Flutter從0基礎到App上線