
Liar’s Dice Update 1
So in this blog post, I wanted to give an update (to myself as well lol) to what the current state of my Liar’s Dice attempt looks like.
Currently, I think I’m done the base game logic for a single player, this entails:
- being able to roll a set of 5 dice to determine your hand
- saving it to a shared (?) state, as a dictionary using useState()
- being able to determine if it’s a bluff or not
- being able to raise/increment the next call
- being able to continue the game after doing the first actions
The next steps that I will have to be focusing on is how to make it (and test it) for multiplayer purposes.
This is where I usually get stuck on in the past (also because I learned useState and didn’t want to refactor everything because I felt like I wanted to see what I thought of at the time — this time I did use React Hooks primarily). I’m hoping to get through this roadblock and figure it out this time around!
Some of the useStates that I’ve used at this point are:
const [tableHand, updateTableHand] = useState({});
const [playerHand, updatePlayerHand] = useState({});
const [diceRolled, updateDiceRoll] = useState(false);
const [faceSelected, updateFaceSelected] = useState();
const [quantitySelected, updateQuantitySelected] = useState(0);
const [previousFace, updatePreviousFace] = useState();
const [previousQuantity, updatePreviousQuantity] = useState();
I wonder if I’ll figure out a better way to implement this down the road, only time and effort will tell.