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
module Nim.NimGame where | |
import Control.Applicative ((<$>)) | |
import Control.Monad (guard, msum, unless) | |
import Control.Monad.Trans (liftIO) | |
import Control.Monad.Trans.Maybe (MaybeT, runMaybeT) | |
import Control.Monad.Trans.State (StateT, evalStateT, get, put) | |
import Data.Bits (shiftR, (.|.)) | |
import Data.Char (toLower) | |
import Data.Maybe (fromJust) |
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
#! /usr/bin/python3.2 | |
from tkinter.tix import Tk | |
from tkinter.ttk import Label, Entry, Button, Combobox | |
import sys | |
from tkinter.messagebox import showerror | |
from tkinter import StringVar | |
from tkinter.constants import S, E, N, W, CENTER, FALSE, DISABLED | |
try: | |
from wmi import WMI | |
except ImportError: |
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
import numpy as np | |
import numpy.random as nprand | |
def simula(num): | |
num = nprand.permutation(num) | |
for i in range(3): | |
if len((num[i::3] == i + 1).nonzero()): | |
return False | |
return True |
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
expr(n(T1, O, T2)) --> term(T1), addop(O), expr(T2). | |
expr(T1) --> term(T1). | |
term(n(F1, O, F2)) --> fact(F1), mulop(O), term(F2). | |
term(F1) --> fact(F1). | |
fact(l(I)) --> [I], {integer(I)}. | |
fact(E) --> ['('], expr(E), [')']. | |
addop(add) --> [+]. | |
addop(sub) --> [-]. | |
mulop(mul) --> [*]. | |
mulop(div) --> [/]. |
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
__author__ = 'davide' | |
import numpy as np | |
LEFT, RIGHT, INCR, DECR, INPUT, OUTPUT, WHILE, WEND = range(8) | |
opcodes = {'<': LEFT, | |
'>': RIGHT, | |
'+': INCR, | |
'-': DECR, | |
',': INPUT, |
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
__author__ = 'davide' | |
import fsm | |
# automa di a+bc* | |
class Q0(fsm.State): | |
def next(self, input, fsm): | |
if input == 'a': |
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
// ==UserScript== | |
// | |
// @name YT | |
// @version 1.0 | |
// @author Davide Canton | |
// | |
// @include http://www.youtube.com/watch?v=* | |
// @match http://www.youtube.com/watch?v=* | |
// @include https://www.youtube.com/watch?v=* | |
// @match https://www.youtube.com/watch?v=* |
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
__author__ = 'davide' | |
import operator | |
NO_EFFECT, NOT_EFFECTIVE, NORMAL, SUPEREFFECTIVE = range(4) | |
TYPES = list(zip(['Normale', 'Fuoco', 'Acqua', 'Elettro', 'Erba', 'Ghiaccio', | |
'Lotta', 'Veleno', 'Terra', 'Volante', 'Psico', 'Coleottero', | |
'Roccia', 'Spettro', 'Drago', 'Buio', 'Acciaio'], range(17))) |
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
class dyn_bitset | |
{ | |
using byte_t = uint_fast8_t; | |
private: | |
int _size, _bits; | |
byte_t* _buf; | |
public: | |
dyn_bitset(int n) |
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
#ifndef BFINTEPRETER_H_ | |
#define BFINTEPRETER_H_ | |
#include <iostream> | |
#include <cstdint> | |
#include <vector> | |
using namespace std; | |
namespace BF |
OlderNewer