Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a class named JanggiGame for playing an abstract board game called Janggi. Please read the Board, Pieces and the overall Rules section on the

Write a class named JanggiGame for playing an abstract board game called Janggi. Please read the "Board", "Pieces" and the overall "Rules" section on the Wikipedia page. You do not have to implement the rules regarding perpetual check, position repetition, any kind of draw or the miscellaneous rules. You do need to correctly handle checkmate. You also need to correctly handle all piece-specific rules, e.g. generals aren't allowed to leave the palace, horses and elephants can be blocked, cannons cannot capture other cannons, etc. A good video describing the rules is here. A general is in check if it could be captured on the opposing player's next move. A player cannot make a move that puts or leaves their general in check. The game ends when one player checkmates the other's general. You don't actually capture a general, instead you have to put it in such a position that it cannot escape being in check, meaning that no matter what, it could be captured on the next move. This works the same as in chess, if you're familiar with that game. Unlike chess, Janggi allows you to pass a turn and thus there is no stalemate (a scenario when no legal moves can be made). Your program should have Blue and Red as the competing players and Blue as the starting player. You do not need to implement any special mechanism for figuring out who can start the game. Locations on the board will be specified using "algebraic notation", with columns labeled a-i and rows labeled 1-10, with row 1 being the Red side and row 10 the Blue side. Your initial board setup should have the Elephant transposed with the Horse, on the right side, as seen on the image from Wikipedia. You can use this spreadsheet as a reference to understand the initial board layout as well as to simulate your moves. You're not required to print the board, but you will probably find it very useful for testing purposes. Your JanggiGame class must include the following: An init method that initializes any data memb

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Transaction Processing

Authors: Philip M. Lewis, Arthur Bernstein, Michael Kifer

1st Edition

0201708728, 978-0201708721

Students also viewed these Databases questions

Question

Is the person willing to deal with the consequences?

Answered: 1 week ago