Cody

Solution 785874

Submitted on 30 Nov 2015 by Alfonso Nieto-Castanon
  • Size: 200
  • This is the leading solution.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
%% global boardz boardz=[298 513 77 456 114 461 638 280 126 345 526 481 533 650 417 499 508 589 262 452 147 336 303 582 129 498 714 296 370 524 253 151 586 581 42 93 472 90 486 630 235 377 721 66 251 577 598 189 688 211 436 709 715 120 613 33 517 274 293 34 102 265 378 490 585 49 553 266 263 583 446 617 426 512 286 314 388 705 181 557 267 656 340 668 246 507 675 403 689 70 636 627 334 305 110 578 63 445 227 83 634 518 692 425 322 604 19 365 26 292 698 612 470 489 275 20 339 546 431 186 4 633 260 397 121 109 665 430 399 94 563 316 252 182 550 233 544 621 11 382 646 473 97 597 74 30 134 429 250 395 331 337 640 3 500 175 242 538 308 554 157 217 416 722 39 204 632 57 128 216 516 2 306 700 455 601 539 206 644 376 173 142 434 289 284 335 62 690 158 318 228 565 574 155 268 561 381 178 192 199 710 641 241 8 338 537 138 521 396 48 408 676 530 73 520 362 344 130 98 356 575 648 135 295 330 270 35 469 454 346 361 666 652 422 194 708 527 504 639 606 542 441 124 384 243 188 448 348 156 610 484 210 514 528 256 287 693 685 351 523 699 373 404 620 667 442 13 510 447 411 92 540 616 247 466 76 197 672 200 494 724 566 393 51 413 637 618 271 625 681 567 629 658 282 488 187 570 53 385 324 244 367 87 428 190 482 406 584 91 112 590 18 326 535 64 191 166 141 522 635 663 307 81 46 541 664 96 37 716 624 720 475 536 357 459 160 58 193 707 683 568 229 122 678 684 573 40 221 694 23 579 529 255 226 72 176 711 127 435 355 647 288 595 562 198 511 712 67 509 421 240 161 717 150 556 559 99 105 386 451 480 342 332 390 167 146 552 113 254 291 209 444 364 487 169 313 602 719 696 152 655 569 493 379 460 207 476 614 165 439 592 483 360 32 680 69 6 171 580 264 220 458 660 695 474 230 560 409 725 669 615 343 212 449 205 608 325 350 143 231 24 352 649 654 457 144 414 427 371 159 55 172 463 587 116 95 368 673 168 5 60 686 443 148 525 279 145 164 179 301 347 65 723 29 153 392 162 224 123 84 103 136 320 68 71 85 358 174 359 548 52 423 300 438 281 485 259 43 304 59 551 418 319 420 315 353 218 405 505 607 258 374 619 329 290 132 400 491 402 101 12 687 412 545 234 44 201 196 225 389 203 479 671 503 15 657 495 222 653 7 465 437 631 61 45 1 104 21 453 703 139 549 407 467 576 626 391 623 366 497 133 27 341 299 534 180 257 236 440 177 215 163 272 28 131 363 659 79 14 321 249 506 154 108 642 208 713 117 183 31 47 609 718 185 273 674 383 137 670 682 354 594 238 471 38 22 10 89 278 477 704 501 645 593 492 419 80 588 564 372 17 410 596 118 432 88 311 600 328 401 297 56 450 312 697 622 302 424 170 555 232 237 125 558 223 661 327 219 380 50 651 261 628 605 184 100 701 75 662 276 78 195 603 398 433 115 572 519 323 25 239 269 283 149 285 214 41 349 691 309 591 36 462 677 599 468 387 317 16 107 86 248 478 213 571 543 464 82 245 310 277 415 375 515 119 532 702 496 611 531 643 294 369 547 394 333 202 9 111 706 679 54 502 106 140]; board=fliplr(boardz); limit=7250; [moves vine] = solver_1D_vine(board,limit); result_expected=20244; Pass=1; btemp=board; for m=1:length(moves) btemp(moves(m,2))=btemp(moves(m,1)); btemp(moves(m,1))=0; end bvec=btemp(vine); % expected to be increasing dmin=min(bvec(2:end)-bvec(1:end-1)); result=sum(btemp(vine)) if dmin<0 fprintf('Not Pass: Non-increasing seq\n') Pass=0; end if length(moves)>limit fprintf('Not Pass: %i moves used: Limit %i\n',length(moves),limit) Pass=0; end if result<0.9*result_expected fprintf('Not Pass: Score %i Less than expected %i\n',result, 0.9*result_expected) Pass=0; end assert(isequal(Pass,1))

result = 20244

2   Pass
%% global boardz board=boardz; limit=7250; [moves vine] = solver_1D_vine(board,limit); result_expected=20244; Pass=1; btemp=board; for m=1:length(moves) btemp(moves(m,2))=btemp(moves(m,1)); btemp(moves(m,1))=0; end bvec=btemp(vine); % expected to be increasing dmin=min(bvec(2:end)-bvec(1:end-1)); result=sum(btemp(vine)) if dmin<0 fprintf('Not Pass: Non-increasing seq\n') Pass=0; end if length(moves)>limit fprintf('Not Pass: %i moves used: Limit %i\n',length(moves),limit) Pass=0; end if result<0.9*result_expected fprintf('Not Pass: Score %i Less than expected %i\n',result, 0.9*result_expected) Pass=0; end assert(isequal(Pass,1))

result = 20244

3   Pass
%% global boardz board=boardz; limit=6681; [moves vine] = solver_1D_vine(board,limit); result_expected=20167; Pass=1; btemp=board; for m=1:length(moves) btemp(moves(m,2))=btemp(moves(m,1)); btemp(moves(m,1))=0; end bvec=btemp(vine); % expected to be increasing dmin=min(bvec(2:end)-bvec(1:end-1)); result=sum(btemp(vine)) if dmin<0 fprintf('Not Pass: Non-increasing seq\n') Pass=0; end if length(moves)>limit fprintf('Not Pass: %i moves used: Limit %i\n',length(moves),limit) Pass=0; end if result<0.9*result_expected fprintf('Not Pass: Score %i Less than expected %i\n',result, 0.9*result_expected) Pass=0; end assert(isequal(Pass,1))

result = 20238

4   Pass
%% global boardz board=boardz; limit=1000; [moves vine] = solver_1D_vine(board,limit); result_expected=13048; Pass=1; btemp=board; for m=1:length(moves) btemp(moves(m,2))=btemp(moves(m,1)); btemp(moves(m,1))=0; end bvec=btemp(vine); % expected to be increasing dmin=min(bvec(2:end)-bvec(1:end-1)); result=sum(btemp(vine)) if dmin<0 fprintf('Not Pass: Non-increasing seq\n') Pass=0; end if length(moves)>limit fprintf('Not Pass: %i moves used: Limit %i\n',length(moves),limit) Pass=0; end if result<0.9*result_expected fprintf('Not Pass: Score %i Less than expected %i\n',result, 0.9*result_expected) Pass=0; end assert(isequal(Pass,1))

result = 14563

5   Pass
%% global boardz board=fliplr(boardz); limit=0; [moves vine] = solver_1D_vine(board,limit); result_expected=2564; Pass=1; btemp=board; for m=1:length(moves) btemp(moves(m,2))=btemp(moves(m,1)); btemp(moves(m,1))=0; end bvec=btemp(vine); % expected to be increasing dmin=min(bvec(2:end)-bvec(1:end-1)); result=sum(btemp(vine)) if dmin<0 fprintf('Not Pass: Non-increasing seq\n') Pass=0; end if length(moves)>limit fprintf('Not Pass: %i moves used: Limit %i\n',length(moves),limit) Pass=0; end if result<0.9*result_expected fprintf('Not Pass: Score %i Less than expected %i\n',result, 0.9*result_expected) Pass=0; end assert(isequal(Pass,1))

result = 2564

6   Pass
%% global boardz board=boardz; limit=10000; [moves vine] = solver_1D_vine(board,limit); result_expected=20244; Pass=1; btemp=board; for m=1:length(moves) btemp(moves(m,2))=btemp(moves(m,1)); btemp(moves(m,1))=0; end bvec=btemp(vine); % expected to be increasing dmin=min(bvec(2:end)-bvec(1:end-1)); result=sum(btemp(vine)) if dmin<0 fprintf('Not Pass: Non-increasing seq\n') Pass=0; end if length(moves)>limit fprintf('Not Pass: %i moves used: Limit %i\n',length(moves),limit) Pass=0; end if result<0.9*result_expected fprintf('Not Pass: Score %i Less than expected %i\n',result, 0.9*result_expected) Pass=0; end assert(isequal(Pass,1))

result = 20244