Javascript array shuffle shouldn't output two next to eachother -
I have found an array that is full of characters see examples below. I first know that the array is shuffling. Well I found it the most famous shuffle called Fisher-Yates Firbadal. Now I want to do this output, eg. F2 should not be next to F and F ' and the other goes to D D 2 or D '. It outputs such as: RB2 UFLF D2 ... and so on. No more: R B2B ' LF D2 ... Any help, suggestions? I know that I should check the first character with Javascript You can drag, check your obligation and if not obstruct If so, then repeat. Your method can be used to check constraints You do not need to fill (), strings can also be accessed by [] notation. charite () , but I am not an expert at that function.
var passesConstraint = function (side) {for (var i = 0; i & lt; sides.length - 1; i ++) {if (Side [i] [0] === side [i + 1] [0]) {return false; }} Be true; }
Shuffle (side) while (! PassesConstraint (side)) {alteration (side)}
Comments
Post a Comment