Beispiel #1
0
loader_t *get_loaders() {
    loader_t *loaders = malloc(sizeof(loader_t) * NUM_LOADERS);
    loaders[0] = get_9x();
    loaders[1] = get_me();
    loaders[2] = get_nt();
    loaders[3] = get_vista();
    loaders[4] = get_uefi();
    return loaders;
}
Beispiel #2
0
void show_step(){
    int cs = ST;
    CHESS ct;
    s2c(cs, ct);

    int steps[dp[ST]-1];

    int oo = 100;
    while(cs != SS && oo > 0){
        oo --;
        for (int d = 0; d < 4; d++)
            {
                CHESS tt;
                get_nt(ct, d, tt);
                int ts = c2s(tt);
                if (dp[ts] == dp[cs] - 1){
                    // printf("%x to %x with direction: %c\n", cs, c2s(tt), DIR_NAME[d]);
                    // print_chess(tt);

                    steps[ dp[cs] -2 ] = REVERSE_DIR[d];
                    // printf("%d\n", dp[cs]);
                    cs = c2s(tt);
                    s2c(cs, ct);
                }
            }
    }

    cs = SS;
    for (int i = 0; i < dp[ST]-1; ++i) {
        s2c(cs, ct);

        int d = steps[i];

        CHESS tt;
        get_nt(ct, d, tt);
        cs = c2s(tt);

        // printf("move: %c\n", DIR_NAME[d]);
        // print_chess(tt);
        printf("%c", DIR_NAME[d]);
    }
    printf("\n");
}
Beispiel #3
0
void solve(){
    // memset(dp, INF, sizeof(dp));

    std::deque<int> a;

    SS = c2s(S);
    ST = c2s(T);
    printf("SS = %x\n", SS);
    printf("ST = %x\n", ST);

    a.push_back(SS);
    printf("a.size = %d\n", (int)a.size());
    dp[SS] = 1;

    int oo = 20000;
    CHESS ct, nt;
    int cs, ns;
    do {
        // oo --;

        cs = a.front();
        a.pop_front();

        s2c(cs, ct);
        if (fp[cs]) continue;
        fp[cs] = true;
        if (cs == ST) break;

        // print_chess(ct);
        // printf("step of %x: %d\n", cs, dp[cs]);
        for (int d=0; d<4; d++) {
            if (! get_nt(ct, d, nt) ) continue;
            int ns = c2s(nt);
            // print_chess(nt);

            if (dp[ns] == 0 or dp[cs]+1 < dp[ns]){
                dp[ns] = dp[cs]+1;
            };
            // printf("ns = %x, fp[ns]= %d\n", ns, fp[ns]);
            if (! fp[ns]) a.push_back(ns);
        };

        // printf("a.size = %d\n", static_cast<int>(a.size()));
    } while ( oo > 0 && a.size() > 0 );

    printf("oo = %d\n", oo);
    printf("a.size = %d\n", static_cast<int>(a.size()));
    printf("dp.size = %d\n", static_cast<int>(dp.size()));
    printf("step: %d\n", dp[cs]-1);
    print_chess(ct);
    printf("\n\n");

    show_step();
}
Beispiel #4
0
std::string kmer_to_string(const T & kmer_block, uint8_t max_k, uint8_t this_k = -1) {
    std::string buf(max_k, DUMMY_SYM);

    // To enable not giving a this_k value -> we can print full kmers or dummy kmers
    if (this_k > max_k) this_k = max_k;

    for (uint32_t j = 0; j < this_k; j++) {
        buf[max_k-j-1] = DNA_ALPHA[get_nt(kmer_block, j)];
    }
    return buf;
}
Beispiel #5
0
uint8_t get_edge_label(const T & x) {
    return get_nt(x, 0);
}
Beispiel #6
0
 uint8_t operator() (const T & x, uint8_t i) {
     return get_nt(x, i);
 }