Lines of Action implementation in Java