Monday, 14 May 2007

Pointers and References, Arrays and Strings,Heap and Memory Management

References in Java
A reference is essentially an object’s memory address

Variables containing address are often termed ‘pointers’
A pointer can be thought of as a low-level reference
‘Pointer arithmetic’ – e.g. add offsets, indexing
A pointer is just another type, like an int or a float
Everything stored in memory, pointers included, has an
address: another pointer can even point to it

Arrays
Usually a block of consecutive elements in memory
All same size (s bytes); same offset from one to the next
The i th element is at offset i × s bytes from beginning
Looking up an element of the array is termed ‘indexing’
Assembly equivalent of an int[] in Java would be. . .
a consecutive block of word-sized signed integers
represented by its starting address and length

static data: Contents may change, but size and location doesn’t
In Java, "hello" + "world" contatenates two strings, But neither of the original strings are modified. Instead a new string is created on the heap
The heap is a much larger pool of memory than the stack
Java allocates storage on the heap with the new keyword
All Java objects live on the heap; only primitive types –ints, floats, doubles and references – on the stack
Storage allocated on the heap persist across procedures. Caller can’t access stack storage//-----?????????????

Lecture 10: MIPS Procedure Calling Convention and Recursion

A portion of code within larger program, typically called:
procedures or subroutines in imperative languages like C
methods in OO languages like Java
and functions in functional languages such as Haskell
Functions usually return a value; procedures don’t
Procedures can call other procedures; even themselves

What happens when we call a procedure?
Control hands over to the callee; the caller is suspended
Callee performs requested task
Callee returns control to the caller

Calling Procedures in MIPS Assembly
jal label – jump and link
$ra := PC + 4; PC := [label]-----??????????
Calls procedure at address label
jr src – jump register
PC := src
Issuing j $ra is the assembly equivalent of return

Register $ra contains the return address of the caller
Arguments are passed in registers $a0 to $a3
Results are left in registers $v0 and $v1

The Stack
The stack provides last-in, first out (LIFO) storage
Register $sp points to the topmost word on the stack
By convention, the stack grows downwards
Placing words onto the stack is termed pushing
Taking words off the stack is called popping

Calling Convention
Caller

Push any of $a0-3, $v0-1 and $t0-9 needed later
Place arguments in $a0 to $a3, and stack if necessary
Make the call using jal callee; result in $v0 and $v1
Pop saved registers and/or extra arguments off stack
Callee
Push any of $ra, $s0-$s1 that may be overwritten
Perform desired task; place result in $v0 and $v1
Pop above registers off the stack
Return to caller with jr $ra

The main label is just another procedure


Local Variables
Solution: save initial value of $sp in $fp //---------?????????
Hence local variables always have the same $fp-offset
Note callee must preserve previous value of $fp!

杀人游戏

An occasional chance wake me to search something about Mafia-game, because it seems to be not fashion as a teenage if you do not know it or you can not play。 So, wiki again can tell me much about it even I have no chance to through.


Mafia (game)

For the video game, see Mafia: The City of Lost Heaven.
Mafia

Players 4 or more
Age range 9 and up
Setup time < 6 minutes
Playing time 15-60 minutes2
Random chance Low
Skills required Strategic thought
Team play
Social skills
Roleplay
See Basic gameplay below.
Varies greatly with setting; see online play.
Mafia (also known under the variant Werewolf or Village) is a party game modeling a battle between an informed minority and an uninformed majority. Mafia is usually played in groups with at least five players. During a basic game, players are divided into two teams: 'Mafia members', who know each other; and 'honest people', who know only the number of Mafia amongst them. The goal of both teams is to eliminate each other; in more complicated games with multiple factions, this generally becomes "last side standing".

History
Mafia was created by Dimma Davidoff at the Psychological Department of Moscow State University, in spring of 1986, and the first players were playing in classrooms, dorms, and summer camps of Moscow University. The game become popular in other Soviet colleges and schools and in the 1990s it began to be played in Europe (Hungary, Poland, England, Norway) and then the United States. Mafia is considered to be one of "the 50 most historically and culturally significant games published since 1800" by about.com.

Andrew Plotkin gave the rules a Werewolf theme in 1997 [1] - Looney Labs have sold this version of the game as Are You a Werewolf?, as have Asmodée Éditions under the title Werewolves of Millers Hollow.

David and Jon Huston created another version in the theme of H. P. Lovecraft's Cthulhu Mythos called Do You Worship Cthulhu, published by Toy Vault, Inc. The main card art was completed by Ron Spencer and Walt Howington designed the Instruction graphics.

A variation of Mafia was used in the movie Cry_Wolf. The game involves one wolf, one shepherd, and a number of sheep, with no day and night phases.

Adam Gopnik devotes a chapter to describing the game in "Through the The Children's Gate: at home in New York" (Knopf, 2006).


Basic gameplay

Roles

Players make themselves comfortable in a space such that every player can see every other player. Roles are assigned by a method which is both confidential and verifiable, often by dealing cards; a red or black card signifies the role as either:

Mafia (alternatively, Werewolves or Worshipers)
Innocents (alternatively, Villagers, Townspeople, or Citizens).
Other roles are possible (see Variants).

Generally, gameplay also requires a Narrator (alternatively, Dealer, Don, God, Host, Mayor, Moderator, Proctor, or Storyteller), a person not playing, but moderating the game. The Narrator knows the roles of each of the players and effectively narrates gameplay. However it is possible to have the first dead player become the Narrator when starting with the day phase.


Night
The Narrator tells everyone to close their eyes and lower their heads ("Go to sleep...", "It is now nighttime and all the villagers are asleep...", etc.). This can optionally be accompanied by all players tapping gently to mask the sounds of player movement. On the first night, the Narrator tells the Mafia to open their eyes and acknowledge their fellow Mafia members. Variations at this point:

