Skip to main content
Code Review

Return to Answer

replaced http://codereview.stackexchange.com/ with https://codereview.stackexchange.com/
Source Link

I have a number of problems with your program, and amon has categorized most of them amon has categorized most of them.... but, the most significant issue is that the code does not work... at least when it comes to spares, and some un-tested input values....

There are three places it fails:

  • it does not specify a good way to declare a spare. I would have expected a token like / to indicate a spare, leading to input like:

     print score_game("5/-5/-5/-5/-5/-5/-5/-5/-5/-5/-5") . "\n"; #150
    

    But, in the absence of that token, it makes it impossible to input the 'wild' spare sequence that I would have represented as:

     print score_game("0/-0/-0/-0/-0/-0/-0/-0/-0/-0/-0") . "\n"; #100
    
  • this leads to the second issue I have, which is invalid input..... you do not handle it very well. For example, should the spare sequence have been input as:

     print score_game("010-010-010-010-010-010-010-010-010-010-0") . "\n"; #100
    

    your code strips the frame-separating - hyphen before it is sure what the frame really is.....

  • finally, your code accepts broken data as input:

     print score_game("66-66-66-66-66-66-66-66-X-X-XX") . "\n"; #156
    

I have a number of problems with your program, and amon has categorized most of them.... but, the most significant issue is that the code does not work... at least when it comes to spares, and some un-tested input values....

There are three places it fails:

  • it does not specify a good way to declare a spare. I would have expected a token like / to indicate a spare, leading to input like:

     print score_game("5/-5/-5/-5/-5/-5/-5/-5/-5/-5/-5") . "\n"; #150
    

    But, in the absence of that token, it makes it impossible to input the 'wild' spare sequence that I would have represented as:

     print score_game("0/-0/-0/-0/-0/-0/-0/-0/-0/-0/-0") . "\n"; #100
    
  • this leads to the second issue I have, which is invalid input..... you do not handle it very well. For example, should the spare sequence have been input as:

     print score_game("010-010-010-010-010-010-010-010-010-010-0") . "\n"; #100
    

    your code strips the frame-separating - hyphen before it is sure what the frame really is.....

  • finally, your code accepts broken data as input:

     print score_game("66-66-66-66-66-66-66-66-X-X-XX") . "\n"; #156
    

I have a number of problems with your program, and amon has categorized most of them.... but, the most significant issue is that the code does not work... at least when it comes to spares, and some un-tested input values....

There are three places it fails:

  • it does not specify a good way to declare a spare. I would have expected a token like / to indicate a spare, leading to input like:

     print score_game("5/-5/-5/-5/-5/-5/-5/-5/-5/-5/-5") . "\n"; #150
    

    But, in the absence of that token, it makes it impossible to input the 'wild' spare sequence that I would have represented as:

     print score_game("0/-0/-0/-0/-0/-0/-0/-0/-0/-0/-0") . "\n"; #100
    
  • this leads to the second issue I have, which is invalid input..... you do not handle it very well. For example, should the spare sequence have been input as:

     print score_game("010-010-010-010-010-010-010-010-010-010-0") . "\n"; #100
    

    your code strips the frame-separating - hyphen before it is sure what the frame really is.....

  • finally, your code accepts broken data as input:

     print score_game("66-66-66-66-66-66-66-66-X-X-XX") . "\n"; #156
    
Source Link
rolfl
  • 98.1k
  • 17
  • 219
  • 419

I have a number of problems with your program, and amon has categorized most of them.... but, the most significant issue is that the code does not work... at least when it comes to spares, and some un-tested input values....

There are three places it fails:

  • it does not specify a good way to declare a spare. I would have expected a token like / to indicate a spare, leading to input like:

     print score_game("5/-5/-5/-5/-5/-5/-5/-5/-5/-5/-5") . "\n"; #150
    

    But, in the absence of that token, it makes it impossible to input the 'wild' spare sequence that I would have represented as:

     print score_game("0/-0/-0/-0/-0/-0/-0/-0/-0/-0/-0") . "\n"; #100
    
  • this leads to the second issue I have, which is invalid input..... you do not handle it very well. For example, should the spare sequence have been input as:

     print score_game("010-010-010-010-010-010-010-010-010-010-0") . "\n"; #100
    

    your code strips the frame-separating - hyphen before it is sure what the frame really is.....

  • finally, your code accepts broken data as input:

     print score_game("66-66-66-66-66-66-66-66-X-X-XX") . "\n"; #156
    
lang-perl

AltStyle によって変換されたページ (->オリジナル) /