mirror of
				https://github.com/lov3b/Schack.git
				synced 2025-11-04 07:00:21 +01:00 
			
		
		
		
	Snart snyggare validMoves
This commit is contained in:
		@@ -2,6 +2,7 @@ package schack;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import java.awt.Point;
 | 
					import java.awt.Point;
 | 
				
			||||||
import java.io.IOException;
 | 
					import java.io.IOException;
 | 
				
			||||||
 | 
					import static java.lang.Math.abs;
 | 
				
			||||||
import java.util.LinkedHashSet;
 | 
					import java.util.LinkedHashSet;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class Horse extends Piece {
 | 
					public class Horse extends Piece {
 | 
				
			||||||
@@ -15,6 +16,17 @@ public class Horse extends Piece {
 | 
				
			|||||||
    public LinkedHashSet<Point> validMoves(Piece[][] pieces, boolean isSelected) {
 | 
					    public LinkedHashSet<Point> validMoves(Piece[][] pieces, boolean isSelected) {
 | 
				
			||||||
        LinkedHashSet<Point> movable = new LinkedHashSet<>();
 | 
					        LinkedHashSet<Point> movable = new LinkedHashSet<>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // TODO: Integrera
 | 
				
			||||||
 | 
					        /*
 | 
				
			||||||
 | 
					        for (int dx : new int[]{-2, -1, 1, 2}) {
 | 
				
			||||||
 | 
					            for (int y = -1; y <= 1; y += 2) {
 | 
				
			||||||
 | 
					                int dy = y * (3 - abs(dx));
 | 
				
			||||||
 | 
					                
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        */
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
        // Postitioner att checka
 | 
					        // Postitioner att checka
 | 
				
			||||||
        Point[] positions = {
 | 
					        Point[] positions = {
 | 
				
			||||||
            // Snett höger uppåt
 | 
					            // Snett höger uppåt
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user