Commit 5276bc4a authored by Jason Rhinelander's avatar Jason Rhinelander

Incorporated eris's new Positional<T> class

parent 19beaa41
#pragma once
#include <eris/Position.hpp>
#include <eris/agent/PositionalAgent.hpp>
#include <eris/Positional.hpp>
#include <eris/Agent.hpp>
#include <eris/Optimize.hpp>
#include <unordered_map>
#include <random>
......@@ -8,16 +8,17 @@
namespace voting {
using eris::eris_id_t;
using eris::agent::PositionalAgent;
using eris::Positional;
using eris::Agent;
/** A "Party" eris agent. A party has a Position and moves around.
*/
class Party : public PositionalAgent, public virtual eris::interopt::OptApply {
class Party : public Positional<Agent>, public virtual eris::interopt::OptApply {
public:
// Inherited constructors is ideal here, but support is lacking, so just replicate the one
// we used:
//using PositionalAgent::PositionalAgent;
Party(double p, double b1, double b2) : PositionalAgent({p}, {b1}, {b2}) {}
//using Positional<Agent>::Positional<Agent>;
Party(double p, double b1, double b2) : Positional<Agent>({p}, {b1}, {b2}) {}
/** Overridden to make movements bind to the position boundaries.
*/
......
#pragma once
#include <eris/Position.hpp>
#include <eris/agent/PositionalAgent.hpp>
#include <eris/Positional.hpp>
#include <eris/Agent.hpp>
#include <eris/Optimize.hpp>
#include <eris/Random.hpp>
#include <unordered_map>
......@@ -8,16 +8,15 @@
namespace voting {
using namespace eris;
using eris::agent::PositionalAgent;
/** A "Voter" eris agent. A voter has a Position and a set of friends.
*/
class Voter : public PositionalAgent, public virtual interopt::Advance {
class Voter : public Positional<Agent>, public virtual interopt::Advance {
public:
// Inherited constructors is ideal here, but support is lacking, so just replicate the one
// we used:
//using PositionalAgent::PositionalAgent;
Voter(double p, double b1, double b2) : PositionalAgent({p}, {b1}, {b2}) {}
//using Positional<Agent>::Positional<Agent>;
Voter(double p, double b1, double b2) : Positional<Agent>({p}, {b1}, {b2}) {}
/** Returns true if the given voter is a friend of this voter. */
bool isFriend(eris_id_t voter) const;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment