antpatch.java

来自「一个TSP问题的图形演示程序」· Java 代码 · 共 38 行

JAVA
38
字号
/* *  This code is from the book: * *    Winder, R and Roberts, G (2000) Developing Java *    Software, second edition, John Wiley & Sons. * *  It is copyright (c) 2000 Russel Winder and Graham Roberts. */import SimFrameWork.Patch ;import SimFrameWork.RandomGen ;/** *  Subclass of Patch specialising patches for the ant simulation. * *  @version 2.0 March 1999 *  @author Graham Roberts */class AntPatch extends Patch {  /**   *  Antpatches don't do much except use the patch value field as a   *  count of the number of wood chips on the patch. Constructor   *  initializes the count randomly.   */  public AntPatch() {    int n = RandomGen.getNext(100) ;    if (n > 90) {      patchValue = 1 ;    } else {      patchValue = 0 ;    }  }  /**   *  Not required for this simulation but must be overridden to   *  make this class concrete.   */  public void update() {}}

⌨️ 快捷键说明

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