Skip to content

Commit

Permalink
Removed Unused parts from Arbiter.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
prrockzed committed Nov 13, 2024
1 parent 6e63426 commit 695a5aa
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 76 deletions.
19 changes: 12 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

138 changes: 69 additions & 69 deletions src/components/Arbiter/Arbiter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ import Chessboard from '../Chessboard/Chessboard'
import { initialBoard } from '../../Constants'
import { PieceType, TeamType } from '../../Types'
import { Piece, Position } from '../../models'
import { useEffect, useRef, useState } from 'react'
import {
bishopMove,
kingMove,
knightMove,
pawnMove,
queenMove,
rookMove,
} from '../../rules'
import { useRef, useState } from 'react'
//import {
// bishopMove,
// kingMove,
// knightMove,
// pawnMove,
// queenMove,
// rookMove,
//} from '../../rules'

export default function Arbiter() {
// Declaring the constants
Expand Down Expand Up @@ -94,66 +94,66 @@ export default function Arbiter() {
}

// Checking if the move is valid
function isValidMove(
initialPosition: Position,
desiredPosition: Position,
type: PieceType,
team: TeamType
) {
let validMove = false

switch (type) {
case PieceType.PAWN:
validMove = pawnMove(
initialPosition,
desiredPosition,
team,
board.pieces
)
break
case PieceType.KNIGHT:
validMove = knightMove(
initialPosition,
desiredPosition,
team,
board.pieces
)
break
case PieceType.BISHOP:
validMove = bishopMove(
initialPosition,
desiredPosition,
team,
board.pieces
)
break
case PieceType.ROOK:
validMove = rookMove(
initialPosition,
desiredPosition,
team,
board.pieces
)
break
case PieceType.QUEEN:
validMove = queenMove(
initialPosition,
desiredPosition,
team,
board.pieces
)
break
case PieceType.KING:
validMove = kingMove(
initialPosition,
desiredPosition,
team,
board.pieces
)
}

return validMove
}
//function isValidMove(
// initialPosition: Position,
// desiredPosition: Position,
// type: PieceType,
// team: TeamType
//) {
// let validMove = false
//
// switch (type) {
// case PieceType.PAWN:
// validMove = pawnMove(
// initialPosition,
// desiredPosition,
// team,
// board.pieces
// )
// break
// case PieceType.KNIGHT:
// validMove = knightMove(
// initialPosition,
// desiredPosition,
// team,
// board.pieces
// )
// break
// case PieceType.BISHOP:
// validMove = bishopMove(
// initialPosition,
// desiredPosition,
// team,
// board.pieces
// )
// break
// case PieceType.ROOK:
// validMove = rookMove(
// initialPosition,
// desiredPosition,
// team,
// board.pieces
// )
// break
// case PieceType.QUEEN:
// validMove = queenMove(
// initialPosition,
// desiredPosition,
// team,
// board.pieces
// )
// break
// case PieceType.KING:
// validMove = kingMove(
// initialPosition,
// desiredPosition,
// team,
// board.pieces
// )
// }
//
// return validMove
//}

// Function to promote a pawn to the desired piece
function promotePawn(pieceType: PieceType) {
Expand Down

0 comments on commit 695a5aa

Please sign in to comment.