///<summary>///Level conversion to Icon distribution///In the form of QQ calculation///2^ (2*0)/1///2^ (2*1)/4///2^ (2*2)/16///2^ (2*3)/64///</summary>/// <param name=" Target "> target level </param >/// <param Name= calculate base </param>/// < Param name=> The maximum number of powers </param>/// <RETURNS></RETURNS>
Public ienumerable<short> A (double target, double x, int y) {if (Y < 1 | | target <= 0 | | x < 1) {return new short[] {1}; } var r = new Short[y + 1]; for (int i = y; i > 0; i--) {Double A = Math.pow (x, I * 2); R[i] = (short) (target/a); Target-= r[i] * A; } R[0] = (short) target; return R; }
The idea is to reduce each of the iconic levels (4,16,64 ...). The product of the integral. Then record the total level/each iconic level, the result is how many patterns (Crown, sun ...). From the largest to the small pattern calculation, to the end is how many first-level patterns (stars)
If each of the iconic levels is not calculated by Math.pow (x, I * 2), the value formula should be replaced by something else.
A (lv,2,4)
Reference Links:
Http://www.cnblogs.com/gzhnan/archive/2005/05/27/163466.html
Algorithm: QQ grade converted into Crown Sun Star Moon