Question: Hi, i must do this in C++.You must write the program of an agent allowing to play the game of the Wumpus whose PEAS description

Hi, i must do this in C++.You must write the program of an agent allowing to play the game of the Wumpus whose PEAS description is as follows:

- Performance : Exit with gold: +1000 Fall or be eaten: Execute an action: 1 - Environment : n n square map

Probability of wells on a space: 0.2 A Gold space and a Wumpus space Actions / Effectors: 1: up, 2: right, 3: down, 4: left, 5: grab, 6: climb

Sensors: Smell = 1 if the Wumpus is on one of the adjacent spaces Breeze = 1 if a well is on one of the adjacent squares

Glow = 1 if the gold is on the current square Shock = 1

if the last move was not valid (takes us out of the map) You no longer have access to the map(about the wumpus game), but your agent must interact with it. the environment via the Game program.

The environment takes the form of a program using the following way: Environment for Wumpus game Usage: ./Game [OPTIONS] YourProgram Positionals: YourProgram TEXT:FILE REQUIRED Executable of your agent Options: -h,--help

Print this help message and exit --seed UINT Map ID (default: 0 for random) -n UINT Map size (default: 4) --verbose Display animation on std::cerr Your program must communicate with the environment through the input and from standard output. Your program receives on the standard input four booleans in {0, 1}, representing respectively the presence of a smell, a breeze, a glow and a shock.

Your program must respond with an integer or a char: 1, 1, h or H to move up. 2, '2', 'd' or 'D' to move right. 3, '3', 'b' or 'B' to move down. 4, '4', 'g' or 'G' to move left. 5, '5', 's' or 'S' to enter. 6, '6', 'f' or 'F' to climb. Note: in this second part, you must build a model of the world by reasoning (use a SAT solver), then reuse your strategy from part 1 to perform your actions. Here is a starting code. Please implement everything in this code:

#include

#include

#include

#include "cadical.hpp"

int main(int argc, char *argv[]) {

CaDiCaL::Solver S;

S.add(1); S.add(2);

S.add(0); // Addition of v1 or v2 clause

S.add(-1); S.add(-2); S.add(0); // Added non v1 or non v2 clause

S.add(-1);

S.add(2);

S.add(0); // // Added non v1 or non v2 clause

S.assume(1); // Added assumption that v1 is true

if(S.solve() == 10) { std::cerr << "SAT with assumption var1 = true with :" << std::endl;

for(unsigned int i=1; i<=S.vars(); i++) {

std::cerr << "var" << i << " = " << (S.val(i)>0) << std::endl; }

} else { std::cerr << "Not SAT with assumption var1 = true" << std::endl; }

if(S.solve() == 10) { std::cerr << "Sat without assumption with :" << std::endl;

for(unsigned int i=1; i<=S.vars(); i++) { std::cerr << "var" << i << " = " << (S.val(i)>0) << std::endl; }

} else { std::cerr << "Non SAT without assumption" << std::endl; }

for(;;) {

bool smell, breeze, glow, shock;

std::cin >> smell >> brise >> lueur >> choc; std::cerr << "(smell:" << smell << ", brise:" << brise << ", lueur:" << glow << ", choc:" << shock << ")" << std::endl;

int action = 1; // TODO : choose the right action std::cerr << "Action: " << action << std::endl;

std::cout << 1 << std::endl; } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!