Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Re: Choosing a data structure for AI applications

by mattr (Curate)
on Jul 17, 2002 at 13:45 UTC ( #182425=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download

  1. or download this
    %actor = (     merlyn=>1, kudra=>1, ovid=>1, badguy=>1      );
    %thing = (    gold=>50, pocketLint=>0.01,
            cheapWhiskey=>-20, dominationFund=>10E10 );
    $actor{merlyn}{owns} = {gold=>1};
    $actor{kudra}{owns}  = {dominationFund=>1};
    $actor{ovid}{owns}   = {pocketLint=>1, cheapWhiskey=>1};
  2. or download this
    $x = any($actor); $y = any($thing);
    &rich($x) if (&owns($x,$y) and &isvaluable($y));
  3. or download this
    if ($x{owns}{$y} && $thing{$y}{value}>20) { print "The badguy will ste
    +al $x\'s $y.\n"; }
    if ($item{value} > 20) { print "The badguy will steal from $potentialv
    +ictim\n"; } 
    if (  $(any(@{$x->{owns}})){value} > 20) { print "badguy will steal fr
    +om $x\n"; }
    $isvaluable = sub ($)  { my $x=shift; $x->{value} > 20 ? 0 : 1; };
  4. or download this
    $x = wave(keys %actor); $y = wave(keys %thing);
    $item = wave($actor{$x}{owns}->{$y});
  5. or download this
    sub wave { # given an array, return entanglement of elements 
     my @k = @_; my $n;
     foreach (@k) { push(@n,(1,$_)); } # every element is 100% probable
     return entangle @n;

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://182425]
[holli]: are you sure? or are they mere prjections of my hallucinating mind?
shmem feels uneasy over his guess of the tune for silent night, perl 6 night
[holli]: https://www. v=6H_9QEc6vA8
[holli]: meh, silent night
[holli]: also sad
[shmem]: halluzination beats newspaper in realism, sometimes

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2017-09-22 20:53 GMT
Find Nodes?
    Voting Booth?
    During the recent solar eclipse, I:

    Results (269 votes). Check out past polls.