Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Game Logic

  1. #1
    Junior Member
    Join Date
    Apr 2013
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Game Logic

    Blitz Cyvasse(Can Anybody make Java Code for This Problem)->
    Tyrion Lannister is a master player of cyvasse, a game of strategy and war similar to chess. He has challenged
    Bronn, the captain of his guard, during Joffrey Baratheon’s nameday celebrations. In his inebriated state,
    Tyrion is finding it harder and harder to beat Bronn as the evening wears on. Unfortunately, he has staked
    too much in his pride and it is imperative that he win all games to avoid humiliation.
    Cyvasse is played with a grid of n x m cells (n rows and m columns), with tiles of grass, forest, water or
    mountains covering each cell. Players have pieces occupying tiles corresponding to infantry, cavalry, artillery
    and one dragon each. Players can attack their own pieces too. Tyrion decides to use his dragon to destroy an
    entire row of the board at a time. Bronn being not so experienced, simply mirrors Tyrion’s tactics. However,
    there is a catch. In subsequent moves, a player can only destroy a row with number of corresponding tile
    position differing from that of the last destroyed row as an odd prime. Two tile positions differ if they one is
    filled and other is empty. Eg. 1100011 and 0001000 differ at 5 positions which is odd prime. ‘1’ denotes a
    filled position and ‘0’ denotes an empty position. Both of them mutually decide to concede when they have
    no move left.
    Given n, m and the state of each tile (occupied or unoccupied), does Tyrion have a winning strategy if he
    takes he first move?
    Input
    First line contains T , the number of test cases. T test cases follow.
    First line of each test case contain 2 space separated integers n and m as specified above.
    An nxm matrix follows denoting the initial state of the game. A ‘1’ denotes that the position is filled up. ‘0’
    denotes an empty position
    Constraints
    n <= 100
    m <= 1000
    Output
    For each test case, output on a separate line “YES” (quotes for clarity) if he has a winning strategy else
    “NO” (quotes for clarity)
    Sample Input
    3
    10 11
    11110000000
    11111111110
    11111111000
    11000000000
    11000000000
    11111000000
    10000000000
    11111110000
    11111000000
    11111000000
    8 11
    1


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Game Logic

    What have you tried? - Matt Gemmell
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Need logic ....!!!
    By Afzal in forum What's Wrong With My Code?
    Replies: 8
    Last Post: March 30th, 2013, 12:12 PM
  2. logic quition on 2d game direction(airhockey)
    By hwoarang69 in forum Java Theory & Questions
    Replies: 2
    Last Post: March 19th, 2013, 06:50 PM
  3. Logic Error in noughts and crosses game
    By eyesackery in forum What's Wrong With My Code?
    Replies: 8
    Last Post: June 15th, 2012, 07:40 AM
  4. need logic
    By arunjib in forum Java Theory & Questions
    Replies: 3
    Last Post: November 27th, 2011, 05:39 PM
  5. whats logic behind this?
    By X0X0 in forum What's Wrong With My Code?
    Replies: 0
    Last Post: February 26th, 2011, 02:48 PM