# Variable Problem in Board Game

**URL:** https://discourse.processing.org/t/variable-problem-in-board-game/29682
**Category:** Coding Questions
**Created:** [April 27, 2021, 1:05pm UTC](https://discourse.processing.org/t/variable-problem-in-board-game/29682 "2021-04-27T13:05:05Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Braunstein](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/braunstein/32/14262_2.png) [@Braunstein](https://discourse.processing.org/u/Braunstein)
#### Post date: [April 27, 2021, 1:05pm UTC](https://discourse.processing.org/t/variable-problem-in-board-game/29682/1 "2021-04-27T13:05:05Z")

</div>

So, i’m considering turning a (existing) board game into a videogame via Processing. The game is called Machi Koro; if you know it: cool, if you don’t know it: It’s a quick board game where you buy buildings (which are on cards). All cards have a number on them, and if you roll the number in your turn, the buildings effect activates (you get money in most cases). The goal is to buy all of your 4 big projects, which all cost a lot of money.  
I’m already having a lot of plans, but something that is really gonna be a problem: I want to keep track of each players cards (i want to get up to 4 players), without making a variable for EVERY kind of card for EVERY player (there are somewhere between 10 and 20 kinds of buildings, so i would end up with 40 to 80 variables in total). Is there any trick that lets me reduce the number of required variables, even with up to 4 players? Or is there no way around it?

---

<div class="post-metadata">

### Author: ![micuat](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/micuat/32/19407_2.png) [@micuat](https://discourse.processing.org/u/micuat)
#### Post date: [April 27, 2021, 1:44pm UTC](https://discourse.processing.org/t/variable-problem-in-board-game/29682/2 "2021-04-27T13:44:52Z")

</div>

You can use ArrayList or HashMap!

(that’s all I can say if you don’t have a code to begin with 🙂 )

---

<div class="post-metadata">

### Author: ![tony](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tony/32/949_2.png) [@tony](https://discourse.processing.org/u/tony)
#### Post date: [April 28, 2021, 3:28am UTC](https://discourse.processing.org/t/variable-problem-in-board-game/29682/3 "2021-04-28T03:28:22Z")

</div>

I second @micuat’s advice.

My advice; start coding! While this optimization might seem like a hurdle now, it’s sometimes better to write code rather than overthink things (especially with a smaller project like this).

---

<div class="post-metadata">

### Author: ![ReyzArtz](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/reyzartz/32/11750_2.png) [@ReyzArtz](https://discourse.processing.org/u/ReyzArtz)
#### Post date: [April 28, 2021, 4:31am UTC](https://discourse.processing.org/t/variable-problem-in-board-game/29682/4 "2021-04-28T04:31:02Z")

</div>

I would recommend using a player class and a card so that each player would have a list of card and u can keep a better track of card
