MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

How to Map[ f[x,y], {y}]?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg79045] How to Map[ f[x,y], {y}]?
  • From: AngleWyrm <anglewyrm at yahoo.com>
  • Date: Tue, 17 Jul 2007 03:16:46 -0400 (EDT)

Hi,
I've got two lists of integers representing player strategies in a game.
  
I've defined a score function which counts the number of pair-ups where 
the player came out ahead, like so:

strategy = {17, 3, 17, 3, 17, 3, 17, 3, 17, 3}; (* player's plan *)
score[enemy_]:= Count[strategy - enemy, x_/;x>0];

and I get a total score by comparing a player's strategy against a list of  
possible enemy strategies:
totalScore = Map[score, strategies] //Sort //Tally
ListLinePlot[totalScore,{Filling->Axis}]


What I want to do next is create a new version of the scoring function, 
with an interface like: score[p1_, p2_]. Then I want to Map each player's  
strategy against the enemies, and see how they do.

Where I run into problem is how do I Map score[p1,p2] so that p2 is drawn  
 from a list of strategies? Something like Map[ score[p1,p2], strategyList].

Second question is: Is it possible to somehow thread both across the  
strategyList?

-- 

AngleWyrm


  • Prev by Date: Re: Odd little Bessel function quirk
  • Next by Date: Re: Copying cells in simple text form?
  • Previous by thread: Re: Odd little Bessel function quirk
  • Next by thread: Re: How to Map[ f[x,y], {y}]?