!752 !include #1003165 // GenOpt static final int numbers = 2; // how many numbers to sort static bool useCheat = false; p { typeWriterConsole(); steps = numbers*numbers*10; // execution steps limit go(); } static int getScore(Grid g, int[] data) { int[] sorted = sortedArray(data); int errors = 0; for (int i = 0; i < numbers; i++) //if (g.get(i) > g.get(i+1)) if (g.get(i) != sorted[i]) ++errors; ret errors; } // makeData static int[] makeData() { int[] data = new int[numbers]; for (int i = 0; i < numbers; i++) data[i] = random(100); ret data; } //// CONTESTANTS //// static O bubblesort_bot; sclass Bubblesort implements Make { public S getLua() { if (bubblesort_bot == null) bubblesort_bot = hotwire(numbers == 2 ? "#1003167" : "#1003158"); ret (S) call(bubblesort_bot, "makeLua"); } } static class Cheat implements Make { public S getLua() { ret [[ for i = 0, 10-1 do for j = i, 10-1 do if get(j) < get(i) then swap(i, j) end end end ]]; } } // updatePool static void updatePool() { pool.clear(); pool.add(new Bubblesort); if (useCheat) pool.add(new Cheat); }