Add tabletop components 486-500 and ten game icons
Fifteen pieces of a games night: Dice, DiceTray, PlayingCard, CardHand, Deck, Chessboard, GoBoard, MahjongTile, Domino, Roulette, CoinFlip, BingoCard, TicTacToe, ScoreTrack and Meeple. Component number 500 is a meeple, which seems right. Dice tumble, coins turn and wheels spin on a cue, a frame at a time, and land at once under Reduce Motion. Hands lift the card you point at and play the one drawn on top; pieces and stones pick the lighter of Lit and Ink for White, so they read in every palette; the computer plays a fair O; FREE is a star in every language. New 12x12 icons: Spade, Club, Diamond, Meeple, King, Queen, Rook, Bishop, Knight and Pawn.
This commit is contained in:
32 files changed
+2781
-1
No files matched your search
@@ -0,0 +1,57 @@
|
||||
package tabletop_test
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/egoist/mygo/ui"
|
||||
|
||||
"git.zacharyzhang.com/ZacharyZhang-NY/8bitMyGoUI/tabletop"
|
||||
)
|
||||
|
||||
func TestTossesTakeAClockStepBack(t *testing.T) {
|
||||
wd := newWorld()
|
||||
cue := 0
|
||||
tt := view(600, 400, wd, func(c *ui.Context) {
|
||||
tabletop.Dice(c, "Die", 4, tabletop.DiceOptions{Cue: cue})
|
||||
tabletop.CoinFlip(c, "Coin", true, tabletop.CoinFlipOptions{Cue: cue})
|
||||
tabletop.Roulette(c, "Wheel", []string{"A", "B", "C"}, 1, tabletop.RouletteOptions{Cue: cue})
|
||||
})
|
||||
cue = 1
|
||||
tt.Frame()
|
||||
later(tt, wd, -time.Second)
|
||||
later(tt, wd, 3*time.Second)
|
||||
find(t, tt, "HEADS")
|
||||
}
|
||||
|
||||
func TestTicTacToeReportsEachMove(t *testing.T) {
|
||||
played := []int{}
|
||||
log := logged(func() {
|
||||
tt := view(400, 400, newWorld(), func(c *ui.Context) {
|
||||
if r := tabletop.TicTacToe(c, "Grid", tabletop.TicTacToeOptions{}); r.Played >= 0 {
|
||||
played = append(played, r.Played)
|
||||
}
|
||||
})
|
||||
cell(t, tt, "Grid", 3, 22, 0)
|
||||
})
|
||||
if len(played) != 1 || played[0] != 0 || !strings.Contains(log, "tic-tac-toe move") {
|
||||
t.Fatalf("played %v; log:\n%s", played, log)
|
||||
}
|
||||
}
|
||||
|
||||
func TestTooWideNumbersPanic(t *testing.T) {
|
||||
for name, build := range map[string]func(c *ui.Context){
|
||||
"track": func(c *ui.Context) { tabletop.ScoreTrack(c, "S", []int{1}, tabletop.ScoreTrackOptions{Spaces: 1000}) },
|
||||
"bingo": func(c *ui.Context) {
|
||||
var n [25]int
|
||||
var m [25]bool
|
||||
for i := range n {
|
||||
n[i] = 1000 + i
|
||||
}
|
||||
tabletop.BingoCard(c, "B", n, &m, tabletop.BingoCardOptions{})
|
||||
},
|
||||
} {
|
||||
mustPanic(t, name, func() { view(600, 400, newWorld(), build) })
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user