
-----------------------------------
CodeMonkey2000
Sat Dec 08, 2007 1:51 am

Help with test cases. [Pascal]
-----------------------------------
I was attempting one of the problems from the UVa site, and the judge kept telling me that my program was giving the wrong answer. uses crt;

var   field:array

-----------------------------------
HeavenAgain
Sat Dec 08, 2007 8:49 am

RE:Help with test cases. [Pascal]
-----------------------------------
try the following test case, i dont know about pascal, but the 2 string array (looks like it) arent really necessary, you just need 1 2-d int array
6 10
****..**.*
.**.....*.
**...****.
..***.*.**
**.*..*.*.
*..*...***
4 3
.*.
***
.*.
*.*
1 2
*.
7 1
.
.
.
.
*
*
. 
0 0Field #1:
****11**3*
5**32356*3
**543****4
45***5*7**
**5*43*6*5
*33*212***
//////////////////////blank line
Field #2:
3*3
***
4*4
*3*
///////////////blank line
Field #3:
*1
//////////////////////blank line
Field #4:
0
0
0
1
*
*
1
if field
something looks wrong with that line (if i understand it correctly) what if the line doesnt begin with a '.'?
hint: what i think you should do is, read line by line (turn them into int) of the field, if is a '.' leave it, else if it is a '*' make it -1, and now you have a field of bombs in a 2-d int array, and read line by line again (int array) if is 0 leave it, else if it a -1 then increase its sourrounding by 1, BUT be sure not to increase any -1
and for your output case, after each case there should be a blank line, but not the first case, there ;) gl

-----------------------------------
CodeMonkey2000
Sat Dec 08, 2007 11:08 am

RE:Help with test cases. [Pascal]
-----------------------------------
Your test cases didn't work, but I know why, it's because of the inBounds function. It looked at values that weren't in the scope of my current array. 

if field[x][y]='.' then
begin
count:=0;
Oh and field is a single dimensional string array. The second identifier just states what part of the string I should look at. And remember, '.' is an open field, if there is open field, check around for mines, or else draw a mine. Count is the number of mines.

It still doesn't like it.
Here is an executable.

-----------------------------------
HeavenAgain
Sat Dec 08, 2007 7:19 pm

RE:Help with test cases. [Pascal]
-----------------------------------
well, its pretty obvious that you dont have to care about the '.', and your focus is on the '*', therefore if you see a '*' you increase its surounding by 1 (but check if there is another '*'). thats it, what do you have problem with? o_O

Er exe files... when you output its impossibile for human eyes (me) to catch it. so i dont know the output so yea... i cant test it and see your output

and ill just repeat my little hint again :p

hint: read each case by the whole, each line you read (input lines) turn them into int 2-d array, if is a '.' then just leave it (because by default int array is 0), else if it is a '*' make the array position of it into -1, and now you have a field of bombs in a 2-d int array, and read line by line again (int array) if is 0 leave it, else if it a -1 then increase its sourrounding by 1, BUT be sure not to increase any -1
and for your output case, after each case there should be a blank line, but not the first case

-----------------------------------
CodeMonkey2000
Sat Dec 08, 2007 9:21 pm

RE:Help with test cases. [Pascal]
-----------------------------------
My problem is that the judge keeps telling me it's outputting the wrong answer. I tested it with the sample case and your case, and it works fine. So now I'm trying to find out which case it doesn't work for. And it's really frustrating. 

Oh did you try to run it from command prompt?

-----------------------------------
HeavenAgain
Sat Dec 08, 2007 9:26 pm

RE:Help with test cases. [Pascal]
-----------------------------------
yea i just double clicked your program... and for that, i think some judge are picky with answers, dont leave any extra space or any blank lines at the end, sometimes thats the case? and check your out put format i guess :roll:

and whats a better way to acually see your output... i enver used pascal :(

-----------------------------------
CodeMonkey2000
Sat Dec 08, 2007 9:45 pm

RE:Help with test cases. [Pascal]
-----------------------------------
Open the exe from command prompt. Like how you run C++ exes. I don't think it is a formatting error, I played around with that a lot. Back in my day we use to read from text file and output to text files. And that's the way we liked it. Little to no formation involved.

-----------------------------------
HeavenAgain
Sat Dec 08, 2007 9:55 pm

RE:Help with test cases. [Pascal]
-----------------------------------
dam it, its really hard to see, you have the right answer, but I think, you are printing out a blank line fore Field #x: you did that for the first line and the last line?
if the test case were
1 1
.
2 2
..
..
0 0
yours output
/////blankline 0)&&(x0)&&(y