photogabble / draughts

A PHP checkers library for move generation/validation, piece placement/movement, and draw detection
MIT License
1 stars 1 forks source link

testRandomMatch errors #3

Closed carbontwelve closed 6 years ago

carbontwelve commented 6 years ago

Each time the test runs through it crashes with the following error:

count(): Parameter must be an array or an object that implements Countable
 H:\Simon\Documents\Projects\draughts\src\Draughts.php:974
 H:\Simon\Documents\Projects\draughts\src\Draughts.php:521
 H:\Simon\Documents\Projects\draughts\src\Draughts.php:246
 H:\Simon\Documents\Projects\draughts\src\Draughts.php:265
 H:\Simon\Documents\Projects\draughts\tests\PlayThroughTest.php:19

I have a feeling this is due to the Move object having some null values by default. It could be a simple fix of defaulting those to their actual types.

carbontwelve commented 6 years ago

This bug was caused by using preg_match instead of preg_match_all:

image