Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public boolean hasConnectionTo(Orientation neighbor){
- Orientation counter = neighbor.findCounterpart();
- switch(this.tileType){
- case DEAD_END:
- for(int i = 0; i < orientation.length; i++){
- if(orientation[i] == counter){
- return true;
- }
- }
- return false;
- case BEND:
- switch(orientation[0]){
- case RIGHT:
- if(counter == Orientation.RIGHT || counter == Orientation.DOWN){
- return true;
- }else
- return false;
- case DOWN:
- if(counter == Orientation.LEFT || counter == Orientation.DOWN){
- return true;
- }else
- return false;
- case UP:
- if(counter == Orientation.RIGHT || counter == Orientation.UP){
- return true;
- }else
- return false;
- default:
- if(counter == Orientation.LEFT || counter == Orientation.UP){
- return true;
- }else
- return false;
- }
- case TEE:
- switch(orientation[0]){
- case RIGHT:
- if(counter != Orientation.UP) return true;
- else return false;
- case UP:
- if(counter != Orientation.LEFT) return true;
- else return false;
- case LEFT:
- if(counter != Orientation.DOWN) return true;
- else return false;
- default:
- if(counter != Orientation.RIGHT) return true;
- else return false;
- }
- case STRAIGHT:
- for(int i = 0; i < orientation.length; i++){
- if(orientation[i] == counter){
- return true;
- }
- }
- return false;
- case CROSS:
- return true;
- default:
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement