Changes between Version 188 and Version 189 of WikiStart
- Timestamp:
- 06/03/19 16:50:11 (5 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
WikiStart
v188 v189 117 117 @Override 118 118 public void notifyChange(Inform info) { 119 // System.out.println("Received info:" + info);120 119 if (info instanceof Settings) { 121 fetchProfile(((Settings) info).getProfile()); 122 this.me = ((Settings) info).getID(); 120 Settings settings = (Settings) info; 121 profileint = getProfile(settings.getProfile().getURI()); 122 this.me = settings.getID(); 123 this.progress = settings.getProgress(); 123 124 } else if (info instanceof ActionDone) { 124 lastActor = ((ActionDone) info).getAction().getActor();125 125 Action otheract = ((ActionDone) info).getAction(); 126 126 if (otheract instanceof Offer) { … … 129 129 } else if (info instanceof YourTurn) { 130 130 myTurn(); 131 if (progress instanceof ProgressRounds) { 132 progress = ((ProgressRounds) progress).advance(); 133 } 134 } else if (info instanceof Finished) { 135 getReporter().log(Level.INFO, "Final ourcome:" + info); 131 136 } 132 137 } 133 138 139 134 140 private void myTurn() { 135 Action action;136 141 if (lastReceivedBid != null && profileint.getProfile() 137 142 .getUtility(lastReceivedBid).doubleValue() > 0.6) { 138 action = new Accept( lastActor, lastReceivedBid);143 action = new Accept(me, lastReceivedBid); 139 144 } else { 140 AllBidsList bidspace = new AllBidsList(getProfile().getDomain()); 145 // for demo. Obviously full bids have higher util in general 146 AllPartialBidsList bidspace = new AllPartialBidsList( 147 profileint.getProfile().getDomain()); 141 148 long i = random.nextInt(bidspace.size().intValue()); 142 149 action = new Offer(me, bidspace.get(BigInteger.valueOf(i))); 143 150 } 144 151 getConnection().send(action); 152 145 153 } 146 154