parent
218ff93449
commit
4a1c0fd630
@ -1,11 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<classpath>
|
|
||||||
<classpathentry kind="src" path="src/test/java" output="target/test-classes" including="**/*.java"/>
|
|
||||||
<classpathentry kind="src" path="src/test/resources" output="target/test-classes" excluding="**/*.java"/>
|
|
||||||
<classpathentry kind="src" path="src/main/java" including="**/*.java"/>
|
|
||||||
<classpathentry kind="src" path="src/main/resources" excluding="**/*.java"/>
|
|
||||||
<classpathentry kind="output" path="target/classes"/>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
|
||||||
<classpathentry kind="var" path="M2_REPO/junit/junit/4.11/junit-4.11.jar"/>
|
|
||||||
<classpathentry kind="var" path="M2_REPO/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar"/>
|
|
||||||
</classpath>
|
|
@ -1,14 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<projectDescription>
|
|
||||||
<name>frog</name>
|
|
||||||
<comment>An artificial life test project. NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse.</comment>
|
|
||||||
<projects/>
|
|
||||||
<buildSpec>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
|
||||||
</buildCommand>
|
|
||||||
</buildSpec>
|
|
||||||
<natures>
|
|
||||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
|
||||||
</natures>
|
|
||||||
</projectDescription>
|
|
@ -1,9 +0,0 @@
|
|||||||
#Tue Feb 19 07:51:10 MST 2019
|
|
||||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
|
||||||
eclipse.preferences.version=1
|
|
||||||
encoding/src/main/java=UTF-8
|
|
||||||
org.eclipse.jdt.core.compiler.source=1.8
|
|
||||||
encoding/src/test/resources=UTF-8
|
|
||||||
encoding/src/main/resources=UTF-8
|
|
||||||
encoding/src/test/java=UTF-8
|
|
||||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
|
Before Width: | Height: | Size: 930 B After Width: | Height: | Size: 930 B |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.3 KiB |
@ -1,32 +1,23 @@
|
|||||||
package com.github.drinkjava2.env;
|
package com.github.drinkjava2.env;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import javax.swing.JFrame;
|
import javax.swing.JFrame;
|
||||||
|
|
||||||
import com.github.drinkjava2.frog.Frog;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Application will build env, frogs and let them run
|
* Application will build env, frogs and let them run
|
||||||
*/
|
*/
|
||||||
public class Application {
|
public class Application {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) throws InterruptedException {
|
||||||
JFrame frame = new JFrame();
|
JFrame frame = new JFrame();
|
||||||
frame.setSize(Env.XSIZE + 20, Env.YSIZE + 40); // 窗口大小
|
frame.setLayout(null);
|
||||||
|
frame.setSize(Env.XSIZE + 220, Env.YSIZE + 250); // 窗口大小
|
||||||
frame.setTitle("Stage#1: First Artifical Life"); // 标题
|
frame.setTitle("Stage#1: First Artifical Life"); // 标题
|
||||||
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // 关闭时退出程序
|
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // 关闭时退出程序
|
||||||
|
|
||||||
Env env = new Env();
|
Env env = new Env();
|
||||||
frame.add(env);
|
frame.add(env);
|
||||||
frame.setVisible(true);
|
frame.setVisible(true);
|
||||||
do {
|
env.run();
|
||||||
env.repaint();
|
|
||||||
try {
|
|
||||||
Thread.sleep(100);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
} while (true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,69 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2018 the original author or authors.
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
|
||||||
* use this file except in compliance with the License. You may obtain a copy of
|
|
||||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
|
|
||||||
* applicable law or agreed to in writing, software distributed under the
|
|
||||||
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
|
|
||||||
* OF ANY KIND, either express or implied. See the License for the specific
|
|
||||||
* language governing permissions and limitations under the License.
|
|
||||||
*/
|
|
||||||
package com.github.drinkjava2.frog;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Leg of frog, frog only have 1 leg, Leg is a output device of frog , Leg's
|
|
||||||
* drive cells are located inside of brain
|
|
||||||
*
|
|
||||||
* Leg used to move frog, has 4 directions, i.e., have 4 output cells in brain
|
|
||||||
*
|
|
||||||
* @author Yong Zhu
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
public class Leg {
|
|
||||||
int up;
|
|
||||||
int down;
|
|
||||||
int left;
|
|
||||||
int right;
|
|
||||||
int stop;
|
|
||||||
|
|
||||||
public int getUp() {
|
|
||||||
return up;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUp(int up) {
|
|
||||||
this.up = up;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getDown() {
|
|
||||||
return down;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDown(int down) {
|
|
||||||
this.down = down;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getLeft() {
|
|
||||||
return left;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLeft(int left) {
|
|
||||||
this.left = left;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getRight() {
|
|
||||||
return right;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRight(int right) {
|
|
||||||
this.right = right;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getStop() {
|
|
||||||
return stop;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStop(int stop) {
|
|
||||||
this.stop = stop;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,27 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2018 the original author or authors.
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
|
||||||
* use this file except in compliance with the License. You may obtain a copy of
|
|
||||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
|
|
||||||
* applicable law or agreed to in writing, software distributed under the
|
|
||||||
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
|
|
||||||
* OF ANY KIND, either express or implied. See the License for the specific
|
|
||||||
* language governing permissions and limitations under the License.
|
|
||||||
*/
|
|
||||||
package com.github.drinkjava2.frog;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Mouth of frog, Mouth is a output device of frog , mouth's input cells are
|
|
||||||
* located inside of brain
|
|
||||||
*
|
|
||||||
* @author Yong Zhu
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
public class Mouth {
|
|
||||||
/**
|
|
||||||
* when eat, cost 1 energy, if eat success, come cells in brain will active
|
|
||||||
*/
|
|
||||||
public void eat() {
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,24 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2018 the original author or authors.
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
|
||||||
* use this file except in compliance with the License. You may obtain a copy of
|
|
||||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
|
|
||||||
* applicable law or agreed to in writing, software distributed under the
|
|
||||||
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
|
|
||||||
* OF ANY KIND, either express or implied. See the License for the specific
|
|
||||||
* language governing permissions and limitations under the License.
|
|
||||||
*/
|
|
||||||
package com.github.drinkjava2.frog.brain;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Eye of frog, each frog has 1 eye, eye is the input device of frog, eye's feel
|
|
||||||
* cells are located inside of brain
|
|
||||||
*
|
|
||||||
* @author Yong Zhu
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
public class Eye {
|
|
||||||
private int xSize = 30;
|
|
||||||
|
|
||||||
private int ySize = 30;
|
|
||||||
}
|
|
@ -1,24 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2018 the original author or authors.
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
|
||||||
* use this file except in compliance with the License. You may obtain a copy of
|
|
||||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
|
|
||||||
* applicable law or agreed to in writing, software distributed under the
|
|
||||||
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
|
|
||||||
* OF ANY KIND, either express or implied. See the License for the specific
|
|
||||||
* language governing permissions and limitations under the License.
|
|
||||||
*/
|
|
||||||
package com.github.drinkjava2.frog.brain;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gene is not a real thing, it represents the structure of brain, gene can be
|
|
||||||
* stored to file or database, used to build next generation.
|
|
||||||
*
|
|
||||||
* Gene is consisted by Zones.
|
|
||||||
*
|
|
||||||
* @author Yong Zhu
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
public class Gene {
|
|
||||||
|
|
||||||
}
|
|
@ -1,22 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2018 the original author or authors.
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
|
||||||
* use this file except in compliance with the License. You may obtain a copy of
|
|
||||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
|
|
||||||
* applicable law or agreed to in writing, software distributed under the
|
|
||||||
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
|
|
||||||
* OF ANY KIND, either express or implied. See the License for the specific
|
|
||||||
* language governing permissions and limitations under the License.
|
|
||||||
*/
|
|
||||||
package com.github.drinkjava2.frog.brain;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Zone is not a real thing, it represents a kind of function zone in brain, may
|
|
||||||
* be consisted with same or bound of different cells
|
|
||||||
*
|
|
||||||
* @author Yong Zhu
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
public class Zone {
|
|
||||||
|
|
||||||
}
|
|
Before Width: | Height: | Size: 2.2 KiB |
Loading…
Reference in new issue