BreakStaticFieldsWolf
This wolf tries to outsmart the other fancy wolves by destructively modifying any static fields that it comes across. The breakEverything method is called whenever the wolf moves. It first gets the value of Wild.classes, casts it to a Class[] array, and then iterates over it. In each class, it iterates over all fields, clearing and adding null to any Collection it finds. Failing that, it will write an appropriate random value to a field of any native type, or null to an object field.
Apart from this tactic it's quite basic. It simply stands still, and chooses the 'best' option when fighting.
I haven't tested this much yet, it should cause several Wolves to throw NullPointerExceptions and suicide though.
package animals; import java.lang.reflect.Field; import java.util.ArrayList; import java.util.Collection; import java.util.Random; import wild.Wild; public class BreakStaticFieldsWolf extends Animal { private Random random = new Random(); public BreakStaticFieldsWolf() { super('W'); } void breakEverything() { try { Field wildClasses = Wild.class.getDeclaredField("classes"); wildClasses.setAccessible(true); Class[] classes = (Class[]) wildClasses.get(null); for(Class clazz : classes) { Field[] fields = clazz.getDeclaredFields(); for(Field field : fields) { try { field.setAccessible(true); Class type = field.getType(); Object obj = field.get(null); if(obj instanceof Collection) { ((Collection) obj).clear(); ((Collection) obj).add(null); // teehee } if(type == long.class) field.setLong(null, random.nextLong()); else if(type == int.class) field.setInt(null, random.nextInt()); else if(type == short.class) field.setShort(null, (short) random.nextInt()); else if(type == char.class) field.setChar(null, (char) random.nextInt()); else if(type == byte.class) field.setByte(null, (byte) random.nextInt()); else if(type == boolean.class) field.setBoolean(null, random.nextBoolean()); else if(type == double.class) field.setDouble(null, random.nextDouble()); else if(type == float.class) field.setFloat(null, random.nextFloat()); else field.set(null, type.newInstance()); } catch (Exception e) { } } } } catch (Exception e) { } } @Override public Attack fight(char c) { switch(c) { case 'L': case 'B': return Attack.SCISSORS; case 'S': return Attack.PAPER; case 'W': default: Attack[] attacks = {Attack.PAPER, Attack.ROCK, Attack.SCISSORS}; return attacks[random.nextInt(3)]; } } @Override public Move move() { breakEverything(); return Move.HOLD; } }