RSS

Tag Archives: game

Brilliant: Elites are more likely selfish and less equality minded

Gordon_Gekko

Who, me? Share?

A new study published in Science Magazine demonstrates something you might very well have predicted, elite individuals place greater value on themselves in general, and when there is cost involved in sharing, they are more likely to ‘charge’ that cost to others.

Somehow this article reminds me of a similar look into the way that drivers of ‘valuable’ cars tend to ignore laws regarding yielding to pedestrians than drivers of less valuable cars described in my ‘Greed is Good‘ blog article.

In the current study, three groups of individuals were asked to play the dictator game. This is a simple ‘game’ where one person is given all the power and then asked how much they want to share. It is typically done with food for children and animals (chimps) or money for adults. Here is the game explained:

In this article, the three groups were Yale Law Students (Labeled as ‘elites’), Berkeley Undergrads (Labeled as ‘intermediate elites’) and a group of randomized Americans. Each group was assessed in two ways, first was their generosity: How fairly did they share?

They were classified as either ‘fair-minded’, ‘intermediate’, or ‘selfish’

Second, was how their generosity was affected by adding a cost to sharing.

This classified them as either ‘equality-focused’ if they split the cost of sharing evenly or ‘efficiency-focused’ meaning that they charged the cost of sharing to the one being shared with.

Here are the data:

Screen Shot 2015-09-17 at 9.41.52 PM

Interestingly, it appears that the ‘Intermediate Elite’ were the most selfish – although both elite groups were much more selfish than the ‘American Adults’. But, when charged a price to share, the Law Students were the most likely to pass that cost along.

In general though, I see both groups of elites acting a lot like todlers…

Here’s an example of the game being played with a two year old girl and her dad using goldfish crackers.

What I would like to say is, hey – those of you for whom life is going pretty well, don’t forget to share a little – oh, and yield for pedestrians.

se_pedestrian_protection_de-data

 
Leave a comment

Posted by on September 17, 2015 in Uncategorized

 

Tags: , , , , , ,

Miss Scarlett

With the Candlestick

Well, of course I did it, Darling.

In writing a quick post for one of my other blogs I came across the studio of Joanna Katchutas, who made a piece of artwork that I thought worked well with the piece. Check out that post – about the game and film, Clue, here.

 
1 Comment

Posted by on June 11, 2014 in Uncategorized

 

Tags: , , , , ,

eteRNA RNA folding game

Image

Proper Folding Achieves Lowest Energy Conformation

My general biology students were asked yesterday to check out eteRNA, an interesting online game designed around problems of RNA folding. RNA is a fascinating molecule for a number of reasons.

  • What we might think of immediately, mRNA as an information carrying molecule, is just one of its many jobs.
  • In addition to this, RNA serves as a delivery molecule in the form of tRNA. These molecules are capable of both ‘reading’ the mRNA message, through codon:anti-codon interactions, and they also recruit and deliver Amino Acids that correspond to the codon in question. 
  • RNA also functions as ribozymes, enzymes comprised entirely, or in part, of RNA. An example of this is the ribosome that is mostly rRNA with only a small protein contribution.

EteRNA explores the plasticity of RNA function by demonstrating the capacity of this molecule to fold into a variety of shapes. As I frequently remind my class, FORM DICTATES FUNCTION. This is true of all things in biology (and perhaps beyond). When a molecule is formed correctly, it carries out its function appropriately. When that form is altered due to mutation, misfiling or other denaturing processes, the function is also altered. This may be for better or worse, but mostly for worse.  Depending on this function, the ‘fitness’ of the cell for survival / reproduction may be affected leading to selection for or against this cell.

Image

Eterna

I set up a group titled: FortScott_Treml that I invite my students (or anyone else) to join. For my students, anyone who completes the the tutorials will receive 5 extra credit points. Anyone who earns a puzzle master badge will earn another 5.

 
 
Leave a comment

Posted by on November 13, 2013 in Uncategorized

 

Tags: , , , , , , ,

Blood Typing Game from NobelPrize.org

Here’s a cute little game to test your knowledge of blood typing. It includes aspects of the typing process that I did not talk about in my posts, but with the instructions provided you should be able to perform perfect typing and transfusions every time.

http://www.nobelprize.org/educational/medicine/bloodtypinggame/

 

Yes!

 
Leave a comment

Posted by on November 12, 2012 in Uncategorized

 

Tags: , , , , , , , ,

Game Night