The Mafia may have a chance to kill off one of the Innocents by show of hands.
On the first night, the Mafia may "kill" the Narrator so that every Innocent gets a chance to participate in at least one execution decision. The Narrator then says in the Morning that he was killed and gameplay continues as usual.
After the first night, Mafia members must secretly communicate during the daytime and then unanimously agree to kill someone during the nighttime without opening their eyes to communicate (i.e., Narrator calls out the names of each player and Mafia must raise a hand to signify a kill). This rule is optional; if it's not included, the Mafia may kill an Innocent in the same method as they did the first night.
In large groups, each Mafia member can kill one person per night.
Other variant characters may have turns to open their eyes to do "business" during the night also (before or after the Mafia).


Day
The Narrator tells everyone to wake up and announces the Mafia's victim. Usually this involves the Narrator telling a story about the murder scene that the remaining players wake up to, and/or a story of how the victim was killed. For example, "The police chief said, 'Bob was shot seven times, stabbed three times and drowned in the river. This is the worst case of suicide I've ever seen.'" This player is "dead" and may no longer participate in the game in any way, and is thus permitted to keep their eyes open at night.

Depending on the variant, The Narrator may reveal the identity of dead players, dead players may reveal themselves by flipping their cards face up (most common version), or the identity of dead players may be left unrevealed. Typically, prematurely revealing one's identity by flipping one's card face up while still alive is considered suicide; in single-execution-per-day variants, this may count as the execution for that day.

During the daytime phase, the players deliberate over which suspected Mafia member they wish to nominate for execution. The Innocents want to execute a Mafia member but all players are allowed to vote. Generally, The Narrator will administer the election, the nominee may be given a chance to defend themselves and a majority is required for the execution to be carried out, although voting variants abound. The same rules apply to players who are executed as to players killed by the Mafia. In some variants, multiple players may be killed during the same day.


Win condition
The game ends either when the last Mafia member is killed (Innocent victory) or the Mafia members gain a majority during the day (Mafia victory). Ties go to the Mafia. The innocents have no way of voting off mafia members at this point, but the mafia can still kill each night. Other variants have different victory conditions.

Note that in a situation of Mafia and Innocent left after a lynching or a morning, the Mafia character usually automatically wins.


Number of Mafia
A game with just one more innocent player than Mafia players during the day phase can still be won by the innocent players (if you start with a night kill, you need two more innocent players than mafia). However, if they make any mistake (i.e. killing an innocent player during the day), they lose.

So the number of "extra villagers" needs to be adjusted to how many mistakes the innocent players are allowed to make during the game. If you have highly skilled players, play with a small difference, if your players tend to just kill random people during the day, increase it. For large parties, kills tend to be much more random, too.

You can start playing mafia with just 3 players, one of which is Mafia (4 if you kill in the first night). This situation however is extremely hard to play lacking any previous knowledge. If the mafia player convinces one of the other two players he wins (draw rule), if he makes both of them suspect him, he loses.

A 5 player setup with just 1 mafia (6 if you kill in the first night) is a bit more interesting. If the innocent players don't happen to identify the mafia player in the first day (which isn't easy), they end up with the same 3 player setup as explained above (or win, if they managed to identify the mafia player), but the remaining players do now have extra information from the behaviour in that previous round.

Empiric values such as 1/3 or 1/4 of players being mafia are common, but again, this depends on the skill of your players. Other players recommend certain combinations such as 2 mafia and 4-5 innocent players, 3 mafia and 6-8 innocent players (and/or discourage larger rounds). There is no mathematically sound 'optimal' value except above "n mafia, n+1 innocent players during the day can still be won by the innocent players" statement.

