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
def alphabeta(igrajer, ploca, alpha, beta, depth, evaluate): | |
if depth == 0: | |
return evaluate(igrajer, ploca), None | |
def value(ploca, alpha, beta): | |
return -alphabeta(protivnik(igrajer), ploca, -beta, -alpha, depth-1, evaluate)[0] | |
moves = legalan_potez(igrajer, ploca) | |
if not moves: | |
if not bilokoji_lPotez(protivnik(igrajer), ploca): |
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
def minimax(igrajer, ploca, depth, evaluate): | |
def value(ploca): | |
return -minimax(protivnik(igrajer), ploca, depth-1, evaluate)[0] | |
if depth == 0: | |
return evaluate(igrajer, ploca), None | |
moves = legalan_potez(igrajer, ploca) | |
if not moves: |
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
TEZINE_PLOCE = [ | |
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
0, 120, -20, 20, 5, 5, 20, -20, 120, 0, | |
0, -20, -40, -5, -5, -5, -5, -40, -20, 0, | |
0, 20, -5, 15, 3, 3, 15, -5, 20, 0, | |
0, 5, -5, 3, 3, 3, 3, -5, 5, 0, | |
0, 5, -5, 3, 3, 3, 3, -5, 5, 0, | |
0, 20, -5, 15, 3, 3, 15, -5, 20, 0, | |
0, -20, -40, -5, -5, -5, -5, -40, -20, 0, | |
0, 120, -20, 20, 5, 5, 20, -20, 120, 0, |
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
import random | |
def random_strategija(igrajer, ploca): | |
return random.choice(legalan_potez(igrajer, ploca)) |
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
def pozicije(): | |
"""Funkcija koja vraca sve validne pozicije na ploci""" | |
return [i for i in xrange(11, 89) if 1 <= (i % 10) <= 8] | |
def init_ploca(): | |
"""Stvara novu plocu sa inicijalnim potezima za crnog i bijelog igraca ispunjenim""" | |
ploca = [obrub] * 100 | |
for i in pozicije(): | |
ploca[i] = prazno | |
ploca[44], ploca[45] = bijeli, crni |
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
~# turnserver -c /usr/local/etc/turnserver.conf -v -a -r 95.85.6.252 --use-auth-secret --userdb /usr/local/etc/turnuserdb.conf | |
0: | |
RFC 3489/5389/5766/5780/6062/6156 STUN/TURN Server | |
Version Citrix-3.2.1.4 'Marshal West' | |
0: | |
==== Show him the instruments, Practical Frost: ==== | |
0: TLS supported | |
0: DTLS supported |
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/env python | |
# -*- coding: utf-8 -*- | |
# Copyright 2013 Matt Martz | |
# All Rights Reserved. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); you may | |
# not use this file except in compliance with the License. You may obtain | |
# a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 |
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
import argparse, time, os, uuid | |
from pwd import getpwnam | |
from multiprocessing import Process, Queue | |
def sender(q, message): | |
_id = uuid.uuid4() | |
print("[S] sending {}".format(message)) | |
for i, part in enumerate(message): | |
q.put({ 'data': part, 'sequence_number': i, 'sender_id': str(_id) }) |
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
import random, subprocess | |
def start_game(): | |
operations = ['+', '-', '*', '/'] | |
for i in range(10): | |
n1 = random.randint(0, 100) | |
n2 = random.randint(0, 100) | |
operation = operations[random.randint(0, 3)] | |
sol = raw_input("{} {} {} = ".format(n1, operation, n2)) |
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
/* | |
Neka je zadana baza znanja: | |
zaposlenik::osoba. | |
kupac::osoba. | |
menadzer::zaposlenik. | |
direktor::menadzer. | |
stefica:kupac. | |
ivek:zaposlenik. |