PuzzleDescription::heuristic()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php declare(strict_types=1);
2
3
namespace Stratadox\PuzzleSolver;
4
5
/**
6
 * Puzzle Description
7
 *
8
 * Value object used to describe some core characteristics of the puzzle to
9
 * solve; contains information about the kind and number of solutions we're
10
 * looking for, whether the moves could turn in circles, whether all moves are
11
 * of equal cost, etc.
12
 *
13
 * @author Stratadox
14
 */
15
final class PuzzleDescription
16
{
17
    /** @var Find */
18
    private $goal;
19
    /** @var bool */
20
    private $weightedMoves;
21
    /** @var bool */
22
    private $exhausting;
23
    /** @var Heuristic|null */
24
    private $heuristic;
25
26
    public function __construct(
27
        Find $goal,
28
        bool $weightedMoves,
29
        bool $exhausting,
30
        ?Heuristic $heuristic
31
    ) {
32
        $this->goal = $goal;
33
        $this->weightedMoves = $weightedMoves;
34
        $this->exhausting = $exhausting;
35
        $this->heuristic = $heuristic;
36
    }
37
38
    public function isWeightedMoves(): bool
39
    {
40
        return $this->weightedMoves;
41
    }
42
43
    public function isExhausting(): bool
44
    {
45
        return $this->exhausting;
46
    }
47
48
    public function heuristic(): ?Heuristic
49
    {
50
        return $this->heuristic;
51
    }
52
53
    public function singleSolution(): bool
54
    {
55
        return $this->goal->singleSolution();
56
    }
57
58
    public function onlyBest(): bool
59
    {
60
        return $this->goal->onlyBest();
61
    }
62
}
63