コメント

このコメントは、倉庫番的な何か。へのコメントです。

コメントの内容

Cdv30200 aoi icon mini aoihikawa(投稿日:2011/08/11 03:08/11/11)
ちょっと、テストが完璧ではないですけれど。。。

def POWER(n, b)
    r = n; i = 0
    while i < (b - 1)
        r = r * n
        i = i + 1
    end
    return r
end

map_w = 8

map_d = createArray()
map_d[0] = 00100010
map_d[1] = 01311131
map_d[2] = 01000201
map_d[3] = 13202001
map_d[4] = 01001111
map_d[5] = 01001000
map_d[6] = 00110000

BLOCK = createArray()
j = 0; jlen = map_w
while j < jlen
    BLOCK[j] = createArray()
    j = j + 1
end

i = 0; ilen = getArrayLength(map_d)
while i < ilen
    j = 0; jlen = map_w
    while j < jlen
        if j > 0
            chk = map_d[i]
        else
            chk = floor(map_d[i] / POWER(10, (map_w - (j + 1))))
        end
        if chk == 0
            BLOCK[j][i] = 0
        else
            BLOCK[j][i] = chk % 10
        end
        j = j + 1
    end
    i = i + 1
end

コメントの内容(一番最初の投稿)

Cdv30200 aoi icon mini aoihikawa(投稿日:2011/08/11 03:08/11/11)
ちょっと、テストが完璧ではないですけれど。。。

def POWER(n, b)
    r = n; i = 0
    while i < (b - 1)
        r = r * n
        i = i + 1
    end
    return r
end

map_w = 8

map_d = createArray()
map_d[0] = 00100010
map_d[1] = 01311131
map_d[2] = 01000201
map_d[3] = 13202001
map_d[4] = 01001111
map_d[5] = 01001000
map_d[6] = 00110000

BLOCK = createArray()
j = 0; jlen = map_w
while j < jlen
    BLOCK[j] = createArray()
    j = j + 1
end

i = 0; ilen = getArrayLength(map_d)
while i < ilen
    j = 0; jlen = map_w
    while j < jlen
        if j > 0
            chk = map_d[i]
        else
            chk = floor(map_d[i] / POWER(10, (map_w - (j + 1))))
        end
        if chk == 0
            BLOCK[j][i] = 0
        else
            BLOCK[j][i] = chk % 10
        end
        j = j + 1
    end
    i = i + 1
end