You are reading a single comment by @Greenbank and its replies. Click here to read the full conversation.
  • # input reading elided
    
    my %swap=( 'jmp' => 'nop', 'nop' => 'jmp' );
    
    # Part 1:
    my ( $p1_r, $p1_a ) = runcomp();
    print "Part 1: $p1_r $p1_a\n";
    
    for( my $ct=0; $ct < $psize ; $ct++ ) {
            my $old_instr = $ins[$ct];
            if( exists( $swap{$old_instr} ) ) {
                    my $new_instr = $swap{$old_instr};
                    $ins[$ct]=$new_instr;
                    my ( $ret, $acc ) = runcomp();
                    if( $ret eq "bounds" ) {
                            print "Part 2: Replacing $ct ($old_instr) with $new_instr return bounds error with acc=$acc\n";
                    }
                    $ins[$ct]=$old_instr;
            }
    }
    
    # runcomp function elided too
    
About

Avatar for Greenbank @Greenbank started