├── 3_sum ├── gotta_go_fast │ ├── .gitkeep │ └── andrerfcsantos │ │ └── go │ │ ├── .gitignore │ │ ├── README.md │ │ └── main.go ├── input.txt ├── code_golf │ ├── 0urobor0s │ │ └── ruby │ │ │ └── 3sum.rb │ └── ZePedroResende │ │ ├── haskell │ │ └── 1.hs │ │ └── python │ │ └── 1.py ├── LEADERBOARD.md └── README.md ├── 7_sleeping_barber ├── .gitkeep ├── herulume │ └── Main.hs └── README.md ├── 1_dice_roler ├── code_golf │ ├── .gitkeep │ └── joaop21 │ │ └── awk │ │ ├── README.md │ │ └── diceroller.awk ├── input.txt ├── gotta_go_fast │ ├── 0urobor0s │ │ └── elixir │ │ │ └── diceroller │ │ │ ├── test │ │ │ ├── test_helper.exs │ │ │ └── diceroler_test.exs │ │ │ ├── .formatter.exs │ │ │ ├── lib │ │ │ ├── benchmark.ex │ │ │ ├── mix │ │ │ │ └── tasks │ │ │ │ │ ├── roll.ex │ │ │ │ │ ├── gen.input.ex │ │ │ │ │ └── benchroll.ex │ │ │ └── diceroler.ex │ │ │ ├── mix.lock │ │ │ ├── README.md │ │ │ ├── bench │ │ │ └── par_bench.exs │ │ │ ├── .gitignore │ │ │ ├── mix.exs │ │ │ ├── sample_input.txt │ │ │ └── config │ │ │ └── config.exs │ ├── andrerfcsantos │ │ └── go │ │ │ ├── .gitignore │ │ │ ├── main.go │ │ │ ├── bonus.go │ │ │ └── README.md │ ├── Marquinhos87 │ │ └── C │ │ │ ├── input.txt │ │ │ ├── Makefile │ │ │ ├── src │ │ │ ├── main.c │ │ │ ├── diceroler.c │ │ │ └── diceroler.h │ │ │ └── README.md │ ├── ZePedroResende │ │ └── clojure │ │ │ ├── doc │ │ │ └── intro.md │ │ │ ├── .gitignore │ │ │ ├── README.md │ │ │ ├── test │ │ │ └── dice │ │ │ │ └── core_test.clj │ │ │ ├── project.clj │ │ │ ├── src │ │ │ └── dice │ │ │ │ └── core.clj │ │ │ ├── CHANGELOG.md │ │ │ └── LICENSE │ └── nelsonmestevao │ │ └── golang │ │ ├── README.md │ │ └── diceroller.go ├── LEADERBOARD.md └── README.md ├── 4_mondrian_puzzle ├── code_golf │ └── .gitkeep ├── gotta_go_fast │ └── .gitkeep ├── input.txt ├── LEADERBOARD.md └── README.md ├── 6_word_funnel ├── easy │ ├── code_golf │ │ └── .gitkeep │ ├── gotta_go_fast │ │ └── .gitkeep │ └── README.md └── medium │ ├── code_golf │ └── .gitkeep │ ├── gotta_go_fast │ └── .gitkeep │ └── README.md ├── 2_reverse_staircase ├── gotta_go_fast │ ├── .gitkeep │ ├── andrerfcsantos │ │ └── go │ │ │ ├── .gitignore │ │ │ ├── main.go │ │ │ └── README.md │ ├── Marquinhos87 │ │ └── C │ │ │ ├── Makefile │ │ │ ├── src │ │ │ ├── main.c │ │ │ ├── stair.c │ │ │ └── stair.h │ │ │ └── README.md │ └── antoniomsantos99 │ │ └── STAIRCASE.LOL ├── code_golf │ ├── ZePedroResende │ │ └── perl │ │ │ └── staircase.pl │ ├── 0urobor0s │ │ └── ruby │ │ │ └── cg.rb │ └── nelsonmestevao │ │ └── perl │ │ ├── staircase.pl │ │ └── README.md ├── LEADERBOARD.md └── README.md ├── 5_smooshed_morse_code ├── easy │ ├── code_golf │ │ ├── .keep │ │ ├── existency │ │ │ └── python │ │ │ │ ├── python3 │ │ │ │ └── easymorsepy3.py │ │ │ │ ├── python2.7 │ │ │ │ └── easymorsepy2_7.py │ │ │ │ └── Readme.md │ │ ├── josefilipeferreira │ │ │ └── python │ │ │ │ └── decode.py │ │ └── 0urobor0s │ │ │ └── ruby │ │ │ └── morse.rb │ ├── gotta_go_fast │ │ ├── .keep │ │ ├── Marquinhos87 │ │ │ └── C │ │ │ │ ├── input.txt │ │ │ │ ├── Makefile │ │ │ │ ├── src │ │ │ │ ├── main.c │ │ │ │ ├── morse.h │ │ │ │ └── morse.c │ │ │ │ └── README.md │ │ ├── ZePedroResende │ │ │ ├── ocaml │ │ │ │ ├── README.md │ │ │ │ └── morse.ml │ │ │ └── elixir │ │ │ │ ├── README.md │ │ │ │ └── morse.exs │ │ ├── brunomartins11 │ │ │ └── go │ │ │ │ ├── README.md │ │ │ │ └── main.go │ │ └── josefilipeferreira │ │ │ └── c │ │ │ └── decode.c │ └── README.md ├── hard │ ├── code_golf │ │ └── .keep │ ├── gotta_go_fast │ │ └── .keep │ └── README.md └── medium │ ├── code_golf │ └── .keep │ ├── gotta_go_fast │ └── .keep │ └── README.md ├── README.md └── .gitignore /3_sum/gotta_go_fast/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /7_sleeping_barber/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /1_dice_roler/code_golf/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /4_mondrian_puzzle/code_golf/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /6_word_funnel/easy/code_golf/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /2_reverse_staircase/gotta_go_fast/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /4_mondrian_puzzle/gotta_go_fast/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /5_smooshed_morse_code/easy/code_golf/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /5_smooshed_morse_code/hard/code_golf/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /6_word_funnel/easy/gotta_go_fast/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /6_word_funnel/medium/code_golf/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /6_word_funnel/medium/gotta_go_fast/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /5_smooshed_morse_code/easy/gotta_go_fast/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /5_smooshed_morse_code/hard/gotta_go_fast/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /5_smooshed_morse_code/medium/code_golf/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /5_smooshed_morse_code/medium/gotta_go_fast/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /3_sum/gotta_go_fast/andrerfcsantos/go/.gitignore: -------------------------------------------------------------------------------- 1 | main 2 | bonus 3 | -------------------------------------------------------------------------------- /3_sum/input.txt: -------------------------------------------------------------------------------- 1 | 9 -6 -5 9 8 3 -4 8 1 7 -4 9 -9 1 9 -9 9 4 -6 -8 2 | -------------------------------------------------------------------------------- /4_mondrian_puzzle/input.txt: -------------------------------------------------------------------------------- 1 | 4 2 | 8 3 | 10 4 | 20 5 | 25 6 | 32 7 | -------------------------------------------------------------------------------- /1_dice_roler/input.txt: -------------------------------------------------------------------------------- 1 | 5d12 2 | 6d4 3 | 5d2 4 | 3d8 5 | 3d6 6 | 4d20 7 | 100d100 8 | -------------------------------------------------------------------------------- /1_dice_roler/gotta_go_fast/0urobor0s/elixir/diceroller/test/test_helper.exs: -------------------------------------------------------------------------------- 1 | ExUnit.start() 2 | -------------------------------------------------------------------------------- /1_dice_roler/gotta_go_fast/andrerfcsantos/go/.gitignore: -------------------------------------------------------------------------------- 1 | *.out 2 | *.exe 3 | *.prof 4 | main 5 | bonus -------------------------------------------------------------------------------- /2_reverse_staircase/code_golf/ZePedroResende/perl/staircase.pl: -------------------------------------------------------------------------------- 1 | say$"x($n-$_).'#'x$_ for 1..($n=<>) 2 | -------------------------------------------------------------------------------- /5_smooshed_morse_code/easy/gotta_go_fast/Marquinhos87/C/input.txt: -------------------------------------------------------------------------------- 1 | ola 2 | hello 3 | !! 4 | outro 5 | -------------------------------------------------------------------------------- /2_reverse_staircase/gotta_go_fast/andrerfcsantos/go/.gitignore: -------------------------------------------------------------------------------- 1 | *.out 2 | *.exe 3 | *.prof 4 | main 5 | bonus -------------------------------------------------------------------------------- /1_dice_roler/gotta_go_fast/Marquinhos87/C/input.txt: -------------------------------------------------------------------------------- 1 | 5d12 2 | 6d4 3 | 5d2 4 | 3d8 5 | 3d6 6 | 4d20 7 | 100d100 8 | -------------------------------------------------------------------------------- /2_reverse_staircase/code_golf/0urobor0s/ruby/cg.rb: -------------------------------------------------------------------------------- 1 | #!ruby -n 2 | 1.upto($_=$_.to_i){|i|puts ('#'*i).rjust$_} 3 | -------------------------------------------------------------------------------- /2_reverse_staircase/code_golf/nelsonmestevao/perl/staircase.pl: -------------------------------------------------------------------------------- 1 | printf' 'x($ARGV[0] - $_).'#'x$_."\n"for(1..$ARGV[0]) 2 | -------------------------------------------------------------------------------- /3_sum/code_golf/0urobor0s/ruby/3sum.rb: -------------------------------------------------------------------------------- 1 | $/=' ' 2 | $<.map(&:to_i).sort.combination(3).select{|c|c.sum==0}.uniq.map{|r|puts r*?\s} 3 | -------------------------------------------------------------------------------- /5_smooshed_morse_code/easy/gotta_go_fast/ZePedroResende/ocaml/README.md: -------------------------------------------------------------------------------- 1 | # Run 2 | 3 | ``` bash 4 | $ ocaml morse.ml 5 | $ ./a.out 6 | ``` 7 | -------------------------------------------------------------------------------- /1_dice_roler/code_golf/joaop21/awk/README.md: -------------------------------------------------------------------------------- 1 | ## Run 2 | 3 | ``` 4 | awk -f diceroller.awk input 5 | ``` 6 | 7 | The **input** is a file with data as described earlier. 8 | -------------------------------------------------------------------------------- /1_dice_roler/gotta_go_fast/ZePedroResende/clojure/doc/intro.md: -------------------------------------------------------------------------------- 1 | # Introduction to dice 2 | 3 | TODO: write [great documentation](http://jacobian.org/writing/what-to-write/) 4 | -------------------------------------------------------------------------------- /1_dice_roler/gotta_go_fast/0urobor0s/elixir/diceroller/.formatter.exs: -------------------------------------------------------------------------------- 1 | # Used by "mix format" 2 | [ 3 | inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"] 4 | ] 5 | -------------------------------------------------------------------------------- /1_dice_roler/gotta_go_fast/Marquinhos87/C/Makefile: -------------------------------------------------------------------------------- 1 | all: clean diceRoler 2 | 3 | diceRoler: 4 | gcc -o diceRoler src/main.c src/diceroler.c 5 | 6 | clean: 7 | rm -f diceRoler 8 | -------------------------------------------------------------------------------- /2_reverse_staircase/gotta_go_fast/Marquinhos87/C/Makefile: -------------------------------------------------------------------------------- 1 | all: clean stairCase 2 | 3 | stairCase: 4 | gcc -o stairCase src/main.c src/stair.c 5 | 6 | clean: 7 | rm -f stairCase -------------------------------------------------------------------------------- /3_sum/code_golf/ZePedroResende/haskell/1.hs: -------------------------------------------------------------------------------- 1 | import Data.List;main=interact$unlines.map(unwords.map show).nub.sort.filter(\x->0==sum x&&3==length x).subsequences.sort.map read.words 2 | -------------------------------------------------------------------------------- /5_smooshed_morse_code/easy/gotta_go_fast/Marquinhos87/C/Makefile: -------------------------------------------------------------------------------- 1 | all: clean morseCode 2 | 3 | morseCode: 4 | gcc -o morseCode src/main.c src/morse.c 5 | 6 | clean: 7 | rm -f morseCode -------------------------------------------------------------------------------- /3_sum/code_golf/ZePedroResende/python/1.py: -------------------------------------------------------------------------------- 1 | import itertools;[print(*a) for a in sorted({tuple(sorted(n)) for n in itertools.combinations([int(n) for n in input().split()],3) if sum(n)==0})] 2 | -------------------------------------------------------------------------------- /1_dice_roler/code_golf/joaop21/awk/diceroller.awk: -------------------------------------------------------------------------------- 1 | BEGIN{FS="d";srand()}{split("",a);s=0;for(i=1;i<=$1;i++){a[i]=int(($2+1)*rand())+1;s+=a[i]};printf"%s:",s;for(x in a)printf" %s",a[x];print""} 2 | -------------------------------------------------------------------------------- /1_dice_roler/gotta_go_fast/ZePedroResende/clojure/.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | /classes 3 | /checkouts 4 | pom.xml 5 | pom.xml.asc 6 | *.jar 7 | *.class 8 | /.lein-* 9 | /.nrepl-port 10 | .hgignore 11 | .hg/ 12 | -------------------------------------------------------------------------------- /3_sum/LEADERBOARD.md: -------------------------------------------------------------------------------- 1 | # [RANKING] 2 | 3 | ## [Gotta Go Fast] 4 | 5 | ## [Code Golf] 6 | 7 | # [Hall of Fame] 8 | 9 | ## [First Blood] 10 | 11 | ## [Least Idiomatic] 12 | 13 | ## [Weird Algorithm] 14 | -------------------------------------------------------------------------------- /5_smooshed_morse_code/easy/code_golf/existency/python/python3/easymorsepy3.py: -------------------------------------------------------------------------------- 1 | for c in input().lower(): 2 | i=' etianmsurwdkgohvf l pjbxcyzq'.index(c);p="" 3 | while i>0:p="-."[i%2]+p;i=(i-1)//2 4 | print(p,end='') -------------------------------------------------------------------------------- /1_dice_roler/LEADERBOARD.md: -------------------------------------------------------------------------------- 1 | # [RANKING] 2 | 3 | ## [Gotta Go Fast] 4 | 5 | ## [Code Golf] 6 | 7 | # [Hall of Fame] 8 | 9 | ## [First Blood] 10 | 11 | ## [Least Idiomatic] 12 | 13 | ## [Weird Algorithm] 14 | -------------------------------------------------------------------------------- /5_smooshed_morse_code/easy/code_golf/existency/python/python2.7/easymorsepy2_7.py: -------------------------------------------------------------------------------- 1 | for c in raw_input().lower(): 2 | i=' etianmsurwdkgohvf l pjbxcyzq'.index(c);p="" 3 | while i>0:p="-."[i%2]+p;i=(i-1)/2 4 | print"\b"+p, -------------------------------------------------------------------------------- /1_dice_roler/gotta_go_fast/ZePedroResende/clojure/README.md: -------------------------------------------------------------------------------- 1 | # dice 2 | 3 | Copyright © 2018 ZePedroResende 4 | 5 | Distributed under the Eclipse Public License either version 1.0 or (at 6 | your option) any later version. 7 | -------------------------------------------------------------------------------- /2_reverse_staircase/LEADERBOARD.md: -------------------------------------------------------------------------------- 1 | # [RANKING] 2 | 3 | ## [Gotta Go Fast] 4 | 5 | ## [Code Golf] 6 | 7 | # [Hall of Fame] 8 | 9 | ## [First Blood] 10 | 11 | ## [Least Idiomatic] 12 | 13 | ## [Weird Algorithm] 14 | -------------------------------------------------------------------------------- /4_mondrian_puzzle/LEADERBOARD.md: -------------------------------------------------------------------------------- 1 | # [RANKING] 2 | 3 | ## [Gotta Go Fast] 4 | 5 | ## [Code Golf] 6 | 7 | # [Hall of Fame] 8 | 9 | ## [First Blood] 10 | 11 | ## [Least Idiomatic] 12 | 13 | ## [Weird Algorithm] 14 | -------------------------------------------------------------------------------- /5_smooshed_morse_code/easy/code_golf/josefilipeferreira/python/decode.py: -------------------------------------------------------------------------------- 1 | for c in input():print(".- -... -.-. -.. . ..-. --. .... .. .--- -.- .-.. -- -. --- .--. --.- .-. ... - ..- ...- .-- -..- -.-- --..".split()[ord(c)-97]) 2 | -------------------------------------------------------------------------------- /5_smooshed_morse_code/easy/code_golf/0urobor0s/ruby/morse.rb: -------------------------------------------------------------------------------- 1 | #!ruby -np 2 | m=".- -... -.-. -.. . ..-. --. .... .. .--- -.- .-.. -- -. --- .--. --.- .-. ... - ..- ...- .-- -..- -.-- --.." 3 | $_=$_.chars.map{|l|Hash[("a".."z").to_a.zip m.split][l]}.join -------------------------------------------------------------------------------- /5_smooshed_morse_code/easy/gotta_go_fast/brunomartins11/go/README.md: -------------------------------------------------------------------------------- 1 | ## Smosshed Morse Code 2 | 3 | To run this program you must have a input file with one word per line and GO installed. 4 | 5 | # Run 6 | 7 | `go run main.go < input.txt` 8 | 9 | -------------------------------------------------------------------------------- /1_dice_roler/gotta_go_fast/0urobor0s/elixir/diceroller/test/diceroler_test.exs: -------------------------------------------------------------------------------- 1 | defmodule DicerolerTest do 2 | use ExUnit.Case 3 | doctest Diceroler 4 | 5 | test "greets the world" do 6 | assert Diceroler.hello() == :world 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /1_dice_roler/gotta_go_fast/ZePedroResende/clojure/test/dice/core_test.clj: -------------------------------------------------------------------------------- 1 | (ns dice.core-test 2 | (:require [clojure.test :refer :all] 3 | [dice.core :refer :all])) 4 | 5 | (deftest a-test 6 | (testing "FIXME, I fail." 7 | (is (= 0 1)))) 8 | -------------------------------------------------------------------------------- /1_dice_roler/gotta_go_fast/0urobor0s/elixir/diceroller/lib/benchmark.ex: -------------------------------------------------------------------------------- 1 | defmodule Benchmark do 2 | def measure(function) do 3 | function 4 | |> :timer.tc 5 | |> elem(0) 6 | |> Kernel./(1_000_000) 7 | |> IO.puts 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /5_smooshed_morse_code/easy/gotta_go_fast/ZePedroResende/elixir/README.md: -------------------------------------------------------------------------------- 1 | # Run 2 | 3 | ```bash 4 | $ elixir morse.exs 5 | ``` 6 | 7 | or the compiled version 8 | 9 | ```bash 10 | $ elixirc morse.exs 11 | $ elixir -e Morse.main 12 | 13 | ``` 14 | -------------------------------------------------------------------------------- /2_reverse_staircase/gotta_go_fast/andrerfcsantos/go/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "strings" 6 | ) 7 | 8 | func main() { 9 | var n int 10 | fmt.Scanf("%d", &n) 11 | for i := 1; i <= n; i++ { 12 | fmt.Printf("%s%s\n", strings.Repeat(" ", n-i), strings.Repeat("#", i)) 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /2_reverse_staircase/gotta_go_fast/Marquinhos87/C/src/main.c: -------------------------------------------------------------------------------- 1 | #include "stair.h" 2 | 3 | int main(int c,char** v){ 4 | if(c==1){ 5 | printf("ERROR: Iniciate like that 'stairCase n', where n is the number of stairs\n"); 6 | } 7 | else{ 8 | int z=stair(v[1]); 9 | if(z==1) printf("Invalid Number\n"); 10 | } 11 | return 0; 12 | } -------------------------------------------------------------------------------- /3_sum/gotta_go_fast/andrerfcsantos/go/README.md: -------------------------------------------------------------------------------- 1 | # Requirements 2 | 3 | * [Go language](https://golang.org/doc/install) 4 | 5 | I'm running the most recent version (1.12). Others are probably fine too. 6 | 7 | 8 | # Usage 9 | 10 | ## Main program 11 | 12 | Compile: 13 | ``` 14 | go build main.go 15 | ``` 16 | 17 | Run: 18 | ``` 19 | ./main < ../../../input.txt 20 | ``` 21 | -------------------------------------------------------------------------------- /2_reverse_staircase/code_golf/nelsonmestevao/perl/README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Stair Case 4 | 5 | This is a perl script so you need to have perl installed. 6 | 7 | ## Run 8 | 9 | The first argument should be size of the stair case. 10 | 11 | ```bash 12 | perl staircase.pl 21 13 | ``` 14 | -------------------------------------------------------------------------------- /2_reverse_staircase/gotta_go_fast/andrerfcsantos/go/README.md: -------------------------------------------------------------------------------- 1 | # Requirements 2 | 3 | * [Go language](https://golang.org/doc/install) 4 | 5 | I'm running the most recent version (1.12). Others are probably fine too. 6 | 7 | 8 | # Usage 9 | 10 | ## Main program 11 | 12 | Compile: 13 | ``` 14 | go build main.go 15 | ``` 16 | 17 | Run: 18 | ``` 19 | ./main < ../../../input.txt 20 | ``` 21 | -------------------------------------------------------------------------------- /1_dice_roler/gotta_go_fast/ZePedroResende/clojure/project.clj: -------------------------------------------------------------------------------- 1 | (defproject dice "0.1.0-SNAPSHOT" 2 | :description "FIXME: write description" 3 | :url "http://example.com/FIXME" 4 | :license {:name "Eclipse Public License" 5 | :url "http://www.eclipse.org/legal/epl-v10.html"} 6 | :dependencies [[org.clojure/clojure "1.8.0"][iota "1.1.3"]] 7 | :aot [dice.core] 8 | :main dice.core ) 9 | 10 | -------------------------------------------------------------------------------- /1_dice_roler/gotta_go_fast/nelsonmestevao/golang/README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Dice Roller 4 | 5 | This is a golang project so you need to have go installed. 6 | 7 | ## Compile 8 | 9 | ```bash 10 | go build diceroller.go 11 | ``` 12 | 13 | ## Run 14 | 15 | The first argument should be the input file. 16 | 17 | ```bash 18 | ./diceroller input.txt 19 | ``` 20 | 21 | -------------------------------------------------------------------------------- /1_dice_roler/gotta_go_fast/0urobor0s/elixir/diceroller/mix.lock: -------------------------------------------------------------------------------- 1 | %{ 2 | "benchfella": {:hex, :benchfella, "0.3.5", "b2122c234117b3f91ed7b43b6e915e19e1ab216971154acd0a80ce0e9b8c05f5", [:mix], [], "hexpm"}, 3 | "parallel": {:hex, :parallel, "0.0.3", "d1c9a03f0fd6c85ba174938b9823db51e01a68f9f0e76e3f3e11989cbeb607e7", [:mix], [], "hexpm"}, 4 | "parallel_task": {:hex, :parallel_task, "0.1.1", "d65477457a9415b98c11b73c4f36886f3b24677595ff792ec8f460ad69725313", [:mix], [], "hexpm"}, 5 | } 6 | -------------------------------------------------------------------------------- /1_dice_roler/gotta_go_fast/andrerfcsantos/go/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "bufio" 5 | "fmt" 6 | "math/rand" 7 | "os" 8 | "strconv" 9 | "strings" 10 | ) 11 | 12 | func main() { 13 | scanner := bufio.NewScanner(os.Stdin) 14 | 15 | for scanner.Scan() { 16 | data := strings.Split(scanner.Text(), "d") 17 | n, _ := strconv.Atoi(data[0]) 18 | d, _ := strconv.Atoi(data[1]) 19 | 20 | var sum int 21 | for i := 0; i < n; i++ { 22 | sum += rand.Intn(d-1) + 1 23 | } 24 | fmt.Println(d) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /2_reverse_staircase/gotta_go_fast/Marquinhos87/C/src/stair.c: -------------------------------------------------------------------------------- 1 | #include "stair.h" 2 | 3 | int verify(char* l){ 4 | for(int i=0;l[i]!='\0' || l[i]!='\n';i++) 5 | if(!isdigit(l[i])) return 1; 6 | return 0; 7 | } 8 | 9 | void prt(int tam){ 10 | for(int i=0;i0;j--) 12 | printf(" "); 13 | for(int k=i+1;k>0;k--) 14 | printf("#"); 15 | printf("\n"); 16 | } 17 | } 18 | 19 | int stair(char* l){ 20 | int len = strlen(l); 21 | if(verify(l)) { 22 | int tam = atoi(l); 23 | if(tam>100 || tam<1) return 1; 24 | prt(tam); 25 | } 26 | else return 1; 27 | return 0; 28 | } -------------------------------------------------------------------------------- /2_reverse_staircase/gotta_go_fast/antoniomsantos99/STAIRCASE.LOL: -------------------------------------------------------------------------------- 1 | HAI 1.2 2 | 3 | BTW CHANGE THIS VALUE TO CHANGE THE SIZE 4 | I HAS A N ITZ 6 5 | N R SUM OF N AN 1 6 | 7 | IM IN YR LOOP UPPIN YR ITERATORNUMEROUNO TIL BOTH SAEM ITERATORNUMEROUNO AN N 8 | IM IN YR LOOP UPPIN YR ITERATORNUMERODOS TIL BOTH SAEM SUM OF ITERATORNUMERODOS AN 1 AN DIFF OF N AN ITERATORNUMEROUNO 9 | VISIBLE " "! 10 | IM OUTTA YR LOOP 11 | IM IN YR LOOP UPPIN YR ITERATORNUMERODOS TIL BOTH SAEM ITERATORNUMERODOS AN ITERATORNUMEROUNO 12 | VISIBLE "#"! 13 | IM OUTTA YR LOOP 14 | VISIBLE "" 15 | IM OUTTA YR LOOP 16 | 17 | KTHXBYE 18 | -------------------------------------------------------------------------------- /1_dice_roler/gotta_go_fast/0urobor0s/elixir/diceroller/lib/mix/tasks/roll.ex: -------------------------------------------------------------------------------- 1 | defmodule Mix.Tasks.Roll do 2 | use Mix.Task 3 | 4 | def run(args) do 5 | cond do 6 | length(args) == 0 -> 7 | Mix.shell.info "Needs to receive atleast one file path ." 8 | true -> 9 | create(args) 10 | end 11 | end 12 | 13 | defp create(path) do 14 | Mix.Task.run "app.start" 15 | path 16 | |> File.stream! 17 | |> Enum.to_list 18 | |> Enum.map(fn x -> String.trim x end) 19 | |> DiceRoler.pproler 20 | #|> Enum.sum 21 | |> IO.puts 22 | #|> Enum.each(fn x -> IO.puts x end) 23 | end 24 | end 25 | -------------------------------------------------------------------------------- /1_dice_roler/gotta_go_fast/0urobor0s/elixir/diceroller/README.md: -------------------------------------------------------------------------------- 1 | # Diceroler 2 | 3 | **TODO: Add description** 4 | 5 | ## Installation 6 | 7 | If [available in Hex](https://hex.pm/docs/publish), the package can be installed 8 | by adding `diceroler` to your list of dependencies in `mix.exs`: 9 | 10 | ```elixir 11 | def deps do 12 | [ 13 | {:diceroler, "~> 0.1.0"} 14 | ] 15 | end 16 | ``` 17 | 18 | Documentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc) 19 | and published on [HexDocs](https://hexdocs.pm). Once published, the docs can 20 | be found at [https://hexdocs.pm/diceroler](https://hexdocs.pm/diceroler). 21 | 22 | -------------------------------------------------------------------------------- /1_dice_roler/gotta_go_fast/0urobor0s/elixir/diceroller/bench/par_bench.exs: -------------------------------------------------------------------------------- 1 | defmodule BasicBench do 2 | use Benchfella 3 | 4 | @list File.read!("sample_input.txt") |> String.split("\n") |> List.delete("") 5 | 6 | bench "Single roler single execution" do 7 | DiceRoler.ssroler(@list) 8 | :ok 9 | end 10 | 11 | bench "Single roler parallel execution" do 12 | DiceRoler.sroler(@list) 13 | :ok 14 | end 15 | 16 | bench "Parallel roler parallel execution v1" do 17 | DiceRoler.proler(@list) 18 | :ok 19 | end 20 | 21 | bench "Parallel roler parallel execution v2" do 22 | DiceRoler.pproler(@list) 23 | :ok 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /1_dice_roler/gotta_go_fast/0urobor0s/elixir/diceroller/lib/mix/tasks/gen.input.ex: -------------------------------------------------------------------------------- 1 | defmodule Mix.Tasks.Gen.Input do 2 | use Mix.Task 3 | 4 | def run(args) do 5 | cond do 6 | length(args) == 0 -> 7 | Mix.shell.info "Needs to receive a number." 8 | true -> 9 | create(args) 10 | end 11 | end 12 | 13 | defp create(number) do 14 | Mix.Task.run "app.start" 15 | number 16 | |> List.first 17 | |> String.to_integer 18 | |> for_c 19 | end 20 | 21 | defp for_c(number) do 22 | Enum.each 1..number, fn(_) -> 23 | IO.puts "#{Enum.random(1..100)}d#{Enum.random(2..100)}" 24 | end 25 | end 26 | end 27 | -------------------------------------------------------------------------------- /1_dice_roler/gotta_go_fast/andrerfcsantos/go/bonus.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "bufio" 5 | "fmt" 6 | "math/rand" 7 | "os" 8 | "strconv" 9 | "strings" 10 | ) 11 | 12 | func main() { 13 | scanner := bufio.NewScanner(os.Stdin) 14 | 15 | for scanner.Scan() { 16 | data := strings.Split(scanner.Text(), "d") 17 | n, _ := strconv.Atoi(data[0]) 18 | d, _ := strconv.Atoi(data[1]) 19 | 20 | var sum int 21 | var rolls []int 22 | for i := 0; i < n; i++ { 23 | roll := rand.Intn(d-1) + 1 24 | rolls = append(rolls, roll) 25 | sum += roll 26 | } 27 | fmt.Printf("%d:", sum) 28 | for _, r := range rolls { 29 | fmt.Printf(" %d", r) 30 | } 31 | fmt.Print("\n") 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /5_smooshed_morse_code/easy/gotta_go_fast/Marquinhos87/C/src/main.c: -------------------------------------------------------------------------------- 1 | #include "morse.h" 2 | 3 | int main(int c,char** v){ 4 | char* l=NULL; 5 | size_t s=0; 6 | ssize_t r; 7 | if(c==1){ 8 | while((r=getline(&l,&s,stdin))>=1) 9 | if(strlen(l)<=1) printf("Invalid String Format\n"); 10 | else{ 11 | int z=translate(l); 12 | if(z==1) printf("Invalid String Format\n"); 13 | } 14 | } 15 | else{ 16 | FILE* f=fopen(v[1],"r"); 17 | if(f==NULL) exit(1); 18 | while((r=getline(&l,&s,f))!=-1) 19 | if(strlen(l)<=1) printf("Invalid String Format\n"); 20 | else{ 21 | int z=translate(l); 22 | if(z==1) printf("Invalid String Format\n"); 23 | } 24 | } 25 | return 0; 26 | } -------------------------------------------------------------------------------- /1_dice_roler/gotta_go_fast/andrerfcsantos/go/README.md: -------------------------------------------------------------------------------- 1 | # Requirements 2 | 3 | * [Go language](https://golang.org/doc/install) 4 | 5 | I'm running the most recent version (1.12). Others are probably fine too. 6 | 7 | 8 | # Usage 9 | 10 | ## Main program 11 | 12 | This program solves the initial problem printing a sum per line. 13 | 14 | Compile: 15 | ``` 16 | go build main.go 17 | ``` 18 | 19 | Run: 20 | ``` 21 | ./main < ../../../input.txt 22 | ``` 23 | 24 | ## Bonus Program 25 | 26 | This program solves the bonus problem printing a sum per line and the rolls that make up that sum. 27 | 28 | Compile: 29 | ``` 30 | go build bonus.go 31 | ``` 32 | 33 | Run: 34 | ``` 35 | ./bonus < ../../../input.txt 36 | ``` 37 | -------------------------------------------------------------------------------- /1_dice_roler/gotta_go_fast/nelsonmestevao/golang/diceroller.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "bufio" 5 | "fmt" 6 | "math/rand" 7 | "os" 8 | "strconv" 9 | "strings" 10 | ) 11 | 12 | func alea_iacta_est(rolls int, faces int) int { 13 | sum := 0 14 | 15 | for i := 1; i < rolls; i++ { 16 | sum += rand.Intn(faces + 1) 17 | } 18 | 19 | return sum 20 | } 21 | 22 | func main() { 23 | file, _ := os.Open(os.Args[1]) 24 | defer file.Close() 25 | 26 | scanner := bufio.NewScanner(file) 27 | 28 | for scanner.Scan() { 29 | s := strings.Split(scanner.Text(), "d") 30 | 31 | rolls, _ := strconv.Atoi(s[0]) 32 | faces, _ := strconv.Atoi(s[1]) 33 | 34 | fmt.Println(alea_iacta_est(rolls, faces)) 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /1_dice_roler/gotta_go_fast/ZePedroResende/clojure/src/dice/core.clj: -------------------------------------------------------------------------------- 1 | (ns dice.core 2 | (:require [clojure.core.reducers :as r] 3 | [clojure.string :as str]) 4 | (:gen-class)) 5 | 6 | (defn parse-int [s] 7 | (Integer. (re-find #"\d+" s ))) 8 | 9 | (defn roll 10 | [nroll nfaces] 11 | (->> (repeat nroll nfaces) 12 | (r/map (fn [x](+ (rand-int (- x 1)) 1))) 13 | (r/fold +))) 14 | 15 | (defn result 16 | [s] 17 | (apply roll (map parse-int (str/split s #"d")))) 18 | 19 | (defn parsefile 20 | [filename] 21 | (r/map result (str/split-lines(slurp filename)))) 22 | 23 | (defn -main [& args] 24 | (prn (format "args=%s" args)) 25 | (if (not (empty? args)) 26 | (do 27 | (time(parsefile (first args)))))) 28 | -------------------------------------------------------------------------------- /1_dice_roler/gotta_go_fast/0urobor0s/elixir/diceroller/.gitignore: -------------------------------------------------------------------------------- 1 | # The directory Mix will write compiled artifacts to. 2 | /_build/ 3 | 4 | # If you run "mix test --cover", coverage assets end up here. 5 | /cover/ 6 | 7 | # The directory Mix downloads your dependencies sources to. 8 | /deps/ 9 | 10 | # Where 3rd-party dependencies like ExDoc output generated docs. 11 | /doc/ 12 | 13 | # Ignore .fetch files in case you like to edit your project deps locally. 14 | /.fetch 15 | 16 | # If the VM crashes, it generates a dump, let's ignore it too. 17 | erl_crash.dump 18 | 19 | # Also ignore archive artifacts (built via "mix archive.build"). 20 | *.ez 21 | 22 | # Ignore package tarball (built via "mix hex.build"). 23 | diceroler-*.tar 24 | 25 | # Bechmark snapshots 26 | *.snapshot 27 | -------------------------------------------------------------------------------- /1_dice_roler/gotta_go_fast/0urobor0s/elixir/diceroller/lib/mix/tasks/benchroll.ex: -------------------------------------------------------------------------------- 1 | defmodule Mix.Tasks.BenchRoll do 2 | use Mix.Task 3 | 4 | def run(args) do 5 | #File.read!("input.txt") 6 | #|> String.split("\n") 7 | #|> List.delete("") 8 | #|> DiceRoler.sroler 9 | cond do 10 | length(args) == 0 -> 11 | Mix.shell.info "Needs to receive atleast one file path ." 12 | true -> 13 | #Benchmark.measure(fn -> create(args) end) 14 | create(args) 15 | end 16 | end 17 | 18 | defp create(path) do 19 | Mix.Task.run "app.start" 20 | res = path 21 | |> File.stream! 22 | |> Enum.to_list 23 | |> Enum.map(fn x -> String.trim x end) 24 | #|> DiceRoler.sroler 25 | Benchmark.measure(fn -> DiceRoler.sroler(res) end) 26 | end 27 | end 28 | -------------------------------------------------------------------------------- /1_dice_roler/gotta_go_fast/Marquinhos87/C/src/main.c: -------------------------------------------------------------------------------- 1 | #include "diceroler.h" 2 | 3 | int main(int c,char** v){ 4 | srand(time(NULL)); 5 | char* l=NULL; 6 | size_t s=0; 7 | ssize_t r; 8 | if(c==1){ 9 | while((r=getline(&l,&s,stdin))>=1) 10 | if(strlen(l)<=3) printf("Invalid String Format\n"); 11 | else if(strcmp(l,"exit\n")==0) return 0; 12 | else{ 13 | int z=calc(l); 14 | if(z==1) printf("Invalid String Format\n"); 15 | } 16 | } 17 | else{ 18 | FILE* f=fopen(v[1],"r"); 19 | if(f==NULL) exit(1); 20 | while((r=getline(&l,&s,f))!=-1) 21 | if(strlen(l)<=3) printf("Invalid String Format\n"); 22 | else if(strcmp(l,"exit\n")==0) return 0; 23 | else{ 24 | int z=calc(l); 25 | if(z==1) printf("Invalid String Format\n"); 26 | } 27 | } 28 | return 0; 29 | } -------------------------------------------------------------------------------- /2_reverse_staircase/gotta_go_fast/Marquinhos87/C/src/stair.h: -------------------------------------------------------------------------------- 1 | /** @file stair.h*/ 2 | 3 | #ifndef STAIR_H_ 4 | #define STAIR_H_ 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | /** Function to verify if all characters pass to program are numbers 12 | * 13 | * @param l String pass to the program. 14 | * @return Return 0 if alright OK or 1 if some character isn't a number 15 | */ 16 | int verify(char* l); 17 | 18 | /** Function to print to stdout the result stairCase. 19 | * 20 | * @param tam Number of stairs to draw. 21 | */ 22 | void prt(int tam); 23 | 24 | /** Function that calls the others to generate de final result. 25 | * 26 | * @param l String with the number of stairs. 27 | * @return Return 0 if alright OK or 1 if something wrong 28 | */ 29 | int stair(char* l); 30 | 31 | #endif -------------------------------------------------------------------------------- /1_dice_roler/gotta_go_fast/0urobor0s/elixir/diceroller/mix.exs: -------------------------------------------------------------------------------- 1 | defmodule Diceroler.MixProject do 2 | use Mix.Project 3 | 4 | def project do 5 | [ 6 | app: :diceroler, 7 | version: "0.1.0", 8 | elixir: "~> 1.7", 9 | start_permanent: Mix.env() == :prod, 10 | deps: deps() 11 | ] 12 | end 13 | 14 | # Run "mix help compile.app" to learn about applications. 15 | def application do 16 | [ 17 | extra_applications: [:logger] 18 | ] 19 | end 20 | 21 | # Run "mix help deps" to learn about dependencies. 22 | defp deps do 23 | [ 24 | {:parallel_task, "~> 0.1.0"}, 25 | {:parallel, "~> 0.0"}, 26 | {:benchfella, "~> 0.3.0"} 27 | # {:dep_from_hexpm, "~> 0.3.0"}, 28 | # {:dep_from_git, git: "https://github.com/elixir-lang/my_dep.git", tag: "0.1.0"}, 29 | ] 30 | end 31 | end 32 | -------------------------------------------------------------------------------- /2_reverse_staircase/gotta_go_fast/Marquinhos87/C/README.md: -------------------------------------------------------------------------------- 1 | # Como Utilizar Reverse Stairs 2 | 3 | Para utilizar de forma correta o morse code, tens de seguir apenas dois passos. 4 | 5 | ## Primeiro Passo 6 | 7 | Abre um terminal e navega até esta diretoria. Assim que aqui chegares faz 'make' no terminal e o executavél será criado. 8 | 9 | ## Segundo Passo 10 | 11 | Executa 'stairCase N' no terminal, onde 'N' é o número de escadas que pretendes desenhar e esta vai imprimir escadas com o número de degraus que pediste. 12 | 13 | ## Observações 14 | 15 | No caso de colocares o 'N' sem ser um número ou se for demasiado grande ou demasiado pequeno obterás um erro a dizer 'Invalid Number'. 16 | 17 | No caso de quereres imprimir o resultado para um ficheiro em vez do terminal acrescenta à forma de iniciares o programa o seguinte '> res.txt' (podes dar o nome que quiseres a esse ficheiro). -------------------------------------------------------------------------------- /5_smooshed_morse_code/easy/gotta_go_fast/Marquinhos87/C/src/morse.h: -------------------------------------------------------------------------------- 1 | /** @file morse.h*/ 2 | 3 | #ifndef MORSE_H_ 4 | #define MORSE_H_ 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | /** Function that translate a character to morse code. 11 | * 12 | * @param c Character to converte to morse code. 13 | * @return String with morse code of the character 14 | */ 15 | char* translateChar(char c); 16 | 17 | /** Function to print to stdout the result translation. 18 | * 19 | * @param l String for translation. 20 | * @param ls Set of Strings with morse code of every character 21 | */ 22 | void prt(char* l,char** ls,int n); 23 | 24 | /** Function that calls the others to generate de final result. 25 | * 26 | * @param l String for translation. 27 | * @return Return 0 if alright OK or 1 if something wrong 28 | */ 29 | int translate(char* l); 30 | 31 | #endif -------------------------------------------------------------------------------- /1_dice_roler/gotta_go_fast/ZePedroResende/clojure/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | All notable changes to this project will be documented in this file. This change log follows the conventions of [keepachangelog.com](http://keepachangelog.com/). 3 | 4 | ## [Unreleased] 5 | ### Changed 6 | - Add a new arity to `make-widget-async` to provide a different widget shape. 7 | 8 | ## [0.1.1] - 2018-11-07 9 | ### Changed 10 | - Documentation on how to make the widgets. 11 | 12 | ### Removed 13 | - `make-widget-sync` - we're all async, all the time. 14 | 15 | ### Fixed 16 | - Fixed widget maker to keep working when daylight savings switches over. 17 | 18 | ## 0.1.0 - 2018-11-07 19 | ### Added 20 | - Files from the new template. 21 | - Widget maker public API - `make-widget-sync`. 22 | 23 | [Unreleased]: https://github.com/your-name/dice/compare/0.1.1...HEAD 24 | [0.1.1]: https://github.com/your-name/dice/compare/0.1.0...0.1.1 25 | -------------------------------------------------------------------------------- /5_smooshed_morse_code/easy/code_golf/existency/python/Readme.md: -------------------------------------------------------------------------------- 1 | # Algoritmos & Complexidade + Boredom present you morse code in just 127 characters 2 | 3 | A ideia aqui é simples. Vamos representar [a..z] dentro de uma [tree]( https://upload.wikimedia.org/wikipedia/commons/thumb/c/ca/Morse_code_tree3.png/770px-Morse_code_tree3.png), "estendida" em um array. 4 | 5 | [(powered by morse code wikipedia)](https://en.wikipedia.org/wiki/Morse_code) 6 | 7 | Regras de criação do array para a árvore 8 | - ([A-Z]) 9 | - Todos os outros valores/saltos serão substituidos por um espaço, ' '. 10 | - valores vão ser colocados da esquerda para direita, segundo imagem. Link da tree em cima. 11 | Array: ' etianmsurwdkgohvf l pjbxcyzq' 12 | 13 | Decidi fazer 2 versões de python, deverão contar como entradas separadas. Com o tempo posso tentar compactar mais o código. 14 | 15 | Usage: 16 | python easymorse3.py 17 | python2.7 easymorse2_7.py 18 | -------------------------------------------------------------------------------- /5_smooshed_morse_code/hard/README.md: -------------------------------------------------------------------------------- 1 | # Código Morse Colado 2 | ![](https://img.shields.io/badge/-HARD-red.svg?style=for-the-badge) 3 | 4 | Uma permutação do alfabeto é uma string de 26 caracteres em que as letras de `a` a `z` apenas aparecem uma vez. 5 | Dada uma permutação do alfabeto codificada em código morse sem espaços entre os caracteres podem ser encontradas várias permutações do mesmo alfabeto. Tenha em conta que a string em código morse pode gerar mais que uma permutação do alfabeto. É necessário também referir que uma letra em código morse e composta por uma combinação de `.` e `-`. 6 | 7 | ## Desafio 8 | 9 | Tipicamente um input válido terá muitos outputs possíveis. O objetivo deste desafio bónus é encontrar um input com o menor número de outputs possíveis tendo pelo menos um. 10 | O teu programa deve imprimir no ecra essa string de código morse colado. 11 | Se tiveres alguma dúvida relacionada com o input ou output verifica o desafio anterior._ 12 | 13 | -------------------------------------------------------------------------------- /3_sum/README.md: -------------------------------------------------------------------------------- 1 | # 3 sum problem 2 | ![](https://img.shields.io/badge/-EASY-brightgreen.svg?style=for-the-badge) 3 | 4 | Dado uma lista de inteiros espera se como output uma lista de combinações de 5 | ternos (Tuplo com 3 elementos) em que a soma dê 0. 6 | 7 | # Input 8 | 9 | Uma sequência de inteiros que terá de ser lida pelo `STDIN`. 10 | 11 | ``` 12 | 9 -6 -5 9 8 3 -4 8 1 7 -4 9 -9 1 9 -9 9 4 -6 -8 13 | ``` 14 | 15 | # Output 16 | 17 | ``` 18 | -9 1 8 19 | -8 1 7 20 | -5 -4 9 21 | -5 1 4 22 | -4 -4 8 23 | -4 1 3 24 | ``` 25 | 26 | - Output tem de ser ordenado do menor tuplo para o maior tuplo, ou seja, 27 | menor do primeiro elemento se igual menor do segundo elemento se igual menor 28 | do terceiro elemento. 29 | - Não devem existir outputs repetidos. 30 | - Flags da linguagem não podem ser usadas para ler mais facilmente (como no 31 | caso de perl, ruby e python). 32 | 33 | --- 34 | 35 | _You can read the original problem [here](https://redd.it/6melen)_. 36 | -------------------------------------------------------------------------------- /6_word_funnel/easy/README.md: -------------------------------------------------------------------------------- 1 | # Funil de Palavras 2 | ![](https://img.shields.io/badge/-EASY-easy.svg?style=for-the-badge) 3 | 4 | Dadas duas strings, determine se a segunda pode ser feita a partir da primeira removendo uma letra. As letras restantes devem permanecer na mesma ordem. A lista de palavras válidas pode ser consultada [aqui](https://raw.githubusercontent.com/dolph/dictionary/master/enable1.txt) 5 | 6 | # Formato Input 7 | Por exemplo: 8 | `reset` 9 | `rest` 10 | 11 | # Formato Output 12 | `True` ou `False` 13 | 14 | Exemplos: 15 | 16 | ``` 17 | funnel("leave", "eave") => true 18 | funnel("reset", "rest") => true 19 | funnel("dragoon", "dragon") => true 20 | funnel("eave", "leave") => false 21 | funnel("sleet", "lets") => false 22 | funnel("skiff", "ski") => false 23 | ``` 24 | 25 | Nota: O teu programa pode deve aceitar argumentos a não ser o próprio programa e um ficheiro com dados de input. O input pode também ser lido através do stdin até EOF. 26 | Por exemplo em C: 27 | `./program input.txt` ou `./program < input.txt` 28 | -------------------------------------------------------------------------------- /5_smooshed_morse_code/easy/README.md: -------------------------------------------------------------------------------- 1 | # Codigo Morse Colado 2 | ![](https://img.shields.io/badge/-EASY-easy.svg?style=for-the-badge) 3 | 4 | Uma letra em código morse é composta por uma combinação de `.` e `-`. 5 | O objetivo deste desafio é dada uma string de letras gerar o codigo morse sem espaço entre os símbolos. 6 | Se tiveres alguma dúvida relacionada com código morse podes consultar [esta](https://duckduckgo.com/?q=tabela+de+codigo+morse&t=brave&iax=images&ia=images&iai=https%3A%2F%2F3.bp.blogspot.com%2F-tRcbVmFJHyU%2FVCcNrC3fHaI%2FAAAAAAAABGU%2FttXSLFTvyog%2Fs1600%2Fcodigo%252Bmorse.jpg) tabela. 7 | ## Formato Input 8 | Por exemplo: 9 | `sos` 10 | `programmer` 11 | 12 | ## Formato Output 13 | 14 | ``` 15 | "sos" => "...---..." 16 | "programmer" => ".--..-.-----..-..-----..-." 17 | ``` 18 | 19 | Nota: A execução do teu programa não deve aceitar argumentos a não ser o próprio programa e um ficheiro com dados de input. O input pode também ser lido através do stdin até EOF. 20 | Por exemplo em C: 21 | `./program input.txt` ou `./program < input.txt` 22 | -------------------------------------------------------------------------------- /5_smooshed_morse_code/easy/gotta_go_fast/josefilipeferreira/c/decode.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | const int SIZE = 1024; 7 | 8 | const char * code[] ={"","","","","","","","","","","\n","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","--..--","",".-.-.-","-..-.","-----",".----","..---","...--","....-",".....","-....","--...","---..","----.","-----","","","","","..--..",".--.-.",".-","-...","-.-.","-..",".","..-.","--.","....","..",".---","-.-",".-..","--","-.","---",".--.","--.-",".-.","...","-","..-","...-",".--","-..-","-.--","--..","","","","","","",".-","-...","-.-.","-..",".","..-.","--.","....","..",".---","-.-",".-..","--","-.","---",".--.","--.-",".-.","...","-","..-","...-",".--","-..-","-.--","--.."}; 9 | int main(int argc, char**argv){ 10 | char * a = malloc(SIZE); 11 | int len; 12 | while(len = read(0,a,SIZE)){ 13 | for (int i = 0; i < len; i++){ 14 | puts(code[(int)(a[i])]); 15 | } 16 | } 17 | free(a); 18 | } 19 | 20 | -------------------------------------------------------------------------------- /1_dice_roler/gotta_go_fast/Marquinhos87/C/src/diceroler.c: -------------------------------------------------------------------------------- 1 | #include "diceroler.h" 2 | 3 | int getD(char* l){ 4 | char* a= malloc(sizeof(char)*strlen(l)); 5 | for(;l[x]!='d';x++) 6 | if(isdigit(l[x])) 7 | a[x]=l[x]; 8 | else return 0; 9 | if(x==0) return 0; 10 | a[x]='\0'; 11 | x++; 12 | return atoi(a); 13 | } 14 | 15 | int getF(char* l){ 16 | char* a= malloc(sizeof(char)*strlen(l)); 17 | int i; 18 | for(i=0;l[x]!='\n';i++,x++) 19 | if(isdigit(l[x])) 20 | a[i]=l[x]; 21 | else return 0; 22 | a[i]='\0'; 23 | return atoi(a); 24 | } 25 | 26 | int* genV(int d,int f){ 27 | int* v=malloc(sizeof(int)*d); 28 | for(int i=0;i100 || f<2 || f>100) return 1; 49 | int* v = genV(d,f); 50 | prt(d,sum(d,v),v); 51 | return 0; 52 | } -------------------------------------------------------------------------------- /3_sum/gotta_go_fast/andrerfcsantos/go/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "bufio" 5 | "fmt" 6 | "os" 7 | "sort" 8 | "strconv" 9 | "strings" 10 | ) 11 | 12 | type Tuple struct { 13 | A, B, C int 14 | } 15 | 16 | func main() { 17 | var ns []int 18 | 19 | s := bufio.NewScanner(os.Stdin) 20 | s.Scan() 21 | 22 | stringNumbers := strings.Split(strings.TrimLeft(s.Text(), "\r\n"), " ") 23 | for _, stringNumber := range stringNumbers { 24 | n, _ := strconv.Atoi(stringNumber) 25 | ns = append(ns, n) 26 | } 27 | 28 | sort.Slice(ns, func(i, j int) bool { return ns[i] < ns[j] }) 29 | 30 | var start, end int 31 | var a, b, c int 32 | 33 | n := len(ns) 34 | seen := make(map[Tuple]bool) 35 | for i := 0; i < n-1; i++ { 36 | a = ns[i] 37 | start, end = i+1, n-1 38 | 39 | for start < end { 40 | 41 | b, c = ns[start], ns[end] 42 | s := a + b + c 43 | 44 | switch { 45 | case s == 0: 46 | t := Tuple{a, b, c} 47 | if _, wasSeen := seen[t]; !wasSeen { 48 | fmt.Printf("%d %d %d\n", a, b, c) 49 | seen[t] = true 50 | } 51 | 52 | start++ 53 | end-- 54 | case s > 0: 55 | end-- 56 | default: 57 | start++ 58 | } 59 | } 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DPUM 2 | > Desafios de Programação da Universidade do Minho 3 | 4 | ## List of Challenges 5 | 6 | ### EASY 7 | 8 | - [Dice Roller](1_dice_roler) 9 | - [Reverse Staircase](2_reverse_staircase) 10 | - [Three Sum](3_sum) 11 | - [Smoshed Morse Code](5_somoshed_morse_code/easy/) 12 | 13 | ### MEDIUM 14 | 15 | - [Smoshed Morse Code](5_somoshed_morse_code/medium/) 16 | - [Sleeping Barber](7_sleeping_barber) 17 | 18 | ### HARD 19 | 20 | - [The Mondrian Art Puzzle](4_mondrian_puzzle/) 21 | - [Smoshed Morse Code](5_somoshed_morse_code/hard/) 22 | 23 | ## Rules 24 | 25 | You should send your solutions by creating a folder with your GitHub username 26 | under the folder of the category that you are participating in (either 27 | `code_golf` or `gotta_go_fast`). Organize your solutions by language (creating 28 | subfolders). 29 | 30 | ### Eligibility 31 | 32 | You must be a student at the University of Minho to be able to qualify for any 33 | eventual prizes. However, anyone is more than welcome to send their own 34 | solutions. 35 | 36 | ## Contributing 37 | 38 | You are welcome to contribute with suggestions to improve the rules in order to 39 | make them clear. Just create an issue or open a pull request. 40 | -------------------------------------------------------------------------------- /6_word_funnel/medium/README.md: -------------------------------------------------------------------------------- 1 | # Funil de Palavras 2 | ![](https://img.shields.io/badge/-MEDIUM-yellow.svg?style=for-the-badge) 3 | 4 | Um funil de palavras é uma série de palavras formada pela remoção de uma letra de cada vez de uma palavra inicial, mantendo as letras restantes em ordem. Para os fins deste desafio, uma palavra é definida como uma entrada na [lista](https://raw.githubusercontent.com/dolph/dictionary/master/enable1.txt) de palavras. Um exemplo de funil de palavras é: 5 | 6 | ``` 7 | gnash => gash => ash => ah 8 | ``` 9 | 10 | Dada uma palavra, determine o tamanho do funil de palavras mais longo que ele inicia. 11 | 12 | ## Formato do Input 13 | 14 | O input contém uma palavra 15 | 16 | ## Formato do Output 17 | 18 | O output deve imprimir no ecra o length do maior funil da palavra introduzida. 19 | 20 | Exemplos 21 | ``` 22 | funnel("gnash") => 4 23 | funnel("princesses") => 9 24 | funnel("turntables") => 5 25 | funnel("implosive") => 1 26 | funnel("programmer") => 2 27 | ``` 28 | 29 | Nota: O teu programa não deve aceitar argumentos a não ser o próprio programa e um ficheiro com dados de input. O input pode também ser lido através do stdin até EOF. 30 | Por exemplo em C: 31 | `./program input.txt` ou `./program < input.txt` 32 | -------------------------------------------------------------------------------- /5_smooshed_morse_code/easy/gotta_go_fast/brunomartins11/go/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "bufio" 5 | "fmt" 6 | "os" 7 | "sync" 8 | "runtime/debug" 9 | ) 10 | 11 | 12 | var wg sync.WaitGroup 13 | 14 | func smosh(line string, m map[string]string) { 15 | code := "" 16 | for i := 0; i < len(line); i++ { 17 | code = code + m[string(line[i])] 18 | } 19 | fmt.Println(code) 20 | wg.Done() 21 | } 22 | 23 | func main() { 24 | 25 | debug.SetGCPercent(-1) 26 | m := map[string]string{ 27 | "a": ".-", 28 | "b": "-...", 29 | "c": "-.-.", 30 | "d": "-..", 31 | "e": ".", 32 | "f": "..-.", 33 | "g": "--.", 34 | "h": "....", 35 | "i": "..", 36 | "j": ".---", 37 | "k": "-.-", 38 | "l": ".-..", 39 | "m": "--", 40 | "n": "-.", 41 | "o": "---", 42 | "p": ".--.", 43 | "q": "--.-", 44 | "r": ".-.", 45 | "s": "...", 46 | "t": "-", 47 | "u": "..-", 48 | "v": "...-", 49 | "w": ".--", 50 | "x": "-..-", 51 | "y": "-.--", 52 | "z": "--..", 53 | } 54 | 55 | scanner := bufio.NewScanner(os.Stdin) 56 | 57 | for scanner.Scan() { 58 | line := scanner.Text() 59 | wg.Add(1) 60 | go smosh(line, m) 61 | } 62 | wg.Wait() 63 | } 64 | -------------------------------------------------------------------------------- /1_dice_roler/gotta_go_fast/0urobor0s/elixir/diceroller/sample_input.txt: -------------------------------------------------------------------------------- 1 | 30d125 2 | 71d144 3 | 50d111 4 | 68d53 5 | 53d141 6 | 43d166 7 | 67d126 8 | 16d31 9 | 97d173 10 | 65d138 11 | 94d172 12 | 72d175 13 | 79d130 14 | 52d178 15 | 78d37 16 | 67d22 17 | 28d78 18 | 86d25 19 | 75d50 20 | 75d61 21 | 82d14 22 | 24d155 23 | 86d198 24 | 52d148 25 | 2d138 26 | 11d73 27 | 49d185 28 | 24d58 29 | 39d26 30 | 27d67 31 | 88d3 32 | 9d122 33 | 53d71 34 | 1d34 35 | 13d193 36 | 81d175 37 | 92d9 38 | 67d3 39 | 49d159 40 | 56d158 41 | 98d66 42 | 78d96 43 | 9d8 44 | 60d93 45 | 39d47 46 | 54d56 47 | 81d44 48 | 39d11 49 | 16d28 50 | 43d171 51 | 35d40 52 | 55d29 53 | 13d47 54 | 43d158 55 | 39d67 56 | 2d171 57 | 63d36 58 | 60d61 59 | 19d73 60 | 68d66 61 | 99d48 62 | 70d182 63 | 96d88 64 | 83d71 65 | 14d164 66 | 40d32 67 | 9d87 68 | 50d110 69 | 63d50 70 | 6d61 71 | 7d173 72 | 5d189 73 | 48d77 74 | 67d163 75 | 18d17 76 | 63d22 77 | 8d23 78 | 52d98 79 | 76d156 80 | 6d63 81 | 91d88 82 | 59d134 83 | 9d193 84 | 37d16 85 | 12d165 86 | 35d7 87 | 82d157 88 | 69d59 89 | 40d52 90 | 1d128 91 | 76d190 92 | 19d90 93 | 100d61 94 | 33d166 95 | 33d69 96 | 92d147 97 | 36d53 98 | 84d64 99 | 34d75 100 | 75d192 101 | -------------------------------------------------------------------------------- /5_smooshed_morse_code/easy/gotta_go_fast/ZePedroResende/ocaml/morse.ml: -------------------------------------------------------------------------------- 1 | let abc = [ 2 | 'a' , ".-"; 3 | 'b' , "-..."; 4 | 'c' , "-.-."; 5 | 'd' , "-.."; 6 | 'e' , "."; 7 | 'f' , "..-."; 8 | 'g' , "--."; 9 | 'h' , "...."; 10 | 'i' , ".."; 11 | 'j' , ".---"; 12 | 'k' , "-.-"; 13 | 'l' , ".-.."; 14 | 'm' , "--"; 15 | 'n' , "-."; 16 | 'o' , "---"; 17 | 'p' , ".--."; 18 | 'q' , "--.-"; 19 | 'r' , ".-."; 20 | 's' , "..."; 21 | 't' , "-"; 22 | 'u' , "..-"; 23 | 'v' , "...-"; 24 | 'w' , ".--"; 25 | 'x' , "-..-"; 26 | 'y' , "-.--"; 27 | 'z' , "--.."; 28 | '\n' , "\n" 29 | ];; 30 | 31 | let find x = 32 | match List.assoc_opt x abc with 33 | Some(x) -> x 34 | | None -> "";; 35 | 36 | 37 | let encode x = 38 | let down_case = String.lowercase_ascii x in 39 | let to_list = List.init (String.length down_case) (String.get down_case) in 40 | let list = List.map (fun c -> find c ) to_list in 41 | String.concat "" list;; 42 | 43 | let maybe_read_line () = 44 | try Some(read_line()) 45 | with End_of_file -> None 46 | 47 | let rec loop acc = 48 | match maybe_read_line () with 49 | | Some(line) -> loop ((encode line) :: acc) 50 | | None -> acc |> List.rev |> List.iter print_endline 51 | 52 | let () = loop [] 53 | -------------------------------------------------------------------------------- /1_dice_roler/gotta_go_fast/0urobor0s/elixir/diceroller/config/config.exs: -------------------------------------------------------------------------------- 1 | # This file is responsible for configuring your application 2 | # and its dependencies with the aid of the Mix.Config module. 3 | use Mix.Config 4 | 5 | # This configuration is loaded before any dependency and is restricted 6 | # to this project. If another project depends on this project, this 7 | # file won't be loaded nor affect the parent project. For this reason, 8 | # if you want to provide default values for your application for 9 | # 3rd-party users, it should be done in your "mix.exs" file. 10 | 11 | # You can configure your application as: 12 | # 13 | # config :diceroler, key: :value 14 | # 15 | # and access this configuration in your application as: 16 | # 17 | # Application.get_env(:diceroler, :key) 18 | # 19 | # You can also configure a 3rd-party app: 20 | # 21 | # config :logger, level: :info 22 | # 23 | 24 | # It is also possible to import configuration files, relative to this 25 | # directory. For example, you can emulate configuration per environment 26 | # by uncommenting the line below and defining dev.exs, test.exs and such. 27 | # Configuration from the imported file will override the ones defined 28 | # here (which is why it is important to import them last). 29 | # 30 | # import_config "#{Mix.env()}.exs" 31 | -------------------------------------------------------------------------------- /2_reverse_staircase/README.md: -------------------------------------------------------------------------------- 1 | # Staircase problem 2 | ![](https://img.shields.io/badge/-EASY-brightgreen.svg?style=for-the-badge) 3 | 4 | Consider a staircase of size 4: 5 | 6 | ``` 7 | # 8 | ## 9 | ### 10 | #### 11 | ``` 12 | 13 | Observe that its base and height are both equal to 4, and the image is drawn 14 | using # symbols and spaces. The last line is not preceded by any spaces. 15 | 16 | Write a program that prints a staircase of size `n`. 17 | 18 | ## Function Description 19 | 20 | Complete the staircase function in the editor below. It should print a 21 | staircase as described above. 22 | 23 | `staircase` has the following parameter (from the command line): 24 | 25 | * n: an integer 26 | 27 | ## Input Format 28 | 29 | A single integer, `n`, denoting the size of the staircase. 30 | 31 | Constraints: 32 | 33 | * $$0 < n <= 100$$ 34 | 35 | ## Output Format 36 | 37 | Print a staircase of size _n_ using # symbols and spaces. 38 | 39 | **Note:** The last line must have _0_ spaces in it. 40 | 41 | Sample Input 42 | 43 | ``` 44 | 6 45 | ``` 46 | 47 | ## Sample Output 48 | 49 | ``` 50 | # 51 | ## 52 | ### 53 | #### 54 | ##### 55 | ###### 56 | ``` 57 | 58 | ## Explanation 59 | 60 | The staircase is right-aligned, composed of # symbols and spaces, and has a 61 | height and width of $$n = 6$$. 62 | 63 | -------------------------------------------------------------------------------- /5_smooshed_morse_code/easy/gotta_go_fast/ZePedroResende/elixir/morse.exs: -------------------------------------------------------------------------------- 1 | defmodule Morse do 2 | @abc %{ 3 | "a" => ".-", 4 | "b" => "-...", 5 | "c" => "-.-.", 6 | "d" => "-..", 7 | "e" => ".", 8 | "f" => "..-.", 9 | "g" => "--.", 10 | "h" => "....", 11 | "i" => "..", 12 | "j" => ".---", 13 | "k" => "-.-", 14 | "l" => ".-..", 15 | "m" => "--", 16 | "n" => "-.", 17 | "o" => "---", 18 | "p" => ".--.", 19 | "q" => "--.-", 20 | "r" => ".-.", 21 | "s" => "...", 22 | "t" => "-", 23 | "u" => "..-", 24 | "v" => "...-", 25 | "w" => ".--", 26 | "x" => "-..-", 27 | "y" => "-.--", 28 | "z" => "--..", 29 | "\n" => "\n" 30 | } 31 | 32 | def pmap(collection, func) do 33 | collection 34 | |> Enum.map(&Task.async(fn -> func.(&1) end)) 35 | |> Enum.map(&Task.await/1) 36 | end 37 | 38 | def read_file(file) do 39 | case File.read(file) do 40 | {:ok, lines} -> 41 | lines 42 | 43 | {:error, _} -> 44 | IO.puts("Can't open " <> file) 45 | "" 46 | end 47 | end 48 | 49 | def encode(string) do 50 | String.downcase(string) 51 | |> String.graphemes() 52 | |> pmap(&Map.get(@abc, &1, "")) 53 | end 54 | 55 | def main() do 56 | System.argv() 57 | |> pmap(&read_file(&1)) 58 | |> pmap(&encode(&1)) 59 | |> IO.puts() 60 | end 61 | end 62 | 63 | Morse.main() 64 | -------------------------------------------------------------------------------- /5_smooshed_morse_code/easy/gotta_go_fast/Marquinhos87/C/README.md: -------------------------------------------------------------------------------- 1 | # Como Utilizar Morse Code 2 | 3 | Para utilizar de forma correta o morse code, tens de seguir apenas dois passos. 4 | 5 | ## Primeiro Passo 6 | 7 | Abre um terminal e navega até esta diretoria. Assim que aqui chegares faz 'make' no terminal e o executavél será criado. 8 | 9 | ## Segundo Passo 10 | 11 | Agora podes executar o programa de duas formas distintas. 12 | 13 | ### Primeira Forma 14 | 15 | Executa apenas 'morseCode' no terminal, este vai ficar à espera que escrevas alguma coisa, se escreveres conforme as regras descritas (apenas letras e números) este irá imprimir-te o resultado da tradução do que escreveste. 16 | 17 | ### Segunda Forma 18 | 19 | Executa 'morseCode input.txt' ou 'morseCode < input.txt' no terminal, desta maneira vai ler todas as linhas do teu ficheiro input.txt (podes dar outro nome ao ficheiro e se o ficheiro não estiver na mesma diretoria onde estás a executar o programa tens de especificar o caminho até ao ficheiro) e para cada uma delas vai imprimir o resultado o código morse obtido, quando chega ao final do ficheiro o programa termina. 20 | 21 | ## Observações 22 | 23 | No caso de colocares uma linha que não esteja no formato das regras o teu programa não se vai desligar inesperadamente mas vai te avisar de 'Invalid String Format'. 24 | 25 | No caso de quereres imprimir o resultado para um ficheiro em vez do terminal acrescenta à forma de iniciares o programa o seguinte '> res.txt' (podes dar o nome que quiseres a esse ficheiro). 26 | 27 | O ficheiro 'input.txt' tem um pequeno exemplo para este exercício. -------------------------------------------------------------------------------- /5_smooshed_morse_code/medium/README.md: -------------------------------------------------------------------------------- 1 | # Código Morse Colado 2 | ![](https://img.shields.io/badge/-MEDIUM-yellow.svg?style=for-the-badge) 3 | 4 | Uma permutação do alfabeto é uma string de 26 caracteres em que as letras de `a` a `z` apenas aparecem uma vez. 5 | Dada uma permutação do alfabeto codificada em código morse sem espaços entre os caracteres encontre qual a permutação que esta string representa. Tenha em conta que a string em código morse pode gerar mais que uma permutação do alfabeto. É necessário também referir que uma letra em código morse é composta por uma combinação de `.` e `-`. 6 | ## Formato do Input 7 | 8 | O input contém uma ou mais linhas, onde cada linha têm sempre o formato `.--...-.-.-.....-.--........----.-.-..---.---.--.--.-.-....-..-...-.---..--.----..` por exemplo. 9 | 10 | ## Formato do Output 11 | 12 | O teu programa deve imprimir no ecra todas as permutações do alfabeto que encontrar numa determinada string de codigo morse. 13 | Por exemplo o input: `.--...-.-.-.....-.--........----.-.-..---.---.--.--.-.-....-..-...-.---..--.----..` 14 | Tem como resultado: 15 | ``` 16 | wirnbfzehatqlojpgcvusyxkmd 17 | ``` 18 | 19 | É de relembrar que este output pode não ser único. 20 | Utiliza este [input](https://gist.github.com/cosmologicon/415be8987a24a3abd07ba1dddc3cf389#file-smorse2-bonus1-in) caso queiras testar a rapidez do teu código. 21 | 22 | Nota: A execução do teu programa não deve aceitar argumentos a não ser o próprio programa e um ficheiro com dados de input. O input pode também ser lido através do stdin até EOF. 23 | Por exemplo em C: 24 | `./program input.txt` ou `./program < input.txt` 25 | 26 | -------------------------------------------------------------------------------- /1_dice_roler/gotta_go_fast/Marquinhos87/C/README.md: -------------------------------------------------------------------------------- 1 | # Como Utilizar Dice Roler 2 | 3 | Para utilizar de forma correta o dice roler, tens de seguir apenas dois passos. 4 | 5 | ## Primeiro Passo 6 | 7 | Abre um terminal e navega até esta diretoria. Assim que aqui chegares faz 'make' no terminal e o executavél será criado. 8 | 9 | ## Segundo Passo 10 | 11 | Agora podes executar o programa de duas formas distintas. 12 | 13 | ### Primeira Forma 14 | 15 | Executa apenas 'diceRoler' no terminal, este vai ficar à espera que escrevas alguma coisa, se escreveres conforme as regras descritas do jogo este irá imprimir-te o resultado final e o valor obtido em cada dado. Para saires basta escreveres 'exit' e corregar Enter. 16 | 17 | ### Segunda Forma 18 | 19 | Executa 'diceRoler input.txt' ou 'diceRoler < input.txt' no terminal, desta maneira vai ler todas as linhas do teu ficheiro input.txt (podes dar outro nome ao ficheiro e se o ficheiro não estiver na mesma diretoria onde estás a executar o programa tens de especificar o caminho até ao ficheiro) e para uma delas vai imprimir o resultado obtido e os valores obtidos em cada dado. Quando chega ao final do ficheiro o programa termina. 20 | 21 | ## Observações 22 | 23 | No caso de colocares uma linha que não esteja no formato das regras o teu programa não se vai desligar inesperadamente mas vai te avisar de 'Invalid String Format'. 24 | 25 | No caso de quereres imprimir o resultado para um ficheiro em vez do terminal acrescenta à forma de iniciares o programa o seguinte '> res.txt' (podes dar o nome que quiseres a esse ficheiro). 26 | 27 | O ficheiro 'input.txt' tem um pequeno exemplo para este exercício. -------------------------------------------------------------------------------- /1_dice_roler/gotta_go_fast/Marquinhos87/C/src/diceroler.h: -------------------------------------------------------------------------------- 1 | /** @file diceroler.h*/ 2 | 3 | #ifndef DICEROLER_H_ 4 | #define DICEROLER_H_ 5 | 6 | #define _GNU_SOURCE 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | int x; /*!< This is a global variable to save the current position of the line that we are processing.*/ 14 | 15 | /** Function that parse the string to get the number of dices. 16 | * 17 | * @param l a charater pointer. 18 | * @return The number of dices 19 | */ 20 | int getD(char* l); 21 | 22 | /** Function that parse the string to get the number of faces of the dices. 23 | * 24 | * @param l a charater pointer. 25 | * @return The number of faces of every dice 26 | */ 27 | int getF(char* l); 28 | 29 | /** Funtion that generate numbers between '1 to f' in a total of 'd' times. 30 | * 31 | * @param d Number of dices. 32 | * @param f Number of faces. 33 | * @return The Integer array with de values of the all dices 34 | */ 35 | int* genV(int d,int f); 36 | 37 | /** Function to print to stdout the result of a play or multiple-play. 38 | * 39 | * @param d Number of dices. 40 | * @param v Sum of the values of all dices. 41 | * @param vs Integer array with all values of the dices. 42 | */ 43 | void prt(int d,int v,int* vs); 44 | 45 | /** Function that make de sum of all dices rolled. 46 | * 47 | * @param d Number of dices. 48 | * @param v Integer array with all values of the dices. 49 | * @return The sum of all dices rolled 50 | */ 51 | int sum(int d,int* v); 52 | 53 | /** Function that calls the others to generate de final result 54 | * 55 | * @param l String to process. 56 | * @return Return 0 if alright OK or 1 if something wrong 57 | */ 58 | int calc(char* l); 59 | 60 | #endif -------------------------------------------------------------------------------- /4_mondrian_puzzle/README.md: -------------------------------------------------------------------------------- 1 | # The Mondrian Art Puzzle 2 | ![](https://img.shields.io/badge/-HARD-red.svg?style=for-the-badge) 3 | 4 | The artist Piet Mondrian is a famous mid-century abstract artist. His designs 5 | of brightly colored rectangles on a canvas should be familiar to you even if 6 | you don't know his name. He's even given his name to a visual programming 7 | language _Piet_. 8 | 9 | The idea for this challenge comes from [this](https://youtu.be/AWcY2-FBa9k) 10 | TED-Ed video. And can be shorted to the following: 11 | 12 | > Fit non-congruent rectangles into a `n * n` square grid. What is the smallest 13 | > difference possible between the areas of the largest and the smallest 14 | > rectangles? 15 | 16 | Remember a non-congruent rectangle is a shape with distinct measurements, so a 17 | 8x1 rectangle is the same as a 1x8, but distinct from a 2x4. 18 | 19 | The challenge is to write a program that can heuristically subdivide the canvas 20 | and find a minimal area range. 21 | 22 | This is sequence [A276523](http://oeis.org/A276523) in the OEIS database. 23 | 24 | ## Input 25 | 26 | You'll be given an integer `n`, one per line, from `STDIN`. This is the size of 27 | your canvas to work with. 28 | 29 | **Example:** 30 | 31 | ``` 32 | 11 33 | ``` 34 | 35 | ## Output 36 | 37 | Your program should emit the smallest value you can find for that canvas size, 38 | optionally the dimensions of the rectangles your program generated. 39 | 40 | **Example:** 41 | 42 | ``` 43 | 6 44 | 3 X 4 45 | 2 X 6 46 | 2 X 7 47 | 3 X 5 48 | 4 X 4 49 | 2 X 8 50 | 2 X 9 51 | 3 X 6 52 | ``` 53 | 54 | ## Bonus 55 | 56 | Note that solutions above `n = 44` don't yet have a known or proven lower 57 | bound. Do your best. 58 | 59 | --- 60 | 61 | _You can read the original problem [here](https://redd.it/9dv08q)_. 62 | -------------------------------------------------------------------------------- /5_smooshed_morse_code/easy/gotta_go_fast/Marquinhos87/C/src/morse.c: -------------------------------------------------------------------------------- 1 | #include "morse.h" 2 | 3 | char* translateChar(char c) { 4 | if(c=='A' || c=='a') return ".-"; 5 | if(c=='B' || c=='b') return "-..."; 6 | if(c=='C' || c=='c') return "-.-."; 7 | if(c=='D' || c=='d') return "-.."; 8 | if(c=='E' || c=='e') return "."; 9 | if(c=='F' || c=='f') return "..-."; 10 | if(c=='G' || c=='g') return "--."; 11 | if(c=='H' || c=='h') return "...."; 12 | if(c=='I' || c=='i') return ".."; 13 | if(c=='J' || c=='j') return ".---"; 14 | if(c=='K' || c=='k') return "-.-"; 15 | if(c=='L' || c=='l') return ".-.."; 16 | if(c=='M' || c=='m') return "--"; 17 | if(c=='N' || c=='n') return "-."; 18 | if(c=='O' || c=='o') return "---"; 19 | if(c=='P' || c=='p') return ".--."; 20 | if(c=='Q' || c=='q') return "--.-"; 21 | if(c=='R' || c=='r') return ".-."; 22 | if(c=='S' || c=='s') return "..."; 23 | if(c=='T' || c=='t') return "-"; 24 | if(c=='U' || c=='u') return "..-"; 25 | if(c=='V' || c=='v') return "...-"; 26 | if(c=='W' || c=='w') return ".--"; 27 | if(c=='X' || c=='x') return "-..-"; 28 | if(c=='Y' || c=='y') return "-.--"; 29 | if(c=='Z' || c=='z') return "--.."; 30 | if(c=='1') return ".----"; 31 | if(c=='2') return "..---"; 32 | if(c=='3') return "...--"; 33 | if(c=='4') return "....-"; 34 | if(c=='5') return "....."; 35 | if(c=='6') return "-...."; 36 | if(c=='7') return "--..."; 37 | if(c=='8') return "---.."; 38 | if(c=='9') return "----."; 39 | if(c=='0') return "-----"; 40 | if(c=='\n') return ""; 41 | return NULL; 42 | } 43 | 44 | void prt(char* l,char** ls,int n){ 45 | printf("\"%s\"=>",l); 46 | for(int i=0;i 8 | [n, d] = String.split(input, "d") 9 | Enum.reduce(1..String.to_integer(n), 0, fn(_d, acc) -> 10 | Enum.random(1..String.to_integer(d)) + acc 11 | end) 12 | end 13 | end 14 | 15 | def sroler(list) do 16 | Stream.map list, fn(x) -> roler(x) end 17 | end 18 | 19 | def pproler(list) do 20 | t = ParallelTask.new 21 | pproler_a(t, list) 22 | |> Enum.reduce(0, fn({_k, v}, acc) -> v + acc end) 23 | end 24 | 25 | defp pproler_a(tsk, []) do 26 | tsk 27 | |> ParallelTask.perform 28 | end 29 | 30 | defp pproler_a(tsk, list) do 31 | tsk 32 | |> ParallelTask.add(Kernel.hd(list), fn -> roler(Kernel.hd(list)) end) 33 | |> pproler_a(Kernel.tl(list)) 34 | end 35 | 36 | def proler(list) do 37 | Parallel.map list, fn(x) -> roler(x) end 38 | end 39 | 40 | def roler(input) do 41 | [n, d] = String.split(input, "d") 42 | n = String.to_integer(n) 43 | d = String.to_integer(d) 44 | t = ParallelTask.new 45 | 46 | tasker(t, n, d) 47 | end 48 | 49 | defp tasker(tsk, 0, _dice) do 50 | tsk 51 | |> ParallelTask.perform 52 | |> Enum.reduce(0, fn({_k, v}, acc) -> v + acc end) 53 | end 54 | 55 | defp tasker(tsk, number, dice) do 56 | tsk 57 | |> ParallelTask.add(number, fn -> Enum.random(1..dice) end) 58 | |> tasker(number-1, dice) 59 | end 60 | 61 | defp read_f(path) do 62 | path 63 | |> File.stream! 64 | |> Enum.to_list 65 | |> Enum.map(fn x -> String.trim x end) 66 | end 67 | 68 | def rmeasure(path) do 69 | Benchmark.measure(fn -> read_f(path) |> ssroler |> Enum.sum end) 70 | Benchmark.measure(fn -> read_f(path) |> sroler end) 71 | Benchmark.measure(fn -> read_f(path) |> pproler end) 72 | #Benchmark.measure(fn -> read_f(path) |> proler end) 73 | end 74 | end 75 | -------------------------------------------------------------------------------- /7_sleeping_barber/herulume/Main.hs: -------------------------------------------------------------------------------- 1 | module Main where 2 | 3 | import Control.Concurrent 4 | import Control.Concurrent.STM.TBQueue 5 | import GHC.Conc 6 | import System.Random 7 | import GHC.Natural 8 | 9 | data Shop = Shop { 10 | seats :: TVar Natural, 11 | queue :: TBQueue Natural 12 | } 13 | 14 | -- Aux functions 15 | initShop :: Natural -> STM Shop 16 | initShop nSeats = do 17 | s <- newTVar nSeats 18 | q <- newTBQueue nSeats 19 | return $ Shop s q 20 | 21 | threadDelayR :: Int -> Int -> IO () 22 | threadDelayR l h = getStdRandom (randomR (l, h)) >>= threadDelay 23 | 24 | seatOrKick :: Shop -> Natural -> IO (Maybe ()) 25 | seatOrKick s c = do 26 | ns <- atomically . readTVar . seats $ s 27 | if ns > 0 then atomically $ do 28 | writeTVar (seats s) (ns-1) 29 | fmap (const (Just ())) $ writeTBQueue (queue s) c 30 | else return Nothing 31 | 32 | -- Main logic 33 | enterShop :: Shop -> Natural -> IO () 34 | enterShop s c = do 35 | putStrLn $ "[*] Client enters shop " ++ show c 36 | decision <- seatOrKick s c 37 | case decision of 38 | Just _ -> putStrLn $ "[*] Seat available for client " ++ show c 39 | Nothing -> putStrLn $ "[*] Kicking client " ++ show c 40 | 41 | createCustomers :: Shop -> IO () 42 | createCustomers shop = createCustomer shop 1 43 | where 44 | createCustomer :: Shop -> Natural -> IO () 45 | createCustomer s n = 46 | threadDelayR 100000 2000000 >> 47 | forkIO (enterShop s n) >> 48 | createCustomer shop (n+1) 49 | 50 | cutHair :: Shop -> IO () 51 | cutHair s = do 52 | c <- atomically $ readTBQueue (queue s) 53 | atomically $ do 54 | ns <- readTVar (seats s) 55 | writeTVar (seats s) (ns+1) 56 | putStrLn $ "[+] Cutting hair of client " ++ show c 57 | threadDelayR 100000 10000000 58 | putStrLn $ "[+] Done cutting hair of client " ++ show c 59 | 60 | work :: Shop -> IO ThreadId 61 | work s = forkIO loop 62 | where 63 | loop :: IO () 64 | loop = cutHair s >> loop 65 | 66 | main :: IO () 67 | main = atomically (initShop 4) >>= 68 | \s -> work s >> createCustomers s 69 | -------------------------------------------------------------------------------- /1_dice_roler/README.md: -------------------------------------------------------------------------------- 1 | # Cria um lançador de dados 2 | ![](https://img.shields.io/badge/-EASY-brightgreen.svg?style=for-the-badge) 3 | 4 | Imagina que queres jogar *Dungeons & Dragons* mas não tens dados de várias 5 | dimensões. Resolve este problema criando um programa que possa lançar qualquer 6 | tipo de dados. 7 | 8 | ## Formato do Input 9 | 10 | O input contém uma ou mais linhas, onde cada linha têm sempre o formato `NdM`. 11 | Por exemplo: 12 | 13 | ``` 14 | 3d6 15 | 4d12 16 | 1d10 17 | 5d4 18 | ``` 19 | 20 | Se já jogaste alguma vez *D&D*, provavelmente reconheces o formato mas para os 21 | restantes, isto é o que significa: 22 | 23 | O primeiro número é a quantidade de dados a lançar, o d significa "dado", é 24 | usado apenas para separar os dois números, e o segundo número é a quantidade de 25 | lados que os dados têm. Usando como exemplo a primeira linha, `3d6` significa 26 | lança 3 dados de 6 faces. 27 | 28 | O primeiro número, o número de dados a lançar, é um inteiro entre 1 e 100, 29 | inclusive. 30 | 31 | O segundo número, o número de faces do dado, é um inteiro entre 2 e 100, 32 | inclusive. 33 | 34 | ## Formato do Output 35 | 36 | O teu programa deve imprimir no ecrã a soma dos lançamentos de um dado pedido. 37 | Cada um destes na sua linha. Usando o exemplo `3d6`, o resultado devia ser algo 38 | como: 39 | 40 | ``` 41 | 14 42 | ``` 43 | 44 | Um simples número, foram lançados 3 dados com 6 faces cada, e a soma do 45 | resultado deu 14. 46 | 47 | ## Notas/Pistas 48 | 49 | O lançamento de um dado é basicamente o mesmo que escolher um número aleatório 50 | entre 1 e 6 (ou 12, 20 ou quantas faces o dado tiver). Deves encontrar uma 51 | maneira de escolher aleatoriamente um número nesse intervalo dado no input. O 52 | teu programa deve gerar resultados o mais aleatórios possível. Se o correres e 53 | para os mesmo dados der sempre o mesmo output isso não seria muito aleatório, 54 | pois não? Tenta garantir que isso não acontece. 55 | 56 | Não multipliques um lançamento pelo número de dados, por favor. Isso estaria 57 | incorreto pois estarias a eliminar vários valores possíveis. Por exemplo, não é 58 | possível obter o resultado `14` a partir do input `3d6` se apenas lançares um 59 | dado uma vez e o multiplicares por 3. Todos os lançamentos devem ser 60 | independentes. 61 | 62 | ## Bónus 63 | 64 | Além de imprimires no ecrã o resultado da soma, podes imprimir o resultado de 65 | todos os lançamentos para cada linha. Por exemplo, assim: 66 | 67 | ``` 68 | 14: 6 3 5 69 | 22: 10 7 1 4 70 | 9: 9 71 | 11: 3 2 2 1 3 72 | ``` 73 | 74 | --- 75 | 76 | _Podes ler o enunciado original [aqui](https://redd.it/8s0cy1/)._ 77 | 78 | -------------------------------------------------------------------------------- /7_sleeping_barber/README.md: -------------------------------------------------------------------------------- 1 | # Sleeping Barber 2 | ![](https://img.shields.io/badge/-MEDIUM-yellow.svg?style=for-the-badge) 3 | 4 | The sleeping barber problem is a classic inter-process communication and synchronization problem between multiple operating system processes. The problem is analogous to that of keeping a barber working when there are customers, resting when there are none, and doing so in an orderly manner. 5 | 6 | In short: 7 | 1. There is a barber’s shop where there is only one barber. 8 | 2. There is one barber chair and a number of waiting chairs for the customers. 9 | 3. When there are no customers the barber sits on the barber chair and sleeps. 10 | 4. When a customer arrives he awakes the barber or waits in one of the vacant chairs if the barber is cutting someone else’s hair. 11 | 5. When all the chairs are full, the newly arrived customer simply leaves. 12 | 13 | You must implement a version of this problem, keeping in mind some problems may arise. 14 | 15 | A customer may arrive and observe that the barber is cutting hair, so he goes to the waiting room. While they're on their way, the barber finishes their current haircut and goes to check the waiting room. Since there is no one there (maybe the waiting room is far away and the barber walks faster passing the customer, or maybe the customer went to the restroom or was going towards the chair and the barber thought he was leaving), so the barber goes back to their chair and sleeps. The barber is now waiting for a customer, but the customer is waiting for the barber. 16 | In another situation, two customers may arrive at the same time when there happens to be a single seat in the waiting room. They observe that the barber is cutting hair, go to the waiting room, and both attempt to occupy the single chair. (Adapted from Wikipedia) 17 | 18 | ## Input format 19 | 20 | You can hard code all the variables (the time each operation takes to finish and the number of waiting chairs). 21 | 22 | ## Output format 23 | 24 | Your program must output every action as showed by the example. 25 | You should use integers for identifying the clients. 26 | 27 | Examples 28 | ``` 29 | [*] Client enters shop id 30 | [*] Seat available for client id 31 | [*] Kicking client id 32 | [+] Cutting hair of client id 33 | [+] Done cutting hair of client id 34 | ``` 35 | 36 | ## General notes 37 | 38 | This challenge is a bit different, please do read these notes. 39 | 40 | 1. Since the interesting part of this problem is the algorithm itself, you can use external libraries (within reason) 41 | 2. Keep all the code in a single file 42 | 3. Put your solution on `/` 43 | 4. We are looking for elegant solutions, no need to format your code in a code golf style 44 | 5. There isn't an objective definition of "elegant", that's up for the current CAOS direction to decide. We will mainly focus on concepts used and code length (withing reason). 45 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ### C ### 2 | # Prerequisites 3 | *.d 4 | 5 | # Object files 6 | *.o 7 | *.ko 8 | *.obj 9 | *.elf 10 | 11 | # Linker output 12 | *.ilk 13 | *.map 14 | *.exp 15 | 16 | # Precompiled Headers 17 | *.gch 18 | *.pch 19 | 20 | # Libraries 21 | *.lib 22 | *.a 23 | *.la 24 | *.lo 25 | 26 | # Shared objects (inc. Windows DLLs) 27 | *.dll 28 | *.so 29 | *.so.* 30 | *.dylib 31 | 32 | # Executables 33 | *.exe 34 | *.out 35 | *.app 36 | *.i*86 37 | *.x86_64 38 | *.hex 39 | 40 | # Debug files 41 | *.dSYM/ 42 | *.su 43 | *.idb 44 | *.pdb 45 | 46 | # Kernel Module Compile Results 47 | *.mod* 48 | *.cmd 49 | .tmp_versions/ 50 | modules.order 51 | Module.symvers 52 | Mkfile.old 53 | dkms.conf 54 | 55 | 56 | ### C++ ### 57 | # Prerequisites 58 | *.d 59 | 60 | # Compiled Object files 61 | *.slo 62 | *.lo 63 | *.o 64 | *.obj 65 | 66 | # Precompiled Headers 67 | *.gch 68 | *.pch 69 | 70 | # Compiled Dynamic libraries 71 | *.so 72 | *.dylib 73 | *.dll 74 | 75 | # Fortran module files 76 | *.mod 77 | *.smod 78 | 79 | # Compiled Static libraries 80 | *.lai 81 | *.la 82 | *.a 83 | *.lib 84 | 85 | # Executables 86 | *.exe 87 | *.out 88 | *.app 89 | 90 | 91 | ### Julia ### 92 | # Files generated by invoking Julia with --code-coverage 93 | *.jl.cov 94 | *.jl.*.cov 95 | 96 | # Files generated by invoking Julia with --track-allocation 97 | *.jl.mem 98 | 99 | # System-specific files and directories generated by the BinaryProvider and BinDeps packages 100 | # They contain absolute paths specific to the host computer, and so should not be committed 101 | deps/deps.jl 102 | deps/build.log 103 | deps/downloads/ 104 | deps/usr/ 105 | deps/src/ 106 | 107 | # Build artifacts for creating documentation generated by the Documenter package 108 | docs/build/ 109 | docs/site/ 110 | 111 | # File generated by Pkg, the package manager, based on a corresponding Project.toml 112 | # It records a fixed state of all packages used by the project. As such, it should not be 113 | # committed for packages, but should be committed for applications that require a static 114 | # environment. 115 | Manifest.toml 116 | 117 | 118 | ### R ### 119 | # History files 120 | .Rhistory 121 | .Rapp.history 122 | 123 | # Session Data files 124 | .RData 125 | 126 | # User-specific files 127 | .Ruserdata 128 | 129 | # Example code in package build process 130 | *-Ex.R 131 | 132 | # Output files from R CMD build 133 | /*.tar.gz 134 | 135 | # Output files from R CMD check 136 | /*.Rcheck/ 137 | 138 | # RStudio files 139 | .Rproj.user/ 140 | 141 | # produced vignettes 142 | vignettes/*.html 143 | vignettes/*.pdf 144 | 145 | # OAuth2 token, see https://github.com/hadley/httr/releases/tag/v0.3 146 | .httr-oauth 147 | 148 | # knitr and R markdown default cache directories 149 | /*_cache/ 150 | /cache/ 151 | 152 | # Temporary files created by R markdown 153 | *.utf8.md 154 | *.knit.md 155 | 156 | ### R.Bookdown Stack ### 157 | # R package: bookdown caching files 158 | /*_files/ 159 | 160 | 161 | ### Scala ### 162 | *.class 163 | *.log 164 | 165 | 166 | ### Clojure ### 167 | pom.xml 168 | pom.xml.asc 169 | *.jar 170 | *.class 171 | /lib/ 172 | /classes/ 173 | /target/ 174 | /checkouts/ 175 | .lein-deps-sum 176 | .lein-repl-history 177 | .lein-plugins/ 178 | .lein-failures 179 | .nrepl-port 180 | .cpcache/ 181 | 182 | 183 | ### Elixir ### 184 | /_build 185 | /cover 186 | /deps 187 | /doc 188 | /.fetch 189 | erl_crash.dump 190 | *.ez 191 | *.beam 192 | /config/*.secret.exs 193 | .elixir_ls/ 194 | 195 | 196 | ### Erlang ### 197 | .eunit 198 | deps 199 | *.o 200 | *.beam 201 | *.plt 202 | erl_crash.dump 203 | ebin/*.beam 204 | rel/example_project 205 | .concrete/DEV_MODE 206 | .rebar 207 | 208 | # Binaries for programs and plugins 209 | *.exe 210 | *.exe~ 211 | *.dll 212 | *.so 213 | *.dylib 214 | 215 | # Test binary, built with `go test -c` 216 | *.test 217 | 218 | # Output of the go coverage tool, specifically when used with LiteIDE 219 | *.out 220 | 221 | ### Go Patch ### 222 | *.prof 223 | *.pprof 224 | **/go/vendor/ 225 | **/go/Godeps/ 226 | 227 | 228 | ### Haskell ### 229 | dist 230 | dist-* 231 | cabal-dev 232 | *.o 233 | *.hi 234 | *.chi 235 | *.chs.h 236 | *.dyn_o 237 | *.dyn_hi 238 | .hpc 239 | .hsenv 240 | .cabal-sandbox/ 241 | cabal.sandbox.config 242 | *.prof 243 | *.aux 244 | *.hp 245 | *.eventlog 246 | .stack-work/ 247 | cabal.project.local 248 | cabal.project.local~ 249 | .HTF/ 250 | .ghc.environment.* 251 | 252 | 253 | ### Java ### 254 | # Compiled class file 255 | *.class 256 | 257 | # Log file 258 | *.log 259 | 260 | # BlueJ files 261 | *.ctxt 262 | 263 | # Mobile Tools for Java (J2ME) 264 | .mtj.tmp/ 265 | 266 | # Package Files # 267 | *.jar 268 | *.war 269 | *.nar 270 | *.ear 271 | *.zip 272 | *.tar.gz 273 | *.rar 274 | 275 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 276 | hs_err_pid* 277 | 278 | 279 | ### Node ### 280 | # Logs 281 | logs 282 | *.log 283 | npm-debug.log* 284 | yarn-debug.log* 285 | yarn-error.log* 286 | lerna-debug.log* 287 | 288 | # Diagnostic reports (https://nodejs.org/api/report.html) 289 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 290 | 291 | # Runtime data 292 | pids 293 | *.pid 294 | *.seed 295 | *.pid.lock 296 | 297 | # Directory for instrumented libs generated by jscoverage/JSCover 298 | lib-cov 299 | 300 | # Coverage directory used by tools like istanbul 301 | coverage 302 | 303 | # nyc test coverage 304 | .nyc_output 305 | 306 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 307 | .grunt 308 | 309 | # Bower dependency directory (https://bower.io/) 310 | bower_components 311 | 312 | # node-waf configuration 313 | .lock-wscript 314 | 315 | # Compiled binary addons (https://nodejs.org/api/addons.html) 316 | build/Release 317 | 318 | # Dependency directories 319 | node_modules/ 320 | jspm_packages/ 321 | 322 | # TypeScript v1 declaration files 323 | typings/ 324 | 325 | # Optional npm cache directory 326 | .npm 327 | 328 | # Optional eslint cache 329 | .eslintcache 330 | 331 | # Optional REPL history 332 | .node_repl_history 333 | 334 | # Output of 'npm pack' 335 | *.tgz 336 | 337 | # Yarn Integrity file 338 | .yarn-integrity 339 | 340 | # dotenv environment variables file 341 | .env 342 | .env.test 343 | 344 | # parcel-bundler cache (https://parceljs.org/) 345 | .cache 346 | 347 | # next.js build output 348 | .next 349 | 350 | # nuxt.js build output 351 | .nuxt 352 | 353 | # vuepress build output 354 | .vuepress/dist 355 | 356 | # Serverless directories 357 | .serverless/ 358 | 359 | # FuseBox cache 360 | .fusebox/ 361 | 362 | # DynamoDB Local files 363 | .dynamodb/ 364 | 365 | 366 | ### Perl ### 367 | !Build/ 368 | .last_cover_stats 369 | /META.yml 370 | /META.json 371 | /MYMETA.* 372 | *.o 373 | *.pm.tdy 374 | *.bs 375 | 376 | # Devel::Cover 377 | cover_db/ 378 | 379 | # Devel::NYTProf 380 | nytprof.out 381 | 382 | # Dizt::Zilla 383 | /.build/ 384 | 385 | # Module::Build 386 | _build/ 387 | Build 388 | Build.bat 389 | 390 | # Module::Install 391 | inc/ 392 | 393 | # ExtUtils::MakeMaker 394 | /blib/ 395 | /_eumm/ 396 | /*.gz 397 | /Makefile 398 | /Makefile.old 399 | /MANIFEST.bak 400 | /pm_to_blib 401 | /*.zip 402 | 403 | 404 | ### Python ### 405 | # Byte-compiled / optimized / DLL files 406 | __pycache__/ 407 | *.py[cod] 408 | *$py.class 409 | 410 | # C extensions 411 | *.so 412 | 413 | # Distribution / packaging 414 | .Python 415 | build/ 416 | develop-eggs/ 417 | dist/ 418 | downloads/ 419 | eggs/ 420 | .eggs/ 421 | lib/ 422 | lib64/ 423 | parts/ 424 | sdist/ 425 | var/ 426 | wheels/ 427 | pip-wheel-metadata/ 428 | share/python-wheels/ 429 | *.egg-info/ 430 | .installed.cfg 431 | *.egg 432 | MANIFEST 433 | 434 | # PyInstaller 435 | # Usually these files are written by a python script from a template 436 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 437 | *.manifest 438 | *.spec 439 | 440 | # Installer logs 441 | pip-log.txt 442 | pip-delete-this-directory.txt 443 | 444 | # Unit test / coverage reports 445 | htmlcov/ 446 | .tox/ 447 | .nox/ 448 | .coverage 449 | .coverage.* 450 | .cache 451 | nosetests.xml 452 | coverage.xml 453 | *.cover 454 | .hypothesis/ 455 | .pytest_cache/ 456 | 457 | # Translations 458 | *.mo 459 | *.pot 460 | 461 | # Django stuff: 462 | *.log 463 | local_settings.py 464 | db.sqlite3 465 | 466 | # Flask stuff: 467 | instance/ 468 | .webassets-cache 469 | 470 | # Scrapy stuff: 471 | .scrapy 472 | 473 | # Sphinx documentation 474 | docs/_build/ 475 | 476 | # PyBuilder 477 | target/ 478 | 479 | # Jupyter Notebook 480 | .ipynb_checkpoints 481 | 482 | # IPython 483 | profile_default/ 484 | ipython_config.py 485 | 486 | # pyenv 487 | .python-version 488 | 489 | # pipenv 490 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 491 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 492 | # having no cross-platform support, pipenv may install dependencies that don’t work, or not 493 | # install all needed dependencies. 494 | #Pipfile.lock 495 | 496 | # celery beat schedule file 497 | celerybeat-schedule 498 | 499 | # SageMath parsed files 500 | *.sage.py 501 | 502 | # Environments 503 | .env 504 | .venv 505 | env/ 506 | venv/ 507 | ENV/ 508 | env.bak/ 509 | venv.bak/ 510 | 511 | # Spyder project settings 512 | .spyderproject 513 | .spyproject 514 | 515 | # Rope project settings 516 | .ropeproject 517 | 518 | # mkdocs documentation 519 | /site 520 | 521 | # mypy 522 | .mypy_cache/ 523 | .dmypy.json 524 | dmypy.json 525 | 526 | # Pyre type checker 527 | .pyre/ 528 | 529 | 530 | ### Ruby ### 531 | *.gem 532 | *.rbc 533 | /.config 534 | /coverage/ 535 | /InstalledFiles 536 | /pkg/ 537 | /spec/reports/ 538 | /spec/examples.txt 539 | /test/tmp/ 540 | /test/version_tmp/ 541 | /tmp/ 542 | 543 | # Used by dotenv library to load environment variables. 544 | # .env 545 | 546 | # Ignore Byebug command history file. 547 | .byebug_history 548 | 549 | ## Specific to RubyMotion: 550 | .dat* 551 | .repl_history 552 | build/ 553 | *.bridgesupport 554 | build-iPhoneOS/ 555 | build-iPhoneSimulator/ 556 | 557 | ## Specific to RubyMotion (use of CocoaPods): 558 | # 559 | # We recommend against adding the Pods directory to your .gitignore. However 560 | # you should judge for yourself, the pros and cons are mentioned at: 561 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 562 | # vendor/Pods/ 563 | 564 | ## Documentation cache and generated files: 565 | /.yardoc/ 566 | /_yardoc/ 567 | /doc/ 568 | /rdoc/ 569 | 570 | ## Environment normalization: 571 | /.bundle/ 572 | /vendor/bundle 573 | /lib/bundler/man/ 574 | 575 | # for a library or gem, you might want to ignore these files since the code is 576 | # intended to run in multiple environments; otherwise, check them in: 577 | # Gemfile.lock 578 | # .ruby-version 579 | # .ruby-gemset 580 | 581 | # unless supporting rvm < 1.11.0 or doing something fancy, ignore this: 582 | .rvmrc 583 | 584 | 585 | ### Rust ### 586 | # Generated by Cargo 587 | # will have compiled files and executables 588 | /target/ 589 | 590 | # Remove Cargo.lock from gitignore if creating an executable, leave it for libraries 591 | # More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html 592 | Cargo.lock 593 | 594 | # These are backup files generated by rustfmt 595 | **/*.rs.bk 596 | 597 | -------------------------------------------------------------------------------- /1_dice_roler/gotta_go_fast/ZePedroResende/clojure/LICENSE: -------------------------------------------------------------------------------- 1 | THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC 2 | LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM 3 | CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. 4 | 5 | 1. DEFINITIONS 6 | 7 | "Contribution" means: 8 | 9 | a) in the case of the initial Contributor, the initial code and 10 | documentation distributed under this Agreement, and 11 | 12 | b) in the case of each subsequent Contributor: 13 | 14 | i) changes to the Program, and 15 | 16 | ii) additions to the Program; 17 | 18 | where such changes and/or additions to the Program originate from and are 19 | distributed by that particular Contributor. A Contribution 'originates' from 20 | a Contributor if it was added to the Program by such Contributor itself or 21 | anyone acting on such Contributor's behalf. Contributions do not include 22 | additions to the Program which: (i) are separate modules of software 23 | distributed in conjunction with the Program under their own license 24 | agreement, and (ii) are not derivative works of the Program. 25 | 26 | "Contributor" means any person or entity that distributes the Program. 27 | 28 | "Licensed Patents" mean patent claims licensable by a Contributor which are 29 | necessarily infringed by the use or sale of its Contribution alone or when 30 | combined with the Program. 31 | 32 | "Program" means the Contributions distributed in accordance with this 33 | Agreement. 34 | 35 | "Recipient" means anyone who receives the Program under this Agreement, 36 | including all Contributors. 37 | 38 | 2. GRANT OF RIGHTS 39 | 40 | a) Subject to the terms of this Agreement, each Contributor hereby grants 41 | Recipient a non-exclusive, worldwide, royalty-free copyright license to 42 | reproduce, prepare derivative works of, publicly display, publicly perform, 43 | distribute and sublicense the Contribution of such Contributor, if any, and 44 | such derivative works, in source code and object code form. 45 | 46 | b) Subject to the terms of this Agreement, each Contributor hereby grants 47 | Recipient a non-exclusive, worldwide, royalty-free patent license under 48 | Licensed Patents to make, use, sell, offer to sell, import and otherwise 49 | transfer the Contribution of such Contributor, if any, in source code and 50 | object code form. This patent license shall apply to the combination of the 51 | Contribution and the Program if, at the time the Contribution is added by the 52 | Contributor, such addition of the Contribution causes such combination to be 53 | covered by the Licensed Patents. The patent license shall not apply to any 54 | other combinations which include the Contribution. No hardware per se is 55 | licensed hereunder. 56 | 57 | c) Recipient understands that although each Contributor grants the licenses 58 | to its Contributions set forth herein, no assurances are provided by any 59 | Contributor that the Program does not infringe the patent or other 60 | intellectual property rights of any other entity. Each Contributor disclaims 61 | any liability to Recipient for claims brought by any other entity based on 62 | infringement of intellectual property rights or otherwise. As a condition to 63 | exercising the rights and licenses granted hereunder, each Recipient hereby 64 | assumes sole responsibility to secure any other intellectual property rights 65 | needed, if any. For example, if a third party patent license is required to 66 | allow Recipient to distribute the Program, it is Recipient's responsibility 67 | to acquire that license before distributing the Program. 68 | 69 | d) Each Contributor represents that to its knowledge it has sufficient 70 | copyright rights in its Contribution, if any, to grant the copyright license 71 | set forth in this Agreement. 72 | 73 | 3. REQUIREMENTS 74 | 75 | A Contributor may choose to distribute the Program in object code form under 76 | its own license agreement, provided that: 77 | 78 | a) it complies with the terms and conditions of this Agreement; and 79 | 80 | b) its license agreement: 81 | 82 | i) effectively disclaims on behalf of all Contributors all warranties and 83 | conditions, express and implied, including warranties or conditions of title 84 | and non-infringement, and implied warranties or conditions of merchantability 85 | and fitness for a particular purpose; 86 | 87 | ii) effectively excludes on behalf of all Contributors all liability for 88 | damages, including direct, indirect, special, incidental and consequential 89 | damages, such as lost profits; 90 | 91 | iii) states that any provisions which differ from this Agreement are offered 92 | by that Contributor alone and not by any other party; and 93 | 94 | iv) states that source code for the Program is available from such 95 | Contributor, and informs licensees how to obtain it in a reasonable manner on 96 | or through a medium customarily used for software exchange. 97 | 98 | When the Program is made available in source code form: 99 | 100 | a) it must be made available under this Agreement; and 101 | 102 | b) a copy of this Agreement must be included with each copy of the Program. 103 | 104 | Contributors may not remove or alter any copyright notices contained within 105 | the Program. 106 | 107 | Each Contributor must identify itself as the originator of its Contribution, 108 | if any, in a manner that reasonably allows subsequent Recipients to identify 109 | the originator of the Contribution. 110 | 111 | 4. COMMERCIAL DISTRIBUTION 112 | 113 | Commercial distributors of software may accept certain responsibilities with 114 | respect to end users, business partners and the like. While this license is 115 | intended to facilitate the commercial use of the Program, the Contributor who 116 | includes the Program in a commercial product offering should do so in a 117 | manner which does not create potential liability for other Contributors. 118 | Therefore, if a Contributor includes the Program in a commercial product 119 | offering, such Contributor ("Commercial Contributor") hereby agrees to defend 120 | and indemnify every other Contributor ("Indemnified Contributor") against any 121 | losses, damages and costs (collectively "Losses") arising from claims, 122 | lawsuits and other legal actions brought by a third party against the 123 | Indemnified Contributor to the extent caused by the acts or omissions of such 124 | Commercial Contributor in connection with its distribution of the Program in 125 | a commercial product offering. The obligations in this section do not apply 126 | to any claims or Losses relating to any actual or alleged intellectual 127 | property infringement. In order to qualify, an Indemnified Contributor must: 128 | a) promptly notify the Commercial Contributor in writing of such claim, and 129 | b) allow the Commercial Contributor to control, and cooperate with the 130 | Commercial Contributor in, the defense and any related settlement 131 | negotiations. The Indemnified Contributor may participate in any such claim 132 | at its own expense. 133 | 134 | For example, a Contributor might include the Program in a commercial product 135 | offering, Product X. That Contributor is then a Commercial Contributor. If 136 | that Commercial Contributor then makes performance claims, or offers 137 | warranties related to Product X, those performance claims and warranties are 138 | such Commercial Contributor's responsibility alone. Under this section, the 139 | Commercial Contributor would have to defend claims against the other 140 | Contributors related to those performance claims and warranties, and if a 141 | court requires any other Contributor to pay any damages as a result, the 142 | Commercial Contributor must pay those damages. 143 | 144 | 5. NO WARRANTY 145 | 146 | EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON 147 | AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER 148 | EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR 149 | CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A 150 | PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the 151 | appropriateness of using and distributing the Program and assumes all risks 152 | associated with its exercise of rights under this Agreement , including but 153 | not limited to the risks and costs of program errors, compliance with 154 | applicable laws, damage to or loss of data, programs or equipment, and 155 | unavailability or interruption of operations. 156 | 157 | 6. DISCLAIMER OF LIABILITY 158 | 159 | EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY 160 | CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, 161 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION 162 | LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 163 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 164 | ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE 165 | EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY 166 | OF SUCH DAMAGES. 167 | 168 | 7. GENERAL 169 | 170 | If any provision of this Agreement is invalid or unenforceable under 171 | applicable law, it shall not affect the validity or enforceability of the 172 | remainder of the terms of this Agreement, and without further action by the 173 | parties hereto, such provision shall be reformed to the minimum extent 174 | necessary to make such provision valid and enforceable. 175 | 176 | If Recipient institutes patent litigation against any entity (including a 177 | cross-claim or counterclaim in a lawsuit) alleging that the Program itself 178 | (excluding combinations of the Program with other software or hardware) 179 | infringes such Recipient's patent(s), then such Recipient's rights granted 180 | under Section 2(b) shall terminate as of the date such litigation is filed. 181 | 182 | All Recipient's rights under this Agreement shall terminate if it fails to 183 | comply with any of the material terms or conditions of this Agreement and 184 | does not cure such failure in a reasonable period of time after becoming 185 | aware of such noncompliance. If all Recipient's rights under this Agreement 186 | terminate, Recipient agrees to cease use and distribution of the Program as 187 | soon as reasonably practicable. However, Recipient's obligations under this 188 | Agreement and any licenses granted by Recipient relating to the Program shall 189 | continue and survive. 190 | 191 | Everyone is permitted to copy and distribute copies of this Agreement, but in 192 | order to avoid inconsistency the Agreement is copyrighted and may only be 193 | modified in the following manner. The Agreement Steward reserves the right to 194 | publish new versions (including revisions) of this Agreement from time to 195 | time. No one other than the Agreement Steward has the right to modify this 196 | Agreement. The Eclipse Foundation is the initial Agreement Steward. The 197 | Eclipse Foundation may assign the responsibility to serve as the Agreement 198 | Steward to a suitable separate entity. Each new version of the Agreement will 199 | be given a distinguishing version number. The Program (including 200 | Contributions) may always be distributed subject to the version of the 201 | Agreement under which it was received. In addition, after a new version of 202 | the Agreement is published, Contributor may elect to distribute the Program 203 | (including its Contributions) under the new version. Except as expressly 204 | stated in Sections 2(a) and 2(b) above, Recipient receives no rights or 205 | licenses to the intellectual property of any Contributor under this 206 | Agreement, whether expressly, by implication, estoppel or otherwise. All 207 | rights in the Program not expressly granted under this Agreement are 208 | reserved. 209 | 210 | This Agreement is governed by the laws of the State of New York and the 211 | intellectual property laws of the United States of America. No party to this 212 | Agreement will bring a legal action under this Agreement more than one year 213 | after the cause of action arose. Each party waives its rights to a jury trial 214 | in any resulting litigation. 215 | --------------------------------------------------------------------------------