(Mathematically speaking, this game is not fair. Assuming that all players could read minds, the mafia only wins if they are at least 1/2 of the players in the game. Fortunately, most people can't read minds; but they do usually perform better than a randomizer.)

Variant character roles and rules can change this setup significantly and usually increase or reduce the need for having extra innocent players. But others are targeted at giving the players more data for the 1 mafia vs. 2 innocent "end game"; this data doesn't need to be reliable, but just to give the players more information to base their judgement upon. So when playing with variant character roles, you might or might not have to modify your game parameters.


Variations
Over the years, players have created Mafia variants which utilize alternative names for characters, additional characters, and different methods for conducting deliberation, voting and killing.


Optional roles
Due to the informal nature of the game, roles can be named differently due to cultural differences, thematic flavor, or other reasons. What follows is a general list of types of roles that can be found in Mafia and Werewolf games; it is by nature non-exhaustive.

Protective roles - "Guardian Angel", "Doctor", "Healer", "Archangel", "Bodyguard", "Sorcerer", "Priest", "Protector", "Highlander", "Nurse", etc.
Allied with the Innocents, this person can protect other roles at night. Depending on the variant, they may know the identities of the Mafia and may attempt to persuade the townspeople to kill the members of the mafia rather than another innocent. Sometimes they are allowed to protect themselves. In some games the Nurse obtains the Doctor's abilities if that role dies. Another variant is the "Bulletproof" innocent, who cannot be killed at night by anyone. (In Werewolf, for example, this person could have wolfsbane.)
Investigative roles - "Detective", "Commandant/Super Commandant", "Cop", "Seer", "Spy", "Angel", "Sheriff", "Psychic", "Inspector", "Cattani", "Devil", "Tracker", "Prophet", "Little Girl", etc.
Allied with the Innocents, this person can detect the alignment of other players at night. Occasionally the role will be themed to reveal the role, instead of the alignment. In some variants, the Narrator may lie to the Detective by showing all players as Innocent, all as Guilty, giving reversed results, or random information; these can be termed as "Naïve", "Paranoid", "Insane", or "Random" respectively. A "Tracker" may see what someone's night action was, or the target of their action, and have to deduce information from that. When the Devil exists, he works for the Mafia/Werewolves, trying to discover Innocents with night actions (usually the Angel/investigative roles). The Commandant is equivalent to the detective, though the Super Commandant has an additional protective feature which allows the inspected person (who can be the Commandant, himself) to survive an attempted Mafia killing in the night. The Little Girl in Werewolf is allowed to secretly peek and watch as the werewolves choose their victim.
Killing roles - "Vigilante", "Rambo", "Crazy Veteran", "Bomb", "Terrorist", "Gravedigger", "Hunter", "Village Bicycle", etc.
Aside from Mafia, Werewolves, and Serial Killers (solitary guilty parties), the Innocents may have some roles with the ability to kill at night. The method varies: the Vigilante may have one or more "bullets" for the entire game, or the Bomb/Crazy Vet may only trigger if targeted at night (not necessarily for death) by another role. Variants exist where this person can kill during the daytime cycle (e.g., the Terrorist / Gravedigger), sometimes only if executed during the daytime (eg. the Hunter / Village Bicycle).
Alignment roles - "Miller", "Godfather", "Alpha Wolf", "Traitor", "Village Idiot", "Undercover Cop", "Rat", etc.
Some roles can fool investigations to determine their alignments: the Miller is an Innocent who appears guilty (usually because they are an outsider); the Godfather, on the other hand, appears innocent despite being the leader of the Mafia. The Alpha Wolf is analogous to the Godfather, while the Traitor works with their vote during the day cycle to protect Mafia and hamper the town. The Village Idiot's objective is to get the town to kill him. The Rat or Undercover Cop is a mole within the Mafia group.
Role manipulators - "Role-blocker", "Godfather", "Prostitute", "National Guardsman", "Switcher", "Bus Driver", "Thief", "Witch", "Sorcerer", "Barman", etc.
These roles can stop or alter the night actions of others; for instance, they may prevent a protection or investigation from occurring, or they may change the target. Not all of these roles will be on the side of the Innocents. The Thief may remove the person's role entirely (for instance, by stealing a Vigilante's gun). The Godfather has the ability to recruit innocent players to become Mafia under certain circumstances. This role differs from the Alignment Role of Godfather above.
Association roles - "Freemasons (Masons)", "Siblings", "Cult Leader and Followers", "Cupid", "Lovers" etc.
These roles, usually on the side of the Innocents, know who each other are and what their roles are. Freemasons (Masons) may talk at night, and confirm each other should one become the target of a murder. Siblings typically consist of one Mafia and one Innocent who are related by blood; if one dies, the other commits suicide shortly thereafter. Cult Leaders can recruit at night instead of kill; therefore they act as an independent faction from both the Innocents and Mafia, usually with the ability to talk at night. Cupid can create a Sibling-like relationship between two random players of his/her choosing (called the Lovers) the first night of the game. In this variant, the Lovers can also win the game (regardless of whether they are Mafia, Innocents, or both) by being the last two standing.
Power roles - "Mayor", "Judge", etc.
This role is taken in addition to the assigned role, and it endows the character with additional power over the game (particularly during the daytime). The character could be chosen by random or selected by vote (which could take place before or after roles are assigned). For instance, a Mayor could possess two votes, or a Judge could moderate discussion in parliamentary fashion (to the advantage of their "team"). If the Power character is also an Innocent (and particularly if they have a helpful role), they aid the town. If they are Mafia, this character aids the Mafia.
Additional variations exist, sometimes with even more specialized or complicated abilities.


Optional rules
Mafia killing methods - some variants require all Mafia members to choose the same victim independently for a kill to succeed. Theoretically, this requires them to "communicate" in some way during the daytime and thus increases the chances of detection. This can be achieved either by waking the Mafia members up separately or by having them write their kills. Under this variant, Innocent players write the word 'honest' on a piece of paper; Mafia members write down the name of a player for elimination. If all the mafia notes have the same name on them, that player is considered killed by the Mafia. In some online versions of the game, a particular player (the Godfather, or a designated member of the group) must send in or execute the kill.
Voting variants - some variants have a more complicated process of selecting players to be executed. One variant allows multiple simultaneous nominations and only requires a plurality. Another requires the vote to be unanimous but allows multiple players to be added to the execution queue to ensure unanimity.
"No lynch" or "No kill" - sometimes the Innocents are allowed to vote not to kill anyone on a particular daytime cycle. In general, although the Townspeople will often feel they do not have enough information to kill someone, this is a bad choice because the Townspeople are more likely to vote off a Mafia member than the Mafia are to kill a Mafia member. Furthermore, because a player's role is generally revealed when that player is executed, it provides the Townspeople with reliable and irrefutable information. However, when there are an even number of Townspeople, this can be a good choice. For example, when there are four Townspeople remaining (including one Mafia), voting not to kill someone will result in a 1/3 chance to kill the Mafia the next day as opposed to a 1/4 chance. Note that voting incorrectly in either situation will end the game (resulting in a 1 Mafia/1 Innocent standoff, which is almost always resolved by the Narrator in favor of the Mafia).
Random narrator - to eliminate the inconvenience (especially in large games) of being killed on the first day, this variant has the Innocent who is killed on the first night become the Narrator. The Mafia, of course, has to find a way of informing this person that they are dead without revealing their identities. The writing variant works best. Some players complain that this variant is biased toward eliminating those who are skilled at narrating. This also works the other way round -- there is no kill in the first night (or a fictious player such as the Major or Kenny is killed), but the mafia still wakes up just to learn their identies; the player killed at day becomes the real narrator.
Multiple families - this variant has multiple Mafia families (or a Mafia group and a Werewolf group) who act and win independently of each other. This allows more kills and thus a faster gameplay and also creates the potential for "cross-fire" between the factions.
Imprisonment - this variant allows players to be sent to prison as an alternative to execution. Depending on the variant they can either be sent there by vote or at the discretion of an optional character. Players in prison exist in the separate room possibly with a separate narrator. Murders can happen in prison and certain roles or events have the ability to bring characters back from prison.
Kidnapping - like imprisonment, this variant allows for a Kidnapper character to remove individuals from the game temporarily. If the kidnapper is killed (or, in some cases, investigated by an Investigative role), all kidnapped individuals (whether Mafia or Innocent) return to the game. While kidnapped, characters are considered "dead." However, they can not watch nighttime events because of the possibility of returning.
Wrath of God - this variant allows the Narrator to select in a random and verifiable manner one or more Innocents, (depending on how many total players are in the game) to carry a cost for their death(s). If for example, the Mafia selects said Innocent during the night round, then the Mafia who selected the "protected" player will also die as a result. If during the day round any player leads an accusation towards the "protected" player and that player is voted out, then the original accusor shall die as well. This variant adds to the confusion by allowing players to claim "divine protection" and also makes selecting players to die during the day or night a much more cautious process.
Plague - this variant allows the Narrator to select in a random and verifiable manner one player who dies of plague in the morning. This can occur at set time intervals, or at random, and the player killed in this manner is revealed at the beginning of the next day. A player who targets the plagued player at night may then become plagued as a result of the contact.
Punishment - this variant is generally used as a drinking or risk based game. When a person is killed in the game they are made to take a punishment. In Drinking circles this may be a shot of a spirit such as Gin or Vodka. The punishment is usually decided at the start of the game. A Final punishment could also be added for the losing team too.

Online play
Although Mafia is usually played face to face, playing it online is also common. This adds a new dimension to the game, making it last longer and allowing people to have a record of what others have said and how they have voted. There are many forms of online play: as part for the promotion of the film Cry_Wolf a website was set up to play a similar game using AIM Instant Messenger, pitching wolves against sheep.

Online forum play was first known to be run on the Internet forum Grey Labyrinth by a regular poster from that site. The game requires 1 or 2 moderators to control. A sign up thread is created announcing the game. The game usually starts in the night phase with players messaging the moderator with their choices, and the mafia teams communicating via email before submitting their kill. The moderator will process the choices, write the appropriate death scene for those that were eliminated, and post a dawn scene. Then the players will vote for who they think is mafia. Generally speaking the first day of the online game is very random in nature, but as the game progresses the lynching becomes more strategic and planned.

Themes are the most common method of online play. Any group of well known characters or groups will work. The Simpsons, Hanna Barbera, The Lord of the Rings for example have been used because of their extensive character sets. In themed games, Roles tend to be more creative and relate to the scenes in which they are set. It is not uncommon for major characters to be left out of the balance of roles to allow the mafia teams to lie about who they are. Themes can also be Types - such as a Werewolf-themed game, or more extreme such as Time Travel Mafia or Deep South (a variant with no night phase).

Moderating online play generally requires you to attempt to balance the game well so any team or group has an even chance of winning. This is even more pertinent when using powerful creative roles. The balance is usually 25% mafia - so a 12 player game would entail 3 or 4 mafia depending on the balance of the remainder of the game. A brief listing of the known online variants follows (some would be near impossible to play in real life).

Deep South Mafia - also known as nightless mafia. The game is broken into choice blocks which last a set amount of real life time. During a choice block, players can vote to lynch and/or submit their choices to the moderator. The moderator will action them at a set time. If a player is lynched during that time, the choice block will end immediately, and all votes are nullified and the next block begins. Choices are always made first as part of an update, and then voting. Some moderators may care to flip this rule around. Choices are made in the order received. Common roles for this variant are "Lie Detector" who can detect a lie in a role claim by a player. "Mafia/Serial Killers" who kill during the day at any time. "Advance doctors" who can protect one choice block in advance. "Chef" who can call lunch and end a choice block once.
Grey Labyrinth's Designer Mafia is to have all prospective players invent a role and submit it to the moderator. The moderator tones the roles down to make them playable and then shuffles them up amongst the players.
Location-based games often have maps involved in which players have to travel to different destinations.
MafiaScum.net's Time Travel mafia allows players to alter history with their night choices. Roles are not revealed on death in this variation because players can be brought back to life at any stage. Time travelling roles are usually restricted to prevent chaos. Standard roles are "Coroner" who can investigate a corpse at night. "Blocker" who can prevent a player time travelling. "Serial Killer" who can travel back 1 or 2 nights to kill someone. One of the major changes in Time Travel mafia is that the person with the most votes at the end of a set time is lynched. This means that if a player votes and then dies on a previous night due to a history change, the vote is effectively nullified.
Romanian Mafia Club's Ebony and Ivory mafia games give every player a black ebony ball and a white ivory ball which stand for votes, and the players can effectively work towards lynching or saving others, because every white ball (a vote in favor of that player) takes out a black ball (a vote against him) that he received. The end of the day brings death to the role that has the most black votes.
Mafiascum is an Internet forum where registered members can play a game of Mafia with other people over a message board. Mafiascum has been around since March 2002 and is a direct descendant of the Grey Labyrinth, an Internet forum dedicated to all types of puzzles and games; when Mafia began to dominate the site's traffic and player base, one of the administrators set up a separate forum specifically for those games. Since its creation, membership has grown and diversified, with games now played under different rulesets, in different languages, and at different skill levels. Recently the gamesite moved to an independent server to accommodate these levels of growth. Players have also contributed to a Mafia-specific wiki about game play, strategy, roles, and local players.




http://www.psytopic.com/mag/post/513.html关键词:谎言

杀人游戏最饱受质疑的地方,就是谎言。想在游戏中获胜,关键是不管真话假话,都要说得“理直气壮”。你不能相信其他任何玩家,必须不断制造谎言或者戳穿谎言。

杀手说:一位从事警察工作的玩家对其体会是三个字:可信度。他说,就是简简单单的三个字,可它却成为如今人与人之间最难以把握和捉摸的一种情愫。而“杀人”游戏虽然明里是一个人骗人的游戏,而实则是在教我们如何学会信任。

关键词:友情

“和朋友,可以喝酒,可以旅行,可以逛街,可以结死党,可以相互吹吹牛,拍拍马……但就是不能一起玩‘杀人游戏’。因为,‘杀人游戏’就是一个凶险江湖缩影,一不小心,就暴露了你隐藏很深的底牌,得不偿失。”这是很多人都信奉的一句话。

杀手说:很多圈中人“每次去杀人吧,像回到了家”。他们在游戏中达成默契,结下友谊。这些互为“老朋友”的人,也许不会主动询问你的职业、你的手机号,甚至对你的姓名和年龄都一无所知,但是需要的时候,会给予热情的帮助。

关键词:沉迷

湖南师范大学社会学教授陈成文指出,这类游戏属于心理暗示游戏,游戏者追求游戏的快感和刺激程度往往容易沉迷其中,这对培养一个健康的心态是非常不利,过分沉迷此类游戏必将对身心带来损害。

杀手说:杀手们通常丝豪不掩饰自己对杀人吧的狂热,大部分人都是“一玩就爱上了。这种感觉可能就像吸鸦片。”杀手吴新说:“我知道这样对工作和身体都不好,但就是欲罢不能。”

关键词:过瘾

社会学家仇立平认为,在杀人游戏的过程中,玩家需要根据不同角色或自我辩白或诬陷他人,它让人们有机会在虚拟的游戏世界里扮演“杀手”,过上一把坏人的瘾。

杀手说:徐小姐坦言“喜欢做杀手的感觉,可以主宰其他人的命运,然而,在现实中这是不可能的。”也有人认为,游戏就是游戏,这种模式在现实生活不具备可移植性。“如果像讨伐小学生玩电游一样,批判这个游戏群体,无异于把高理性群体降低成感性人群。”

游戏是一个客观的东西,关键在于游戏者的自控能力。杀人吧受到高知识层的青睐,毕竟对社会危害性不大,存在有合理性,但是也不能排除,游戏过度会产生的心理问题,大脑长期处于兴奋状态,容易造成失衡。
也许,杀人吧的充实,正好填补了现实生活的虚无……

来源: 国际在线
“杀人游戏” 超越游戏

据说“杀人游戏”的雏形源自格林童话:很久以前,一群骑士通过玩纸牌来决定命运,胜者过关,负者葬身毒龙口中。后来,硅谷人由此创立了游戏,并把它作为一种培训工具,用来测评人的心理素质与潜能,培养团队精神。一些敏感的同行们往往只知道这游戏由“海归”们带回,却不知它正是网络人套搬国外商业模式的产物。这个游戏往往能在新员工培训和客户交往时收到奇效,因为它迅速地把陌生的人们挤压到一个封闭的圈子里,让他们休戚与共,大家能迅速熟悉,并了解每个人的个性。虽然它强大的娱乐性掩盖了工具的本质,但究其根源,我们不难理解这种对心理素质和判断力的考验,决不仅仅是在虚拟世界中“发泄”、“减压”那么简单。

“杀人游戏”的参与者面对的是一个信息残缺,虚实难辨的局面,敌友与将来都存在不可预知性,由此,参与者人性的本质和弱点也会不自觉的暴露出来。人的行为模式表现为金字塔形,而塔底则是主导行为的心理动机。据此我们可以把参与游戏者分为这几种类型:

权力型:力图保持权威,充当意见领袖者;

协作型,缺乏主见,追随意见领袖;

控制型:无论成功与否,只求游戏继续,乐于操盘;

成就型,把游戏当作工作,苛求成功,从中获得成就感。

当然还有一种,不擅言辞,容易紧张,往往惨遭错杀者,我们称之“无辜型”。

回头看看,人们在游戏中的表现不正与事业中的表现相符吗?现代人力资源理论认为,苛求人不断发现自己的弱点并不断克服是事业误区,人只有找到自己的核心竞争力并集中发展才不会造成资源浪费。据统计,即便美国也只有1/3受过高等教育的人能找准自己的定位,能通过简单的游戏为人生定位提供参考,游戏的意义早已超越了游戏本身。

林林总总“游戏民”

既然有“股民”、“彩民”世象百态,“游戏民”也不例外。一旦你成为“游戏民”,你就会发现,原来自己如此多疑,记者冷眼旁观了一番“游戏民”们的种种表现。

先看看我们的同行,记者们接近于SOHO一族的生活方式和定题采访的工作习惯造就了强烈的主观意识。他们玩游戏时往往先设立出假想敌,不停搜集素材佐证自己的判断,直觉往往让他们忽略了一些真实的信息。有口舌伶俐的本钱,他们还很容易成为意见领袖,这种领袖往往会误导无辜者,实战中记者就在“老陆”和“老孙”两位胖同行身上证实了这一点。

相比而言技术人员就可信得多,与机器常打交道令他们理性思维极佳,判断时很少感情色彩,“冷酷无情”,评判均衡,误差较小。另外一种IT人则全然把它当作工作,属于成就型,拼命想当法官,而当了良民往往“闹情绪”,常被当奸细“干掉”。

公司领导和下属一同玩游戏不是好事,领导往往会不自觉的成为下属们的意见领袖。尤其是对于规模不大的私企,盲从比率异常的高,而大公司则好得多,“斗争” 也会更有趣。最后给您提供一点秘技:老练的杀手虽然很冷静,少有小动作,但眼神多少会有些惶恐不安或志得意满,盯着他们的眼睛吧,成功率超过60%。

Minutes To Midnight

these days, I am enjoying from Linkin Park's new album Minutes to Midnight. from its introduction, I learn a new phrase named Doomsday Clock
, then I search the web and catch some brief intr from WikiPedia. the singer in introduction was said to be changed but I can not find, however, it is easy to chack out there are several soft songs, it is great different from former ones.



Doomsday Clock
From Wikipedia, the free encyclopedia
(Redirected from Doomsday clock)
The Doomsday Clock now stands at five minutes to midnight.The Doomsday Clock is a symbolic clockface maintained since 1947 by the Board of Directors of the Bulletin of the Atomic Scientists at the University of Chicago. It uses the analogy of the human race being at a time that is "minutes to midnight" where midnight represents destruction by nuclear war. Since its introduction, the clock has appeared on the cover of each issue of the Bulletin of the Atomic Scientists. The first representation of the clock was produced in 1947, when artist Martyl Langsdorf, the wife of physicist, Alexander Langsdorf, Jr., who worked on the Manhattan Project, was asked by magazine cofounder Hyman Goldsmith to design a cover for the June issue.

The number of minutes before midnight, a measure of the degree of nuclear, environmental, and technological threats, is updated periodically. The clock is currently set to five minutes to midnight, having been advanced by two minutes on January 17, 2007.
Time changes
The clock was started at seven minutes to midnight during the Cold War in 1947, and has subsequently been advanced or rewound at intervals, depending on the state of the world and the prospects for nuclear war. Its setting is relatively arbitrary, set by the Board of Directors at the Bulletin of the Atomic Scientists in response to global affairs. The setting of the clock has not always been fast enough to cope with the speed of global events, either; one of the closest periods to nuclear war, the Cuban Missile Crisis in 1962, reached its head and resolution in a number of weeks, and the clock either could not be changed or was not changed to reflect any of this at the time. Nevertheless, the changing of the clock usually does provoke attention.

The clock's hands have been moved 19 times in response to international events since its initial start at seven minutes to midnight in 1947:

1949 - The Soviet Union tests its first atomic bomb. Clock changed to three minutes to midnight (four minutes closer to midnight).
1953 - The United States and the Soviet Union test thermonuclear devices within nine months of one another. Clock changed to two minutes to midnight (one minute closer, its closest approach to midnight to date).
1960 - In response to a perception of increased scientific cooperation and public understanding of the dangers of nuclear weapons, clock is changed to seven minutes to midnight (five minutes further from midnight).
1963 - The United States and Soviet Union sign the Partial Test Ban Treaty, limiting atmospheric nuclear testing. Clock changed to twelve minutes to midnight (another five minutes further).
1968 - France and China acquire and test nuclear weapons (1960 and 1964 respectively), wars rage on in the Middle East, Indian subcontinent, and Vietnam. Clock changed to seven minutes to midnight (five minutes closer to midnight).
1969 - The U.S. Senate ratifies the Nuclear Non-Proliferation Treaty. Clock changed to ten minutes to midnight (three minutes further from midnight).
1972 - The United States and the Soviet Union sign the SALT I (Strategic Arms Limitation Treaty) and the Anti-Ballistic Missile Treaty. Clock changed to twelve minutes to midnight (two minutes further).
1974 - India tests a nuclear device (Smiling Buddha), SALT II talks stall. Clock changed to nine minutes to midnight (three minutes closer to midnight).
1980 - Further deadlock in US-USSR talks, increase in nationalist wars and terrorist actions. Clock changed to seven minutes to midnight (two minutes closer).
1981 - Arms race escalates, conflicts in Afghanistan, South Africa, and Poland
Cover of a 2002 Bulletin of the Atomic Scientists with the famous Doomsday Clock set at seven minutes to midnight. The clock can be seen in the "o" of Atomic in the title.add to world tension. Clock changed to four minutes to midnight (three minutes closer).
1984 - Further escalation of the arms race under the U.S. policies of Ronald Reagan. Clock changed to three minutes to midnight (one minute closer).
1988 - The U.S. and the Soviet Union sign treaty to eliminate intermediate-range nuclear forces, relations improve. Clock changed to six minutes to midnight (three minutes further from midnight).
1990 - Fall of the Berlin Wall, success of anti-communist movements in Eastern Europe, Cold War nearing an end. Clock changed to ten minutes to midnight (four minutes further).
1991 - United States and Soviet Union sign the Strategic Arms Reduction Treaty. Clock changed to seventeen minutes to midnight (seven minutes further, its greatest distance from midnight so far).
1995 - Global military spending continues at Cold War levels; concerns about post-Soviet nuclear proliferation of weapons and brainpower. Clock changed to fourteen minutes to midnight (three minutes closer to midnight).
1998 - Both India and Pakistan test nuclear weapons in a tit-for-tat show of aggression; the United States and Russia run into difficulties in further reducing stockpiles. Clock changed to nine minutes to midnight (five minutes closer).
2002 - Little progress on global nuclear disarmament; United States rejects a series of arms control treaties and announces its intentions to withdraw from the Anti-Ballistic Missile Treaty; terrorists seek to acquire nuclear weapons. Clock changed to seven minutes to midnight (two minutes closer).
2007 - North Korea’s recent test of a nuclear weapon, Iran’s nuclear ambitions, a renewed U.S. emphasis on the military utility of nuclear weapons, the failure to adequately secure nuclear materials, and the continued presence of some 26,000 nuclear weapons in the United States and Russia.[1] Experts assessing the dangers posed to civilization have added climate change to the prospect of nuclear annihilation as the greatest threats to humankind. Clock changed to five minutes to midnight (two minutes closer).
The official announcement of the most recent change to five minutes to midnight took place on January 17, 2007 at 14:30 hours GMT.


In popular culture

In fiction
The Doomsday Clock is referenced in Piers Anthony's novel, Wielding A Red Sword, in which the mythical Incarnation of War can control the position of the hands up to midnight and thereby bring about World War III.
The clock illustrations used in the Watchmen graphic novel series is a reference to The Doomsday Clock. On page 18 of issue #1, a newspaper on Adrian Veidt's desk bears the headline "Nuclear Doomsday Clock Stands At Five To Twelve, Warn Experts".
The Doomsday Clock was used in the game Empire Earth II during a United States mission, featuring a battle on the Bering Sea. The Soviet Union was provoking America to war by attacking Alaska, while the United States was doing everything possible to prevent the clock from reaching midnight.
A similar game, Rise of Nations, has an Armageddon counter that goes down with every nuclear launch. All players will receive an Armageddon ending (automatic lose) if the counter reaches zero.
In the video game Duke Nukem: Zero Hour for the Nintendo 64 the name Zero Hour refers to the Doomsday Clock.
In the book by John Bellairs, The House with a Clock in Its Walls, the mystery involves a clock that is ticking down toward doomsday.
In the comic "Stormwatch PHD". In issue #4 it is explained that the "original" clock gained magical powers, and if the hands were forcefully turned to 12, it would cause nuclear war.

