a geicko-2 based round robin ranking system designed to test c++ battleship submissions battleship.dunkirk.sh
at main 661 B view raw
1package terminfo 2 3type stack []interface{} 4 5func (s *stack) push(v interface{}) { 6 *s = append(*s, v) 7} 8 9func (s *stack) pop() interface{} { 10 if len(*s) == 0 { 11 return nil 12 } 13 v := (*s)[len(*s)-1] 14 *s = (*s)[:len(*s)-1] 15 return v 16} 17 18func (s *stack) popInt() int { 19 if i, ok := s.pop().(int); ok { 20 return i 21 } 22 return 0 23} 24 25func (s *stack) popBool() bool { 26 if b, ok := s.pop().(bool); ok { 27 return b 28 } 29 return false 30} 31 32func (s *stack) popByte() byte { 33 if b, ok := s.pop().(byte); ok { 34 return b 35 } 36 return 0 37} 38 39func (s *stack) popString() string { 40 if a, ok := s.pop().(string); ok { 41 return a 42 } 43 return "" 44} 45 46func (s *stack) reset() { 47 *s = (*s)[:0] 48}