使用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 (将#修改为@)