我在做一个Java游戏,我试图让块产卵使用for循环交替来回x轴。For循环输出0,-1,1,-2,2,-3,3
-1
A
回答
2
0
IntStream.iterate(0, i -> i >= 0 ? -i - 1 : -i). limit(100).forEach(i -> System.out.println(i));
1
Method createBlock(): //creates the blocks at desired x axis
createBlock(0); //initial block placed at 0
int howMany= input
for (i=0; howMany;i++){
createBlock(-i)
createBlock(i)
}
+0
或者你知道......迈克尔说了些什么。 = / –
0
System.out.print(0);
for (int i = 1; i<=3; i++) {
System.out.print(String.format(",%s,%s", -i, i));
}
相关问题
- 1. for循环输出
- 2. For循环输出复制
- 3. 组合for循环输出
- 4. 输出关闭for循环
- 5. For循环输出在jframe
- 6. Java For循环输出
- 7. subprocess.Popen for循环输出
- 8. For循环最终输出
- 9. for“for”循环的OpenMP输出
- 10. 在python中写for循环的输出
- 11. Java“For”循环输出重复
- 12. XSLT for-each循环表输出
- 13. for循环的奇数输出
- 14. For循环 - 多输出超过需要
- 15. R嵌套for循环输出
- 16. For循环输出错误答案
- 17. matlab中for循环的意外输出
- 18. nohup的for循环输出命名
- 19. 简单C++ for循环意外输出
- 20. 为什么for循环输出这个?
- 21. 表输出 - For循环中R
- 22. Lotus Notes @For XML输出中的循环
- 23. “For”循环输出问题在R
- 24. for循环的输出如何工作?
- 25. Shell脚本:For循环意外输出
- 26. FOR循环和输出数据
- 27. 重定向输出嵌套for循环
- 28. bash中for循环的输出
- 29. 从for循环获取输出在r
- 30. Python里面for循环readlines单输出
所以有什么问题了吗? –