Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

CSC112 Spring 2016 Examples

2370 views
1
//implimentation file for cheatPaca
2
3
#include "cheatPaca.h"
4
#include "../alpaca.h"
5
#include <cstdlib>
6
#include <iostream>
7
8
using namespace std;
9
10
//virtual functions to override
11
std::string
12
cheatPaca::name() {
13
return nickName;
14
}
15
16
void
17
cheatPaca::act(Alpaca *opponent) {
18
19
switch(rand()%2) {
20
case 0:
21
troll();
22
break;
23
case 1:
24
lol();
25
break;
26
}
27
}
28
29
//moveset
30
void
31
cheatPaca::troll() {
32
cout << name() << " is trolling you!!" << endl;
33
}
34
35
void
36
cheatPaca::lol() {
37
cout << name() << " types 'lol' but he doesn't actually laugh out loud!!" << endl;
38
}
39
40