• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

dedicate-project / beast / 49939c40-5d31-48c2-8363-71719028ff1b

pending completion
49939c40-5d31-48c2-8363-71719028ff1b

Pull #9

circleci

fairlight1337
Made the right-click menu on the frontend a bit nicer
Pull Request #9: Adding pipeline applications

1399 of 1399 new or added lines in 23 files covered. (100.0%)

2922 of 3244 relevant lines covered (90.07%)

15773.93 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

20.0
/src/evaluators/maze_evaluator.cpp
1
#include <beast/evaluators/maze_evaluator.hpp>
2

3
// Standard
4
#include <limits>
5
#include <random>
6

7
// BEAST
8
#include <beast/cpu_virtual_machine.hpp>
9

10
namespace beast {
11

12
namespace {
13
maze::Maze getSolvableMaze(uint32_t rows, uint32_t cols, double difficulty, uint32_t max_tries) {
×
14
  uint32_t tries = 0;
×
15

16
  do {
×
17
    maze::Maze maze(rows, cols, difficulty);
×
18
    if (maze.isSolvable()) {
×
19
      return maze;
×
20
    }
21
    tries++;
×
22
  } while (tries < max_tries);
×
23

24
  throw std::runtime_error(
25
      std::string("Failed to generate a solvable maze with these parameters: ") +
×
26
      "rows=" + std::to_string(rows) + ", cols=" + std::to_string(cols) +
×
27
      ", difficulty=" + std::to_string(difficulty) + ", max_tries=" + std::to_string(max_tries));
×
28
}
29
} // namespace
30

31
MazeEvaluator::MazeEvaluator(uint32_t rows, uint32_t cols, double difficulty, uint32_t max_steps)
5✔
32
    : rows_{rows}, cols_{cols}, difficulty_{difficulty}, max_steps_{max_steps} {}
5✔
33

34
double MazeEvaluator::evaluate(const VmSession& session) {
×
35
  maze::Maze target_maze = getSolvableMaze(rows_, cols_, difficulty_, 10);
×
36

37
  VmSession local_session = session;
×
38
  CpuVirtualMachine virtual_machine;
×
39
  virtual_machine.setSilent(true);
×
40
  const uint32_t max_steps = 1000;
×
41
  uint32_t current_steps = 0;
×
42
  while (virtual_machine.step(local_session, false)) {
×
43
    // TODO(fairlight1337): Implement this evaluation function: Feed current sight and player state
44
    // into maze, and get move commands out.
45
    static_cast<void>(target_maze);
46

47
    current_steps++;
×
48
    if (current_steps > max_steps) {
×
49
      return 0.0;
×
50
    }
51
  }
52

53
  double score = 0.0;
×
54
  return score;
×
55
}
56

57
uint32_t MazeEvaluator::getRows() const { return rows_; }
5✔
58

59
uint32_t MazeEvaluator::getCols() const { return cols_; }
5✔
60

61
double MazeEvaluator::getDifficulty() const { return difficulty_; }
5✔
62

63
uint32_t MazeEvaluator::getMaxSteps() const { return max_steps_; }
5✔
64

65
} // namespace beast
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc