func out_of_bounds()

in shootout/meteor-contest.go [212:244]


func out_of_bounds(cell, dir int8) bool {
	switch dir {
	case E:
		return cell%5 == 4
	case ESE:
		i := cell % 10
		return i == 4 || i == 8 || i == 9 || cell >= 45
	case SE:
		return cell%10 == 9 || cell >= 45
	case S:
		return cell >= 40
	case SW:
		return cell%10 == 0 || cell >= 45
	case WSW:
		i := cell % 10
		return i == 0 || i == 1 || i == 5 || cell >= 45
	case W:
		return cell%5 == 0
	case WNW:
		i := cell % 10
		return i == 0 || i == 1 || i == 5 || cell < 5
	case NW:
		return cell%10 == 0 || cell < 5
	case N:
		return cell < 10
	case NE:
		return cell%10 == 9 || cell < 5
	case ENE:
		i := cell % 10
		return i == 4 || i == 8 || i == 9 || cell < 5
	}
	return false
}