This file contains hidden or 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
#!/usr/bin/python2 | |
print 'Enter number of processes' | |
n, proc_in, time, proc_queue = int(raw_input()), [], 0, [] | |
for i in xrange(n): | |
proc = [] | |
print 'Enter PID' | |
proc.append(raw_input()) | |
print 'Enter arrival time' | |
proc.append(int(raw_input())) |
This file contains hidden or 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
#!/usr/bin/python2 | |
print 'Enter number of processes' | |
n, proc_queue, time = int(raw_input()), [], 0 | |
for i in xrange(n): | |
proc = [] | |
print 'Enter PID' | |
proc.append(raw_input()) | |
print 'Enter arrival time' | |
proc.append(int(raw_input())) |
This file contains hidden or 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
print "Enter string" | |
inp = list(raw_input()) + [' '] | |
R, L = lambda f:f+1, lambda f:f-1 | |
state, i = 0, 0 | |
machine = [{'0':[1,'X',R], 'Y':[3,'Y',R]}, {'0':[1,'0',R], 'Y':[1,'Y',R], '1':[2,'Y',L]}, {'Y':[2,'Y',L], '0':[2,'0',L], 'X':[0,'X',R]},{'Y':[3,'Y',R], ' ':[4,' ',R]},{}] | |
while state != 4: | |
print inp[i],': State = ',state, |
This file contains hidden or 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
# -*- coding: utf-8 -*- | |
""" | |
pygments.console | |
~~~~~~~~~~~~~~~~ | |
Format colored console output. | |
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS. | |
:license: BSD, see LICENSE for details. | |
""" |
This file contains hidden or 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
#!/bin/bash | |
inp="No"; | |
echo "Are you SURE you want to delete file(s) in $(pwd)? (No/yes)" | |
read inp | |
if [ "$inp" == "yes" ];then | |
echo "Removing..." | |
rm $@ | |
else | |
exit 1 |
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Test Game</title> | |
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> | |
<script type="text/javascript"> | |
$(document).ready(function(){ | |
$('#gameCanvas').width(window.innerWidth); | |
$('#gameCanvas').height(window.innerHeight); | |
}); |
This file contains hidden or 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
#include <iostream> | |
#include <string> | |
#include <vector> | |
#include <queue> | |
#include <stack> | |
#include <algorithm> | |
using namespace std; | |
class Node{ |
This file contains hidden or 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
#!/usr/bin/python3 | |
def whazaa(n): | |
for i in range(1,n): | |
if i % 15 == 0: | |
print('Whazaa') | |
elif i % 3 == 0: | |
print('Hip') | |
elif i % 5 == 0: | |
print('Hop') | |
else: |
This file contains hidden or 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
/** | |
* Based on the paper "A Heuristic for Solving the Generalized Water Jug Problem | |
* Florin Leon, Mihai Zaharia, Dan Galea | |
*/ | |
#include <iostream> | |
using namespace std; | |
class Jug{ |
This file contains hidden or 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
#include <iostream> | |
using namespace std; | |
enum players {X = 1, O = 2}; | |
class TicTacToe{ | |
short state[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; | |
const short strategy[9] = { 1, 3, 1, 3, 5, 3, 1, 3, 1}; |