⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 removalmove.java

📁 ErGo是一个很早的Java通用围棋服务器(IGS/NNGS)客户端程序。有全部源码和文档
💻 JAVA
字号:
package ergo.logic;

// $Id: RemovalMove.java,v 1.2 1999/08/13 01:17:49 sigue Exp $

/*
 *  Copyright (C) 1999  Carl L. Gay and Antranig M. Basman.
 *  See the file copyright.txt, distributed with this software,
 *  for further information.
 */

import ergo.util.*;
import java.io.PrintWriter;

/**
 * A RemovalMove represents a group removed during game scoring.
 * It copies the timeleft from its parent, and it is never a variation.
 */
  // +++ Would be nice to store the name of the player who removed
  //     this group.
public class RemovalMove extends Move {

  Position pos;
  SimpleGroupVector capturedGroups = new SimpleGroupVector(1);

  public RemovalMove (Move parent, Position pos, int num, boolean isVar) {
    super(parent, parent.timeLeft, num, parent.nextColor(), isVar);
    this.pos = pos;
  }

  public String toString () {
    return "Removed " + pos + " group";
  }

  public PositionVector placedPositions (int x) {
    return null;
  }

  public boolean isLegal (Game game, boolean fast, ILMV result) {
    SimpleGroup group = game.groupAt(pos.row, pos.column);
    if (group == null) {
      result.failureReason = "No group to remove at " + pos + ".";
      return false;
    }
    else {
      capturedGroups.addElement(group);
      return true;
    }
  }

  public boolean equals (Move m) {
    return false;		// No two removal moves are the same.
  }

  public int numberOfStones () {
    return 0;
  }

  public SimpleGroupVector capturedGroups () {
    return capturedGroups;
  }

  public boolean occupiesPosition (Position pos) {
    return false;
  }

  public void writeSGF (PrintWriter out, Game game, int n) {
    out.print(";C[Ergo: " + this + "]");
    super.writeSGF(out, game, n);
  }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -