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
roll <- function(rolls=6, die=1:6) { | |
dice <- sample(die, size = rolls, replace = TRUE) | |
} | |
verify <- function(a_roll=roll(), target=c(1,2,3)) { | |
if(length(a_roll) < length(target)) { # target requires more rolls | |
return (FALSE) | |
} | |
# cat("The roll being processed: ", a_roll, "\n") | |
for(choice in target) { |
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 cv2 as cv | |
def integral_test(X): # returns True if X is convex | |
img_t = np.reshape(X, (28, 28)) # preprocess: reshaping | |
int_result = cv.integral(img_t.astype(np.uint8)) # calculating the integral-image | |
patterns_to_test = [block_patterns, big_block_patterns, horizontal_patterns, vertical_patterns, | |
horizontal_patterns2, vertical_patterns2, bigger_block_patterns, horizontal_patterns3, | |
vertical_patterns3, bbigger_block_patterns, bbbigger_block_patterns, bbbbigger_block_patterns] | |
for p in range(len(patterns_to_test)): # run test on all patterns until a match is found |
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
# defining/generating all the patterns | |
pattern1 = np.asarray([[-1, -1, -1, 1], | |
[ 1, 1, 1, 1]]) | |
pattern2 = np.rot90(pattern1) | |
pattern3 = np.rot90(pattern2) | |
pattern4 = np.rot90(pattern3) | |
pattern5 = np.fliplr(pattern1) | |
pattern6 = np.rot90(pattern5) | |
pattern7 = np.rot90(pattern6) |
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
package com.example.payne.simpletestapp.mainActivities; | |
import android.arch.lifecycle.ViewModelProviders; | |
import android.content.Context; | |
import android.content.DialogInterface; | |
import android.content.Intent; | |
import android.content.SharedPreferences; | |
import android.os.Build; | |
import android.os.Bundle; | |
import android.os.Vibrator; |