康威的生命逻辑游戏问题

时间:2017-03-25 02:33:17

标签: java

我一直试图让这个生命游戏正常运行几个小时,由于某些原因我只是不能,它在runLife()或countNeighbors()类中。问题不是语法上的,但是当我输入一个测试用例如

时会出现一些逻辑错误
setInterval(function () {newYorkTimeDisplay(+3)}, 1000); 

我得到了

 ..*..
 ..*..
 ..*..

然后而不是返回

 .....
 .***.
 .....

它变成了

 ..*..
 ..*..
 ..*..

我的代码是:

 ..**.
 .*.*.
 .....

1 个答案:

答案 0 :(得分:0)

runLife根据next填充currentnext适用于第一代。但对于下一代,您需要将current中的内容复制回current = next

语句java.lang.RuntimeException: Unable to create application com.abdalltif.wajabatonline.WajabatOnlineApp: java.lang.RuntimeException: com.google.android.gms.internal.ym: No acceptable module found. Local version is 0 and remote version is 0. at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4733) at android.app.ActivityThread.access$1600(ActivityThread.java:175) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1368) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:146) at android.app.ActivityThread.main(ActivityThread.java:5602) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.RuntimeException: com.google.android.gms.internal.ym: No acceptable module found. Local version is 0 and remote version is 0. at com.google.firebase.database.connection.idl.b.a(Unknown Source) at com.google.firebase.database.connection.idl.m.a(Unknown Source) at com.google.android.gms.internal.ay.a(Unknown Source) at com.google.android.gms.internal.ed.a(Unknown Source) at com.google.android.gms.internal.et.<init>(Unknown Source) at com.google.android.gms.internal.fs.b(Unknown Source) at com.google.android.gms.internal.fs.a(Unknown Source) at com.google.firebase.database.k.d(Unknown Source) at com.google.firebase.database.k.b(Unknown Source) at com.abdalltif.wajabatonline.WajabatOnlineApp.onCreate(Unknown Source) at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1013) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4730) ... 10 more Caused by: com.google.android.gms.internal.ym: No acceptable module found. Local version is 0 and remote version is 0. at com.google.android.gms.internal.ye.a(Unknown Source) ... 22 more 使它们成为相同的数组,而不是2个具有相同内容的不同数组。