Copy link to clipboard
Copied
Have a game in the making. The game is the logic game "NIM". To be able to code the computers moves, we need to convert the value of the rows from integers to binary so the calculations can be made. How do I accomplish this? Thanks
Copy link to clipboard
Copied
function integerToBinaryF(n:int):String{
return n.toString(2);
}
Copy link to clipboard
Copied
So if the variable with the number we wish to convert is "row1". We would have this in the button that begins the conversion :
return row1.toString(2);
And then how would we assign that binary number to a variable to manipulate with?
Copy link to clipboard
Copied
no, use:
var yourbinary:String;
yourbinary=integerToBinaryF(row1);