-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclass_definition_player.php
More file actions
53 lines (33 loc) · 893 Bytes
/
class_definition_player.php
File metadata and controls
53 lines (33 loc) · 893 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
Class Player {
//properties
public $p_playerid;
public $p_pieces = array();
//methods
function __construct( $x_id ) {
$this->p_playerid = $x_id;
for ( $x_counter = 1; $x_counter <= 4; $x_counter++ ) {
$this->p_pieces[ $x_counter ] = $this->p_assignpiece( $this );
}
}
//feed an array of markers per player
public function p_assignpiece( Player $x_player ): Marker {
$p_m_temp = new Marker( $x_player );
return ( $p_m_temp );
}
public function p_get_playerid() {
return $this->p_playerid;
}
public function p_check_game_status( Player $x_player ) {
$x_game_over = TRUE;
for($x_counter = 1;$x_counter<=4;$x_counter++)
{
if($x_player->p_pieces[$x_counter]->m_get_location() != 120)
{
$x_game_over = FALSE;
}
}
return $x_game_over;
}
}
?>