Final Da PDF
Final Da PDF
Assignment 2
Game Component Development
17BCE0918
D.PENCHAL REDDY
SLOT:G2
6. Specify in which language, tool, Game Engine and etc. you developed the game
part
10. Compare your design with the existing game part available and identify what
innovation you did on the designing and what improvement you did on the design
of that part
OTHELLO GAME PART
1.Name of the game part
APPENDIX-A,B
An initial set up of the game; white squares are where the dark player can
potentially place counters, (as they play first) while grey squares are where
counters cannot be placed until the game state changes (or because counters
already exist there)
6. Specify in which language, tool, Game Engine and etc. you developed
the game part
The hardware and software of the computer we used for these evaluations is as
follows:
• OS: Windows 10
Agent.java
package othelo;
@Override
public int compareTo(MoveScore o) {
if(o.score > this.score)
return 1;
else if (o.score < this.score)
return -1;
else
return 0;
}
}
}
Board.java
package othelo;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.image.BufferedImage;
import java.io.IOException;
import javax.imageio.ImageIO;
/******************************/
/* CONSTANT FOR DRAWING BOARD */
/******************************/
/** size of board */
private static final int board_size = Othello.board_size;
/***********************************/
/* END CONSTANTS FOR DRAWING BOARD */
/***********************************/
init();
}
/**
* Draw the board
*/
@Override
public void paint(Graphics g) {
// draw the board with board color
g.setColor(board_color);
g.fillRect(0, 0, board_size_pixel, board_size_pixel);
// draw border
g.setColor(divide_color);
//left line
g.fillRect(boarder_offset, boarder_offset, border_width, board_size_pixel - boarder_offset * 2);
//top line
g.fillRect(boarder_offset, boarder_offset, board_size_pixel - boarder_offset * 2, border_width);
//bottom line
g.fillRect(boarder_offset, board_size_pixel - boarder_offset,board_size_pixel - boarder_offset * 2 + border_width,
border_width);
//right line
g.fillRect(board_size_pixel - boarder_offset, boarder_offset,border_width, board_size_pixel - boarder_offset * 2 +
border_width);
if (Othello.getInstance().isEffectedPiece(r, c))
{
drawEffectedPiece(g, r, c);
}
if (board[r][c] == Othello.blck_piece)
{
//draw black piece
drawPiece(g, BlackPieceImg, r, c);
}
}
@Override
public void mouseClicked(MouseEvent arg0) {
// TODO Auto-generated method stub
@Override
public void mouseEntered(MouseEvent arg0) {
// TODO Auto-generated method stub
@Override
public void mouseExited(MouseEvent arg0) {
// TODO Auto-generated method stub
@Override
public void mousePressed(MouseEvent arg0) {
// TODO Auto-generated method stub
}
}
Pruning
To improve the performance of a minimax or other tree searching algorithm,
branches of the tree can be pruned if expanding them would not be beneficial to
the outcome of the algorithm. For example, at a level of the tree where Player B is
looking to minimize the value of Player A’s next state, and where the two available
branches of the tree lead to values of -4 and -2 for Player A, the -2 branch can be
pruned. This is because a sensible Player B would never select a move that doesn’t
minimise the gain for Player A, so the -2 branch does not need to be evaluated. This
type of pruning is called Alpha-Beta Pruning, and can drastically increase the
performance of a tree search algorithm that uses it. Many other pruning algorithms
exist, but Alpha-Beta is well suited to a minimax-type algorithm. Effective use of
pruning will allow an AI to evaluate more games states within the allotted
processing time, thus improving the quality of its decisions.
----------------------THE END----------------------------