Compare commits

..

No commits in common. "a55d8f564f9a4d22c1374b0f1c1144aa2d1a2228" and "27fdf340e06aab3e150c23624f801de6fe1df5a9" have entirely different histories.

2 changed files with 7 additions and 9 deletions

View File

@ -22,27 +22,27 @@ void Step(struct SS13ArcadeEnv* instance, const int action, struct Observation*
switch (action) {
case 0: // Attack
instance->enemy_hp -= (rand() % 5) + 2; // 2-6
instance->enemy_hp -= rand() % 4 + 2;
break;
case 1: // Heal
instance->player_hp += (rand() % 3) + 6; // 6-8
instance->player_mp -= (rand() % 3) + 1; // 1-3
instance->player_hp += rand() % 6 + 2;
instance->player_mp -= rand() % 1 + 2;
break;
case 2: // Charge
instance->player_mp += (rand() % 4) + 4; // 4-7
instance->player_mp += rand() % 4 + 3;
break;
}
if(instance->enemy_hp <= 0 || instance->enemy_mp <= 0) { // Enemy Defeated
reward = 1;
terminated = true;
} else if(instance->enemy_mp <= 5 && (rand() % 10) + 1 >= 7) { // Enemy Drain Player MP 1-10
instance->player_mp -= (rand() % 2) + 2; // 2-3
} else if(instance->enemy_mp <= 5 && rand() % 1 + 9 >= 7) { // Enemy Drain Player MP
instance->player_mp -= rand() % 2 + 1;
} else if(instance->enemy_hp <= 10 && instance->enemy_mp > 4) { // Enemy Heal
instance->enemy_hp += 4;
instance->enemy_mp -= 4;
} else {
instance->player_hp -= (rand() % 4) + 3; // 3-6
instance->player_hp -= rand() % 3 + 3;
}
if(instance->player_hp <= 0 || instance->player_mp <= 0) {

2
main.c
View File

@ -9,7 +9,6 @@
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <time.h>
int SetupServer(int* socket_fd, int port) {
printf("[Client] Starting Server\n");
@ -66,7 +65,6 @@ int StartEnv(int port) {
int client_size = sizeof(client_addr);
int client_sock = accept(socket_fd, (struct sockaddr*)&client_addr, &client_size);
srand(time(NULL));
int obs_size = sizeof(struct Observation);
struct SS13ArcadeEnv env;
CreateEnvironment(&env);