bwmodel
A modeling environment for Minecraft Bedwars
Loading...
Searching...
No Matches
src
game
sim.h
1
// Copyright (C) 2024 Ethan Uppal. All rights reserved.
2
3
#pragma once
4
5
#include <queue>
6
#include <vector>
7
#include <functional>
8
#include <utility>
9
#include "game.h"
10
11
namespace
bwmodel {
12
class
Simulator
{
13
using
Event = std::pair<uint64_t, std::function<void(
Game
&)>>;
14
15
struct
EventCompare {
16
bool
operator()(
const
Event& a,
const
Event& b)
const
{
17
return
a.first > b.first;
18
}
19
};
20
21
std::priority_queue<Event, std::vector<Event>, EventCompare> events;
22
23
public
:
24
Simulator
();
25
28
void
sequence
(uint64_t time, std::function<
void
(
Game
&)> event);
29
32
void
simulate
(
Game
& game);
33
};
34
}
bwmodel::Game
Definition
game.h:37
bwmodel::Simulator
Definition
sim.h:12
bwmodel::Simulator::simulate
void simulate(Game &game)
Definition
sim.cpp:12
bwmodel::Simulator::sequence
void sequence(uint64_t time, std::function< void(Game &)> event)
Definition
sim.cpp:8
Generated by
1.10.0