Problem 53840. Backgammon #3 - Display a Board Position
There are a couple problems with the tests. The "correct" result listed in test #4 has an error in it. One of the B's down the centerline in an 'X'. Also, the importdata() command used in test #5 seems to fail.
Hi @William, many thanks for attempting this problem. The result in the test suite for test 4 is correct. The Bs down the centreline represent the Bar, and that test case has one of red's stones on the bar (-1 in the Board vector's 26th element), so the 'X' on the Bar is correct and represents that stone. This case is shown in the second example of the problem description, where you also see the 'X' on the Bar. As for the importdata() function, I'm not sure why that failed for you, but it must have been a Cody glitch, because it seems to work OK for me now (I submitted a dummy solution to test that case, which passed). Maybe you can try again? Regards, Mark
@William, just to follow up on the last point; I have investigated further and indeed you are correct that the importdata() function fails for your code (but not my reference solution!). I can't immediately see why this is. Test 5 was intended as an 'anti-cheating' test but is perhaps not needed for this problem, so I've removed test 5 for now. If others try to game the problem by cheating I'll have another think about how to block those solutions! If you can fix your code to pass test 4 then I think you'll now get a working solution. Regards, Mark
Mark, Thanks for the explanation! I have never played Backgammon, so this is a good learning opportunity for me. My modified code now passes all the tests, including an uncommented version of test #5.
Solution CommentsShow comments
Problem Recent Solvers2
Find common elements in matrix rows
Test if a Number is a Palindrome without using any String Operations
Basic electricity in a dry situation
Find the Kronecker Tensor Product without using KRON
mathematics , probability problem
More from this Author17
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!