This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def _single_frame(self): | |
self._i = self._i + 1 | |
iframe = self._ts.frame | |
i_ref = self.atoms.positions - self.atoms.center_of_mass() | |
# diagonal entries need not be calculated due to metric(x,x) == 0 in | |
# theory, _ts not updated properly. Possible savings by setting a | |
# cutoff for significant decimal places to sparsify matrix | |
for j, ts in enumerate(self._u.trajectory[self.start:self.stop:self.step]): | |
self._ts = ts | |
if self._ts.frame >= iframe: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Code written by Hanh Nguyen. hanhn3@uci.edu | |
import MDAnalysis | |
import numpy as np | |
from MDAnalysis import analysis | |
import matplotlib.pyplot as plt | |
import math | |
traj = ['prod1.trr', 'prod2.trr', 'prod3.trr', 'prod4.trr', 'prod5.trr', 'prod6.trr', 'prod7.trr', 'prod8.trr', 'prod9.trr', | |
'prod10.trr', 'prod25.trr', 'prod50.trr', 'prod75.trr', 'prod100.trr'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//numPrimes is above in scope, array that maps bin to the number of primes up to it | |
//takes n of the prime that we are looking for | |
//returns bin | |
function binSearch(target, bins){ | |
lastBin = bins[bins.size-1]; | |
if(target < numPrimes[lastBin] && target > numPrimes[lastBin-1]){ | |
return lastBin; | |
} | |
else if(target < numPrimes[lastBin]){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function foo(arg){ | |
if(arg == baseCase){ | |
//console.log arg and we will get what we want | |
return result; | |
//will returned undefined | |
} | |
else{ | |
//decrement arg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var deepCopy = require("deepcopy"); | |
//takes in deck object, returns shuffled deck object, given random number generator | |
function size (object) { | |
var size = 0; | |
var keys = Object.keys(object); | |
for (var i = 0; i<keys.length; i++){ | |
if(object.hasOwnProperty(keys[i])){ | |
size++; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var deepCopy = require("deepcopy"); | |
//takes in deck object, returns shuffled deck object, given random number generator | |
function size (object) { | |
var size = 0; | |
var keys = Object.keys(object); | |
for (var i = 0; i<keys.length; i++){ | |
if(object.hasOwnProperty(keys[i])){ | |
size++; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package tictactoe; | |
import java.util.ArrayList; | |
import java.util.Scanner; | |
public class ComputerPlayer implements Player { | |
public char playerchar; | |
public ComputerPlayer(char c){ | |
playerchar = c; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package tictactoe; | |
import java.util.Scanner; | |
public class HumanPlayer implements Player { | |
private Scanner scanner; | |
public char playerchar; | |
public HumanPlayer(Scanner s, char c){ | |
scanner = s; | |
playerchar = c; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public WinDrawLose returnmoveoutcome(ToeBoard tictac, char playerchar){ | |
//System.out.println("Remember to input your move in terms of the row and column that you want to place your character in."); | |
WinDrawLose outcome = new WinDrawLose(); | |
char nextplayerchar = 'O'; | |
if(playerchar == 'O'){ | |
nextplayerchar = 'X'; | |
} | |
int[] move = new int[2]; | |
int row = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public WinDrawLose returnmoveoutcome(ToeBoard tictac, char playerchar){ | |
//System.out.println("Remember to input your move in terms of the row and column that you want to place your character in."); | |
WinDrawLose outcome = new WinDrawLose(); | |
char nextplayerchar = 'O'; | |
if(playerchar == 'O'){ | |
nextplayerchar = 'X'; | |
} | |
int[] move = new int[2]; | |
int row = 0; |