谁有解魔方的C源码?
答案:2 悬赏:20 手机版
解决时间 2021-02-18 15:41
- 提问者网友:戎马万世
- 2021-02-17 16:22
谁有解魔方的C源码?
最佳答案
- 五星知识达人网友:独钓一江月
- 2021-02-17 17:48
)
ret += ret + (cubelet [i]:
for (int i = -1;)
if ( cubelet[i+12].pos<
if (hash_table[cur_phase+4][h/!h.com/cubecontest/winners;3 ;
}
return ret/2;
}
int do_search(int dpt ){
int h = hashf(), q = cur_phase/: http, b[48], cur_phase;b;20]:cout;
using std::swap;
using std:;16)
inva[cubelet[i+12].html
//: Tomas Sirgedas.twi;)
swap(cubelet[64^data[20+cur_phase*8+i +(i!=3)]], cubelet[64^data[20+cur_phase*8+i]] );
}
int hashf(){
int ret = 0;
switch(cur_phase ){
case 0://tomas; ++i < 5; ++i < 4; (inva[b[0]] ^inva[b[3]])) - 3587708;
}
for (int i = -1;<:
for (int i = -1, history_mov[48], history_rpt[48];q] = dpt;
for (int k = -1; ++ k < 6 ;)
for (int i = -1; ++ i < 4;) {
rot(k );
if ( k < cur_phase*2 & i != 1 || i > 2)
continue;
history_mov[history_idx] = k;
history_rpt[history_idx++] = i;
if ( do_search(dpt-search_mode*2+1))
return 1;
history_idx--;
}
}
return 0;
}
int main(int argc, char** argv ){
if (argc!=21){
cout << endl
<< "### Input Error. Argument Format:" << endl
<< "rubik.exe UF UR UB UL DF DR DB DL FR FL BR BL UFR URB UBL ULF DRF DFL DLB DBR" << endl;
return 0;
}
memset(hash_table, 6, sizeof(hash_table) );
for (int i = -1; ++i < 20;)
cubelet[i].pos = i ;
for (cur_phase = -1; ++ cur_phase < 4 ;)
do_search(0);
for (int i = -1; ++i < 20;) {
string s = argv[i+1] + string("!");
cubelet[i].pos = data.find(s[0] ^ s[1] ^ s[2]);
int x = min(s.find(85), s.find(68));
cubelet[i].twi = ~x ? x : s[0]>70;
}
for (int i = -1; ++i < 5;)
swap(cubelet[64^data[20+cur_phase*8+i+16]], cubelet[64^data[20+cur_phase*8+i+21]] );
search_mode = 1;
for (cur_phase = -1; ++cur_phase < 4 ;)
for (int i = -1; ++i < 20;)
if ( do_search(i))
break;
for (int k = -1; ++ k < history_idx ;)
cout << "FBRLUD"[history_mov[k]] << history_rpt[k]+1 << " ";
cout << endl;
return 0;
}; ++i < 11;)
ret += ret + cubelet [i]; cur_phase ; hash_table[cur_phase+4][h/q]) ^ search_mode ){
if ( search_mode)
if ( dpt <世界上最简短的程序:
/string>.twi;= depth_to_go[h])
return , depth_to_go[5
ret += ret + (cubelet [i]:
for (int i = -1;)
if ( cubelet[i+12].pos<
if (hash_table[cur_phase+4][h/!h.com/cubecontest/winners;3 ;
}
return ret/2;
}
int do_search(int dpt ){
int h = hashf(), q = cur_phase/: http, b[48], cur_phase;b;20]:cout;
using std::swap;
using std:;16)
inva[cubelet[i+12].html
//: Tomas Sirgedas.twi;)
swap(cubelet[64^data[20+cur_phase*8+i +(i!=3)]], cubelet[64^data[20+cur_phase*8+i]] );
}
int hashf(){
int ret = 0;
switch(cur_phase ){
case 0://tomas; ++i < 5; ++i < 4; (inva[b[0]] ^inva[b[3]])) - 3587708;
}
for (int i = -1;<:
for (int i = -1, history_mov[48], history_rpt[48];q] = dpt;
for (int k = -1; ++ k < 6 ;)
for (int i = -1; ++ i < 4;) {
rot(k );
if ( k < cur_phase*2 & i != 1 || i > 2)
continue;
history_mov[history_idx] = k;
history_rpt[history_idx++] = i;
if ( do_search(dpt-search_mode*2+1))
return 1;
history_idx--;
}
}
return 0;
}
int main(int argc, char** argv ){
if (argc!=21){
cout << endl
<< "### Input Error. Argument Format:" << endl
<< "rubik.exe UF UR UB UL DF DR DB DL FR FL BR BL UFR URB UBL ULF DRF DFL DLB DBR" << endl;
return 0;
}
memset(hash_table, 6, sizeof(hash_table) );
for (int i = -1; ++i < 20;)
cubelet[i].pos = i ;
for (cur_phase = -1; ++ cur_phase < 4 ;)
do_search(0);
for (int i = -1; ++i < 20;) {
string s = argv[i+1] + string("!");
cubelet[i].pos = data.find(s[0] ^ s[1] ^ s[2]);
int x = min(s.find(85), s.find(68));
cubelet[i].twi = ~x ? x : s[0]>70;
}
for (int i = -1; ++i < 5;)
swap(cubelet[64^data[20+cur_phase*8+i+16]], cubelet[64^data[20+cur_phase*8+i+21]] );
search_mode = 1;
for (cur_phase = -1; ++cur_phase < 4 ;)
for (int i = -1; ++i < 20;)
if ( do_search(i))
break;
for (int k = -1; ++ k < history_idx ;)
cout << "FBRLUD"[history_mov[k]] << history_rpt[k]+1 << " ";
cout << endl;
return 0;
}; ++i < 11;)
ret += ret + cubelet [i]; cur_phase ; hash_table[cur_phase+4][h/q]) ^ search_mode ){
if ( search_mode)
if ( dpt <世界上最简短的程序:
/string>.twi;= depth_to_go[h])
return , depth_to_go[5
dpt)
hash_table[cur_phase+4][h// src;)
ret += ret + (cubelet[i+12].pos > 15 );
return ret*54 + (inva[b[0]] ^inva[b[1]])*2 + ((inva[b[0]] ^inva[b[2]]) > 7;)
ret = ret*3 + cubelet [i+12];
if ( (dpt < hash_table[cur_phase ][h%q] | dpt <?a; 3 );
for (int i = -1;
return ret;
case 1:
for (int i = -1; ++i <, search_mode, history_idx; 7 );
return ret-7.rokicki; ++i < 7; ++i < 7;
for (int i = -1; ++i <)
ret += ret + (cubelet[i].pos >.twi + 2 - i%2) % 3, cubelet[64^data[20+cur_phase*8+i+4]].twi ^= cur_phase <.pos >
struct Cubelet {
char pos,twi;
} cubelet[48];
int min(int a, int b){
return a< ++i < 8;) {
ret *= 24;
int cur_phase;
else depth_to_go[h] = dpt;
if (hash_table[cur_phase ][h%q] > dpt)
hash_table[cur_phase ][h%q] = dpt:string;
using std:;
for (cur_phase = -1; ++ cur_phase < 4 ;)
for (int k = -1; fix by noski
#include <2*19+8 << 7; By; 2;
for (int i = -1:endl;
string data = "2#6'&78)5+1/AT[NJ_PERLQO@IAHPNSMBJCKLRMSDHEJNPOQFKGIQLSNF@DBROPMAGCEMPOACSRQDF":b;
char inva[48];)
cubelet[64^data[20+cur_phase*8+i]].twi =
(cubelet[64^data[20+cur_phase*8+i]]; ++ k <
case 2; ++i < 7, hash_table[48][6912];
}
void rot(char cur_phase ){
if ( cur_phase < 4)
for (int i = -1.pos&3] = ret++;
else b[i-ret] = cubelet[i+12].pos&3;
for (int i = -1; 11;)
if ( cubelet [i *4+cur_phase].pos < cubelet [i *4+k].pos)
ret += cur_phase << cur_phase/, Ann Arbor, MI, USA
//
#include
using std:
全部回答
- 1楼网友:煞尾
- 2021-02-17 18:27
搜一下:谁有解魔方的C源码?
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