Question
There is a n * n square board, theres a new kind of game which is played on this board. there are pieces on the
There is a n * n square board, theres a new kind of game which is played on this board. there are pieces on the board which can only move horizontal and vertical any number of squares until it encounters an opponent piece, when it does so, it replaces the opponent piece at that position and the turn alternates. The input will contain a n * n matrix with 1,2 and 0 in the cells. 1 denotes your pieces, 2 denotes opponent pieces, and 0 denotes free space. One of your pieces has fallen from the board and neither you nor your opponent remember its original position, so you collectively decide that you can place it anywhere you want to, so its upto you to place it at a position where you can maximize the number of opponent pieces you can cut. Output the x and y coordinates of such position. If multiple positions exists, output anyone.
Program in Java or Python.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started