📄 antpatch.java
字号:
/* * 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -