Java代写/Java小游戏/Java Game/Java Array/Java Print/Java基础/Java入门
Project 02: Connect 4
Connect Four is a two‐player connection game in which the players first choose a color and then take turns dropping colored discs from the top into a seven‐column, six‐row vertically suspended grid. The pieces fall straight down, occupying the next available space within the column. The objective of the game is to connect four of one’s own discs of the same color next to each other vertically, horizontally, or diagonally before your opponent.
You can play the game here: Connect 4
In this project, you are going to write your own version of Connect Four. The two players of the game will be both human, that is, the move to be applied will be always chosen by the user(s). You will be creating a simple (non graphical) interface that will facilitate the game for the user.
This is the class that will represent the game. You will need a way to represent a board and a way to represent the disks. Taking advantage of the object oriented nature of java, you will use instance variables to do this:
⚫ A 6×7 two‐dimensional character array to represent the board
⚫ Constant characters to represent the colored discs: ‘O’ for red, ‘X’ for yellow and ‘ ’ for an empty space.
You are required to provide an implementation for the following methods:
⚫ public Connect4()
The constructor that initializes the instance variables.
⚫ public char getBoard()
This method should return a copy of the current board, that is the 2 dimensional array holding the game board.
本网站支持淘宝 支付宝 微信支付 paypal等等交易。如果不放心可以用淘宝交易！
E-mail: [email protected] 微信:itcsdx