(* The Double(Common Outcry) Auction: Zero Intelligent Traders *) history1 = {{0, 7, 2.06}, {2, 0, 4.940000000000001}, {4, 0, 2.75}, {0, 3, 2.35}, {4, 1, 2.75}, {0, 3, 2.6}, {1, 0, 5.8}, {0, 4, 2.8}} candidate1 = Join[history1, {{0, 4, 2.4}}] message[candidate1] candidate2 = Join[history1, {{0, 5, 3.4}}] message[candidate2] candidate3 = Join[history1, {{3, 0, 4.0}}] message[candidate3] candidate4 = Join[history1, {{1, 0, 2.3}}] message[candidate4] zitbuy[v_] := Random[Real, {0, v}] zitbuy[3] zitsell[c_] := Random[Real, {c, 12}] zitsell[4] bidoffer[values_, costs_] := Module[{d1}, d1 = Random[Integer, {1, Length[values] + Length[costs]}]; k = If[d1 <= Length[values], {0, d1, zitbuy[values[[d1]]]}, {d1 - Length[values], 0, zitsell[costs[[d1 - Length[values]]]]}]; Return[k]] values = {5, 4, 3, 2, 1}; costs = {2, 7, 8, 9}; hist = {{1, 0, 12}, {0, 2, 0}} newhist = Join[hist, {bidoffer[values, costs]}] message[newhist] histor[1] = hist = {{1, 0, 12}, {0, 2, 0}} histor[t_] := histor[t] = message[Join [histor[t - 1], {bidoffer[values, costs]}]] histor[2] hist = Table[histor[j], {j, 2, 800}]; trade = Function[x, ! x[[1]] == 0 && ! x[[2]] == 0] Select[hist[[799]], trade]