Skip to content

3 test cases for exercise "Connect" are wrong #107

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
khoguan opened this issue Mar 26, 2016 · 3 comments
Closed

3 test cases for exercise "Connect" are wrong #107

khoguan opened this issue Mar 26, 2016 · 3 comments

Comments

@khoguan
Copy link

khoguan commented Mar 26, 2016

Hello,

in the exercise "Connect", the 4th test case is:

test("convoluted path") {
    val lines = List(". X X . ."
                    ," X . X . X"
                    ,"  . X . X ."
                    ,"   . X X . ."
                    ,"    O O O O O")
    Connect(mkBoard(lines)).result should be (Some(Color.Black))
  }

There are 9 X's but only 5 O's. Then the X player (Black) must have cheated! A cheater should not win.

The 5th test case is:

test("rectangle - black wins") {
    val lines = List(". O . ."
                    ," O X X X"
                    ,"  O X O ."
                    ,"   X X O X"
                    ,"    . O X .")
    Connect(mkBoard(lines)).result should be (Some(Color.Black))
  }

There are 8 X's but only 6 O's. The player X must have cheated. In addition, there are 5 rows but only 4 columns. The numbers of the rows and the columns should be the same to be fair for the two players. The 6th test case has the same problem with 5 rows but 4 columns:

 test("rectangle - white wins") {
    val lines = List(". O . ."
                    ," O X X X"
                    ,"  O O O ."
                    ,"   X X O X"
                    ,"    . O X .")
    Connect(mkBoard(lines)).result should be (Some(Color.White))
  }

By the way, with the current unreasonable test cases, I have still written my code by the rules to pass all of the tests. But these are unfair games.

I really appreciate all of your kind efforts to establish and maintain this wonderful website. I have learned a lot by doing the exercises and from other programmers' comments.

@ricemery
Copy link
Member

Thanks. I notice that the same test cases are included in other language tracks. The Go and Haskell Connect exercises also have these same test case. I'll have to check to see how to proceed. We should probably be consistent..

Thanks again.

@kytrinyx : Could you weigh in on if this issue should be addressed in all the language tracks that implement Connect (or not addressed at all)?

@kytrinyx
Copy link
Member

@ricemery I think we should move this discussion to the x-common repository, figure out what the generic "right answer" is, and then write up an issue that can be submitted to all the affected language tracks.

I'll go ahead and copy the relevant part of the discussion over to x-common.

@kytrinyx
Copy link
Member

I've posted it here: exercism/problem-specifications#212 -- I'm closing this, and we can continue the discussion there. Thanks for bringing this up!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants