This commit is contained in:
		
							parent
							
								
									a36d0efd4b
								
							
						
					
					
						commit
						6a42539f09
					
				@ -17,6 +17,9 @@ val xMasSearchOffsets = listOf(
 | 
			
		||||
var ycoordinates = mutableListOf<List<String>>()
 | 
			
		||||
while (scanner.hasNextLine()) {
 | 
			
		||||
    val line = scanner.nextLine()
 | 
			
		||||
    if (line.isEmpty()) {
 | 
			
		||||
        continue
 | 
			
		||||
    }
 | 
			
		||||
    val xcoordinates = line.split("").filter { it.isNotEmpty() }
 | 
			
		||||
    ycoordinates.add(xcoordinates)
 | 
			
		||||
}
 | 
			
		||||
@ -34,12 +37,10 @@ for (y in ycoordinates.indices) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
fun findXmas(y: Int, x: Int): Int {
 | 
			
		||||
    println("x: $x, y: $y")
 | 
			
		||||
    var xmasfound = 0
 | 
			
		||||
    for (searchOffset in xMasSearchOffsets) {
 | 
			
		||||
        val last = searchOffset.last()
 | 
			
		||||
        if ((y+last.first) !in ycoordinates.indices || (x+last.second) !in ycoordinates[y].indices){
 | 
			
		||||
            if (x == 1 && y == 139) println("skipping x: (${x+last.second}, y: ${y+last.first})")
 | 
			
		||||
            continue
 | 
			
		||||
        }
 | 
			
		||||
        var match = true
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										3807
									
								
								day04.kts.testvalue
									
									
									
									
									
								
							
							
						
						
									
										3807
									
								
								day04.kts.testvalue
									
									
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user