-
Notifications
You must be signed in to change notification settings - Fork 0
/
Solution.php
45 lines (37 loc) · 952 Bytes
/
Solution.php
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
<?php
/**
* Created by IntelliJ IDEA.
* User: kfuntov
* Date: 26.12.12
* Time: 16:44
* To change this template use File | Settings | File Templates.
*/
class Solution {
/**
* @var CoinGroup
*/
private $coin_group;
protected $result_coin_index=false;
public function __construct($coin_group)
{
$this->coin_group=$coin_group;
}
public function solute(){}
public function getResult(){
return $this->result_coin_index;
}
protected function weight($group1_indexes, $group2_indexes){
$w=new Weighing(
$this->getCoinGroupByIds($group1_indexes),
$this->getCoinGroupByIds($group2_indexes)
);
return $w->result();
}
private function getCoinGroupByIds($indexes){
$coins=array();
foreach($indexes as $i){
$coins[]=$this->coin_group->get($i);
}
return new CoinGroup($coins);
}
}