关灯游戏的算法...
& ltp?style = " padding:0;margin:0 " >& lt输入?type="button "?id="btn_0_0 "?value="0 "?onclick="change(0,0)"?/& gt;& lt输入?type="button "?id="btn_0_1 "?value="1 "?onclick="change(0,1)"?/& gt;& lt输入?type="button "?id="btn_0_2 "?value="1 "?onclick="change(0,2)"?/& gt;& lt输入?type="button "?id="btn_0_3 "?value="0 "?onclick="change(0,3)"?/& gt;& lt输入?type="button "?id="btn_0_4 "?value="1 "?onclick="change(0,4)"?/& gt;& lt输入?type="button "?id="btn_0_5 "?value="0 "?onclick="change(0,5)"?/& gt;& lt/p & gt;
& ltp?style = " padding:0;margin:0 " >& lt输入?type="button "?id="btn_1_0 "?value="1 "?onclick="change(1,0)"?/& gt;& lt输入?type="button "?id="btn_1_1 "?value="0 "?onclick="change(1,1)"?/& gt;& lt输入?type="button "?id="btn_1_2 "?value="0 "?onclick="change(1,2)"?/& gt;& lt输入?type="button "?id="btn_1_3 "?value="1 "?onclick="change(1,3)"?/& gt;& lt输入?type="button "?id="btn_1_4 "?value="1 "?onclick="change(1,4)"?/& gt;& lt输入?type="button "?id="btn_1_5 "?value="1 "?onclick="change(1,5)"?/& gt;& lt/p & gt;
& ltp?style = " padding:0;margin:0 " >& lt输入?type="button "?id="btn_2_0 "?value="0 "?onclick="change(2,0)"?/& gt;& lt输入?type="button "?id="btn_2_1 "?value="0 "?onclick="change(2,1)"?/& gt;& lt输入?type="button "?id="btn_2_2 "?value="1 "?onclick="change(2,2)"?/& gt;& lt输入?type="button "?id="btn_2_3 "?value="0 "?onclick="change(2,3)"?/& gt;& lt输入?type="button "?id="btn_2_4 "?value="0 "?onclick="change(2,4)"?/& gt;& lt输入?type="button "?id="btn_2_5 "?value="1 "?onclick="change(2,5)"?/& gt;& lt/p & gt;
& ltp?style = " padding:0;margin:0 " >& lt输入?type="button "?id="btn_3_0 "?value="1 "?onclick="change(3,0)"?/& gt;& lt输入?type="button "?id="btn_3_1 "?value="0 "?onclick="change(3,1)"?/& gt;& lt输入?type="button "?id="btn_3_2 "?value="0 "?onclick="change(3,2)"?/& gt;& lt输入?type="button "?id="btn_3_3 "?value="1 "?onclick="change(3,3)"?/& gt;& lt输入?type="button "?id="btn_3_4 "?value="0 "?onclick="change(3,4)"?/& gt;& lt输入?type="button "?id="btn_3_5 "?value="1 "?onclick="change(3,5)"?/& gt;& lt/p & gt;
& ltp?style = " padding:0;margin:0 " >& lt输入?type="button "?id="btn_4_0 "?value="0 "?onclick="change(4,0)"?/& gt;& lt输入?type="button "?id="btn_4_1 "?value="1 "?onclick="change(4,1)"?/& gt;& lt输入?type="button "?id="btn_4_2 "?value="1 "?onclick="change(4,2)"?/& gt;& lt输入?type="button "?id="btn_4_3 "?value="1 "?onclick="change(4,3)"?/& gt;& lt输入?type="button "?id="btn_4_4 "?value="0 "?onclick="change(4,4)"?/& gt;& lt输入?type="button "?id="btn_4_5 "?value="0 "?onclick="change(4,5)"?/& gt;& lt/p & gt;
& lt剧本?type="text/javascript "?src = " ~/Js/jquery-1 . 8 . 2 . min . Js " >& lt/script & gt;
& lt剧本?type = " text/JavaScript " & gt;
功能?改变(我,?j)
{
var?这个瓦尔?=?$("#btn_ "?+?我?+?"_"?+?j)。val()?==?"1"?"0"?:?"1";
$("#btn_ "?+?我?+?"_"?+?j)。瓦尔(this val);
如果?($("#btn_ "?+?(我?-?1)+"_"+j))?{
var?upval?=?$("#btn_ "?+?(我?-?1)?+?"_"?+?j)。val()?==?"1"?"0"?:?"1";
$("#line "?+?(我?-?1)).查找(“输入”)。等式(j)。瓦尔(上瓦尔)
}
如果?($("#btn_ "?+?(我?+?1)?+?"_"?+?j))?{
var?唐瓦尔?=?$("#btn_ "?+?(我?+?1)?+?"_"?+?j)。val()?==?"1"?"0"?:?"1";
$("#line "?+?(我?+?1)).查找(“输入”)。等式(j)。瓦尔(下瓦尔)
}
如果?($("#btn_ "?+?我?+?"_"?+?(j-1)))?{
var?莱夫瓦尔?=?$("#btn_ "?+?我?+?"_"?+?(j?-?1)).val()?==?"1"?"0"?:?"1";
$("#btn_ "?+?我?+?"_"?+?(j?-?1)).瓦尔(左瓦尔)
}
如果?($("#btn_ "?+?我?+?"_"?+?(j?+?1)))?{
var?rightval?=?$("#btn_ "?+?我?+?"_"?+?(j?+?1)).val()?==?"1"?"0"?:?"1";
$("#btn_ "?+?我?+?"_"?+?(j?+?1)).瓦尔(右瓦尔)
}
}
& lt/script & gt;