41 lines
1.2 KiB
Plaintext
41 lines
1.2 KiB
Plaintext
#ifndef ARCADE_ENV_H
|
|
#define ARCADE_ENV_H
|
|
#include <curand_kernel.h>
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
#include <stdlib.h>
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
|
|
struct __attribute__((packed)) State {
|
|
int player_hp, player_mp, enemy_hp, enemy_mp, steps;
|
|
};
|
|
|
|
struct __attribute__((packed)) Observation {
|
|
struct State state;
|
|
int reward;
|
|
bool terminated;
|
|
bool truncated;
|
|
};
|
|
|
|
struct SS13ArcadeEnv {
|
|
int player_hp, player_mp, enemy_hp, enemy_mp, steps;
|
|
};
|
|
|
|
__device__ int clamp(int value, int min, int max);
|
|
__device__ uint32_t device_ntohl(uint32_t x);
|
|
|
|
__global__ void initCurrand(curandState *states, unsigned long seed);
|
|
__device__ int randint(curandState *state, int low, int high);
|
|
|
|
__global__ void CreateEnvironment(struct SS13ArcadeEnv *env, int n);
|
|
__global__ void ApplyAction(curandState *states, char *actionBuf, struct SS13ArcadeEnv *env, int n, struct Observation *obs);
|
|
__device__ void Step(curandState *state, struct SS13ArcadeEnv *instance, const int action, struct Observation *obs);
|
|
__device__ void GetState(struct SS13ArcadeEnv *env, struct State *state);
|
|
__device__ void Reset(struct SS13ArcadeEnv *instance, struct Observation *obs);
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
#endif
|