Commit bcbb2f93 authored by Russ Cox's avatar Russ Cox

test/bench: move to test/bench/shootout

R=golang-dev, r, gri, bradfitz
CC=golang-dev
https://golang.org/cl/5487067
parent b1175beb
...@@ -101,7 +101,7 @@ do ...@@ -101,7 +101,7 @@ do
done done
[ "$GOARCH" == arm ] || [ "$GOARCH" == arm ] ||
(xcd ../test/bench (xcd ../test/bench/shootout
./timing.sh -test ./timing.sh -test
) || exit $? ) || exit $?
......
...@@ -178,7 +178,6 @@ func main() { ...@@ -178,7 +178,6 @@ func main() {
Random(homosapiens, 5**n) Random(homosapiens, 5**n)
} }
type buffer []byte type buffer []byte
func (b *buffer) Flush() { func (b *buffer) Flush() {
......
...@@ -43,7 +43,6 @@ import ( ...@@ -43,7 +43,6 @@ import (
var max_solutions = flag.Int("n", 2100, "maximum number of solutions") var max_solutions = flag.Int("n", 2100, "maximum number of solutions")
func boolInt(b bool) int8 { func boolInt(b bool) int8 {
if b { if b {
return 1 return 1
...@@ -115,7 +114,6 @@ var piece_def = [10][4]int8{ ...@@ -115,7 +114,6 @@ var piece_def = [10][4]int8{
[4]int8{E, E, E, SW}, [4]int8{E, E, E, SW},
} }
/* To minimize the amount of work done in the recursive solve function below, /* To minimize the amount of work done in the recursive solve function below,
* I'm going to allocate enough space for all legal rotations of each piece * I'm going to allocate enough space for all legal rotations of each piece
* at each position on the board. That's 10 pieces x 50 board positions x * at each position on the board. That's 10 pieces x 50 board positions x
...@@ -138,7 +136,6 @@ func rotate(dir int8) int8 { return (dir + 2) % PIVOT } ...@@ -138,7 +136,6 @@ func rotate(dir int8) int8 { return (dir + 2) % PIVOT }
/* Returns the direction flipped on the horizontal axis */ /* Returns the direction flipped on the horizontal axis */
func flip(dir int8) int8 { return (PIVOT - dir) % PIVOT } func flip(dir int8) int8 { return (PIVOT - dir) % PIVOT }
/* Returns the new cell index from the specified cell in the /* Returns the new cell index from the specified cell in the
* specified direction. The index is only valid if the * specified direction. The index is only valid if the
* starting cell and direction have been checked by the * starting cell and direction have been checked by the
...@@ -322,7 +319,6 @@ func record_piece(piece int, minimum int8, first_empty int8, piece_mask uint64) ...@@ -322,7 +319,6 @@ func record_piece(piece int, minimum int8, first_empty int8, piece_mask uint64)
piece_counts[piece][minimum]++ piece_counts[piece][minimum]++
} }
/* Fill the entire board going cell by cell. If any cells are "trapped" /* Fill the entire board going cell by cell. If any cells are "trapped"
* they will be left alone. * they will be left alone.
*/ */
...@@ -351,7 +347,6 @@ func fill_contiguous_space(board []int8, index int8) { ...@@ -351,7 +347,6 @@ func fill_contiguous_space(board []int8, index int8) {
} }
} }
/* To thin the number of pieces, I calculate if any of them trap any empty /* To thin the number of pieces, I calculate if any of them trap any empty
* cells at the edges. There are only a handful of exceptions where the * cells at the edges. There are only a handful of exceptions where the
* the board can be solved with the trapped cells. For example: piece 8 can * the board can be solved with the trapped cells. For example: piece 8 can
...@@ -382,7 +377,6 @@ func has_island(cell []int8, piece int) bool { ...@@ -382,7 +377,6 @@ func has_island(cell []int8, piece int) bool {
return true return true
} }
/* Calculate all six rotations of the specified piece at the specified index. /* Calculate all six rotations of the specified piece at the specified index.
* We calculate only half of piece 3's rotations. This is because any solution * We calculate only half of piece 3's rotations. This is because any solution
* found has an identical solution rotated 180 degrees. Thus we can reduce the * found has an identical solution rotated 180 degrees. Thus we can reduce the
...@@ -417,7 +411,6 @@ func calc_pieces() { ...@@ -417,7 +411,6 @@ func calc_pieces() {
} }
} }
/* Calculate all 32 possible states for a 5-bit row and all rows that will /* Calculate all 32 possible states for a 5-bit row and all rows that will
* create islands that follow any of the 32 possible rows. These pre- * create islands that follow any of the 32 possible rows. These pre-
* calculated 5-bit rows will be used to find islands in a partially solved * calculated 5-bit rows will be used to find islands in a partially solved
...@@ -530,7 +523,6 @@ func calc_rows() { ...@@ -530,7 +523,6 @@ func calc_rows() {
} }
} }
/* Calculate islands while solving the board. /* Calculate islands while solving the board.
*/ */
func boardHasIslands(cell int8) int8 { func boardHasIslands(cell int8) int8 {
...@@ -545,7 +537,6 @@ func boardHasIslands(cell int8) int8 { ...@@ -545,7 +537,6 @@ func boardHasIslands(cell int8) int8 {
return bad_even_triple[current_triple] return bad_even_triple[current_triple]
} }
/* The recursive solve algorithm. Try to place each permutation in the upper- /* The recursive solve algorithm. Try to place each permutation in the upper-
* leftmost empty cell. Mark off available pieces as it goes along. * leftmost empty cell. Mark off available pieces as it goes along.
* Because the board is a bit mask, the piece number and bit mask must be saved * Because the board is a bit mask, the piece number and bit mask must be saved
......
...@@ -39,8 +39,8 @@ import ( ...@@ -39,8 +39,8 @@ import (
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"os" "os"
"runtime"
"regexp" "regexp"
"runtime"
) )
var variants = []string{ var variants = []string{
......
...@@ -52,7 +52,7 @@ func f(i int, in <-chan int, out chan<- int) { ...@@ -52,7 +52,7 @@ func f(i int, in <-chan int, out chan<- int) {
fmt.Printf("%d\n", i) fmt.Printf("%d\n", i)
os.Exit(0) os.Exit(0)
} }
out <- n-1 out <- n - 1
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment