| [ Team LiB ] |
9.2 Ad-hoc Code GenerationUnix comes equipped with some powerful special-purpose code generators for purposes like building lexical analyzers (tokenizers) and parsers; we'll survey these in Chapter 15. But there are much simpler, lighter-weight sorts of code generation we can use to make life easier without having to know any compiler theory or write (error-prone) procedural logic. Here are a couple of simple case studies to illustrate this point: 9.2.1 Case Study: Generating Code for the ascii DisplaysCalled without arguments, ascii generates a usage screen that looks like Example 9.5. Example 9.5 ascii usage screen.Usage: ascii [-dxohv] [-t] [char-alias...] -t = one-line output -d = Decimal table -o = octal table -x = hex table -h = This help screen -v = version information Prints all aliases of an ASCII character. Args may be chars, C \-escapes, English names, ^-escapes, ASCII mnemonics, or numerics in decimal/octal/hex. Dec Hex Dec Hex Dec Hex Dec Hex Dec Hex Dec Hex Dec Hex Dec Hex 0 00 NUL 16 10 DLE 32 20 48 30 0 64 40 @ 80 50 P 96 60 ` 112 70 p 1 01 SOH 17 11 DC1 33 21 ! 49 31 1 65 41 A 81 51 Q 97 61 a 113 71 q 2 02 STX 18 12 DC2 34 22 " 50 32 2 66 42 B 82 52 R 98 62 b 114 72 r 3 03 ETX 19 13 DC3 35 23 # 51 33 3 67 43 C 83 53 S 99 63 c 115 73 s 4 04 EOT 20 14 DC4 36 24 $ 52 34 4 68 44 D 84 54 T 100 64 d 116 74 t 5 05 ENQ 21 15 NAK 37 25 % 53 35 5 69 45 E 85 55 U 101 65 e 117 75 u 6 06 ACK 22 16 SYN 38 26 & 54 36 6 70 46 F 86 56 V 102 66 f 118 76 v 7 07 BEL 23 17 ETB 39 27 ' 55 37 7 71 47 G 87 57 W 103 67 g 119 77 w 8 08 BS 24 18 CAN 40 28 ( 56 38 8 72 48 H 88 58 X 104 68 h 120 78 x 9 09 HT 25 19 EM 41 29 ) 57 39 9 73 49 I 89 59 Y 105 69 i 121 79 y 10 0A LF 26 1A SUB 42 2A * 58 3A : 74 4A J 90 5A Z 106 6A j 122 7A z 11 0B VT 27 1B ESC 43 2B + 59 3B ; 75 4B K 91 5B [ 107 6B k 123 7B { 12 0C FF 28 1C FS 44 2C , 60 3C < 76 4C L 92 5C \ 108 6C l 124 7C | 13 0D CR 29 1D GS 45 2D - 61 3D = 77 4D M 93 5D ] 109 6D m 125 7D } 14 0E SO 30 1E RS 46 2E . 62 3E > 78 4E N 94 5E ^ 110 6E n 126 7E ~ 15 0F SI 31 1F US 47 2F / 63 3F ? 79 4F O 95 5F _ 111 6F o 127 7F DEL This screen is carefully designed to fit in 23 rows and 79 columns, so that it will fit in a 24x80 terminal window. This table could be generated at runtime, on the fly. Grinding out the decimal and hex columns would be easy enough. But between wrapping the table at the right places and knowing when to print mnemonics like NUL rather than characters, there would have been enough odd corner cases to make the code distinctly unpleasant. Furthermore, the columns had to be unevenly spaced to make the table fit in 79 columns. But any Unix programmer would reflexively express it as a block of data before finding out these things. The most naïve way to generate the usage screen would have been to put each line into a C initializer in the ascii.c source code, and then have all lines be written out by code that steps through the initializer. The problem with this method is that the extra data in the C initializer format (trailing newline, string quotes, comma) would make the lines longer than 79 characters, causing them to wrap and making it rather difficult to map the appearance of the code to the appearance of the output. This, in turn, would make the display difficult to edit, which was annoying when I was tinkering it to fit in 24x80 screen cells. A more sophisticated method using the string-pasting behavior of the ANSI C preprocessor collided with a variant of the same problem. Essentially, any way of inlining the usage screen explicitly would involve punctuation at start and end of line that there's no room for.[2] And copying the table to the screen from a file at runtime seemed like a fragile expedient; after all, the file could get lost.
Here's the solution. The source distribution contains a file that just contains the usage screen, exactly as listed above and named splashscreen. The C source contains the following function: void showHelp(FILE *out, char *progname) { fprintf(out,"Usage: %s [-dxohv] [-t] [char-alias...]\n", progname); #include "splashscreen.h" exit(0); } And splashscreen.h is generated by a makefile production: splashscreen.h: splashscreen sed <splashscreen >splashscreen.h \ -e 's/\\/\\\\/g' -e 's/"/\\"/' -e 's/.*/puts("&");/' So when the program is built, the splashscreen file is automatically massaged into a series of output function calls, which are then included by the C preprocessor in the right function. By generating the code from data, we get to keep the editable version of the usage screen identical to its display appearance. This promotes transparency. Furthermore, we could modify the usage screen at will without touching the C code at all, and the right thing would automatically happen on the next build. For similar reasons, the initializer that holds the name synonym strings is also generated via a sed script in the makefile, from a file called nametable in the ascii source distribution. Most of nametable is simply copied into the C initializer. But the generation process would make it easy to adapt this tool for other 8-bit character sets such as the ISO-8859 series (Latin-1 and friends). This is an almost trivial example, but it nevertheless illustrates the advantages of even simple and ad-hoc code generation. Similar techniques could be applied to larger programs with correspondingly greater benefits. 9.2.2 Case Study: Generating HTML Code for a Tabular ListLet's suppose that we want to put a page of tabular data on a Web page. We want the first few lines to look like Example 9.6. Example 9.6 Desired output format for the star table.Aalat David Weber The Armageddon Inheritance Aelmos Alan Dean Foster The Man who Used the Universe Aedryr Steve Miller/Sharon Lee Scout's Progress Aergistal Gerard Klein The Overlords of War Afdiar L. Neil Smith Tom Paine Maru Agandar Donald Kingsbury Psychohistorical Crisis Aghirnamirr Jo Clayton Shadowkill The thick-as-a-plank way to handle this would be to hand-write HTML table code for the desired appearance. Then, each time we want to add a name, we'd have to hand-write another set of
 and  tags for the entry. This would get very tedious very quickly. But what's worse, changing the format of the list would require hand-hacking every entry. The superficially clever way to handle this would be to make this data a three-column relation in a database, then use some fancy CGI[3] technique or a database-capable templating engine like PHP to generate the page on the fly. But suppose we know that the list will not change very often, don't want to run a database server just to be able to display this list, and don't want to load the server with unnecessary CGI traffic?
There's a better solution. We put the data in a tabular flat-file format like Example 9.7. Example 9.7 Master form of the star table.Aalat :David Weber :The Armageddon Inheritance Aelmos :Alan Dean Foster :The Man who Used the Universe Aedryr :Steve Miller/Sharon Lee :Scout's Progress Aergistal :Gerard Klein :The Overlords of War Afdiar :L. Neil Smith :Tom Paine Maru Agandar :Donald Kingsbury :Psychohistorical Crisis Aghirnamirr :Jo Clayton :Shadowkill We could in a pinch have done without the explicit colon field delimiters, using the pattern consisting of two or more spaces as a delimiter, but the explicit delimiter protects us in case we press spacebar twice while editing a field value and fail to notice it. We then write a script in shell, Perl, Python, or Tcl that massages this file into an HTML table, and run that each time we add an entry. The old-school Unix way would revolve around the following nigh-unreadable sed(1) invocation sed -e 's,^,
,' -e 's,$,
,' -e 's,:,	,g' or this perhaps slightly more scrutable awk(1) program: awk -F: '{printf("
%s	%s	%s
\n", \ $1, $2, $3)}' (If either of these examples interests but mystifies, read the documentation for sed(1) or awk(1). We explained in Chapter 8 that the latter has largely fallen out of use. The former is still an important Unix tool that we haven't examined in detail because (a) Unix programmers already know it, and (b) it's easy for non-Unix programmers to pick up from the manual page once they grasp the basic ideas about pipelines and redirection.) A new-school solution might center on this Python code, or on equivalent Perl: for row in map(lambda x:x.rstrip().split(':'),sys.stdin.readlines()): print "
" + "	".join(row) + "
" These scripts took about five minutes each to write and debug, certainly less time than would have been required to either hand-hack the initial HTML or create and verify the database. The combination of the table and this code will be much simpler to maintain than either the under-engineered hand-hacked HTML or the over-engineered database. A further advantage of this way of solving the problem is that the master file stays easy to search and modify with an ordinary text editor. Another is that we can experiment with different table-to-HTML transformations by tweaking the generator script, or easily make a subset of the report by putting a grep(1) filter before it. I actually use this technique to maintain the Web page that lists fetchmail test sites; the example above is science-fictional only because publishing the real data would reveal account usernames and passwords. This was a somewhat less trivial example than the previous one. What we've actually designed here is a separation between content and formatting, with the generator script acting as a stylesheet. (This is yet another mechanism-vs.-policy separation.) The lesson in all these cases is the same. Do as little work as possible. Let the data shape the code. Lean on your tools. Separate mechanism from policy. Expert Unix programmers learn to see possibilities like these quickly and automatically. Constructive laziness is one of the cardinal virtues of the master programmer. |
| [ Team LiB ] |


Hack Princetion, Fall 2019
By: Andrew Ippoliti
Git is a distributed version-control system for tracking changes in source code during software development. It is designed for coordinating work among programmers, but it can be used to track changes in any set of files. Its goals include speed, data integrity, and support for distributed, non-linear workflows.
or
apt-get install git
git config --global user.name "Your name"
git config --global user.email<EMAIL_ADDRESS>1. Create it on GitHub (or your provider)
2.


--- layout: default title: Collaboration permalink: / ---
The top 50 connections between organizations over the last two years.
A connection between two organizations is rated higher the more people contribute to both organizations. Users are considered members of an organization if the majority of their pushes were made to this organization.
The depicted collaboration is especially meaningful if the affected organizations cover different topics. If two organizations cover the same topic (for example, an organization foo-server and an organization foo-client), then the collaboration is less meaningful.
In this situation, it might be a good idea to consolidate the two organizations into one (in this example, foo).


{% extends "base.html" %}
{% block body %}
{% include "navbar.html" %}
Please pay $5.00 to use the service
For testing purposes, please use the following information:
-
Email<EMAIL_ADDRESS>-
Credit Card Number:<PHONE_NUMBER>424242
-
Expiry Date: 01/20
-
CVC: 000
{% endblock %}
{% block scripts %}
{% endblock %}


STRICTLY BALLROOM A film review by Max Hoffmann Copyright 1993 Max Hoffmann
RATING = 10 (scale of 0 -> 10, 10 = must see) Australian, (general distribution in Australia August 1992.) No nudity, little profanity, no violence.
Why would anyone want to go to a film about the cut-throat, competitive world of ballroom dancing, that some critics might be tempted to label as a cross between DIRTY DANCING and FLASHDANCE?
If PRETTY WOMAN is your favorite film, go for the costumes, the dancing and the terrific hairstyles. If you lean towards THE PLAYER, go see this film for the touching parable of growing up, and overcoming repressive unquestioned "traditional values." But most of all, go because the film is a gift: a thoroughly Aussie maverick that kicks up its heels at film-making conventions, and has some great comedy and dancing to boot.
The film's slight plot grew from a fifty-minute Australian stage play, that started out as a student project at NIDA (National Institute for the Dramatic Arts). It toured Oz to great acclaim and won awards at an international competition in Czechoslovakia. The Aussie producers were unable to convince overseas distributors of financiers to help fund the film, so they turned to their own devices for fund-raising, and made it "their way."
Though lacking stars of any renown in North America, STRICTLY BALLROOM is a thoroughly engaging film chock full of Oscar-worthy supporting performances, terrific dancing, comedy drawn in brush strokes broad enough to make Monty Python envious. This film may be the international launching pad for Paul Mercurio, a highly gifted choreographer and lead dancer with a stream of hits in Oz. (I had the privilege to watch him dance live from front row seats in August, where he sucked up the audience's attention like a black hole ... what 5 other dancers in the company?) With a young Tyrone Power's face on Marky Mark's body, Mercurio is a candidate for the decade's next "poster boy" role.
The film's only disappointment (which won't affect Americans) is that the camera isn't "kind" enough to Mercurio, and film stock flattens much of his dynamic energy. It's a shame that more of his brilliant dance career wasn't shared by a world audience. A chance to see Mercurior perform live on stage is well worth whatever means it takes to get "down under" to his next venue.
The film is an uneven mix of visual and acting styles, but taken as a whole, the film is reminiscent of the works of Swiss artist Paul Klee, who according to the Encyclopedia Britannica "attempted through his own highly inventive pictorial language to convey the essential spiritual significance of things." That wouldn't be a bad description of director Baz Luhrmann's style. From the deadpan seriousness of the love story to the giddy Peter Max colored dance sequences and flashbacks, each scene carries much more than meets the eye.
Synopsis: Scott Hastings (Mercurio) appears to have it all: looks, charm, and a shoe-in for the next Pan Pacific Grand Prix Champion. He shocks the Ballroom Federation's dictatorial director, and his lifetime ballroom dancing parents (who missed their chance and are counting on Scott...) by introducing some wild new steps in the rhumba competition. Losing his partner of 15 years, Scott's only hope is to bring ugly duckling Fran (Tara Morice) up to speed. Along the rocky path to the finals Scott learns a thing or too about love and loyalty from Fran, and about "real" dancing from Fran's flamenco dancing immigrant father.
Tara Morice brings sensitivity and charm to what could have been a throw-away role. Pat Thomson gives a world-class performance as the bleached blond comet of a stage mother who'll stop at nothing to hitch her son Scott to his rightful partner "Tina Sparkle" (instead of the little "nothing" with the bad complexion.) The rest of the cast lend some flesh and substance to cartoon-like characters.
Though on the surface, *very* Australian in it's fixation with Ballroom Dancing and class structure, the film has a heart-felt message for anyone who grew up to be something other than their parents best-laid plans. The "rebellion" carried out in dance steps will speak to anyone who's had to put a lid on it at work, or in any other highly compromising environment. In spite of this, I fear for the film's acceptance, in that much of it's satire may be misinterpreted, and the broader comic icons will make easy targets for myopic critics who collapse into comparisons on any film with vaguely familiar themes.
Though it remains to be seen how American audiences will warm to this quirky film, it's been picked up for distribution in 86 countries, and was voted audience favorite at both the Toronto and Cannes film festivals. If the film accomplishes nothing more than exposing Paul Mercurio to a wider audience (though so far he's a better dancer than actor) the film will proved its worth on at least one level.
While in Sydney recently, I was also able to visit the Powerhouse museum and see an exhibit about the creation of the film. Though Americans might think some of the ballroom scenes are overblown caricatures, Polaroids of actual events reveal the film to be visually very true to its topic. Some of the competition scenes were filmed on the floor of the *real* Pan Pacific Ballroom Competition, which ironically created an eerie sense of unreality. (Also got a close up look at the costumes, which are dynamite.)
Local Australian critics interpreted STRICTLY BALLROOM as a coming of age film for Australia, in which a more diverse population is revealed to have more to offer than the stodgy Anglo values of countless decades. Even if you have trouble taking the love story between Mecurio and Morice seriously, you'll still enjoy broad references to shameless plugs for Coca Cola, and some smug camera angles that wink satirically at DIRTY DANCING. Though not the Hope Diamond, the film has enough facets and catches enough light to make the nearly two-hour length seem to fly by all too fast.
To be distributed by MiraMax, look for openings in major cities sometime in February/March.
-- Max Hoffmann
.
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


#include <stDFTree.h>
Public Types | |
| typedef stDFGlobalRep< ObjectType, EvaluatorType > | tGR |
Public Member Functions | |
| stDFLogicNode (stCount maxOccupation) | |
| ~stDFLogicNode () | |
| int | AddEntry (ObjectType *obj) |
| int | AddEntry (stSize size, const stByte *object) |
| stCount | GetNumberOfEntries () |
| ObjectType * | GetObject (stCount idx) |
| ObjectType * | operator[] (stCount idx) |
| stPageID | GetPageID (stCount idx) |
| stSize | GetNEntries (stCount idx) |
| stDistance | GetRadius (stCount idx) |
| void | SetEntry (stCount idx, stPageID pageID, stSize nEntries, stDistance radius, stDistance *fieldDistance) |
| void | AddIndexNode (stDFIndexNode *node) |
| void | AddLeafNode (stDFLeafNode *node) |
| stCount | GetRepresentativeIndex (stCount idx) |
| ObjectType * | GetRepresentative (stCount idx) |
| void | SetRepresentative (stCount rep0, stCount rep1) |
| int | Distribute (stDFIndexNode *node0, ObjectType *&rep0, stDFIndexNode *node1, ObjectType *&rep1, EvaluatorType *metricEvaluator, tGR *GR) |
| int | Distribute (stDFLeafNode *node0, ObjectType *&rep0, stDFLeafNode *node1, ObjectType *&rep1, EvaluatorType *metricEvaluator, tGR *GR) |
| int | TestDistribution (stDFIndexNode *node0, stDFIndexNode *node1, EvaluatorType *metricEvaluator) |
| int | TestDistribution (stDFLeafNode *node0, stDFLeafNode *node1, EvaluatorType *metricEvaluator) |
| void | SetMinOccupation (stCount min) |
| stNodeType | GetNodeType () |
| void | SetNodeType (stNodeType type) |
| bool | IsRepresentative (stCount idx) |
| ObjectType * | BuyObject (stCount idx) |
| stDistance * | GetFieldDistance (stCount idx) |
| void | SetFocusDistance (stCount idx, stCount iGlobalRep, stDistance iFieldDistance) |
| void | SetFieldDistance (stCount idx, stDistance *fieldDistance) |
Thic class template represents a DFTree logic node entry. It is used to hold an index node or a leaf node in a memory form which allows better way to manipulate entries. It also implements means to distribute its contents between 2 nodes.
Each entry of this node can hold all information required by both nodes at same time so, the users of this node must control if it holds an index node or a leaf node.
Documentation review.
More tests!
Definition at line 125 of file stDFTree.h.
| typedef stDFGlobalRep<ObjectType, EvaluatorType> stDFLogicNode< ObjectType, EvaluatorType >::tGR |
This type implements the GR.
Definition at line 132 of file stDFTree.h.
| stDFLogicNode< ObjectType, EvaluatorType >::stDFLogicNode | ( | stCount | maxOccupation | ) |
Creates a new instance of this node with no objects.
| maxOccupation | The maximum number of entries. |
| stDFLogicNode< ObjectType, EvaluatorType >::~stDFLogicNode | ( | ) |
Disposes this instance and releases all related resources. All instances of object added to this node will also be deleted unless it is not owned by this node (see method BuyObject()).
|
inline |
Adds an object to this node. This method will claim the ownership of the object instance.
Use SetEntry() to fill the other fields of each entry.
| obj | The object to be added. |
Definition at line 157 of file stDFTree.h.
References STFOCUS.
| int stDFLogicNode< ObjectType, EvaluatorType >::AddEntry | ( | stSize | size, |
| const stByte * | object | ||
| ) |
Adds an object to this node.
Use SetEntry() to fill the other fields of each entry.
| size | The size of the object in bytes. |
| object | The object data. |
| void stDFLogicNode< ObjectType, EvaluatorType >::AddIndexNode | ( | stDFIndexNode * | node | ) |
Adds all objects of an index node. It will also set the node type to stDFNode::INDEX.
| node | The node. |
| void stDFLogicNode< ObjectType, EvaluatorType >::AddLeafNode | ( | stDFLeafNode * | node | ) |
Adds all objects of a leaf node. It will also set the node type to stDFNode::LEAF.
| node | The node. |
|
inline |
Gets the ownership of an object associated with a given entry. This method will avoid the automatic destruction of the object instance by the destructor of this node.
This method can be used to buy the representative objects to avoid unnecessary replications.
| idx | The object index. |
Definition at line 425 of file stDFTree.h.
Referenced by stDFLogicNode< ObjectType, EvaluatorType >::Distribute().
|
inline |
Distribute objects between 2 index nodes using the current representatives (see SetRepresentative()). Both nodes must be empty.
| node0 | The first node. |
| rep0 | Representative of node 0. |
| node1 | The second node. |
| rep0 | Representative of node 1. |
| metricEvaluator | The metric evaluator to be used to compute distances. |
| GR | Used to know when find GR |
Definition at line 306 of file stDFTree.h.
References stDFLogicNode< ObjectType, EvaluatorType >::BuyObject(), stDFLogicNode< ObjectType, EvaluatorType >::GetRepresentativeIndex(), and stDFLogicNode< ObjectType, EvaluatorType >::TestDistribution().
|
inline |
Distribute objects between 2 leaf nodes using the current representatives (see SetRepresentative()). Both nodes must be empty.
| node0 | The first node. |
| rep0 | Representative of node 0. |
| node1 | The second node. |
| rep1 | Representative of node 1. |
| metricEvaluator | The metric evaluator to be used to compute distances. |
| GR | Used to know when find GR |
Definition at line 334 of file stDFTree.h.
References stDFLogicNode< ObjectType, EvaluatorType >::BuyObject(), stDFLogicNode< ObjectType, EvaluatorType >::GetRepresentativeIndex(), and stDFLogicNode< ObjectType, EvaluatorType >::TestDistribution().
|
inline |
Returns the GR of a given entry.
| idx | The object index. |
Definition at line 436 of file stDFTree.h.
|
inline |
Returns the number of entries in the sub-tree of a given entry. Only index nodes will use this field.
| idx | The object index. |
Definition at line 216 of file stDFTree.h.
|
inline |
Returns the node type. It may assume the values stDFNode::INDEX or stDFNode::LEAF.
Definition at line 393 of file stDFTree.h.
|
inline |
Returns the number of entries in this node.
Definition at line 179 of file stDFTree.h.
|
inline |
Returns the object of a given entry.
| idx | The object index. |
Definition at line 188 of file stDFTree.h.
|
inline |
Returns the PageID of a given entry. Only index nodes will use this field.
| idx | The object index. |
Definition at line 206 of file stDFTree.h.
|
inline |
Returns the radius of the sub-tree of a given entry. Only index nodes will use this field.
| idx | The object index. |
Definition at line 226 of file stDFTree.h.
|
inline |
Returns the representative object.
| id | The representative ID. It may be 0 or 1. |
Definition at line 277 of file stDFTree.h.
|
inline |
Returns the id of the representative object.
| id | The representative ID. It may be 0 or 1. |
Definition at line 268 of file stDFTree.h.
Referenced by stDFLogicNode< ObjectType, EvaluatorType >::Distribute().
|
inline |
Verifies if a given object is a representative.
| idx | Object index. |
Definition at line 410 of file stDFTree.h.
|
inline |
Returns the object of a given entry.
| idx | The object index. |
Definition at line 197 of file stDFTree.h.
|
inline |
Sets the data associated with a given entry.
| idx | The object index. |
| pageID | The pageID. |
| nEntries | The number of entries in the sub-tree. |
| radius | The radius of the sub-tree. |
| FieldDistance | The distance from object to GR |
Definition at line 239 of file stDFTree.h.
|
inline |
Set GR of a given entry.
| idx | The object index. |
| FieldDistance | The GR Vector |
Definition at line 457 of file stDFTree.h.
|
inline |
Sets the Focus Distance.
| idx | The object index. |
| iGlobalRep | The GlobalRep index. |
| FieldDistance | The distance to GlobalRep index. |
Definition at line 447 of file stDFTree.h.
|
inline |
Set minimum occupation. This must be the minimum number of objects in a page. This value must be at least 1.
Definition at line 381 of file stDFTree.h.
|
inline |
Sets the node type.
Definition at line 400 of file stDFTree.h.
|
inline |
Sets both representatives ids. Use UpdateDistances() to update all distances between objects and.
| rep0 | Index of representative 0. |
| rep1 | Index of representative 1. |
Definition at line 288 of file stDFTree.h.
| int stDFLogicNode< ObjectType, EvaluatorType >::TestDistribution | ( | stDFIndexNode * | node0, |
| stDFIndexNode * | node1, | ||
| EvaluatorType * | metricEvaluator | ||
| ) |
Tests the distribution of objects between 2 index nodes using the current representatives (see SetRepresentative()). Both nodes must be empty.
| node0 | The first node. |
| node1 | The second node. |
| metricEvaluator | The metric evaluator to be used to compute distances. |
Referenced by stDFLogicNode< ObjectType, EvaluatorType >::Distribute().
| int stDFLogicNode< ObjectType, EvaluatorType >::TestDistribution | ( | stDFLeafNode * | node0, |
| stDFLeafNode * | node1, | ||
| EvaluatorType * | metricEvaluator | ||
| ) |
Tests the distribution of objects between 2 leaf nodes using the current representatives (see SetRepresentative()). Both nodes must be empty.
| node0 | The first node. |
| node1 | The second node. |
| metricEvaluator | The metric evaluator to be used to compute distances. |


--- title: What do Animal Crossing players look for in villagers? author: Ryan Estrellado date: '2020-05-24' slug: what-do-animal-crossing-players-look-for-in-villagers categories: [] tags: [rstats] ---
I spent a recent morning at a virtual island concert celebrating the arrival of a dog folk guitarist named K.K. Slider. The concert is a milestone in the game Animal Crossing: New Horizons, which has become odd comfort to me and others during the COVID-19 stay-at-home orders. Demand for Animal Crossing caused the Nintendo Switch to join toilet paper and cleaning wipes on the list of near-impossible things to acquire during the pandemic.
In April of 2020, Polygon published a fascinating story about a trend in the Animal Crossing community: players were ousting villagers—cute animal non-player characters—from their island because of the way they looked or acted.
Using Animal Crossing datasets posted on Kaggle, I explored what makes some villagers desirable island residents, and what makes others the object of fan mockery.
But first, a note on personality types. There are eight personality types in Animal Crossing: big sister, cranky, jock, lazy, normal, peppy, smug, and snooty. These personalities were originally found in the code for older Animal Crossing games like New Leaf and Pocket Camp, then translated from Japanese to English. The categories are, at best, comically simple. For example, there’s a personality type called “big sister” but, inexplicably, there’s no personality type called “big brother.” The saving grace of this somewhat pejorative personality system—I can’t recommend using “jock” or “lazy” as personality descriptions in other contexts—is they’re used in a video game that’s otherwise designed as a positive and escapist experience. But all the same, we should look elsewhere when talking about actual personalities.
To learn more about why players like and dislike certain villagers, we need a way to quantify a villager’s desirability. nook.market is a website where Animal Crossing players go to exchange villagers and furniture for bells, the in-game currency. On the website, players can view all the villagers in a list, sorted by “most wished for”. I used this list to assign each villager a “wish score” by ranking the list in reverse order so the most wished-for villager has the highest wish score. For example, a bookish cat named Raymond, the most wished for villager as of May 24, 2020, has the highest possible wish score at 391. Pudge, a green-eared bear cub and sadly the least wished-for of all the villagers, has a wish score of 1.
| name | species | personality | wish score |
|---|---|---|---|
| Raymond | Cat | Smug | 391 |
| Coco | Rabbit | Normal | 390 |
| Lucky | Dog | Lazy | 389 |
| Marshal | Squirrel | Smug | 388 |
| Bob | Cat | Lazy | 387 |
| Lolly | Cat | Normal | 386 |
| Audie | Wolf | Peppy | 385 |
| Ankha | Cat | Snooty | 384 |
| Judy | Cub | Snooty | 383 |
| Marina | Octopus | Normal | 382 |
A villager’s personality might explain why players don’t want them on their islands. For example, villagers who have the “jock” personality have the lowest mean wish score.
But personality doesn’t fully explain why players are so desparate to attract Raymond and Coco to their island resorts. Players seem to care a lot about a villager’s species, even when taking the villager’s personalities into account. Wolves, octopuses, cats, deer, and rabbits had the highest mean wish scores.
Cats and mice, for example, make up similar shares of the villager population, yet cats have a higher average wish score than mice by 211 points.
| species | mean wish score | standard dev | count |
|---|---|---|---|
| Cat | 304 | 101 | 23 |
| Mouse | 93 | 84 | 15 |
Even the three cat villagers who have the jock personality achieved decent to excellent places in the rankings. The lowest wish score of the three cat jocks was 169 and belongs to a feline named Stinky whose catchphrase is “GAAHHH.”
| name | species | personality | catchphrase | wish score |
|---|---|---|---|---|
| Rudy | Cat | Jock | mush | 333 |
| Kid Cat | Cat | Jock | psst | 327 |
| Stinky | Cat | Jock | GAAHHH | 169 |
In fact, while the jock personality has the lowest mean wish score of all the Animal Crossing personality types, it’s not all doom and gloom for villagers obsessed with exercise. There’s quite a range of outcomes for those with the jock personality. Dom, a jock sheep whose favorite K.K. Slider song is K.K. Country, has one of the highest wish scores at 378. On the other hand, Sparro, a jock bird who’s favorite hobby is fitness, has a dismal wish score of 68. His catchphrase is “Like, whoa.”
Indeed you’ll find a wide range of villager desirability in all personality types. Have a look at the range of wish scores on these plots:
There isn’t any one personality that screams, “Pick me!” Not even the ostensibly desirable “normal” is a shield against low wish scores, nor does it guarantee a spot next to the wish score champion, Raymond.
On the other hand, you can identify species that are more likely to earn the love of the Animal Crossing player community. Rabbits and mice make up similar shares of the total villager population at 5 percent and 4 percent, respectively. But let’s just say I won’t be betting on a mouse for anyone’s first round draft pick:
Personally, my favorite villager is a chicken named Goose. I don’t particularly care that he’s obssessed with fitness (and he is obsessed—once he told me he worked out so hard he fainted). The fact that he’s a chicken doesn’t give me any strong feelings. Goose was the first villager to set up camp on my island as my family and I spent our first few evenings locked down. It’s hard to imagine my island without him.
You can find all the code for this analysis on my GitHub account. Thank you to Nook Plaza for collecting the data and to Kaggle for hosting it.