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

1. Member
Join Date
Sep 2013
Posts
20
Rep Power
0

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.

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;

String[] board  = new String[9];
for(int i=0; i < 9; i++) {
}

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. 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.

3. Member
Join Date
Sep 2013
Posts
20
Rep Power
0

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. Member
Join Date
Sep 2013
Posts
20
Rep Power
0

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

will u plz help to solve this problem

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

Originally Posted by codequicker@yahoo.com
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.

6. Just a guy
Join Date
Jun 2013
Location
Netherlands
Posts
5,114
Rep Power
9

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

Originally Posted by codequicker@yahoo.com
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.

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

I see what your problem is: this code is C# not Java.

8. Just a guy
Join Date
Jun 2013
Location
Netherlands
Posts
5,114
Rep Power
9

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

Originally Posted by SurfMan
I see what your problem is: this code is C# not Java.
Right, that settles it - I need glasses.

9. ▼ dafuq did I do?
Join Date
Dec 2013
Posts
204
Rep Power
0

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

Originally Posted by SurfMan
I see what your problem is: this code is C# not Java.

10. Member
Join Date
Sep 2013
Posts
20
Rep Power
0

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. Member
Join Date
Sep 2013
Posts
20
Rep Power
0

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. Re: Give me way to understand .....My big assignment problem

Originally Posted by codequicker@yahoo.com
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?

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

Apparently this is from here: https://www.hackerrank.com/challenges/hip

14. Member
Join Date
Sep 2013
Posts
20
Rep Power
0

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. Just a guy
Join Date
Jun 2013
Location
Netherlands
Posts
5,114
Rep Power
9

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.

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

Originally Posted by codequicker@yahoo.com
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.

17. Member
Join Date
Sep 2013
Posts
20
Rep Power
0

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. Re: Give me way to understand .....My big assignment problem

Originally Posted by codequicker@yahoo.com
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.

19. Member
Join Date
Sep 2013
Posts
20
Rep Power
0

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.

Posting Permissions

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