I just wrote about the change in season and it’s very much on my mind and last night was a perfect example of what I like.: Perfect for game night.

ImageMy wife has been away traveling for two weeks (with a little respite last weekend) and just returned yesterday afternoon. Because she’s been gone so long, it felt much better to sit and play a board game rather than get sucked into a movie. Moreover, Harry picked the perfect game.

When I was a kid, I lived (most of the time) with my grandparents. My youngest aunt, Kim, was only eight years older than me, so she was in the house for many of those years. She was also a wholeheartedly devoted runner who still holds a  records in Delaware for her age group for 10K, 15K, 20K, 10 mile and Half-Marathon. I’m waxing on about her a little because she passed away a couple of years ago following an accident that caused serious brain damage, so there’s no fear of her reading this and getting an inflated ego.

I brought up Kim’s memory because she once got a Marathon board game from Runners, World. It’s a great game in part because of its simplicity. Basically, you set your pace to one of five speeds and then draw cards that indicate how many spaces you can go. Being a marathon, the road is littered with obstacles, thirst and injuries that will limit your pace, causing more damaging impact the faster your pace was set when you hit it.

This game is so old and targeted at such a specific audience that I really wonder how many surviving copies there still are.

Image

 
Leave a comment

Posted by on October 27, 2012 in Uncategorized

 

Tags: , , , , , , , ,

function: compareGuess – the hardest one yet

First – I’m playing with some themes, so sorry about the fact that the site doesn’t look the same. I’m actually having a hell of a time getting things set up in a way that I am happy with and feel like I have sufficient control over.

Second -the new function: compareGuess. This one was a bear! I was wrestling with it forever before I finally got it to work correctly. Well, I hope it works correctly – I’ll post the whole program in the next post so that you can copy and paste it into a Javascript editor / compiler /whatever it’s called.

Why this one was hard is that, in the game, there are two ways you can ‘score’: if you get the right number in the right position, that’s the best(I’m calling that green). You can also get the right number in the wrong position (I’m calling that yellow). The problem is that these are mutually exclusive, with green trumping yellow in a manner of speaking. This is further complicated by the fact that once a number matches, you don’t want to use that same number to match again. This requires an example to illustrate…

secret code is: 112

guess is 123

The first position is a perfect match (green). But then the first position of the guess needs to be ignored when analyzing the rest of the code. If you just nest one loop inside another, you can easily get output of :

1 green

2 yellow

This is because position#1 of the guess matches position#1 of the code= green

but position #1 of the guess also matches position#2 of the code = yellow? -It’s not supposed to be, but how to fix?!?

then, position#2 of guess matches position#3 of the code = yellow (this one’s correctly attributed)

that gives us a total of three match signals when only two are a match!!

 

My solution (after a long time of playing around) was to add ‘guessedAlready’ and ‘secretedAlready’ Boolean Arrays within the function (It’s really important to keep these arrays private / privileged otherwise, you can run into problems when values get carried over from one guess to the next).

guessedAlready[0] refers to the first position of the guess, i.e. guess[0].

Then I set the arrays to false to start, added statements redefining them as true anytime a match was made and finally added qualifiers to my ‘if’ statements that check to see if each number was guessed already (or part of the secret code already) and therefore should be ignored.

This solution still ran into problems though until I separated my loops and looked for only exact matches (green) first, then went back and looked for inexact matches (yellow). Otherwise, if I found an inexact match in the secret code and then hid it, I couldn’t ‘see’ it for the exact match comparison later. Ughhh. example:

secret code: 112

guess : 212

if guess[0] matches code[2] as above, then we get a yellow peg for an inexact match and then we hide code[2] and don’t see that it should actually be an exact match with guess[2].

So, the function has two major parts. Part#1 loops and looks for greens. Part#2 loops and looks for yellows. Then I added a short Part#3 that sets the # of whites (no match) to white = code -(green+yellow), where code is the number of digits in the code.

I hope that makes sense. I tested this several times last night and it looked good. I will test it more later, but please feel free to make comments if you see a problem. Or ever better: if you can code and are still reading this for some reason, let me know if there is an easier way to solve this problem.

Here’s the code:

 

