-
1 Attachment(s)
4 sensors programm
i have to solve a programm that has 4 sensors series.there is an array 10x15
with black and white cells like this Attachment 11375
the challenge is to make a programm that take as entrance a file with the result of 4 sensor seiries (black cells sensor translate as 1 ,and the white cells sensor translate as 0,so every sensor(73 totaly) give a number of the sum of ones(1) ,and the numbers are this result.
10 10 6 4 6 8 13 15 11 6 ///1 seiries of sensors
0 1 2 2 2 2 4 5 5 6 7 6 5 6 6 5 5 6 6 3 2 2 1 0///2 seiries of sensors
2 4 5 5 7 6 7 10 10 10 7 3 3 5 5///3 seiries of sensors
0 0 1 3 4 4 4 4 3 4 5 7 8 8 9 9 6 4 4 2 0 0 0 0///4 series of sensors
the exit φιλε should be a file like this
.##########....
.##########....
....######.....
......####.....
.......####..##
.......########
#####..########
###############
..#########..##
....######..... (the 1 correspond to '#' and 0 to '.'
i really need a idea of who sensors should be.
-
What have you done so far? Even if it's just allocating the arrays, we need to see that you're putting forth some effort before helping you.
-
i need help how this 73 sensors works.if only every sensor knows the sum of ones.i havent done something yet because i dont understand the logic
-
Then why do you expect help for doing absolutely nothing? I still can't understand exactly what you want because your posts make no sense... but anyway....
It's fine if you don't understand the logic, but there's still a lot you could do. First, you know that the program will use a 15x10 array, right? You also know that it will open a file, and write to a file. That doesn't take any complex logic, so, you can set that up and post it.
For the actual sensor reading, you'll have to dissect whatever format it's in, and then programatically parse it, but we'd be glad to help you with that (provided you used Google first).
-
Can't you just store the correct pattern of '#' and '.' in a 73 byte array, then read in 73 bytes from disk and do a memcmp()?
-
no,because this is the point of the programm,to produce the pattern of '#' and '.' .memcyp you have right i have to start with the simple things first
-
Ok, but how are you suppose to know where on the line the 1s are? Let's say the first sensor produce 6. It does not tell you about the layout on the row of 15 possible slots.