April 2019 0 31 Report
Twoim zadaniem jest stworzenie funkcji która wygeneruje postać i zwróci jej charakter jako odpowiedni zbiór 8 bitów.

Funkcja MONSTER setMonster( bool, bool, bool, bool, bool, bool, bool, bool) pobiera 8 parametrów typu bool opisujące sposób zachowania potwora w grze:
param1 : czy potwór ma broń palną
param2 : czy potwór jest agresywny
param3 : czy jest odporny na strzały
param4 : czy potwór porzuca broń po śmierci
param5 : czy potwór zauważy przeciwnika
param6 : czy potwór usłyszy przeciwnika
param7 : czy potwór pobiegnie za przeciwnikiem
param8 : czy potwór otwiera drzwi

Na wyjściu otrzymujemy zmienną typu MONSTER (unsigned char = 8 bitów) według następującej mapy bitów.
const unsigned char monsterHasGun = 1;
const unsigned char monsterIsAggresive = 2;
const unsigned char monsterIsFireResistant = 4;
const unsigned char monsterLoseWeapon = 8;
const unsigned char monsterSeeOponent = 16;
const unsigned char monsterHearOponent = 32;
const unsigned char monsterRunOponent = 64;
const unsigned char monsterOpenDoor = 128;

#define MONSTER unsigned char





Początek programu:
#define MONSTER unsigned char

const unsigned char monsterHasGun = 1;
const unsigned char monsterIsAggresive = 2;
const unsigned char monsterIsFireResistant = 4;
const unsigned char monsterLoseWeapon = 8;
const unsigned char monsterSeeOponent = 16;
const unsigned char monsterHearOponent = 32;
const unsigned char monsterRunOponent = 64;
const unsigned char monsterOpenDoor = 128;

MONSTER setMonster ( bool param1, bool param2, bool param3, bool param4, bool param5, bool param6, bool param7, bool param8 )
{
return 0;
}

More Questions From This User See All

Recommend Questions



Life Enjoy

" Life is not a problem to be solved but a reality to be experienced! "

Get in touch

Social

© Copyright 2013 - 2024 KUDO.TIPS - All rights reserved.