
import java.util.*;


enum CharacterType {ELF, ROBOT, KNIGHT}

class Character {
	private String name;
	private int health = 100;
	private CharacterType type;


	public void attack(Character victim) {
		if (0 < health && 0 < victim.getHealth()) {
			if (this.type == CharacterType.ELF) {
				elfAttack(victim);
			} else if (this.type == CharacterType.KNIGHT) {
				knightAttack(victim);
			} else if (this.type == CharacterType.ROBOT) {
				robotAttack(victim);
			} else {
				System.err.println("Unrecognized type of chartacter");
				System.exit(1);
			}
		}
	}

	private void elfAttack(Character victim) {
		System.out.println("An elf is shooting an arrow at his victim");
		int blow = (int) (Math.random() * 10);
		victim.decHealth(blow);
		this.decHealth(5);
	}

	private void robotAttack(Character victim) {
		System.out.println("A robot is crushing his victim");
		int blow = (int) (Math.random() * Math.random() * 100);
		victim.decHealth(blow);
	}

	private void knightAttack(Character victim) {
		System.out.println("An knight is stabbing his victim");
		int blow = (int) (Math.random() * health);
		victim.decHealth(blow);
		this.decHealth((int)(Math.random() * blow));
	}

}

