如何解决使用Java和Processing连接5个游戏实现
我正在开发一款 Connect 5 游戏。有这样一个游戏here的例子。尽管这不是最好的解决方案,但我将使用 Java 和 Processing 作为 GUI。我想创建一个二维数组,其中每个元素都是零、一或二。最初,每个元素都为零,然后我将根据移动的人将值更新为 1 或 2。我打算把它分解成几个功能:
boolean gameEnd(int move){
// returns true is player 1 or player 2 just won
// else return false
}
void makeMove(int column,int player){
// checks the first available square in the columns and updates the value with 1 or 2
}
void drawMap(int [][] map){
// draws a map using processing depending on the current state of map
}
int getMove(){
// Depending on the coordinate of the click calculate the column where the move was made
}
void setup(){
// initialize array
// call draw function
}
我对这个想法有点怀疑,觉得它可以以更好的方式实施。另外,我不确定实现 drawMap 功能的最佳方法。如果您能获得有关如何使用 Java 和 Processing 实现游戏的任何帮助、指导和指南,我将不胜感激。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。