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