var compareGuess = function(code,secrets,guesses){

var green = 1-1; //right color, right position

var yellow = 1-1; //right color, wrong position

var white = 1-1; //wrong color

var guessedAlready=[];

var secretedAlready = [];

code = code*1; //converts code to a number type

//part 0: set ‘Already’ arrays to false

for (i=0; i<code; i++){

guessedAlready[i] = false;

secretedAlready [i]= false;

};

//part 1: check for perfect matches, alter guesses and secrets

//array positions to eliminate recount – count greens

for (i=0; i<code; i++){

guesses[i] = guesses[i] *1;

//console.log(“I’m in the first loop”);

//console.log(“guess”+i+”=”+guesses[i]+” of type “+typeof guesses[i]);

//console.log(“secret”+i+”=”+secrets[i]+” of type “+typeof secrets[i]);

if (guesses[i] === secrets[i] &&

guessedAlready[i] === false && secretedAlready[i] === false){

//console.log(“I’m in green”);

green++;

guessedAlready[i] = true;

secretedAlready[i] = true;

}

}

//part2: check for imperfect matches, alter guesses and secrets

//array positions to eliminate recount – count yellows

for(i=0; i<code; i++){

for (j=0; j<code; j++){

if (guesses[i] === secrets[j] &&

guessedAlready[i] === false && secretedAlready[j] === false){

yellow++;

guessedAlready[i] = true;

secretedAlready[j] = true;

}

}

}

//part 3: set white to number of unmatched items

//provide feedback to player

white = code – (green+yellow);

alert(green+” green    ” + yellow+” yellow”+ white+” white”);

console.log(green+” green ” + yellow+” yellow”+ white+” white”);

if (green === code){

exitShowResultLoop = true;

}

 

};

 

 

 

 

Tags: , , , , , , , ,

function: AcceptGuess

The next function I had to work out was how to accept the player’s guess in a way that would set up an array in a way that each digit of the player’s guess is an entry in the array. This would give me an array containing the secretCode generated by the computer and an array containing the guess generated by the user. All I’d have to do then, in cycle through the arrays to make comparisons (If only it was so easy).

So, this function proved to be quite simple:

 

 

//accepts guess from user and parses it into an array of ‘code’ length

acceptGuess = function(code,numbers){

    console.log(“***acceptGuess function reached***”);

    var guess = prompt(“Make a guess at the secret code (“+code+”digits/1-“+numbers+”)”);

    //need to add something to ensure guess is within parameters

        console.log(“guesslength is “+guess.length);

        console.log(“code is “+code);

        var codeNum = code * 1;

        console.log(typeof guess.length);

        console.log(typeof codeNum);

        if (guess.length === codeNum){

        console.log(“got inside the loop”);

            for (i=0;i>code; i++){

                console.log(“guess[i] = “+guess[i]);

                guessDigit[i] =guess.substring(i,i+1);

                console.log(guessDigit[i]);

            }

            return guessDigit;

        } else {

             console.log(“invalid guess”);

        }

};

The only problem I had with this was that the parameter ‘code’ comes through as a string. Note the two lines of code:

console.log(typeof guess.length);

console.log(typeof codeNum);

I’ve realized that the best way to debug is to have console.log lines everywhere that write out what is going on step by step. ‘typeof’ has been a very valuable code that I use whenever it looks like math isn’t working – so far it has uncovered the problem nearly 100% of the time.

Javascript will convert it to a ‘number’ if you do any mathematical function with the variable. An easy way to do this without messing anything up is to multiply by 1. To be even more careful, I created a new variable, ‘codeNum’, to hold this value as a number. The following line did that:

var codeNum = code * 1;

 

Last piece in my next post: comparing the values of the guess with the secret code. I just finished this 5 minutes ago after running myself ragged for several days (it was the reason I was dilly dallying about this posting)

 

 
Leave a comment

Posted by on July 3, 2012 in Uncategorized

 

Tags: , , , , , , ,

function: Generating a Secret Code

I knew this would be a more challenging function for me. From the outset I’ve been considering a couple different strategies for accomplishing this function. One idea was to have the secret code be an object – one thing I liked about this was that I’ve never used an Object in any coding before aside from the codecademy exercises where you have a lot of help in getting it right. The other idea was to make the guess an Array. I should say that I’ve never used an array before for anything that wasn’t a reformatted exercise either. I also thought that perhaps an array might be a bit easier too.

S0, I chose to go forward with the array idea. It makes sense to me. An array is a list of variables all collected together and in a fixed order (the first position is called [0], the second is [1] and so on. Some examples of arrays are:

var x = [1,2,3,5,8,13];

console.log(x[0]); would print the number in the ‘0’ position to the console, (i.e. 1)

console.log(x[3]); would print the number in the ‘3’ position to the console, (i.e. 5)

Array can also be lists of strings:

var cats = [“William”, “Oliver”, “Chloe”, “Anna”];

console.log(cats[1]); would print the number in the ‘1’ position to the console, (i.e. Oliver)

 

What I like about this is that the numbers have order – just what I’ll need to set and crack a combination.

Here’s the function I came up with to do this – It wasn’t easy for me, at one point I managed to make an array that had another nested array inside of it. I couldn’t make heads or tails of it, but thanks to some good people on stack overflow, the problem was identified and solved.

 

 

//sets up an array of numbers that will be the secret code

// code is the number of digits, number is the integers used for each digit

setSecretCode = function(code,numbers){

var secretCode = “0”;

var secret = [];

console.log(“***reached setSecretCode function***”);

for (i=0; i < code; i++){

secret[i] = Math.floor(Math.random()*numbers+1);

}

return secret; to return result to be used going forward

};

 

This function is called:

var secret = setSecretCode(enteredCode,enteredNumber);

 

//printout of array for debugging

console.log(“secret code is: “+ secret);

 

Tags: , , , , , , ,

function#1: User provides number of digits in the secret code

Here’s my first function.

It prompts the user to provide a number of digits from 1-6. It then confirms this with the user – well, really just me for debugging purposes. I also use a Boolean ‘codeVeritas’ to ensure that the number of digits the user enters is within the parameters defined.

 

//gets the number of digits used
var code = function(){
    var enteredCode = 0;
    var codeVeritas = false;
    //so far the codeVeritas is working fine
    while (codeVeritas === false){
        console.log(“***code function reached***”);
        enteredCode = prompt(“How many digits shall the code be? (1-6)”);
        //verify input
        if (enteredCode > 0 && enteredCode <= 6){
            console.log(“We will be using “+ enteredCode+ ” digits in our code”);
            codeVeritas = true;
            return enteredCode;    
        } else{
            alert(“number is out of range.”);
            
        }
    }

};

 

Tags: , , , , , , ,

Outlining and early steps in coding mastermind

The only language that I have an even decent grasp on right now is javascript. So, even though I know I’ll have to redo most of my work in order to get this project into XCode, I’m starting there.

 

My first thought was to create an outline of how I think the program should function.

 

I’m not sure what will change over time, but to start I had this:

 

//gets the number of digits used

var code = function(){

console.log(“***code function reached***”);

};

 

//gets numerals to be used in code

var numbers = function(){

console.log(“***numbers function reached***”);

};

 

//sets up an array of numbers that will be the secret code

// code is the number of digits, number is the integers used for each digit

setSecretCode = function(code,numbers){

console.log(“***reached setSecretCode function***”);

};

 

//accepts guess from user and parses it into an array of ‘code’ length

acceptGuess = function(code,numbers){

    console.log(“***acceptGuess function reached***”);

};  

 

var compareGuess = function(){

    console.log(“***compareGuess function reached***”);

};

 

var showResult = function(){

    console.log(“***showResult function reached***”);

    exitShowResultLoop = true;

};

 

 

var exitShowResultLoop = false;

//computer prompts users for parameters to build secret code

var enteredCode = code(); // brings the variable  enteredCode out of the function

console.log(enteredCode); //checking variable

var enteredNumber = numbers(); // brings the variable enteredNumber out of the function

 console.log(enteredNumber); //checking variable

 

//computer sets secret code

var secret = setSecretCode(enteredCode,enteredNumber);

 

//printout of array for debugging

console.log(“secret code is: “+ secret);

 

//play the game using a while loop to loop until correct guess is made

while (exitShowResultLoop === false){

    var guessArray = acceptGuess(enteredCode, enteredNumber);

    console.log(“guess is: “+guessArray);

    compareGuess();

    showResult(); //contains an exit clause

}

console.log(“You’ve done it!!! Congratulations!!”);

 

 Really, this is just a list of functions and function calls that I want to build out. I think that if I can write each of these properly, I should have a functioning game. For starters, I have a ton of console.log()’s littered everywhere just to make sure that the program is going to each function in turn. Once I complete a section, I comment them out or completely delete then and replace them with notes about how things work.

Another important thing I learned was that it’s easiest to look at this in chunks. set variables myself and send them into the functions so they could be made independently. I’m sure this is not worth mentioning to anyone who has done any programming, but to someone like me it was an epiphany.

 

More later as I flesh things out….

 

Tags: , , , , , ,