I did this.:
Develop games in your browser. Powerful, performant & highly capable.
Your logic says : if the array contains AValue then set every array value to 5. You need to compare curx,cury = AValue in a loop.
What should I do without you Plinkie. Thanks. :-)