private int winnerByManhattan() { int score0 = 0; int score1 = 0; for (int y = 0; y < IField.cFieldHeight; y++) { for (int x = 0; x < IField.cFieldWidth; x++) { IGhost g = getGhost(x, y); if (g == null) { continue; } if (g.getType() == GhostType.Good) { int team = g.getTeamId(); if (team == 0) { score0 += Math.Min(TPoint.manhattan(IField.GetGoalPositions(0)[0], x, y), TPoint.manhattan(IField.GetGoalPositions(0)[1], x, y)); } else { score0 += Math.Min(TPoint.manhattan(IField.GetGoalPositions(1)[0], x, y), TPoint.manhattan(IField.GetGoalPositions(1)[1], x, y)); } } } } return(score0 < score1 ? 0 : score1 < score0 ? 1 : 2); }
override public GhostType getType() { if (mViewerPlayerId != getTeamId()) { return(GhostType.Unknown); } else { return(mMasterGhost.getType()); } }
public MaxMinBitField(IField field, int myTeamId, int turn) { mMyPlayerId = myTeamId; mTurn = turn; mNextPlayerId = myTeamId; for (int y = 0; y < IField.cFieldHeight; y++) { for (int x = 0; x < IField.cFieldWidth; x++) { IGhost g = field.getGhost(x, y); if (g == null) { continue; } if (g.getTeamId() == myTeamId) { if (g.getType() == GhostType.Evil) { mMyEvilGhostBit |= Mask(x, y); } else { mMyGoodGhostBit |= Mask(x, y); } } else { mEnemyGhostBit |= Mask(x, y); } } } mEnemyEvilNum = field.getRemainEvilNum(1 - mMyPlayerId); mEnemyGoodNum = field.getRemainGoodNum(1 - mMyPlayerId); }
public Ghost(IGhost other) { this.mTeamNo = other.getTeamId(); this.mType = other.getType(); }
public static Ghost Create(IGhost g) { return(Create(g.getTeamId(), g.getType())); }