Search

Tuesday, December 4, 2012

Day 117: Readers always are right

On my day 99 post, a reader, Steve, pointed at something that is right. I am using a lot up, down, left and right, so, it is better to create methods for that. I will create them in board class.

public int up(int move){ int play; play=this.getMove(move-this.getBoardSize()+1); return play; } public int down(int move){ int play; play=this.getMove(move+this.getBoardSize()+1); return play; } public int left(int move){ int play; play=this.getMove(move-1); return play; } public int right(int move){ int play; play=this.getMove(move+1); return play; }

No comments:

Post a Comment