Results 1 to 19 of 19
Like Tree5Likes
  • 3 Post By gimbal2
  • 2 Post By SurfMan

Thread: Give me way to understand .....My big assignment problem

  1. #1
    Join Date
    Sep 2013
    Posts
    21
    Rep Power
    0

    Default Give me way to understand .....My big assignment problem

    Hip is a classic board game invented by Martin Gardner. Itís a 2 player game played on a 9x9 board. Players take turns placing a token on an unoccupied cell. The player who completes any square such that 4 corners are marked by his token loses. The square may be of any size and can be tilted at any angle. Here are a couple of game states that shows the players lose by completing a square.

    Give me way to understand .....My big assignment problem-map.png

    The function nextMove takes in a character player and an 9x9 char board as an input and provides 2 integer positions row and column space separated as output. The board is 0-indexed.

    Example Input

    b
    r--------
    ---------
    --r------
    ---b--b--
    --r------
    ---------
    ---------
    ---------
    ---------

    Example Output

    0 1

    The board results in the following state

    rb-------
    ---------
    --r------
    ---b--b--
    --r------
    ---------
    ---------
    ---------
    ---------

    First player is identified by token r, the second player by b and an unoccupied cell is identified by - (ascii value:45)
    Code which is given is

    Java Code:
    using System;
    using System.Collections.Generic;
    using System.IO;
    class Solution {
    
    /* Head ends here */
      static void nextMove(String player, String [] board){
      }
    
    /* Tail starts here */
      static void Main(String[] args) {
            String player;
    
            player = Console.ReadLine();
    
            String[] board  = new String[9];
            for(int i=0; i < 9; i++) {
                board[i] = Console.ReadLine(); 
            }
    
            nextMove(player,board);
         }
    }


    I have understand game but getting confuse in input n output details...
    Problem is how to show output,how to use -(ascii 45) or have to use two dimensional array but problem saying that you have to use singe array.

    Anybody please give me right way to understand problem.Its a online assignment so no one whom i can discuss.So plz help me for understanding and solving this problem.

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,691
    Rep Power
    8

    Default Re: Give me way to understand .....My big assignment problem

    You can use a char to refer to individual characters as well as small integers. Could the assignment be talking about a char with a value of 45?

    The array looks like a single array, and each index in that array contains a String representing a single line.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    Join Date
    Sep 2013
    Posts
    21
    Rep Power
    0

    Default Re: Give me way to understand .....My big assignment problem

    Would you plz solve this problem for me.So it will be easily understandable by me.

  4. #4
    Join Date
    Sep 2013
    Posts
    21
    Rep Power
    0

    Default Re: Give me way to understand .....My big assignment problem

    will u plz help to solve this problem

  5. #5
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,691
    Rep Power
    8

    Default Re: Give me way to understand .....My big assignment problem

    Quote Originally Posted by codequicker@yahoo.com View Post
    Would you plz solve this problem for me.
    That is absolutely not how this works. Nobody is going to do your homework for you.

    Show some initiative and make an attempt.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  6. #6
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    3,083
    Rep Power
    4

    Default Re: Give me way to understand .....My big assignment problem

    Quote Originally Posted by codequicker@yahoo.com View Post
    will u plz help to solve this problem
    Good correction, but by saying this I can only assume that you think that now that you created this forum thread, your work is done. If you want to be helped, you need to make it possible to BE helped. For me it is very unclear where you are getting stuck, so I can't really say anything that would help you not be stuck anymore. I am not going to fix or write any code for you, the only thing I am willing to do is help you so you can continue on your own again. Most people are the same as me (edit: I mean have the same opinion).

    So. Step one: you have to understand the problem first, so you may properly explain it (or even solve it yourself based on your new understanding of it). Talk to the person who gave you this assignment.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  7. #7
    SurfMan's Avatar
    SurfMan is offline Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    732
    Rep Power
    2

    Default Re: Give me way to understand .....My big assignment problem

    I see what your problem is: this code is C# not Java.
    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2ô © 2013

  8. #8
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    3,083
    Rep Power
    4

    Default Re: Give me way to understand .....My big assignment problem

    Quote Originally Posted by SurfMan View Post
    I see what your problem is: this code is C# not Java.
    Right, that settles it - I need glasses.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  9. #9
    zFollette is offline ▼ dafuq did I do?
    Join Date
    Dec 2013
    Posts
    203
    Rep Power
    0

    Default Re: Give me way to understand .....My big assignment problem

    Quote Originally Posted by SurfMan View Post
    I see what your problem is: this code is C# not Java.
    Give me way to understand .....My big assignment problem-guy-takes-off-ones-set-sunglasses-but-has-second-set-aswell.gif

  10. #10
    Join Date
    Sep 2013
    Posts
    21
    Rep Power
    0

    Default Re: Give me way to understand .....My big assignment problem

    Mistakly i have written java...So i think u have to understand that its may be mistake

  11. #11
    Join Date
    Sep 2013
    Posts
    21
    Rep Power
    0

    Default Re: Give me way to understand .....My big assignment problem

    Thankyou gimbal for your valuable response.I need more chat on this problem n few others,I hope u will help me.

  12. #12
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,691
    Rep Power
    8

    Default Re: Give me way to understand .....My big assignment problem

    Quote Originally Posted by codequicker@yahoo.com View Post
    Thankyou gimbal for your valuable response.I need more chat on this problem n few others,I hope u will help me.
    What more do you want? Even if we were going to do your homework for you, you've posted on a Java forum. Wouldn't handing in a Java solution tip of your instructor that you've been cheating?
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  13. #13
    SurfMan's Avatar
    SurfMan is offline Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    732
    Rep Power
    2

    Default Re: Give me way to understand .....My big assignment problem

    Apparently this is from here: https://www.hackerrank.com/challenges/hip
    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2ô © 2013

  14. #14
    Join Date
    Sep 2013
    Posts
    21
    Rep Power
    0

    Default Re: Give me way to understand .....My big assignment problem

    Ya its from hacked rank...can u any body give me idea how to do it with one dimensional array...how to keep track of placed token.u intelligent surfman...solve it.

  15. #15
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    3,083
    Rep Power
    4

    Default Re: Give me way to understand .....My big assignment problem

    No, YOU solve it. YOU want to do this. If you can't... yeah well that's bad luck, but then you clearly need to study and practice more with whatever language you're using which apparently is not Java if I believe the code in your original post. If someone else solves it for you, you do not gain anything here.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  16. #16
    SurfMan's Avatar
    SurfMan is offline Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    732
    Rep Power
    2

    Default Re: Give me way to understand .....My big assignment problem

    Quote Originally Posted by codequicker@yahoo.com View Post
    Ya its from hacked rank...can u any body give me idea how to do it with one dimensional array...how to keep track of placed token.u intelligent surfman...solve it.
    Even if I could I won't. Simply because you let other people solve your own challenges. If you can't do this yourself, the Hacker Challenge ends for you here. That's the point of the site.
    KevinWorkman and gimbal2 like this.
    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2ô © 2013

  17. #17
    Join Date
    Sep 2013
    Posts
    21
    Rep Power
    0

    Default Re: Give me way to understand .....My big assignment problem

    i M HERE TO ASK FEW IDEA ABOUT HOW TO DO THIS GAME CODING USING ARRAY...NOTHING MORE.....IF I HURT ANYBODY...I M ASKING FOR SORRY.IF U GUYS PRAISE ME THEN I WILL SURE WIN HACKERRANK COMPETITION.THANKYOU.

  18. #18
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,691
    Rep Power
    8

    Default Re: Give me way to understand .....My big assignment problem

    Quote Originally Posted by codequicker@yahoo.com View Post
    i M HERE TO ASK FEW IDEA ABOUT HOW TO DO THIS GAME CODING USING ARRAY...NOTHING MORE.....IF I HURT ANYBODY...I M ASKING FOR SORRY.IF U GUYS PRAISE ME THEN I WILL SURE WIN HACKERRANK COMPETITION.THANKYOU.
    Caps lock isn't going to get you very far.

    If you want help, please read the link in my signature on asking questions the smart way.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  19. #19
    Join Date
    Sep 2013
    Posts
    21
    Rep Power
    0

    Default Re: Give me way to understand .....My big assignment problem

    Thanks for sharing this valuable information to me. Seriously i was unaware of all this.I bookmarked it n sure follow all rules.Thanks again all of you.Finally i have to say one thing is ...Love u all.

Similar Threads

  1. Plz give me the code of following simple problem..
    By juhiswt in forum New To Java
    Replies: 3
    Last Post: 03-07-2011, 03:54 AM
  2. Replies: 8
    Last Post: 11-21-2010, 06:38 AM
  3. Java syntax I don't understand - assignment
    By poet in forum New To Java
    Replies: 2
    Last Post: 09-19-2009, 06:47 AM
  4. Replies: 0
    Last Post: 02-24-2009, 02:40 PM
  5. anyone can give idea 2 my assignment?
    By chen8735 in forum Advanced Java
    Replies: 2
    Last Post: 03-08-2008, 06:03 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •