How to update my score

Hello, everyone,

I am trying to update my score in program "Connect Four" but for some reason it is not being updated. I got function that I use to calculate score. I got classes that are necessary to update it.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
  class Eval {
  int marks; // connected to me.
  int spaces; // possible spaces.
public:
  Eval(const int c=0, const int p=0) : marks(c), spaces(p) {}
  bool isConnect4() const { return marks >= 3; }
  bool isWinning()  const { return marks == 2 && spaces >= 1; }
  int getValue() const {
      int a = m_conn * 2 + m_poss;
      if(isWinning()) {
        a=+50;
      }
      else if(isConnect4()){
        a=+100;
      }
      else{a++;}
      return a;
  }
  int marks() { return marks; }
  int empties() { return spaces; }
  friend ostream& operator<<(ostream& o, const Eval& e) {
    return o << "(" << e.marks << ", " << e.spaces << ")";
  }
};


1
2
3
4
5
6
7
8
9
10
11
12
13
14
class Turn {
  char m_turn;
  int  m_score;
public:
  Turn(const char c = '\0', const int s = 0) : m_turn(c), m_score(s) {}
  char getTurn() const { return m_turn; }
  int getScore() const { return m_score; }
  friend bool operator<(const Turn& lhs, const Turn& rhs) {
    return lhs.m_score < rhs.m_score;
  }
  friend ostream& operator<<(ostream& o, const Turn& t) {
    return o << "\t--> (" << t.m_turn << ") with score " << t.m_score;
  }
};


What should I change in those classes so the score will be updated?
Last edited on
Topic archived. No new replies allowed.