Mathematica 9 is now available
Student Support Forum
Student Support Forum: 'Applying boolean condition to a list' topicStudent Support Forum > General > "Applying boolean condition to a list"

Next Comment >Help | Reply To Topic
Author Comment/Response
Jonathan Wooldridge
07/16/07 03:00am

I have a pair of lists representing plays in a two player game. My score function counts the number of pair-ups where player has more than enemy:

player = {17, 3, 17, 3, 17, 3, 17, 3, 17, 3, 64};
score[enemy_]:= Count[player-enemy, x_/;x>0];

Which I then map across a list of player strategies like so:
totalScore = Map[score, strategySet]//Sort//Tally

What I want to do next is score[player_,enemy_], but how do I Map that across the strategySet?

More technically, if x and y are integer lists (of same length) how can can I map f[x,y] across a list of values for y?


Subject (listing for 'Applying boolean condition to a list')
Author Date Posted
Applying boolean condition to a list Jonathan Woo... 07/16/07 03:00am
Re: Applying boolean condition to a list yehuda ben-s... 07/23/07 00:30am
Next Comment >Help | Reply To Topic