最大ステータス計算アルゴリズム

PU結果がこれまでに計算したステータス値/PU値/転生値と被っていたら、より少ないコスト (使用体数) で済む方を採用する、といった感じ。 もうちょっと削れる部分がありそうな気がする。数秒で終わるような処理なので並列化する旨味はあまりないはず。 ※ PU不可条件時 (☆0+☆3等) のループ continue とかを一部書いていないのでそのまま実装すると無駄計算が発生します (最大ステ更新処理で補正されるからバグることは無いと思う)。実際の計算機ではきちんとやってます。

B: Base Sets
P: Partner Sets
T: Trans-Up Base Sets

# trans-up loop
for level = 0 to (max-trans-up-level - 1)
    if (level is 0)
        B = {☆0}
        P = {☆0}
        T = {☆0}
    else
        B = {} [different instance from the former level]
        P = {} [different instance from the former level]
        T = {} [different instance from the former level]
        foreach t in former level T
            n = trans-up t
            B = B ∪ n
            y = search an element which has the same power-up-value as n has from P
            if (y was not found)
                P = P ∪ n
            else if (the cost to make n is smaller than that of y)
                overwrite y in P with n
            if (level is less than (max-trans-up-level - 1))
                z = search an element which has the same trans-up-value as n has from T
                if (z was not found)
                    T = T ∪ n
                else if (the cost to make n is smaller than that of z)
                    overwrite z in T with n
            else
                update maximum status (update maximum status power-up tree)

    # outer power-up loop
    for star = 0 to (4 - 1)
        # inner power-up loop
        foreach b in B
            foreach p in P
                n = power-up b with p

                x = search an element which has the same status-value as n has from B
                if (x was not found)
                    B = B ∪ n
                else if (the cost to make n is smaller than that of x)
                    overwrite x in B with n [when inner power-up loop is done]

                y = search an element which has the same power-up-value as n has from P
                if (y was not found)
                    P = P ∪ n
                else if (the cost to make n is smaller than that of y)
                    overwrite y in P with n [when inner power-up loop is done]

                if (level is less than (max-trans-up-level - 1))
                    z = search an element which has the same trans-up-value as n has from T
                    if (z was not found)
                        T = T ∪ n
                    else if (the cost to make n is smaller than that of z)
                        overwrite z in T with n
                else
                    update maximum status (update maximum status power-up tree)

0 件のコメント:

コメントを投稿