Amazon Design 11 chess

Source: Internet
Author: User
1 public class ChessPieceTurn { };2 public class GameManager {3 void processTurn(PlayerBase player) { };4 boolean acceptTurn(ChessPieceTurn turn) { return true; };5 Position currentPosition;6 }78 public abstract class PlayerBase {9 public abstract ChessPieceTurn getTurn(Position p);10 }11 class ComputerPlayer extends PlayerBase {12 public ChessPieceTurn getTurn(Position p) { return null; }13 public void setDifficulty() { };14 public PositionEstimator estimater;15 public PositionBackTracker backtracter;16 }17 public class HumanPlayer extends PlayerBase {18 public ChessPieceTurn getTurn(Position p) { return null; }19 }2021 public abstract class ChessPieceBase {22 abstract boolean canBeChecked();23 abstract boolean isSupportCastle();24 }25 public class King extends ChessPieceBase { ... }26 public class Queen extends ChessPieceBase { ... }2728 public class Position { // represents chess positions in compact form29 ArrayList<ChessPieceBase> black;30 ArrayList<ChessPieceBase> white;31 }3233 public class PositionBackTracker {34 public static Position getNext(Position p) { return null; }35 }36 public class PositionEstimator {37 public static PositionPotentialValue estimate(Position p) { ... }38 }39 public abstract class PositionPotentialValue {40 abstract boolean lessThan(PositionPotentialValue pv);41 }

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.