In music
The Doomsday Clock is alluded to throughout "2 Minutes to Midnight", a single from Iron Maiden's album Powerslave. In the cover of the band's single, the mascot Eddie is sitting in chair, with nuclear explosion behind his back.
The song "Def. Con. One." by the band Pop Will Eat Itself includes the lyric "Ten to doomsday, moving fast... Heads up! Mind that blast. No time to sleep, it's Def. Con. One. Can't get no sleep as the ticking ticks on."
The song "Why Did I Fall For That" by The Who has the lines "Four minutes to midnight on a sunny day/Maybe if we smile the clock'll fade away/Maybe we can force the hands to just reverse/'Maybe' is a word, maybe 'maybe's' a curse... We simply believe that we'd remain intact/But history is asking why did you fall for that."
The song "Easy/Lucky/Free" by Bright Eyes contains the lyrics, "I set my watch to the atomic clock. I hear the crowd count down 'til the bomb gets dropped. I always figured there'd be time enough; I never let it get me down."
The Doomsday Clock is directly mentioned in the Ozzy Osbourne song "Thank God for the Bomb" on the album The Ultimate Sin. It is, however, cited in a manner that is inconsistent with the clock's purpose. "The face of the doomsday clock / Has launched a thousand wars / As we near the final hour / Time is the only foe we have."
Australian band Midnight Oil discuss the Doomsday Clock and the threat of nuclear war in their song "Minutes to Midnight" from the album Red Sails in the Sunset. The album cover depicted the disturbing scene of the city of Sydney after a fictional nuclear attack.
"Midnight in a Perfect World" by DJ Shadow, featuring Gift of Gab (from group Blackalicious), alludes to nuclear war and that we are "now approaching midnight", especially in the full lyrical "Gab Mix" off the Endtroducing..... reissue from 2005.
The song "Five Minutes to Midnight" by Boys Like Girls may be a reference to the Doomsday Clock.
On the cover of American band Alive's album 11:59, the Trinity test's rising fireball can be seen with the text "It's later than we thought..." written at the bottom.
Chaos Theory by Jumpsteady makes mention of the Doomsday Clock in the opening song "Outcha Mouth", saying "I'm the last second, sound of doomsday clock, like an open box of anthrax...".
Industrial band Funker Vogt refers heavily to the Doomsday Clock during the chorus of their track "History", a single from the album Survivor, which follows the themes of apocalyptic warfare. Specifically with the lines "The war will soon begin. It's already ten to twelve".
In the music video for "Russians" by Sting, the Doomsday Clock is represented by the clock ticking over the main doorway.
In ABC's music video "S.O.S", the Doomsday Clock was used as the main theme throughout the video.
Linkin Park's album Minutes to Midnight is said to be a reference to the Doomsday Clock.[4]
Zeitgeist, an upcoming Smashing Pumpkins album, includes a song entitled "Doomsday Clock".

In television
Gummi Bears Season 4 Episode 4 "A Knight to Remember" The ghost of a Gummi knight helps Cubbi destroy the mysterious Doomsday Clock.
Glenn Beck had a large Doomsday Clock on the set of his CNN Headline News television show, and he would occasionally adjust the time based on the news of the day.
The title of the Venture Brothers episode "Twenty Years to Midnight" is a reference to the Doomsday clock.
The eighth episode of the series Heroes is titled "Seven Minutes to Midnight", which was the time on the clock at the release of the episode. Also, the villain Sylar wears a watch that stopped at seven minutes to midnight. The series was filmed and began to air prior to the 2007 adjustment of the Doomsday clock, which until then did indeed read seven minutes to midnight.
Adult Swim's night time lineup recently gave reference to the Doomsday clock, by saying sarcastically how we now have five more minutes to do what we want till we die...giving further reference to the recent clock change to five minutes till midnight.
The Doctor Who episode "Four to Doomsday" was first aired in 1982, when the clock was at four minutes to midnight.

In games
In Magic the Gathering 4th edition, there is an artifact called Armageddon Clock that deals increasing damage to each player, speeding up the game's current outcome if left unattended.

Inner Class 嵌套式类

什么是嵌套式类?

顾名思义,Java 语言中的嵌套式类 是在另一个类中声明的类。以下是一个简单的例子:


public class EnclosingClass {
...
public class NestedClass {
...
}
}

通常,好的编程人员会在嵌套式类只在封闭类的上下文中有意义的时候定义嵌套式类。常见的一些例子如下所示:

* UI 类中的事件处理程序。
* 用于组件中的那些 UI 组件的辅助类。
* 适配器类,将某一个类的内部结构转换成其他一些用于该类的用户的形式。

可以将嵌套式类定义为 public、private 或 protected。还可以将嵌套式类定义为 final(以便保护它,使它免受更改)、abstract(意味着它不能被继承)或 static。

当在另一个类中创建 static 类时,将相应地创建一个称为嵌套式类的类。嵌套式类是在另一个类中定义的,但它可以存在于封闭类的实例之外。如果嵌套式类不是 static,那么它只能存在于封闭类的实例中,并且它有一个更适当的称呼,称为内部类。换句话说,所有内部类都是嵌套式类,但并不是所有的嵌套式类都是内部类。在您的工作中遇到的大多数嵌套式类都将是内部类,而不是只是嵌套式类。

任何嵌套式类都可以访问封闭类的所有成员,即使没有将它们声明为 private 也是如此。



定义嵌套式类

定义嵌套式类就像定义非嵌套式类那样,但这项操作是在封闭类中完成的。举一个稍微有点假的例子:在 Adult 内部定义一个 Wallet 类。尽管除了 Adult 之外,实际上还可以拥有一个 Wallet 类,但它并不总是一直有用,所以让每个 Adult 拥有一个 Wallet(或者至少有一个地方存放钱,MoneyContainer 听起来有点怪)是很有道理的。Wallet 并没有存在于 Person 之上也是有一定道理的,因为 Baby 不需要用钱包,如果 Person 上存在 Wallet,那么 Person 的所有子类都将继承它。

