Ich bin schon ein bischen weiter
Rechts-Oben -> X/Y+1
Links-Unten -> X/Y-1
Rechts -> X-1/Y
Links X+1/Y
Fehlt jetzt noch Rechts-Unten und Links-Oben.
Logischerweise müsste das so sein:
Rechts-Unten -> X-1/Y-1
Links-Oben -> X+1/Y+1
Da müsste jeweils eigentlich eine Diagonale als Ergebnis kommen. Stattdessen erhalte ich aber so einen Verlauf:
Immer:
Diagonal - Sprung - Diagonal - Sprung
Meine Methode sieht so aus:
|
Source code
|
1
2
3
4
5
6
7
8
9
10
11
12
13
|
(method (adjacent-field? field)
(cond ((and (= (- (send field x) 1) (x)) (= (send field y) (y))) #t)
((and (= (+ (send field x) 1) (x)) (= (send field y) (y))) #t)
((and (= (+ (send field y) 1) (y)) (= (send field x) (x))) #t)
((and (= (- (send field y) 1) (y)) (= (send field x) (x))) #t)
((and (= (- (send field x) 1) (x)) (= (- (send field y) 1) (y))) #t)
((and (= (+ (send field y) 1) (y)) (= (+ (send field x) 1) (x))) #t)
(else #f))
)
|
Ich weiss net was ich übersehen hab. Vielleicht kann ja jmd. mal in seine funtkionierende Methode gucken