JSFiddle - React, Tailwind, and code Playground
by karthick6891
HTML
Given an 2d array 6 * 6 like this
<br/>
[
[0,0,0,0,0,0],
[0,0,0,0,0,0],
[0,0,0,1,0,0],
[0,0,1,0,0,0],
[0,1,0,0,0,0],
[1,0,0,0,0,0]
]
<br/>
[
[1,1,1,1,0,0],
[0,0,0,0,0,0],
[0,0,0,0,0,0],
[0,0,0,0,0,0],
[0,0,0,0,0,0],
[0,0,0,0,0,0]
]
<br/>
[
[0,0,0,0,0,0],
[0,0,0,0,1,0],
[0,0,0,0,1,0],
[0,0,0,0,1,0],
[0,0,0,0,1,0],
[0,0,0,0,0,0]
]
return true if there are 4 matching positions in any direction horizontal, vertical or diagonal