这里的 Wallet 将非常简单,因为只有服务器说明了嵌套式类的定义:


protected class Wallet {
protected ArrayList bills = new ArrayList();

protected void addBill(int aBill) {
bills.add(new Integer(aBill));
}

protected int getMoneyTotal() {
int total = 0;
for (Iterator i = bills.iterator(); i.hasNext(); ) {
Integer wrappedBill = (Integer) i.next();
int bill = wrappedBill.intValue();
total += bill;
}
return total;
}
}

我们将定义 Adult 中的类,如下所示:


public class Adult extends Person {
protected Wallet wallet = new Wallet();
public Adult() {
}
public void talk() {
System.out.println("Spoke.");
}
public void acceptMoney(int aBill) {
this.wallet.addBill(aBill);
}
public int moneyTotal() {
return this.wallet.getMoneyTotal();
}
protected class Wallet {
...
}
}

注意,我们添加了 acceptMoney() 来允许 Adult 接受更多的钱。(也可以随意地扩展这个例子,强迫 Adult 给出一些钱,这在现实生活中是很常见的事。)

一旦拥有了自己的嵌套式类和新的 acceptMoney() 方法,就可以使用它们,如下所示:


Adult anAdult = new Adult();
anAdult.acceptMoney(5);
System.out.println("I have this much money: " + anAdult.moneyTotal());

执行以下代码应该报告说 anAdult 的总钱数为 5。



过分简单事件的处理

Java 语言定义了一个事件处理方法,该方法包含相关的类,它允许您创建和处理自己的事件。但事件处理可能比这更简单。实际上,所有您需要的只是一些生成“事件” 的逻辑(该逻辑事实上根本不必是事件类),以及监听该事件并随后相应地给出响应的逻辑。例如,假设无论何时移动 Person,系统都会生成(或者激活)一个 MoveEvent,我们可以选择是处理这个事件,还是不处理这个事件。这要求对系统做一些更改。必须进行以下操作:

* 创建一个“应用程序”类来启动系统,并使用匿名内部类进行说明。
* 创建一个应用程序可以实现的 MotionListener,然后在监听器中处理事件。
* 添加一个监听器的 List 到 Adult 中。
* 添加一个 addMotionListener() 方法到 Adult 中,以便注册一个监听器。
* 添加一个 fireMoveEvent() 方法到 Adult中,这样就可以告诉监听器何时处理事件。
* 添加代码到应用程序中,以便创建一个 Adult 并将其注册为处理程序。

所有这些都很简单。以下是包含新的材料的 Adult:


public class Adult extends Person {
protected Wallet wallet = new Wallet();
protected ArrayList listeners = new ArrayList();
public Adult() {
}
public void move() {
super.move(); fireMoveEvent();
}
...
public void addMotionListener(MotionListener aListener) {
listeners.add(aListener);
}
protected void fireMoveEvent() {
Iterator iterator = listeners.iterator();
while(iterator.hasNext()) {
MotionListener listener = (MotionListener) iterator.next();
listener.handleMove(this);
}
}
protected class Wallet {
...
}
}

注意,我们现在要重写 move(),先调用 Person 上的 move(),然后调用 fireMoveEvent() 告诉监听器作出响应。我们还添加了一个 addMotionListener(),以便将 MotionListener 添加到监听器的运行列表中。以下是一个 MotionListener:


public interface MotionListener {
public void handleMove(Adult eventSource);
}

所有剩下要做的事就是创建应用程序类:


public class CommunityApplication implements MotionListener {
public void handleMove(Adult eventSource) {
System.out.println("This Adult moved:
" + eventSource.toString());
}
public static void main(String[] args) {
CommunityApplication application = new CommunityApplication();
Adult anAdult = new Adult();
anAdult.addMotionListener(application);
anAdult.move();
}
}

这个类实现了 MotionListener 接口,这意味着它实现了 handleMove()。在这里,我们要做的所有事情就是输出一条消息,以说明事件是何时激发的。



匿名内部类

匿名内部类允许在适当的位置定义一个类,而不用命名这个类,以便提供一些特定于上下文的行为。在用户界面中,这是一种用于处理程序的常见方法,这个主题超出了本教程的讨论范围。我们甚至可以在过于简单的事件处理示例中使用匿名内部类。

通过更改对 CommunityApplication.main() 中 addMotionListener() 的调用,可以将前面使用的例子转换成使用匿名内部类,如下所示:


anAdult.addMotionListener(new MotionListener() {
public void handleMove(Adult eventSource) {
System.out.println("This Adult moved:
" + eventSource.toString());
}
});

我们宁愿让 CommunityApplication 实现 MotionListener,也不愿意声明类型 MotionListener 的未指定(因而匿名)的内部类,并为它提供 handleMove() 的实现。事实上,MotionListener 是一个接口,而不是一个类,但是没关系,无论哪种情况都可以接受。

这个代码产生的结果与前面版本产生的结果完全相同,但它使用了一个更常见的并且人们期望使用的方法。几乎总是可以看见用匿名内部类实现的事件处理程序。



使用嵌套式类


嵌套式类可能非常有用,但它们也可能会带来一些痛苦。

当在封闭类之外定义类不那么合理的时候,可以使用嵌套式类。在这个例子中,我们可以拥有在 Adult 之外定义的 Wallet,感觉不错。但是,请设想一下 Personality 这样的类。您曾经有一个位于 Person 实例之外的类吗?没有吧,所以,将这个类定义为嵌套式类是很合理的。一条好的经验法则是:除非显然应该将类定义为嵌套式类,然后重构这个类来实现其嵌套,否则应该将该类定义为非嵌套式类。

匿名内部类是用于事件处理程序的标准方法,因此,可以将它们用于这些方面。在其他情况下,要小心使用它们。除非匿名内部类很小、很集中并且是人们惯用的,否则这些类会弄乱代码。它们还会使调试更加困难,虽然 Eclipse IDE 有助于减轻这种痛苦。通常,除了对事件处理程序使用匿名内部类,绝对不要尝试在其他情况下使用匿名内部类。