Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

ahmedshamim's avatar

ahmedshamim wrote a comment+100 XP

5mos ago

Real Time Games With Laravel: Ep 3, Board Basics

I think instead of keeping the states in an 1-dimensional array, it'd be much easier to manage the user's state, calculate the winning state and visualize the overall board if it is a 2D array. Also, to calculate users' turn, one alternate solution could be simply incrementing a number on each user's action and checking if it's an odd number or an even number.