Cody

Rafael Siqueira Telles Vieira

125
Rank
30
Badges
5905
Score
1 – 50 of 784

Rafael Siqueira Telles Vieira submitted a Comment to Problem 44374. Tautology

It would be a good measure to add operator precedence to the problem description since the author is requesting a parser. We cannot assume every language is the same. Imho, a tautology is true regardless of the order that we evaluate it such as A|~A or ~0. If there is a way to make it false, then it is not a tautology. And different languages may evaluate it differently.

2 hours and 25 minutes ago

Rafael Siqueira Telles Vieira submitted a Comment to Problem 44343. Pair Primes

Good problem. At first, I thought we needed to reverse the numbers, but only their order is necessary. And we need to count twice numbers like 31 and 13.

2 hours and 41 minutes ago

Rafael Siqueira Telles Vieira submitted a Comment to Problem 337. Number of toolboxes?

The answer should be 0. It is written on the FAQ: "Cody supports MATLAB and not the toolboxes".

23 hours and 7 minutes ago

Rafael Siqueira Telles Vieira submitted a Comment to Problem 44337. Sums of Distinct Powers

It is not clear at all, James, that we must sum all possible unique combinations of exponents for a base. However, it is a good problem.

23 hours and 13 minutes ago

Rafael Siqueira Telles Vieira submitted a Comment to Problem 44337. Sums of Distinct Powers

The problem wants all unique combinations of distinct powers of a given base up to a point. If we forget some factors it will overflow, if we repeat sequences, their sum will not match the test cases. that means 0 1 2 3 1 0 2 0 2 1 3 0 3 1 3 2 2 1 0 3 1 0 3 2 0 3 2 1 and so on (and resulting numbers must be sorted if we are not following their natural order)

23 hours and 20 minutes ago

Rafael Siqueira Telles Vieira submitted a Comment to Problem 44365. An asteroid and a spacecraft

An interesting test case, for instance, would be (that my solution and many others would fail): p0 = [1, 0, 0]; p1 = [ -1, 0, 0]; p2 = [ 0, 1, 0.5]; p3 = [ 0, -1, 0.5]; t0 = 0; t1 = 1; d = 1; ok = false; At half-way their path, asteroid and spacecraft will be at distance 0.5 of each other, violating the safe distance d=1, and without crossing paths.

on 8 Jul 2020 at 17:19

Rafael Siqueira Telles Vieira submitted a Comment to Problem 44365. An asteroid and a spacecraft

This problem needs more test cases. My solution probably is not general, but it works without using all of its tests.

on 8 Jul 2020 at 17:01

Rafael Siqueira Telles Vieira submitted a Comment to Solution 1325665

It is not a general solution. It would fail on: x = [ 1 1 -1; -1 1 -1; -1 1 0]; y_correct = 0; PS: The game ended but O kept on playing.

on 8 Jul 2020 at 7:14

Rafael Siqueira Telles Vieira submitted a Comment to Problem 44382. Parse me a Lisp

Good problem, and better than 44374. Precedence is clear.

on 8 Jul 2020 at 2:40

Rafael Siqueira Telles Vieira submitted a Comment to Solution 1321395

Using str2num is a hack to bypass the rules that forbid using eval.

on 7 Jul 2020 at 23:14

Rafael Siqueira Telles Vieira submitted a Comment to Solution 1321278

It is correct because of A|~A, the other letters won't matter since is a or.

on 7 Jul 2020 at 23:13

Rafael Siqueira Telles Vieira submitted a Comment to Solution 1297342

Although is a creative solution, the function str2num should be banished from Cody since eval is not allowed.

on 7 Jul 2020 at 23:09

Rafael Siqueira Telles Vieira submitted a Comment to Problem 44374. Tautology

This question ignores operator precedence, and imho that's just evil. All compilers that I know of use operator precedence because if they don't that leads to contradictions. Test cases 49 & 51 demonstrates this: (1|A&0) is a tautology only if evaluated from right to left (1|0 -> 1, but 1&0 -> 0), and (A&~A|1) is a tautology only if evaluated from left to right (0|1 -> 1, but A & 1 -> 0). Assuming that & and I have the same precedence.

on 7 Jul 2020 at 22:13

Rafael Siqueira Telles Vieira submitted a Comment to Problem 281. Acid and water

And I agree that more test cases should be added, besides improving its description. In Cody, there are broken tests. So we can never be sure at times wether our code or the test set is bogus.

on 6 Jul 2020 at 1:58

1 – 50 of 784