소스 검색

Patches stay when changing algorithms

master
Lee 11 년 전
부모
커밋
1fe3afa516
1개의 변경된 파일16개의 추가작업 그리고 0개의 파일을 삭제
  1. +16
    -0
      src/Render.java

+ 16
- 0
src/Render.java 파일 보기

@@ -289,7 +289,23 @@ public class Render extends Canvas implements Runnable, MouseListener,
} else if ("clear".equals(event.getActionCommand())) {
clear();
} else {
String oldRule = rule;
rule = event.getActionCommand();
if (oldRule.equals("Brian's Brain") && !rule.equals("Brian's Brain")) {
for (int i = 0; i < _grid.getWidth(); i++) {
for (int j = 0; j < _grid.getHeight(); j++) {
if (_grid.getPatch(i,j).getState() == 2)
_grid.getPatch(i,j).setState(1);
}
}
} else if (!oldRule.equals("Brian's Brain") && rule.equals("Brian's Brain")) {
for (int i = 0; i < _grid.getWidth(); i++) {
for (int j = 0; j < _grid.getHeight(); j++) {
if (_grid.getPatch(i,j).getState() == 1)
_grid.getPatch(i,j).setState(2);
}
}
}
title = "Goldfish: " + rule;
_frame.setTitle(title);
}


불러오는 중...
취소
저장