-
Notifications
You must be signed in to change notification settings - Fork 0
/
gameTileStack.go
53 lines (38 loc) · 978 Bytes
/
gameTileStack.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package main
type GameTileStack struct {
list TileList
}
func NewEmptyGameTileStack() *GameTileStack {
result := new(GameTileStack)
return result
}
func NewGameTileStack(list TileList) *GameTileStack {
result := new(GameTileStack)
result.list = list
return result
}
func (receiver GameTileStack) GetTileList() TileList {
return receiver.list
}
func (receiver *GameTileStack) Shuffle() {
result := receiver.list.Shuffle()
receiver.list = result
}
func (receiver *GameTileStack) GetFromHead(n int) TileList {
result, list := receiver.list.GetFromHead(n)
receiver.list = list
return result
}
func (receiver *GameTileStack) GetOneFromHead() Tile {
result := receiver.GetFromHead(1)
return result[0]
}
func (receiver *GameTileStack) GetFromEnd(n int) TileList {
result, list := receiver.list.GetFromEnd(n)
receiver.list = list
return result
}
func (receiver *GameTileStack) GetOneFromEnd() Tile {
result := receiver.GetFromEnd(1)
return result[0]
}