《人品计算器》原理

2007-7-2 Nie.Meining Debug

今天被一个叫"人品计算器"的东西搞郁闷了:“你的人品真差!肯定经常做偷鸡摸狗的事...”。不能忍,果断反编译,找到关键算法:

// Action script...

// [onClipEvent of sprite 64 in frame 1]

onClipEvent (construct)

{

     editable = true;

     password = false;

     text = "";

     maxChars = null;

     restrict = "";

     enabled = true;

     visible = true;

     minHeight = 0;

     minWidth = 0;

}

// [onClipEvent of sprite 21 in frame 1]

onClipEvent (construct)

{

     icon = "";

     label = "计算";

     labelPlacement = "right";

     selected = false;

     toggle = false;

     enabled = true;

     visible = true;

     minHeight = 0;

     minWidth = 0;

}

// [onClipEvent of sprite 63 in frame 1]

onClipEvent (construct)

{

     editable = false;

     html = false;

     text = "";

     wordWrap = true;

     maxChars = null;

     restrict = "";

     enabled = true;

     password = false;

     visible = true;

     minHeight = 0;

     minWidth = 0;

}

// [Action in Frame 1]

function nameResult(str)

{

     var _loc1 = checkPreList(str);

     if (_loc1 == null)

     {

         _loc1 = getResult(str);

     } // end if

     var _loc2 = "姓名:" + str + "\n";

     _loc2 = _loc2 + ("人品得分:" + foramtResult(_loc1) + "\n");

     _loc2 = _loc2 + ("评价:" + getValue(_loc1));

     return (_loc2);

} // End of the function

function foramtResult(n)

{

     return (n >= 0 && n <= 100 ? (n) : ("负溢出"));

} // End of the function

function getValue(n)

{

     var _loc2 = "";

     if (n == 0)

     {

         _loc2 = "你一定不是人吧?怎么一点人品都没有?!";

     }

     else if (n > 0 && n <= 5)

     {

         _loc2 = "算了,跟你没什么人品好谈的...";

     }

     else if (n > 5 && n <= 10)

     {

         _loc2 = "是我不好...不应该跟你谈人品问题的...";

     }

     else if (n > 10 && n <= 15)

     {

         _loc2 = "杀过人没有?放过火没有?你应该无恶不做吧?";

     }

     else if (n > 15 && n <= 20)

     {

         _loc2 = "你貌似应该三岁就偷看隔壁大妈洗澡的吧...";

     }

     else if (n > 20 && n <= 25)

     {

         _loc2 = "你的人品之低下实在让人惊讶啊...";

     }

     else if (n > 25 && n <= 30)

     {

         _loc2 = "你的人品太差了。你应该有干坏事的嗜好吧?";

     }

     else if (n > 30 && n <= 35)

     {

         _loc2 = "你的人品真差!肯定经常做偷鸡摸狗的事...";

     }

     else if (n > 35 && n <= 40)

     {

         _loc2 = "你拥有如此差的人品请经常祈求佛祖保佑你吧...";

     }

     else if (n > 40 && n <= 45)

     {

         _loc2 = "老实交待..那些论坛上面经常出现的偷拍照是不是你的杰作?";

     }

     else if (n > 45 && n <= 50)

     {

         _loc2 = "你随地大小便之类的事没少干吧?";

     }

     else if (n > 50 && n <= 55)

     {

         _loc2 = "你的人品太差了..稍不小心就会去干坏事了吧?";

     }

     else if (n > 55 && n <= 60)

     {

         _loc2 = "你的人品很差了..要时刻克制住做坏事的冲动哦..";

     }

     else if (n > 60 && n <= 65)

     {

         _loc2 = "你的人品比较差了..要好好的约束自己啊..";

     }

     else if (n > 65 && n <= 70)

     {

         _loc2 = "你的人品勉勉强强..要自己好自为之..";

     }

     else if (n > 70 && n <= 75)

     {

         _loc2 = "有你这样的人品算是不错了..";

     }

     else if (n > 75 && n <= 80)

     {

         _loc2 = "你有较好的人品..继续保持..";

     }

     else if (n > 80 && n <= 85)

     {

         _loc2 = "你的人品不错..应该一表人才吧?";

     }

     else if (n > 85 && n <= 90)

     {

         _loc2 = "你的人品真好..做好事应该是你的爱好吧..";

     }

     else if (n > 90 && n <= 95)

     {

         _loc2 = "你的人品太好了..你就是当代活雷锋啊...";

     }

     else if (n > 95 && n <= 99)

     {

         _loc2 = "你是世人的榜样!";

     }

     else if (n == 100)

     {

         _loc2 = "天啦!你不是人!你是神!!!";

     }

     else

     {

         _loc2 = "你的人品竟然负溢出了...我对你无语..";

     } // end else if

     return (_loc2);

} // End of the function

