carddeck

package module
v0.0.0-...-685d9bd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 22, 2015 License: Apache-2.0 Imports: 4 Imported by: 0

README

carddeck

playing card modeling for golang

Documentation

Overview

Copyright 2015 SeukWon Kang (kasworld@gmail.com) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2015 SeukWon Kang (kasworld@gmail.com) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2015 SeukWon Kang (kasworld@gmail.com) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2015 SeukWon Kang (kasworld@gmail.com) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2015 SeukWon Kang (kasworld@gmail.com) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

View Source
var Deck13x4 = NewDeckType(
	[]string{"♠", "♡", "♢", "♣"},
	[]string{"A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K"},
	nil,
)
View Source
var Deck13x4j1 = NewDeckType(
	[]string{"♠", "♡", "♢", "♣"},
	[]string{"A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K"},
	[]string{"☻"},
)
View Source
var Deck13x4j2 = NewDeckType(
	[]string{"♠", "♡", "♢", "♣"},
	[]string{"A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K"},
	[]string{"☻", "☺"},
)
View Source
var DeckRWTarot = NewDeckType(
	[]string{"Sword", "Cup", "Wand", "Pentacle"},
	[]string{"Ace", "2", "3", "4", "5", "6", "7", "8", "9", "10", "Page", "Knight", "Queen", "King"},
	[]string{"0–The Fool",
		"I–The Magician",
		"II–The High Priestess",
		"III–The Empress",
		"IV–The Emperor",
		"V–The Hierophant",
		"VI–The Lovers",
		"VII–The Chariot",
		"VIII–Strength",
		"IX–The Hermit",
		"X–Wheel of Fortune",
		"XI–Justice",
		"XII–The Hanged Man",
		"XIII–Death",
		"XIV–Temperance",
		"XV–The Devil",
		"XVI–The Tower",
		"XVII–The Star",
		"XVIII–The Moon",
		"XIX–The Sun",
		"XX–Judgement",
		"XXI–The World"},
)

Functions

This section is empty.

Types

type By

type By func(p1, p2 *Card) bool

func (By) Sort

func (by By) Sort(cards CardList)

type Card

type Card struct {
	// contains filtered or unexported fields
}

func (Card) IsJoker

func (c Card) IsJoker() bool

func (Card) Num

func (c Card) Num() int

func (Card) String

func (c Card) String() string

func (Card) Suit

func (c Card) Suit() int

type CardList

type CardList []*Card

func NewCardList

func NewCardList(dt *DeckType) CardList

func (CardList) Add

func (s CardList) Add(cs CardList) CardList

func (*CardList) Append

func (s *CardList) Append(c *Card)

func (*CardList) DrawByPos

func (s *CardList) DrawByPos(i int) *Card

func (CardList) FindIndex

func (s CardList) FindIndex(v int) int

func (CardList) Shuffle

func (s CardList) Shuffle(rnd *rand.Rand)

func (CardList) SortNum

func (s CardList) SortNum()

func (CardList) SortSuit

func (s CardList) SortSuit()

type CardStack

type CardStack struct {
	// contains filtered or unexported fields
}

func NewCardStack

func NewCardStack() *CardStack

func NewShuffledSingleCardStack

func NewShuffledSingleCardStack(dt *DeckType) *CardStack

func (*CardStack) AppendCards

func (cs *CardStack) AppendCards(ncs CardList)

func (*CardStack) DrawCard

func (cs *CardStack) DrawCard() *Card

func (*CardStack) Empty

func (cs *CardStack) Empty() bool

func (*CardStack) Rewind

func (cs *CardStack) Rewind()

func (*CardStack) Shuffle

func (cs *CardStack) Shuffle()

func (CardStack) String

func (cs CardStack) String() string

type DeckType

type DeckType struct {
	// contains filtered or unexported fields
}

func NewDeckType

func NewDeckType(s, n, j []string) *DeckType

func (*DeckType) IsJoker

func (dt *DeckType) IsJoker(v int) bool

func (*DeckType) Num

func (dt *DeckType) Num(v int) int

func (*DeckType) Suit

func (dt *DeckType) Suit(v int) int

func (*DeckType) ToStr

func (dt *DeckType) ToStr(v int) string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL