-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHumanPlayer.go
More file actions
38 lines (32 loc) · 868 Bytes
/
HumanPlayer.go
File metadata and controls
38 lines (32 loc) · 868 Bytes
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
/* HumanPlayer.go contains a substuct of player which allows people to play
/
/ Author: Drew Davis
*/
package main
import "fmt"
/* HumanPlayer struct is a substruct of player that allows a person to play
*/
type HumanPlayer struct {
Player
}
/* newHumanPlayer acts as the HumanPlayer constructor
/ it sets the name and playerNum based on the call
*/
func newHumanPlayer(aName string, aPlayerNum int) HumanPlayer {
p := HumanPlayer{Player{
name: aName,
playerNum: aPlayerNum,
}}
return p
}
/* let user choose a move and return the int of the column to drop in
/ Input: a board to be evaluated
/ Output: an int representing which column to play in
*/
func (p HumanPlayer) chooseMove(b Board) int {
aMove := -1
// request user make a move
print("\nHuman, please select which column to play in (0-6)\n")
fmt.Scan(&aMove)
return aMove
}