カタン、Pythonでは?―― 正六角形の頂点を19個
全然、どうしよう、ではなかった。
np.append で作った新たな配列を、t1に入れればいいだけだった。
import numpy as np
t1 = np.empty((0, 2), dtype = float)
t1a = np.array([217.32, 200.00])
t2a = np.array([34.64, 0.00])
t2b = t1a + t2a
t1 = np.append(t1, np.array([t2b]), axis=0)
t2b = t2b + t2a
t1 = np.append(t1, np.array([t2b]), axis=0)
print(t1)
結果は、
[[251.96 200. ]
[286.6 200. ]]
となる。これでOK。
で、上段から作っていこう。
import numpy as np
t1 = np.empty((0, 2), dtype = float)
t1a = np.array([217.32, 200.00])
t2a = np.array([34.64, 0.00])
t1b = np.array([-17.32, 30.00])
t1c = np.array([17.32, 30.00])
t1 = np.append(t1, np.array([t1a]), axis=0)
t2b = t1a
for i in range(2):
t2b = t2b + t2a
t1 = np.append(t1, np.array([t2b]), axis=0)
t2b = t1a + t1b
for i in range(4):
t1 = np.append(t1, np.array([t2b]), axis=0)
t2b = t2b + t2a
t2b = t1a + t1b +t1b
for i in range(5):
t1 = np.append(t1, np.array([t2b]), axis=0)
t2b = t2b + t2a
t2b = t1a + t1b + t1b + t1c
for i in range(4):
t1 = np.append(t1, np.array([t2b]), axis=0)
t2b = t2b + t2a
t2b = t1a + t1b + t1b + t1c + t1c
for i in range(3):
t1 = np.append(t1, np.array([t2b]), axis=0)
t2b = t2b + t2a
print(t1)
結果は、
[[217.32 200. ]
[251.96 200. ]
[286.6 200. ]
[200. 230. ]
[234.64 230. ]
[269.28 230. ]
[303.92 230. ]
[182.68 260. ]
[217.32 260. ]
[251.96 260. ]
[286.6 260. ]
[321.24 260. ]
[200. 290. ]
[234.64 290. ]
[269.28 290. ]
[303.92 290. ]
[217.32 320. ]
[251.96 320. ]
[286.6 320. ]]
エクセルか何かで全部作ったほうが速かったのでは、という感じではあるが、とにかく、できた。
とはいうものの、タイルの資源をランダムに並べるだけならいいのだが、砂漠の位置によってトークン(生産力)の配置を変えなければいけないことを考えると、この順番は使いづらいのではないか、と思えてきた。やはり、外から中に向かう渦巻き状でなければ。
さて、どうしよう。