algorithm

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

功能:组合 说明:

功能: 说明:

功能:查找 说明:

功能:随机 说明:

功能:删除 说明:

功能:排序 说明:

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Combo_card_type

func Combo_card_type(hole_cards []byte, target_hole_cnt int, board_cards []byte, target_board_cnt int) []common.CardCtrl

Combo_card_type 按所需张数进行组合,返回组合牌型的列表 hole_cards:手里的牌 target_hole_cnt:需要手里的牌的张数 board_cards:公共牌 target_board_cnt:需要公共牌的张数

func Combo_cards

func Combo_cards(all_cards []byte, target_cnt int) []common.CardCtrl

Combo_cards 组合牌

func Combo_cnt

func Combo_cnt(n int, k int) int64

Combo_cnt 组合数,数学方法计算组合数(从n中取k个数),组合没有顺序 C(n,k) = n!/((n-k)!*k!)

func Factorial

func Factorial(n int) *big.Int

Factorial 阶乘 5!=5*4*3*2*1

func Find_cnt

func Find_cnt[T byte | int](all []T, element T) int

Find_cnt 查找个数

func Find_suit_cnt

func Find_suit_cnt(cards []byte, suit byte, Suit SuitFunc) int

Find_suit_cnt 查找花色个数

func Find_value_cnt

func Find_value_cnt(cards []byte, value byte, Value ValueFunc) int

Find_value_cnt 查找牌值个数

func Permutation_cnt

func Permutation_cnt(n int, k int) int64

Permutation_cnt 排列数,数学方法计算排列数(从n中取k个数),排列有顺序 P(n,k) = n!/(n-k)!

func Raw_cards

func Raw_cards(decks int) []byte

Raw_cards 得到牌

func Remove

func Remove[T byte | int](all []T, target_element T) (removed_cnt int, results []T)

Remove 删除

func Remove_duplication

func Remove_duplication[T byte | int](all []T) []T

去重

func Remove_value

func Remove_value(all []byte, target_value byte, Value ValueFunc) (removed_cnt int, result_cards []byte)

删除牌值

func Remove_values

func Remove_values(all []byte, target_values []byte, Value ValueFunc) (removed_cnt int, result_cards []byte)

func Removes

func Removes[T byte | int](all []T, target_elements []T) (removed_cnt int, results []T)

Removes 删除

func Shuffle_cards

func Shuffle_cards(decks int) []byte

Shuffle_cards 随机洗牌

func Shuffle_cards_ex

func Shuffle_cards_ex(cards []byte) []byte

func Sort_by_suit

func Sort_by_suit(cards []byte, Suit SuitFunc, Value ValueFunc, order_types ...ORDER_TYPE.TYPE) []byte

Sort_by_suit 按花色排序,默认升序

func Sort_by_suit_cnt

func Sort_by_suit_cnt(cards []byte, Suit SuitFunc, Value ValueFunc, order_types ...ORDER_TYPE.TYPE) []byte

Sort_by_suit_cnt 按花色个数排序,默认升序

func Sort_by_value

func Sort_by_value(cards []byte, Suit SuitFunc, Value ValueFunc, order_types ...ORDER_TYPE.TYPE) []byte

Sort_by_value 按值大小排序,默认升序

func Sort_by_value_cnt

func Sort_by_value_cnt(cards []byte, Suit SuitFunc, Value ValueFunc, order_types ...ORDER_TYPE.TYPE) []byte

Sort_by_value_cnt 按值个数排序,默认升序

Types

type SuitFunc

type SuitFunc func(byte) byte

type ValueFunc

type ValueFunc func(byte) byte

Jump to

Keyboard shortcuts

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