最大サイズが5フィールドの5倍の可変サイズのボードがあります。すべてのフィールドは「x」で埋められます。「x」で埋められていない場合は、「o」で埋められます。
すべてのボードの開始状態が示されます(以下を参照)。各ボードでは、10ラウンドをプレイする必要があり(最大、条件:以下を参照)、xの進化を監視する必要があります。
1ラウンドは次のように機能します。
- すべての「x」は、直交するフィールドに広がりますが、消えます
- 2つの「x」が1つのフィールドにあるたびに、互いに中和します。
各ラウンドのすべての「x」の進化は同時に発生する必要があります。例:
o o o o x o
o x o -> x o x
o o o o x o
進化の各ラウンドで、ボードに「x」が空になるかどうかを確認する必要があります。空ではない場合、繰り返しパターンが存在する可能性があります。これも当てはまらない場合は、進化の分析を放棄します。さらに、開始ボードごとにxフィールドの最大パーセンテージを印刷する必要があります(整数に切り捨てられます)。
入力:
入力データはここ(Pastebin)にあります。このデータには100の開始状態が含まれています。すでに述べたように、ボードのサイズはさまざまです。行の数は、1から5までの番号nで示され、その後に「x」と「o」のみを含むn行が続き、開始パターンを表します。ボードの各行には1〜5個のフィールドがあります。
出力:
完全な結果を印刷する必要があります。開始ボードごとに1行を次の形式で印刷します。
Round {0-10}: {repetition/empty/giveup}, {0-100} percent maximum-fill
例:
例1:
Input: 2 Starting state: x o x
xox x x
xx
Round 1: x x o
o x
Round 2: x o x
o x
Round 3: o x o
o o
Round 4: x o x -> The pattern repeats:
o x It is the same as in round 2,
therefore we stop. Maximum fill was
in the starting state with four times 'x'
of 5 fields altogether,
so we have 4/5 = 80 %.
Output: Round 4: repetition, 80 percent maximum-fill
例2:
Input: 1 Starting state: x x
xx
Round 1: x x -> We already have a repetition, because
the pattern is the same as in the starting
state. The board is always filled 100 %.
Output: Round 1: repetition, 100 percent maximum-fill
8日後、私は最も少ないキャラクターで作業中の回答を勝者としてマークします。さらに、100個の開始ボード(入力)の正しい出力を投稿します。
好みの(プログラミング/スクリプト/何でも)言語を使用できます。
楽しんで!
PS:ご質問がありましたら、お気軽にお問い合わせください。
PPS:オリジナルクリエイターについて:ドイツ語を話すことができる人のために、ここでネタバレをしたくない場合はクリックしないで ください。チャレンジを完了するための公式時間が終了したので、私は誰かが短くてエレガントな解決策を思い付くことができるかどうかを見たかったです。
22.04.2014:
チャレンジ完了!受賞者は承認済みとしてマークされました。正しい出力:
Round 10: giveup, 50 percent maximum-fill
Round 5: empty, 66 percent maximum-fill
Round 1: repetition, 100 percent maximum-fill
Round 1: empty, 100 percent maximum-fill
Round 4: repetition, 100 percent maximum-fill
Round 4: repetition, 70 percent maximum-fill
Round 2: repetition, 60 percent maximum-fill
Round 4: empty, 88 percent maximum-fill
Round 10: giveup, 50 percent maximum-fill
Round 5: repetition, 80 percent maximum-fill
Round 10: repetition, 80 percent maximum-fill
Round 1: empty, 80 percent maximum-fill
Round 3: repetition, 60 percent maximum-fill
Round 4: repetition, 48 percent maximum-fill
Round 9: empty, 41 percent maximum-fill
Round 10: giveup, 92 percent maximum-fill
Round 10: giveup, 53 percent maximum-fill
Round 10: giveup, 66 percent maximum-fill
Round 6: repetition, 50 percent maximum-fill
Round 10: giveup, 88 percent maximum-fill
Round 10: giveup, 76 percent maximum-fill
Round 10: giveup, 68 percent maximum-fill
Round 10: giveup, 40 percent maximum-fill
Round 10: giveup, 100 percent maximum-fill
Round 10: giveup, 71 percent maximum-fill
Round 2: empty, 81 percent maximum-fill
Round 6: repetition, 36 percent maximum-fill
Round 10: giveup, 61 percent maximum-fill
Round 10: giveup, 60 percent maximum-fill
Round 4: repetition, 66 percent maximum-fill
Round 10: giveup, 72 percent maximum-fill
Round 3: empty, 80 percent maximum-fill
Round 10: giveup, 50 percent maximum-fill
Round 10: giveup, 83 percent maximum-fill
Round 7: repetition, 37 percent maximum-fill
Round 9: repetition, 85 percent maximum-fill
Round 5: repetition, 40 percent maximum-fill
Round 5: repetition, 60 percent maximum-fill
Round 4: empty, 80 percent maximum-fill
Round 10: giveup, 60 percent maximum-fill
Round 4: repetition, 46 percent maximum-fill
Round 6: repetition, 42 percent maximum-fill
Round 10: giveup, 72 percent maximum-fill
Round 4: repetition, 70 percent maximum-fill
Round 4: repetition, 80 percent maximum-fill
Round 6: repetition, 50 percent maximum-fill
Round 4: repetition, 56 percent maximum-fill
Round 10: giveup, 60 percent maximum-fill
Round 10: giveup, 54 percent maximum-fill
Round 10: giveup, 66 percent maximum-fill
Round 2: repetition, 40 percent maximum-fill
Round 2: repetition, 40 percent maximum-fill
Round 6: repetition, 75 percent maximum-fill
Round 7: empty, 85 percent maximum-fill
Round 10: giveup, 50 percent maximum-fill
Round 6: repetition, 70 percent maximum-fill
Round 2: empty, 66 percent maximum-fill
Round 1: empty, 66 percent maximum-fill
Round 3: empty, 100 percent maximum-fill
Round 3: empty, 66 percent maximum-fill
Round 8: repetition, 42 percent maximum-fill
Round 1: empty, 60 percent maximum-fill
Round 2: repetition, 100 percent maximum-fill
Round 2: repetition, 83 percent maximum-fill
Round 4: repetition, 66 percent maximum-fill
Round 6: repetition, 75 percent maximum-fill
Round 4: empty, 66 percent maximum-fill
Round 10: giveup, 61 percent maximum-fill
Round 10: giveup, 56 percent maximum-fill
Round 4: empty, 66 percent maximum-fill
Round 6: repetition, 33 percent maximum-fill
Round 3: empty, 57 percent maximum-fill
Round 3: repetition, 100 percent maximum-fill
Round 6: repetition, 73 percent maximum-fill
Round 10: giveup, 50 percent maximum-fill
Round 6: repetition, 50 percent maximum-fill
Round 10: giveup, 73 percent maximum-fill
Round 5: empty, 80 percent maximum-fill
Round 10: giveup, 61 percent maximum-fill
Round 3: repetition, 53 percent maximum-fill
Round 10: giveup, 33 percent maximum-fill
Round 10: giveup, 80 percent maximum-fill
Round 10: giveup, 63 percent maximum-fill
Round 10: giveup, 70 percent maximum-fill
Round 10: giveup, 84 percent maximum-fill
Round 7: repetition, 70 percent maximum-fill
Round 10: repetition, 57 percent maximum-fill
Round 10: giveup, 55 percent maximum-fill
Round 6: repetition, 36 percent maximum-fill
Round 4: repetition, 75 percent maximum-fill
Round 10: giveup, 72 percent maximum-fill
Round 10: giveup, 64 percent maximum-fill
Round 10: giveup, 84 percent maximum-fill
Round 10: giveup, 58 percent maximum-fill
Round 10: giveup, 60 percent maximum-fill
Round 10: giveup, 53 percent maximum-fill
Round 4: repetition, 40 percent maximum-fill
Round 4: empty, 40 percent maximum-fill
Round 10: giveup, 50 percent maximum-fill
Round 10: giveup, 68 percent maximum-fill