Beispiel #1
0
//places the black pieces on the board
func (self *Board) placeBlackPieces() {
	for i := size - 1; i > (len(self.Places) / 2); i-- {
		for j := 0; j < size; j++ {
			if i%2 == 0 { // if row is pair
				if j%2 != 0 { // place on odd columns
					self.Places[j][i] = piece.NewPiece(BLACK)
				}
			} else {
				if j%2 == 0 { // place on even columns
					self.Places[j][i] = piece.NewPiece(BLACK)
				}
			}
		}

	}
}
Beispiel #2
0
// Places the red pieces on the board
func (self *Board) placeRedPieces() {
	for i := 0; i < len(self.Places); i++ {
		for j := 0; j < (size/2)-1; j++ {
			if i%2 == 0 { // if row is pair
				if j%2 != 0 { // place on odd columns
					self.Places[i][j] = piece.NewPiece(RED)
				}
			} else {
				if j%2 == 0 { // place on even columns
					self.Places[i][j] = piece.NewPiece(RED)
				}
			}
		}

	}
}