Compare commits
	
		
			1 Commits
		
	
	
		
			284c2b923a
			...
			cb2b6087b7
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| cb2b6087b7 | 
@ -75,19 +75,19 @@ func (m *Path) readLine(text string) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
func (m *Path) buildPath() int {
 | 
					func (m *Path) buildPath() int {
 | 
				
			||||||
	m.start()
 | 
						m.start()
 | 
				
			||||||
	log(m.n)
 | 
						// log(m.n)
 | 
				
			||||||
	i := 0
 | 
						i := 0
 | 
				
			||||||
	for m.next() {
 | 
						for m.next() {
 | 
				
			||||||
		log(m.n)
 | 
							// log(m.n)
 | 
				
			||||||
		i++
 | 
							i++
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	log(m.n)
 | 
						// log(m.n)
 | 
				
			||||||
	log("length", (m.l+2)/2)
 | 
						// log("length", (m.l+2)/2)
 | 
				
			||||||
	return (m.l+2)/2
 | 
						return (m.l+2)/2
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
func (m *Path) start() {
 | 
					func (m *Path) start() {
 | 
				
			||||||
	m.n = &node{value: 'S', pos: m.s}
 | 
						m.n = &node{value: 'S', pos: m.s}
 | 
				
			||||||
	log(m.n)
 | 
						// log(m.n)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	switch {
 | 
						switch {
 | 
				
			||||||
	case m.peek(UP) != nil:
 | 
						case m.peek(UP) != nil:
 | 
				
			||||||
 | 
				
			|||||||
@ -34,11 +34,8 @@ func TestExample1(t *testing.T) {
 | 
				
			|||||||
	result, err := run(scan)
 | 
						result, err := run(scan)
 | 
				
			||||||
	is.NoErr(err)
 | 
						is.NoErr(err)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	t.Log(result.valuePT1)
 | 
						// t.Log(result.valuePT1)
 | 
				
			||||||
	is.Equal(result.valuePT1, 4)
 | 
						is.Equal(result.valuePT1, 4)
 | 
				
			||||||
 | 
					 | 
				
			||||||
	t.Log(result.valuePT2)
 | 
					 | 
				
			||||||
	is.Equal(result.valuePT2, uint64(0))
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func TestExample2(t *testing.T) {
 | 
					func TestExample2(t *testing.T) {
 | 
				
			||||||
@ -48,11 +45,8 @@ func TestExample2(t *testing.T) {
 | 
				
			|||||||
	result, err := run(scan)
 | 
						result, err := run(scan)
 | 
				
			||||||
	is.NoErr(err)
 | 
						is.NoErr(err)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	t.Log(result.valuePT1)
 | 
						// t.Log(result.valuePT1)
 | 
				
			||||||
	is.Equal(result.valuePT1, 8)
 | 
						is.Equal(result.valuePT1, 8)
 | 
				
			||||||
 | 
					 | 
				
			||||||
	t.Log(result.valuePT2)
 | 
					 | 
				
			||||||
	is.Equal(result.valuePT2, uint64(0))
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func TestExample3(t *testing.T) {
 | 
					func TestExample3(t *testing.T) {
 | 
				
			||||||
@ -62,10 +56,10 @@ func TestExample3(t *testing.T) {
 | 
				
			|||||||
	result, err := run(scan)
 | 
						result, err := run(scan)
 | 
				
			||||||
	is.NoErr(err)
 | 
						is.NoErr(err)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	t.Log(result.valuePT1)
 | 
						// t.Log(result.valuePT1)
 | 
				
			||||||
	is.Equal(result.valuePT1, 23)
 | 
						is.Equal(result.valuePT1, 23)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	t.Log(result.valuePT2)
 | 
						// t.Log(result.valuePT2)
 | 
				
			||||||
	is.Equal(result.valuePT2, 4)
 | 
						is.Equal(result.valuePT2, 4)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -76,10 +70,10 @@ func TestExample4(t *testing.T) {
 | 
				
			|||||||
	result, err := run(scan)
 | 
						result, err := run(scan)
 | 
				
			||||||
	is.NoErr(err)
 | 
						is.NoErr(err)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	t.Log(result.valuePT1)
 | 
						// t.Log(result.valuePT1)
 | 
				
			||||||
	is.Equal(result.valuePT1, 70)
 | 
						is.Equal(result.valuePT1, 70)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	t.Log(result.valuePT2)
 | 
						// t.Log(result.valuePT2)
 | 
				
			||||||
	is.Equal(result.valuePT2, 8)
 | 
						is.Equal(result.valuePT2, 8)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -90,10 +84,10 @@ func TestExample5(t *testing.T) {
 | 
				
			|||||||
	result, err := run(scan)
 | 
						result, err := run(scan)
 | 
				
			||||||
	is.NoErr(err)
 | 
						is.NoErr(err)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	t.Log(result.valuePT1)
 | 
						// t.Log(result.valuePT1)
 | 
				
			||||||
	is.Equal(result.valuePT1, 80)
 | 
						is.Equal(result.valuePT1, 80)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	t.Log(result.valuePT2)
 | 
						// t.Log(result.valuePT2)
 | 
				
			||||||
	is.Equal(result.valuePT2, 10)
 | 
						is.Equal(result.valuePT2, 10)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -104,12 +98,12 @@ func TestInput(t *testing.T) {
 | 
				
			|||||||
	result, err := run(scan)
 | 
						result, err := run(scan)
 | 
				
			||||||
	is.NoErr(err)
 | 
						is.NoErr(err)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	t.Log(result.valuePT1)
 | 
						// t.Log(result.valuePT1)
 | 
				
			||||||
	t.Log(result.valuePT1 != 51)
 | 
						is.True(result.valuePT1 != 51)
 | 
				
			||||||
	is.Equal(result.valuePT1, 6649)
 | 
						is.Equal(result.valuePT1, 6649)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	t.Log(result.valuePT2)
 | 
						// t.Log(result.valuePT2)
 | 
				
			||||||
	is.Equal(result.valuePT2, uint64(0))
 | 
						is.True(result.valuePT2 != 0)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// first: 51 false
 | 
					// first: 51 false
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user