-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathExampleSearcheline100.cpp
39 lines (35 loc) · 1.38 KB
/
ExampleSearcheline100.cpp
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
#include "Searcheline.h"
#include "CelesteUtils.h"
#include "Carts/Celeste.h"
using namespace std;
class Search100: public Searcheline<>{
//initial state to search from
void init_state() override {
utils::load_room(p8, 0); //load 100m
utils::supress_object<Celeste::fake_wall>(p8); //don't consider berry block
utils::skip_player_spawn(p8); //skip to after the player has spawned
//execute list of initial inputs
for (auto a:{18, 2, 2, 2, 2, 2, 2, 2, 2, 2, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}) {
p8.set_btn_state(a);
p8.step();
}
//alternatively using output from a TAS tool:
//utils::place_maddy(p8, 55, 79, 0.2, 0.185, 1.4, 0.63, 0, 0);
}
// get list of available inputs for a state - only consider {r, r + z, u + r + x}
vector<int> allowable_actions(const State& state, Celeste::player& player, bool h_movement, bool can_jump, bool can_dash) override{
vector<int> actions{0b000010}; //r
if (can_jump){
actions.push_back(0b010010); //r + z
}
if(can_dash){
actions.insert(actions.end(),{0b100010, 0b100100, 0b100110});//r + x, u + x, u + r + x
}
return actions;
}
};
int main(){
// search up to depth 50, but stop at the depth of the first solution found
Search100 s;
vector<vector<int>> solutions=s.search(50);
}