Would the first row be row 0 or 1? If 0 then you'd basically just have to convert the row number to its binary representation, e.g. if you have 3 boolean variables do something like
0 -> 0 0 0
1 -> 0 0 1
2 -> 0 1 0
3 -> 0 1 1
...
Then use those bits and your truth function to calculate the result.