Positive {{ public double getResult(Claim claim, List replies){ double claimedQuality = claim.getQuality(); if(replies.length() == 2){ ProvideResponse provideResponse = (ProvideResponse)replies.lookup(0); if(provideResponse.getInstance() == null){ provideResponse.getInstance().finishParse(); } HSRInstance i = (HSRInstance)provideResponse.getInstance().getInstance(); SolveResponse solveResponse = (SolveResponse)replies.lookup(1); Solution solution = solveResponse.getSolution(); if(solution.getSolution() == null){ solution.finishParse(); } if(i.valid(solution)== 1){ if(i.quality(solution) <= claimedQuality){ return 1; //Refutation fails. Alice wins } } } return 0; //Draw } public ProtocolSpec getProtocolSpec(){ return Positive.protocolSpec; } static ProtocolSpec protocolSpec; static{ try{ ProtocolSpec.parse( "instance from Bob " + "solution of 0 from Alice " ); }catch(Exception ex){ ex.printStackTrace(); } } }} Negative {{ public double getResult(Claim claim, List replies){ double claimedQuality = claim.getQuality(); if(replies.length() == 2){ ProvideResponse provideResponse = (ProvideResponse)replies.lookup(0); if(provideResponse.getInstance() == null){ provideResponse.getInstance().finishParse(); } HSRInstance i = (HSRInstance)provideResponse.getInstance().getInstance(); SolveResponse solveResponse = (SolveResponse)replies.lookup(1); Solution solution = solveResponse.getSolution(); if(solution.getSolution() == null){ solution.finishParse(); } if(i.valid(solution)== 1){ if(i.quality(solution) <= claimedQuality){ return -1; //Refutation succeeds. Bob wins } } } return 0; //Draw } public ProtocolSpec getProtocolSpec(){ return Negative.protocolSpec; } static ProtocolSpec protocolSpec; static{ try{ ProtocolSpec.parse( "instance from Alice " + "solution of 0 from Bob " ); }catch(Exception ex){ ex.printStackTrace(); } } }}