Skip to content

Instantly share code, notes, and snippets.

View djvita's full-sized avatar

Vita V djvita

  • support enginer
  • MX remote
View GitHub Profile
@djvita
djvita / othello
Created July 11, 2016 19:13 — forked from alcuin/othello
A Min-Max search algorithm for Othello on R with simple GUI.
CONST.TIME.LIMIT <- 6 # threshold of time(sec) for searching.
CONST.MAX.DEPTH <- 3 # max depth of depth-first searching.
##' main
othello <- function(verbose = FALSE) {
## initialize.
board <- as.numeric(rep(0,8^2))
turn <- 1
board[conv.xy2index(4,4)] <- board[conv.xy2index(5,5)] <- 1
board[conv.xy2index(4,5)] <- board[conv.xy2index(5,4)] <- -1
This file has been truncated, but you can view the full file.
{
"metadata": {
"name": "",
"signature": "sha256:a04c38d9604adb7eb9ca89860dfa1ef72db66037cc2c07c391ef8e67a31f9254"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
# Calculate the nth Fibonacci number, f(n). Using invariants
def fibo_tr(n, acc1, acc2)
if n == 0
0
elsif n < 2
acc2
else
return fibo_tr(n - 1, acc2, acc2 + acc1)
end
end