与或运算
//"arr":[1,2,3,4,5] function getBuyGate(arr:Array):int { var gateArr:Array = [1,2,4,8,16]; var gate:int = 0; for(var i:int=0;i<arr.length;i++) { gate |= gateArr[arr[i]]; } return gate; } //1闲,2闲对,3庄对,4庄,5和 //0庄 1闲 2和 3庄对 4闲对 var iWin:int = 1;//庄赢 //var iWin:int = 2;//闲赢 iWin = getBuyGate([0,1,2,3,4]); function getWinGate():Array { var iBanker:int = 1 & iWin; /*var iPlayer:int = (2 & iWin) / 2; var iTie:int = (4 & iWin) / 4; var iBankerPair:int = (8 & iWin) / 8; var iPlayerPair:int = (16 & iWin) / 16;*/ var iPlayer:int = (2 & iWin); var iTie:int = (4 & iWin); var iBankerPair:int = (8 & iWin); var iPlayerPair:int = (16 & iWin); var aWinResult:Array = [iBanker,iPlayer,iTie,iBankerPair,iPlayerPair]; return aWinResult; } trace(getWinGate())