|  | @@ -61,16 +61,14 @@ func indexOf(value int, sequence []int) int {
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  func part1(sequence []int, min, max int) {
 |  |  func part1(sequence []int, min, max int) {
 | 
											
												
													
														|  |  	index := 0
 |  |  	index := 0
 | 
											
												
													
														|  | 
 |  | +	size := len(sequence)
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  	for i := 0; i < 10; i++ {
 |  |  	for i := 0; i < 10; i++ {
 | 
											
												
													
														|  |  		pickup := sequence[index+1 : index+4]
 |  |  		pickup := sequence[index+1 : index+4]
 | 
											
												
													
														|  | -		var partialSequence []int
 |  | 
 | 
											
												
													
														|  | -		for j, item := range sequence {
 |  | 
 | 
											
												
													
														|  | 
 |  | +		for j, _ := range sequence {
 | 
											
												
													
														|  |  			if j > index && j < index+4 {
 |  |  			if j > index && j < index+4 {
 | 
											
												
													
														|  | -				continue
 |  | 
 | 
											
												
													
														|  | 
 |  | +				sequence[j] = 0
 | 
											
												
													
														|  |  			}
 |  |  			}
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | -			partialSequence = append(partialSequence, item)
 |  | 
 | 
											
												
													
														|  |  		}
 |  |  		}
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  		destination := sequence[index] - 1
 |  |  		destination := sequence[index] - 1
 | 
											
										
											
												
													
														|  | @@ -82,27 +80,52 @@ func part1(sequence []int, min, max int) {
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  			destination--
 |  |  			destination--
 | 
											
												
													
														|  |  			if destination < min {
 |  |  			if destination < min {
 | 
											
												
													
														|  | -				_, newDestination := minMax(partialSequence)
 |  | 
 | 
											
												
													
														|  | 
 |  | +				_, newDestination := minMax(sequence)
 | 
											
												
													
														|  |  				destination = newDestination
 |  |  				destination = newDestination
 | 
											
												
													
														|  |  				break
 |  |  				break
 | 
											
												
													
														|  |  			}
 |  |  			}
 | 
											
												
													
														|  |  		}
 |  |  		}
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +		fmt.Println(sequence)
 | 
											
												
													
														|  |  		fmt.Println(destination)
 |  |  		fmt.Println(destination)
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +		partialSequence := make([]int, size)
 | 
											
												
													
														|  | 
 |  | +		i := index + 1
 | 
											
												
													
														|  | 
 |  | +		for {
 | 
											
												
													
														|  | 
 |  | +			partialSequence[i] = sequence[i]
 | 
											
												
													
														|  | 
 |  | +			if i == index {
 | 
											
												
													
														|  | 
 |  | +				i++
 | 
											
												
													
														|  | 
 |  | +				break
 | 
											
												
													
														|  | 
 |  | +			}
 | 
											
												
													
														|  | 
 |  | +			i++
 | 
											
												
													
														|  | 
 |  | +			if i > size-1 {
 | 
											
												
													
														|  | 
 |  | +				i = 0
 | 
											
												
													
														|  | 
 |  | +			}
 | 
											
												
													
														|  | 
 |  | +		}
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |  		destinationIndex := indexOf(destination, partialSequence)
 |  |  		destinationIndex := indexOf(destination, partialSequence)
 | 
											
												
													
														|  |  		if destinationIndex < 0 {
 |  |  		if destinationIndex < 0 {
 | 
											
												
													
														|  |  			log.Fatalf("Wrong destinationIndex: %d", destinationIndex)
 |  |  			log.Fatalf("Wrong destinationIndex: %d", destinationIndex)
 | 
											
												
													
														|  |  		}
 |  |  		}
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -		var newSequence []int
 |  | 
 | 
											
												
													
														|  | -		for j, item := range partialSequence {
 |  | 
 | 
											
												
													
														|  | -			newSequence = append(newSequence, item)
 |  | 
 | 
											
												
													
														|  | 
 |  | +		newSequence := make([]int, size)
 | 
											
												
													
														|  | 
 |  | +		i = destinationIndex
 | 
											
												
													
														|  | 
 |  | +		for j := destinationIndex; ; j++ {
 | 
											
												
													
														|  | 
 |  | +			newSequence[j] = partialSequence[i]
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  			if j == destinationIndex {
 |  |  			if j == destinationIndex {
 | 
											
												
													
														|  | 
 |  | +				j++
 | 
											
												
													
														|  |  				for _, cup := range pickup {
 |  |  				for _, cup := range pickup {
 | 
											
												
													
														|  | -					newSequence = append(newSequence, cup)
 |  | 
 | 
											
												
													
														|  | 
 |  | +					newSequence[j] = cup
 | 
											
												
													
														|  | 
 |  | +					j++
 | 
											
												
													
														|  |  				}
 |  |  				}
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +				i++
 | 
											
												
													
														|  | 
 |  | +				continue
 | 
											
												
													
														|  |  			}
 |  |  			}
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +			j++
 | 
											
												
													
														|  | 
 |  | +			i++
 | 
											
												
													
														|  |  		}
 |  |  		}
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  		sequence = newSequence
 |  |  		sequence = newSequence
 | 
											
										
											
												
													
														|  | @@ -110,7 +133,6 @@ func part1(sequence []int, min, max int) {
 | 
											
												
													
														|  |  		if index < 0 {
 |  |  		if index < 0 {
 | 
											
												
													
														|  |  			index = 0
 |  |  			index = 0
 | 
											
												
													
														|  |  		}
 |  |  		}
 | 
											
												
													
														|  | -		fmt.Println(sequence)
 |  | 
 | 
											
												
													
														|  |  	}
 |  |  	}
 | 
											
												
													
														|  |  }
 |  |  }
 | 
											
												
													
														|  |  
 |  |  
 |