function getResult(str)

{

     var _loc3 = 0;

     for (var _loc1 = 0; _loc1 < str.length; ++_loc1)

     {

         _loc3 = _loc3 + str.charCodeAt(_loc1);

     } // end of for

     return (_loc3 % 100);

} // End of the function

function checkPreList(str)

{

     var _loc1 = null;

     for (var _loc3 in PrenameList)

     {

         if (PrenameList[_loc3][0] == str)

         {

             _loc1 = PrenameList[_loc3][1];

             break;

         } // end if

     } // end of for...in

     return (_loc1);

} // End of the function

PrenameList = new Array();

PrenameList.push(["张晋", 100]);

PrenameList.push(["鬼龟", 100]);

PrenameList.push(["cordy", 100]);

PrenameList.push(["jx2cordy", 100]);

PrenameList.push(["2306205002", 100]);

PrenameList.push(["日本人", -1]);

PrenameList.push(["小日本", -1]);

PrenameList.push(["日本", -1]);

PrenameList.push(["日本鬼子", -1]);

getURL("FSCommand:showmenu", false);

inputName.maxChars = 20;

resultArea.text = "请输入要计算的名字 然后点击计算按钮\n本程序内容纯属构 仅供娱乐之用\n如有雷同 纯属巧合\n----------by cordy";

okBtAction = new Object();

okBtAction.click = function ()

{

     var _loc1 = inputName.text;

     _loc1 = _loc1.split(" ").join("");

     _loc1 = _loc1.split(" ").join("");

     _loc1 = _loc1.split("\t").join("");

     inputName.text = _loc1;

     if (_loc1 == "")

     {

         resultArea.text = "请先输入要计算的名字";

     }

     else

     {

         resultArea.text = nameResult(_loc1);

     } // end else if

};

okBt.addEventListener("click", okBtAction);

原来是先看名字属不属于PrenameList(一些特殊名字的列表),如果名字是“张晋”(估计是作者吧……)直接就是100分,如果是“日本”就是-1分,也就是“负溢出”。不属于列表的普通名字就把unicode码全加起来,然后对100求余数……好简单的算法……

现在就来破除迷信!赶快把自己加到PrenameList里头去: 

PrenameList.push(["小聂", 101]);

在 getValue() 里加上:

else if(n==101){

        _loc2="你是全宇宙包括外太空学习的榜样!";

}

再改foramtResult():

function foramtResult(n){

     if(n<0)           return (("负溢出"));

     else if(n>100)   return (("正溢出"));

     else              return (n);

}

嘿嘿!

评论:

PastorBrad
2018-01-11 23:27
All 4 of these children were taken from their mother who doesn't have custody and fled out of the county with them.
July 4th they left from Lost Angeles airport and their final destination was Paris France.
We do not know the whereabouts they may be now. They could be anywhere in the world.
https://intersnap.com/Missing-Kona-Kids.jpg
Our Facebook page: https://www.facebook.com/KonasKids/

发表评论:

Powered by emlog