Haskell と Python
first_turn :: Score -> [Int] -> [Int] -> [Int] first_turn game_score xs yzs = [ sum [(max_of_list (second_turn game_score (progress_turn (Play x y z)) (delete x xs) (delete y (delete z yzs)))) | y <- yzs, z <- yzs, y /= z] | x <- xs]
とそれを移植したPythonのコード
def first_turn(game_score, xs, yzs): """ 最終ラウンドの探索、1ターン目 現在のゲームスコア、自分が出せる札、他人が出せる札、を引数として取り、 「第2ラウンドで、その後を読んだ結果勝ち点が最大になる手を選ぶ」 という条件で第1ターンの今何を出すとどれくらいの勝ち点が得られるかを 他人が出しうるすべての手について合計したものを返す。 :: Score -> [Int] -> [Int] -> [Int] """ return ( sum( max( second_turn( game_score, progress_turn((x, y, z)), delete(x, xs), delete(y, delete(z, yzs)))) for y in yzs for z in yzs if y != z) for x in xs)
同じだね(ぇ
とか言ってたらネガティブキャンペーンされたw
http://twitter.com/voluntas/status/975205263