Changes between Version 11 and Version 12 of WikiStart


Ignore:
Timestamp:
02/25/19 17:00:19 (6 years ago)
Author:
wouter
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • WikiStart

    v11 v12  
    1818After installing and starting, go to [http://localhost:8080/partiesserver] to see if it works.
    1919
    20 Example parties can be found in the general genius repository, for example the [https://tracinsy.ewi.tudelft.nl/trac/Genius2/browser/exampleparties/randomparty randomparty]. The randomparty roughly looks like this
    21 {{{
    22 
    23 public class RandomParty extends DefaultParty {
    24         @Override
    25         public void notifyChange(Inform info) {
    26                 // System.out.println("Received info:" + info);
    27                 if (info instanceof Settings) {
    28                         fetchProfile(((Settings) info).getProfile());
    29                         this.me = ((Settings) info).getID();
    30                 } else if (info instanceof ActionDone) {
    31                         lastActor = ((ActionDone) info).getAction().getActor();
    32                         Action otheract = ((ActionDone) info).getAction();
    33                         if (otheract instanceof Offer) {
    34                                 lastReceivedBid = ((Offer) otheract).getBid();
    35                         }
    36                 } else if (info instanceof YourTurn) {
    37                         myTurn();
    38                 }
    39         }
    40 
    41         private void myTurn() {
    42                 Action action;
    43                 if (lastReceivedBid != null && profileint.getProfile()
    44                                 .getUtility(lastReceivedBid).doubleValue() > 0.6) {
    45                         action = new Accept(lastActor, lastReceivedBid);
    46                 } else {
    47                         AllBidsList bidspace = new AllBidsList(getProfile().getDomain());
    48                         long i = random.nextInt(bidspace.size().intValue());
    49                         action = new Offer(me, bidspace.get(BigInteger.valueOf(i)));
    50                 }
    51                 try {
    52                         getConnection().send(action);
    53                 } catch (IOException e) {
    54                         e.printStackTrace();
    55                 }
    56 
    57         }
    58 
    59 }
    60 }}}
     20Example parties can be found in the general genius repository, for example the [https://tracinsy.ewi.tudelft.nl/trac/Genius2/browser/exampleparties/randomparty randomparty].
    6121
    6222