Merged
重构:简化foundFrogOrOutEdge方法的布尔表达式 #1
忘语Add on Oct 31, 2025
重构:简化foundFrogOrOutEdge方法的布尔表达式 #1
Merged
Merged fromguo874758140/frogmasterintodrinkjava22222/frogmaster
Total: 1 files changed+1-4
| @@ -138,10 +138,7 @@ public class Env extends JPanel { | |||
| 138 | public static boolean foundFrogOrOutEdge(int x, int y) {// 如果指定点看到青蛙或超出边界,返回true | 138 | public static boolean foundFrogOrOutEdge(int x, int y) {// 如果指定点看到青蛙或超出边界,返回true |
| 139 | if (x < 0 || y < 0 || x >= ENV_WIDTH || y >= ENV_HEIGHT) | 139 | if (x < 0 || y < 0 || x >= ENV_WIDTH || y >= ENV_HEIGHT) |
| 140 | return true;// 如果出界返回true | 140 | return true;// 如果出界返回true |
| 141 | - if ((Env.bricks[x][y] & Material.FROG_TAG) > 0) | 141 | + return (Env.bricks[x][y] & Material.FROG_TAG) > 0; |
| 142 | - return true; | ||
| 143 | - else | ||
| 144 | - return false; | ||
| 145 | } | 142 | } |
| 146 | 143 | ||
| 147 | public static void setMaterial(int x, int y, int material) { | 144 | public static void setMaterial(int x, int y, int material) { |