A console Gobang written in Java, just a combination of loops and arrays in Java, a novice, by feeling written, if there is a mistake welcome correct O (∩_∩) o
After running console input coordinates
code as follows
Import Java.util.Scanner;
public class Wuziqi {String a = "";
String B = "0";
boolean bool = true;//as Othello alternating mark; string[][] Qipan = new STRING[25][25]; Public Wuziqi () {this.
Qipan (); }//Checkerboard construction 25*25, traversing two-dimensional array assignment "+" every 25 newline can be public void Qipan () {for (int i = 0; i < i++) {for (int j = 0; J < J + +)
{Qipan[i][j] = "+";
System.out.print (Qipan[i][j]);
while (j = =) {System.out.print ("\ n");
Break
}} Xiaqi ();
The method of playing chess is public void Xiaqi () {System.out.println ("Please enter coordinates:");
Scanner sc = new Scanner (system.in);
int x = Sc.nextint ();
int y = Sc.nextint (); if (x > | | y >) {System.out.println ("Out of coordinate range, re-enter.")
");
Xiaqi (); else {if (qipan[x][y]==a| | QIPAN[X][Y]==B) {SysteM.OUT.PRINTLN ("The coordinates have been occupied by other flags, please re-enter");
Xiaqi ();
}else{if (bool) {qipan[x][y] = A;
bool = false;
else {Qipan[x][y] = b;
BOOL = true;
(int i = 0; i < i++) {for (int j = 0; J <-J) {
System.out.print (Qipan[i][j]);
while (j = =) {System.out.print ("\ n");
Break
}} Panduan (); }///Win/Lose method public void Panduan () {for (int i = 0; i < i++) {for (int j = 0; j < 21; J + +) {if (qipan[i][j] = = && Qipan[i][j + 1] = = a && qipan[i][j + 2] = = a && qipan[i][j + 3] = = a && qipan[i][j + 4]= = a) {System.out.println ("Black Side wins"); System.out.println ("Whether to proceed to the next inning.")
\ n, to proceed to the next inning, cancel ");
Scanner sc = new Scanner (system.in);
String F=sc.next ();
if (F.equals ("Y")) {Qipan ();
}else{System.out.println ("Gameover"); "Else If" (qipan[i][j] = = a && qipan[i + 1][j] = = a && qipan[i +
2][J] = = a && qipan[i + 3][j] = = a && qipan[i + 4][j] = = a) {
System.out.println ("Black Side wins"); System.out.println ("Whether to proceed to the next inning.")
\ n, to proceed to the next inning, cancel ");
Scanner sc = new Scanner (system.in);
String F=sc.next ();
if (F.equals ("Y")) {Qipan ();
}else{System.out.println ("Gameover"); } else if (qipan[i][j] = = a && qipan[i + 1][j + 1] = = a &&A mp Qipan[i + 2][j + 2] = = a && qipan[i + 3][j + 3] = = a && qipan[i + 4][j + 4] = = a)
{System.out.println ("Black Side wins"); System.out.println ("Whether to proceed to the next inning.")
\ n, to proceed to the next inning, cancel ");
Scanner sc = new Scanner (system.in);
String F=sc.next ();
if (F.equals ("Y")) {Qipan ();
}else{System.out.println ("Gameover"); } else if (Qipan[i][j + 4] = = a && qipan[i + 1][j + 3] = = a && q
Ipan[i + 2][j + 2] = = a && qipan[i + 3][j + 1] = = a && qipan[i + 4][j + 0] = = a) {
System.out.println ("Black Side wins"); System.out.println ("Whether to proceed to the next inning.")
\ n, to proceed to the next inning, cancel "); Scanner sc = new Scanner (system.in);
String F=sc.next ();
if (F.equals ("Y")) {Qipan ();
}else{System.out.println ("Gameover"); Or else if (qipan[i][j] = = B && qipan[i][j + 1] = = B && qipan[i][
J + 2] = = B && qipan[i][j + 3] = = B && qipan[i][j + 4] = = b) {
System.out.println ("White win"); System.out.println ("Whether to proceed to the next inning.")
\ n, to proceed to the next inning, cancel ");
Scanner sc = new Scanner (system.in);
String F=sc.next ();
if (F.equals ("Y")) {Qipan ();
}else{System.out.println ("Gameover"); else if (qipan[i][j] = = B && qipan[i + 1][j] = = B && QIPAn[i + 2][j] = = B && qipan[i + 3][j] = = B && qipan[i + 4][j] = = b) {
System.out.println ("White win"); System.out.println ("Whether to proceed to the next inning.")
\ n, to proceed to the next inning, cancel ");
Scanner sc = new Scanner (system.in);
String F=sc.next ();
if (F.equals ("Y")) {Qipan ();
}else{System.out.println ("Gameover"); } else if (qipan[i][j] = = B && qipan[i + 1][j + 1] = = B && Qipan [i + 2]
[j + 2] = = B && qipan[i + 3][j + 3] = = B && qipan[i + 4][j + 4] = = b) {
System.out.println ("White win"); System.out.println ("Whether to proceed to the next inning.")
\ n, to proceed to the next inning, cancel ");
Scanner sc = new Scanner (system.in);
String F=sc.next ();
if (F.equals ("Y")) { Qipan ();
}else{System.out.println ("Gameover"); } else if (Qipan[i][j + 4] = = B && qipan[i + 1][j + 3] = = b && q
Ipan[i + 2][j + 2] = = B && qipan[i + 3][j + 1] = = B && qipan[i + 4][j + 0] = = b) {
System.out.println ("White win"); System.out.println ("Whether to proceed to the next inning.")
\ n, to proceed to the next inning, cancel ");
Scanner sc = new Scanner (system.in);
String F=sc.next ();
if (F.equals ("Y")) {Qipan ();
}else{System.out.println ("Gameover");
}}else{Xiaqi ();
}}} public static void Main (string[] args) {//TODO auto-generated method stub
Wuziqi wzq = new Wuziqi ();
}
}