├── .gitignore
├── README.md
├── challenges
├── 2016-11-09-roman-numerals-converter
│ ├── README.md
│ └── code.py
├── 2016-12-07-longest-palindrome
│ ├── .babelrc
│ ├── index.js
│ ├── package.json
│ ├── readme.md
│ └── yarn.lock
├── 2016-12-21-battleships
│ ├── README.md
│ ├── main.go
│ └── main_test.go
├── 2017-01-18-fizzbuzz-kotlin
│ ├── .gradle
│ │ └── 3.1
│ │ │ └── taskArtifacts
│ │ │ ├── cache.properties
│ │ │ ├── cache.properties.lock
│ │ │ ├── fileHashes.bin
│ │ │ ├── fileSnapshots.bin
│ │ │ └── taskArtifacts.bin
│ ├── .idea
│ │ ├── compiler.xml
│ │ ├── gradle.xml
│ │ ├── libraries
│ │ │ ├── Gradle__junit_junit_4_11.xml
│ │ │ ├── Gradle__org_hamcrest_hamcrest_core_1_3.xml
│ │ │ ├── Gradle__org_jetbrains_kotlin_kotlin_runtime_1_0_6.xml
│ │ │ ├── Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_0_6.xml
│ │ │ ├── Gradle__org_jetbrains_kotlin_kotlin_test_1_0_6.xml
│ │ │ └── Gradle__org_jetbrains_kotlin_kotlin_test_junit_1_0_6.xml
│ │ ├── misc.xml
│ │ ├── modules.xml
│ │ ├── modules
│ │ │ ├── codingdojojo.iml
│ │ │ ├── codingdojojo_main.iml
│ │ │ └── codingdojojo_test.iml
│ │ └── workspace.xml
│ ├── build.gradle
│ ├── build
│ │ ├── classes
│ │ │ ├── main
│ │ │ │ ├── META-INF
│ │ │ │ │ └── codingdojojo_main.kotlin_module
│ │ │ │ ├── Main.class
│ │ │ │ └── MainKt.class
│ │ │ └── test
│ │ │ │ ├── MainTest$testFizzBuzz$1.class
│ │ │ │ ├── MainTest$testFizzBuzz$2.class
│ │ │ │ └── MainTest.class
│ │ └── kotlin-build
│ │ │ └── caches
│ │ │ └── version.txt
│ ├── gradle
│ │ └── wrapper
│ │ │ ├── gradle-wrapper.jar
│ │ │ └── gradle-wrapper.properties
│ ├── gradlew
│ ├── gradlew.bat
│ ├── readme.md
│ ├── settings.gradle
│ └── src
│ │ ├── main
│ │ └── kotlin
│ │ │ └── Main.kt
│ │ └── test
│ │ └── kotlin
│ │ └── MainTest.kt
├── 2017-01-25-get-number
│ ├── .babelrc
│ ├── index.js
│ ├── package.json
│ ├── readme.md
│ └── yarn.lock
├── 2017-02-01-bank-entries
│ ├── dojo.playground
│ │ ├── Contents.swift
│ │ ├── contents.xcplayground
│ │ ├── playground.xcworkspace
│ │ │ ├── contents.xcworkspacedata
│ │ │ └── xcuserdata
│ │ │ │ └── ostanik.xcuserdatad
│ │ │ │ └── UserInterfaceState.xcuserstate
│ │ └── timeline.xctimeline
│ └── readme.md
├── 2017-02-08-urinol
│ ├── README.md
│ ├── code.py
│ └── requirements.txt
├── 2017-02-15-prime-words
│ ├── .babelrc
│ ├── index.js
│ ├── package.json
│ ├── readme.md
│ └── yarn.lock
├── 2017-02-22-coin-change
│ ├── README.md
│ ├── main.go
│ └── main_test.go
├── 2017-03-01-zigzag-py
│ ├── README.md
│ ├── code.py
│ └── requirements.txt
├── 2017-03-01-zigzag
│ ├── .babelrc
│ ├── index.js
│ ├── package.json
│ ├── readme.md
│ └── yarn.lock
├── 2017-03-08-character-count
│ ├── index.js
│ ├── package.json
│ ├── readme.md
│ └── yarn.lock
├── 2017-03-15-atm-problem
│ ├── index.js
│ ├── package.json
│ ├── readme.md
│ └── yarn.lock
├── 2017-03-22-game-of-life
│ ├── index.js
│ ├── package.json
│ ├── readme.md
│ └── yarn.lock
├── 2017-04-05-tennis-game
│ ├── README.md
│ ├── codingdojo.cabal
│ ├── dist
│ │ ├── build
│ │ │ ├── Code.dyn_hi
│ │ │ ├── Code.dyn_o
│ │ │ ├── Code.hi
│ │ │ ├── Code.o
│ │ │ ├── Code.p_hi
│ │ │ ├── Code.p_o
│ │ │ ├── autogen
│ │ │ │ ├── Paths_codingdojo.hs
│ │ │ │ └── cabal_macros.h
│ │ │ ├── libHScodingdojo-0.0.0-O89NcY1WlHGQ8029dJqHh-ghc8.0.2.dylib
│ │ │ ├── libHScodingdojo-0.0.0-O89NcY1WlHGQ8029dJqHh.a
│ │ │ ├── libHScodingdojo-0.0.0-O89NcY1WlHGQ8029dJqHh_p.a
│ │ │ └── spec
│ │ │ │ ├── spec
│ │ │ │ └── spec-tmp
│ │ │ │ ├── CodeSpec.hi
│ │ │ │ ├── CodeSpec.o
│ │ │ │ ├── Main.hi
│ │ │ │ └── Main.o
│ │ ├── package.conf.inplace
│ │ │ ├── codingdojo-0.0.0-O89NcY1WlHGQ8029dJqHh.conf
│ │ │ └── package.cache
│ │ ├── setup-config
│ │ └── test
│ │ │ ├── codingdojo-0.0.0-spec.log
│ │ │ └── codingdojo-0.0.0.log
│ ├── src
│ │ └── Code.hs
│ └── test
│ │ ├── CodeSpec.hs
│ │ └── Spec.hs
├── 2017-04-19-find-the-murderer
│ ├── README.md
│ ├── code.py
│ └── requirements.txt
├── 2017-05-03-tic-tac-toe
│ ├── index.js
│ ├── package.json
│ ├── readme.md
│ └── yarn.lock
├── 2017-05-24-a-little-world
│ ├── .gitignore
│ ├── index.test.js
│ ├── package.json
│ ├── readme.md
│ └── yarn.lock
├── 2017-06-21-complex-number-multiplication
│ ├── CodingDojo.playground
│ │ ├── Contents.swift
│ │ ├── contents.xcplayground
│ │ └── playground.xcworkspace
│ │ │ ├── contents.xcworkspacedata
│ │ │ └── xcuserdata
│ │ │ └── nicholas.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── README.md
├── 2017-07-kata-poker-dojo
│ ├── .gitignore
│ ├── README.md
│ ├── config
│ │ └── config.exs
│ ├── lib
│ │ ├── deck.ex
│ │ └── poker_dojo.ex
│ ├── mix.exs
│ ├── mix.lock
│ └── test
│ │ ├── poker_dojo_test.exs
│ │ └── test_helper.exs
├── 2017-08-10-radio-transmitters
│ ├── README.md
│ ├── code.py
│ ├── requirements.txt
│ └── test_code.py
├── 2017-08-16-kata-bathroom-security
│ ├── README.md
│ ├── doorpassword.exs
│ └── doorpasword.clj
├── 2017-08-30-monkey-path
│ ├── .gitignore
│ ├── README.md
│ ├── index.test.js
│ ├── package.json
│ ├── positions.png
│ └── yarn.lock
├── 2018-02-23-inverse-captcha
│ ├── README.md
│ ├── code.py
│ └── requirements.txt
├── 2018-07-25-high-entropy-passphrases
│ ├── .gitignore
│ ├── README.md
│ ├── requirements.txt
│ └── test_code.py
├── 2018-08-15-elixir-proj-euler
│ ├── README.md
│ ├── problem007.exs
│ └── problem020.exs
├── 2019-04-26-mictorio
│ ├── README.md
│ └── code.py
├── 2019-05-10-fizzbuzz
│ ├── README.md
│ └── code.ex
└── 2019-05-24-minesweeper
│ ├── README.md
│ └── code.ex
├── codingdojo.png
└── templates
├── Swift
├── README.md
└── SwiftTestsTemplate.playground
│ ├── Contents.swift
│ ├── contents.xcplayground
│ └── playground.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcuserdata
│ └── ostanik.xcuserdatad
│ └── UserInterfaceState.xcuserstate
├── elixir
├── README.md
└── template.exs
├── go
├── README.md
├── main.go
└── main_test.go
├── haskell
├── .ghci
├── .gitignore
├── README.md
├── codingdojo.cabal
├── src
│ └── Code.hs
└── test
│ ├── CodeSpec.hs
│ └── Spec.hs
├── javascript
├── .gitignore
├── index.test.js
├── package.json
├── readme.md
└── yarn.lock
├── kotlin
├── .idea
│ ├── gradle.xml
│ ├── misc.xml
│ ├── modules.xml
│ ├── modules
│ │ └── kotlin.iml
│ ├── vcs.xml
│ └── workspace.xml
├── build.gradle
├── build
│ ├── classes
│ │ ├── main
│ │ │ ├── META-INF
│ │ │ │ └── codingdojojo_main.kotlin_module
│ │ │ ├── Main.class
│ │ │ └── MainKt.class
│ │ └── test
│ │ │ ├── MainTest$testFizzBuzz$1.class
│ │ │ ├── MainTest$testFizzBuzz$2.class
│ │ │ └── MainTest.class
│ └── kotlin-build
│ │ └── caches
│ │ └── version.txt
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── settings.gradle
└── src
│ ├── main
│ └── kotlin
│ │ └── Main.kt
│ └── test
│ └── kotlin
│ └── MainTest.kt
└── python
├── README.md
├── code.py
└── requirements.txt
/.gitignore:
--------------------------------------------------------------------------------
1 | __pycache__
2 |
3 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Cheesecake Labs Coding Dojo
2 |
3 | 
4 |
5 | Hi,
6 | this is the repository where we will keep our results from Coding Dojo sessions and all challenges that we want to do!
7 |
8 | But, what is a Coding Dojo?
9 |
10 | > A Coding Dojo is a meeting where a bunch of coders get together to work on a programming challenge. They are there have fun and to engage in deliberate practice in order to improve their skills.
11 |
12 | To get more information, here is some links:
13 |
14 | - [What is coding dojo?](http://codingdojo.org/)
15 | - [The coding dojo](http://code.joejag.com/2009/the-coding-dojo.html)
16 |
17 | ## Modes
18 | The Dojo can be made in three different modes:
19 |
20 | ### Kata
21 | A presenter shows how to solve a problem. All participants should be able to reproduce the solution on their own, interrupting to make question or commentaries at any time.
22 |
23 | ### Randori
24 | Everyone helps to solve a problem using one machine - in pairs - the pilot (who is coding) and the co-pilot (who is assisting). Each time frame (between 5 or 10 minutes), the co-pilot assumes the keyboard and someone from the audiance takes its place. The problem may has tests already produced, to create a definition of done. Also, the pair decides what to do to solve the problem, which should be explained as it goes.
25 |
26 | ### Kake
27 | Likely the Randori, but multiple pairs working at the same time. On each turn, the pairs are changed, promoting more integration among all participants.
28 |
29 | ## Structure
30 | Each challenge will be placed inside the `challenges` directory, with a descriptive name and the problem to be solved.
31 |
32 | Once finished, the code created will be uploaded inside the challenge's directory.
33 |
34 | ## Contributing
35 | Do you have a cool challenge or puzzle to be used in a Dojo session? Just create a pull request with a new folder inside `challenges` with its name and description.
36 | Also, here's a list of links with cool puzzles (if you know others, PR them too!):
37 |
38 | - [DojoPuzzles.com](http://dojopuzzles.com/)
39 | - [Ruby Quiz](http://rubyquiz.com/)
40 | - [LeetCode](https://leetcode.com/problemset/algorithms/)
41 | - [Facebook CodeLab](https://codelab.interviewbit.com/)
42 | - [CarrerCup](https://www.careercup.com/page)
43 | - [awesome-challenges (1)](https://github.com/mauriciovieira/awesome-challenges)
44 | - [awesome-challenges (2)](https://github.com/eliotsykes/awesome-challenges)
45 |
46 | ## Help
47 | If you need any help, just yell on the #codingdojo Slack channel, at Cheesecake Labs.
48 |
49 | **Happy coding!**
50 |
--------------------------------------------------------------------------------
/challenges/2016-11-09-roman-numerals-converter/README.md:
--------------------------------------------------------------------------------
1 | # Roman numbers
2 |
3 | The Roman numeration system (or Roman numerals) developed in Ancient Rome and was used throughout its Empire. In this system the figures are written with certain letters, which represent the numbers. The letters are always uppercase, because don't exists lowercase letters in the Roman alphabet. The letters are I, V, X, L, C, D and M.
4 |
5 | Our task is to develop a program that converts Arabic numbers to Roman format and vice versa. The rules for the formation of Roman numerals are given below.
6 |
7 | Each letter corresponds to a certain value:
8 | * I = 1
9 | * V = 5
10 | * X = 10
11 | * L = 50
12 | * C = 100
13 | * D = 500
14 | * M = 1000
15 |
16 | By grouping the letters above, we can represent the numbers according to a set of rules:
17 | With the exception of V, L and D, the other numerals can be repeated no more than three times:
18 | * III = 3
19 | * XXX = 30
20 | * CCC = 300
21 | * MMM = 3000
22 |
23 | When written to the right of larger numerals, I, X and C add up to the values of the first ones:
24 | * VIII = 5 + 1 + 1 + 1 = 8
25 | * LXII = 50 + 10 + 1 + 1 = 62
26 | * CLVIII = 158
27 | * MCXX = 1000 + 100 + 10 + 10 = 1120
28 |
29 | But if the numerals I, X and C are to the left of the larger ones, their values are subtracted, for example, in:
30 | * IV = 5 - 1 = 4
31 | * IX = 10 - 1 = 9
32 | * XC = 100 - 10 = 90
33 |
34 | [Source](http://dojopuzzles.com/problemas/exibe/numeros-romanos/)
35 |
36 | # Python Template
37 |
38 | ## Install
39 | Tested with Python 3.
40 |
41 | ## Run
42 | Run the tests with `python code.py`
43 |
--------------------------------------------------------------------------------
/challenges/2016-11-09-roman-numerals-converter/code.py:
--------------------------------------------------------------------------------
1 | import unittest
2 |
3 | roman_values = {
4 | 'I':1,
5 | 'V':5,
6 | 'X':10,
7 | 'L':50,
8 | 'C':100,
9 | 'D':500,
10 | 'M':1000
11 | }
12 |
13 | can_subtract = ['I', 'X', 'C']
14 |
15 | def check_invalid_number(roman):
16 | invalid_combinations = [
17 | 'IIII',
18 | 'XXXX',
19 | 'CCCC',
20 | 'MMMM',
21 | ]
22 | for invalid_combination in invalid_combinations:
23 | if roman.find(invalid_combination) >= 0:
24 | raise Exception
25 | return roman
26 |
27 | def convert_into_decimal(roman):
28 | roman = check_invalid_number(roman)
29 | decimal_list = []
30 | for number in roman:
31 | decimal_list.append(roman_values[number])
32 |
33 | sum_list = []
34 | skip = False
35 | for index, decimal in enumerate(decimal_list):
36 | if skip:
37 | skip = False
38 | continue
39 |
40 | if index < len(decimal_list) - 1 and decimal < decimal_list[index + 1]:
41 | if decimal not in [1,10,100]:
42 | raise Exception
43 | if decimal_list[index + 1] / decimal > 10:
44 | raise Exception
45 | sum_list.append(decimal_list[index + 1] - decimal)
46 | skip = True
47 | else:
48 | sum_list.append(decimal)
49 |
50 | sum_list_sorted = sorted(sum_list, reverse=True)
51 |
52 | if sum_list != sum_list_sorted:
53 | raise Exception
54 |
55 | return sum(sum_list)
56 |
57 | class TestDojo(unittest.TestCase):
58 | def setUp(self):
59 | self.test_data = [
60 | ('X', 10),
61 | ('XX', 20),
62 | ('XXX', 30),
63 | ('IX', 9),
64 | ('MDC', 1600)
65 | ]
66 |
67 | def test_stuff(self):
68 | self.assertEquals(convert_into_decimal('X'), 10)
69 | self.assertEquals(convert_into_decimal('XX'), 20)
70 | self.assertEquals(convert_into_decimal('XXV'), 25)
71 | self.assertEquals(convert_into_decimal('IX'), 9)
72 | self.assertEquals(convert_into_decimal('IV'), 4)
73 | self.assertEquals(convert_into_decimal('XC'), 90)
74 | self.assertEquals(convert_into_decimal('MCXX'), 1120)
75 | self.assertEquals(convert_into_decimal('XIX'), 19)
76 |
77 | def test_invalid(self):
78 | with self.assertRaises(Exception):
79 | convert_into_decimal('MMMM')
80 | with self.assertRaises(Exception):
81 | convert_into_decimal('IC')
82 | with self.assertRaises(Exception):
83 | convert_into_decimal('VLC')
84 | with self.assertRaises(Exception):
85 | convert_into_decimal('VX')
86 | with self.assertRaises(Exception):
87 | convert_into_decimal('XLC')
88 | with self.assertRaises(Exception):
89 | convert_into_decimal('IXX')
90 | with self.assertRaises(Exception):
91 | convert_into_decimal('IIX')
92 | with self.assertRaises(Exception):
93 | convert_into_decimal('JOJO')
94 |
95 | if __name__ == "__main__":
96 | unittest.main()
97 |
--------------------------------------------------------------------------------
/challenges/2016-12-07-longest-palindrome/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": ["latest"]
3 | }
4 |
--------------------------------------------------------------------------------
/challenges/2016-12-07-longest-palindrome/index.js:
--------------------------------------------------------------------------------
1 | import test from 'ava'
2 |
3 | const inputs = [
4 | 'aba',
5 | 'abad',
6 | 'natan',
7 | 'tanznaia',
8 | 'a',
9 | 'nnnnnnnnnnatannnnnnnnnncivilwartestingwhetherthatnaptionoranynartionsoconceivedandsodedicatedcanlongendureWeareqmetonagreatbattlefiemldoftzhatwarWehavecometodedicpateaportionofthatfieldasafinalrestingplaceforthosewhoheregavetheirlivesthatthatnationmightliveItisaltogetherfangandproperthatweshoulddothisButinalargersensewecannotdedicatewecannotconsecratewecannothallowthisgroundThebravelmenlivinganddeadwhostruggledherehaveconsecrateditfaraboveourpoorponwertoaddordetractTgheworldadswfilllittlenotlenorlongrememberwhatwesayherebutitcanneverforgetwhattheydidhereItisforusthelivingrathertobededicatedheretotheulnfinishedworkwhichtheywhofoughtherehavethusfarsonoblyadvancedItisratherforustobeherededicatedtothegreattdafskremainingbeforeusthatfromthesehonoreddeadwetakeincreaseddevotiontothatcauseforwhichtheygavethelastpfullmeasureofdevotionthatweherehighlyresolvethatthesedeadshallnothavediedinvainthatthisnationunsderGodshallhaveanewbirthoffreedomandthatgovernmentofthepeoplebythepeopleforthepeopleshallnotperishfromtheearth',
10 |
11 | ]
12 |
13 | const outputs = [
14 | 'aba',
15 | 'aba',
16 | 'natan',
17 | 'anzna',
18 | 'a',
19 | 'nnnnnnnnnnatannnnnnnnnn',
20 | ]
21 |
22 | test('sum 1', t => {
23 | t.true(isPalindrome('natan'))
24 | t.false(isPalindrome('iurhaoiejapw'))
25 | for (var i = inputs.length - 1; i >= 0; i--) {
26 | t.is(getLongestPalindrome(inputs[i]), outputs[i], 'test ' + i)
27 | }
28 | })
29 |
30 | function isPalindrome (value) {
31 |
32 | for (var i = 0; i < value.length / 2; i++) {
33 | if(value[i] !== value[value.length - 1 - i]) {
34 | return false
35 | }
36 |
37 | }
38 | return true
39 | }
40 |
41 | function getLongestPalindrome (value) {
42 | var longest = ""
43 |
44 | for(var i = 0; i < value.length; i++) {
45 | for (var j = value.length; j > longest.length && j > i; j--){
46 | var substr = value.substring(i,j);
47 | if(substr.length > longest.length && isPalindrome(substr)) {
48 | longest = substr;
49 | }
50 | }
51 | }
52 | return longest
53 | }
54 |
--------------------------------------------------------------------------------
/challenges/2016-12-07-longest-palindrome/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "dojo-javascript",
3 | "version": "1.0.0",
4 | "main": "index.js",
5 | "license": "MIT",
6 | "scripts": {
7 | "test": "ava --watch index.js"
8 | },
9 | "devDependencies": {
10 | "ava": "^0.17.0",
11 | "babel-cli": "^6.18.0",
12 | "babel-core": "^6.18.2",
13 | "babel-preset-latest": "^6.16.0"
14 | },
15 | "ava": {
16 | "babel": "inherit"
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/challenges/2016-12-07-longest-palindrome/readme.md:
--------------------------------------------------------------------------------
1 | # Longest Palindromic Substring
2 |
3 | Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.
4 |
5 | *Example:*
6 | ```
7 | Input: "babad"
8 |
9 | Output: "bab"
10 |
11 | Note: "aba" is also a valid answer.
12 | ```
13 |
14 | *Example:*
15 |
16 | ```
17 | Input: "cbbd"
18 |
19 | Output: "bb"
20 | ```
21 |
22 | [Source](https://leetcode.com/problems/longest-palindromic-substring/)
23 |
24 | # Javascript Template
25 |
26 | ## Install
27 |
28 | `npm install`
29 |
30 | ## Run
31 |
32 | `npm test`
33 |
34 |
--------------------------------------------------------------------------------
/challenges/2016-12-21-battleships/README.md:
--------------------------------------------------------------------------------
1 | ## Challenge
2 |
3 | Given an 2D board, count how many battleships are in it. The battleships are represented with 'X's, empty slots are represented with '.'s. You may assume the following rules:
4 |
5 | * You receive a valid board, made of only battleships or empty slots.
6 | * Battleships can only be placed horizontally or vertically. In other words, they can only be made of the shape `1xN` (1 row, N columns) or `Nx1` (N rows, 1 column), where N can be of any size.
7 | * At least one horizontal or vertical cell separates between two battleships - there are no adjacent battleships.
8 |
9 | Example:
10 |
11 | ```
12 | X..X
13 | ...X
14 | ...X
15 | ```
16 |
17 | In the above board there are 2 battleships.
18 |
19 | Invalid Example:
20 | ```
21 | ...X
22 | XXXX
23 | ...X
24 | ```
25 |
26 | This is an invalid board that you will not receive - as battleships will always have a cell separating between them.
27 |
28 | [Source](https://leetcode.com/problems/battleships-in-a-board/?tab=Description)
29 |
30 | # Go Template
31 |
32 | ## Install
33 | You need Go! This was tested with version 1.8.
34 | You'll also need [bro](https://github.com/marioidival/bro), a Go test runner with file watch. Install it with `go get github.com/marioidival/bro`.
35 |
36 | ## Run
37 | On the directory, run `bro`.
38 |
39 |
--------------------------------------------------------------------------------
/challenges/2016-12-21-battleships/main.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "fmt"
5 | )
6 |
7 | func CountBattleships(board [][]string) int {
8 |
9 | totalShips := 0
10 |
11 | for line := 0; line < len(board); line++ {
12 | for column := 0; column < len(board[line]); column++ {
13 | position := board[line][column]
14 | fmt.Print(board[line][column])
15 |
16 | if IsGhostBattleship(position) {
17 | if (line-1 >= 0 && IsGhostBattleship(board[line-1][column])) ||
18 | (column-1 >= 0 && IsGhostBattleship(board[line][column-1])) {
19 | continue
20 | }
21 | totalShips++
22 | }
23 | }
24 | fmt.Println("")
25 | }
26 | return totalShips
27 | }
28 |
29 | func IsGhostBattleship(position string) bool {
30 | return position == "X"
31 | }
32 |
33 | func main() {
34 | }
35 |
--------------------------------------------------------------------------------
/challenges/2016-12-21-battleships/main_test.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import "testing"
4 |
5 | var validBoard = [][]string{
6 | []string{"X", ".", ".", "X"},
7 | []string{"X", ".", ".", "X"},
8 | []string{".", "X", ".", "X"},
9 | }
10 |
11 | func TestCountBattleships(t *testing.T) {
12 | if CountBattleships(validBoard) != 3 {
13 | t.Fatal("Not valid")
14 | }
15 | }
16 |
17 | func TestIsBattleships(t *testing.T) {
18 | if !IsGhostBattleship("X") {
19 | t.Fatal("Not valid")
20 | }
21 |
22 | if IsGhostBattleship(".") {
23 | t.Fatal("Not valid")
24 | }
25 | }
--------------------------------------------------------------------------------
/challenges/2017-01-18-fizzbuzz-kotlin/.gradle/3.1/taskArtifacts/cache.properties:
--------------------------------------------------------------------------------
1 | #Wed Jan 18 11:05:02 BRST 2017
2 |
--------------------------------------------------------------------------------
/challenges/2017-01-18-fizzbuzz-kotlin/.gradle/3.1/taskArtifacts/cache.properties.lock:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CheesecakeLabs/codingdojo/e56bbbf27a91ce01054156e4e23fc76b7dbbf873/challenges/2017-01-18-fizzbuzz-kotlin/.gradle/3.1/taskArtifacts/cache.properties.lock
--------------------------------------------------------------------------------
/challenges/2017-01-18-fizzbuzz-kotlin/.gradle/3.1/taskArtifacts/fileHashes.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CheesecakeLabs/codingdojo/e56bbbf27a91ce01054156e4e23fc76b7dbbf873/challenges/2017-01-18-fizzbuzz-kotlin/.gradle/3.1/taskArtifacts/fileHashes.bin
--------------------------------------------------------------------------------
/challenges/2017-01-18-fizzbuzz-kotlin/.gradle/3.1/taskArtifacts/fileSnapshots.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CheesecakeLabs/codingdojo/e56bbbf27a91ce01054156e4e23fc76b7dbbf873/challenges/2017-01-18-fizzbuzz-kotlin/.gradle/3.1/taskArtifacts/fileSnapshots.bin
--------------------------------------------------------------------------------
/challenges/2017-01-18-fizzbuzz-kotlin/.gradle/3.1/taskArtifacts/taskArtifacts.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CheesecakeLabs/codingdojo/e56bbbf27a91ce01054156e4e23fc76b7dbbf873/challenges/2017-01-18-fizzbuzz-kotlin/.gradle/3.1/taskArtifacts/taskArtifacts.bin
--------------------------------------------------------------------------------
/challenges/2017-01-18-fizzbuzz-kotlin/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/challenges/2017-01-18-fizzbuzz-kotlin/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
18 |
19 |
--------------------------------------------------------------------------------
/challenges/2017-01-18-fizzbuzz-kotlin/.idea/libraries/Gradle__junit_junit_4_11.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/challenges/2017-01-18-fizzbuzz-kotlin/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/challenges/2017-01-18-fizzbuzz-kotlin/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_runtime_1_0_6.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/challenges/2017-01-18-fizzbuzz-kotlin/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_0_6.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/challenges/2017-01-18-fizzbuzz-kotlin/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_test_1_0_6.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/challenges/2017-01-18-fizzbuzz-kotlin/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_test_junit_1_0_6.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/challenges/2017-01-18-fizzbuzz-kotlin/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/challenges/2017-01-18-fizzbuzz-kotlin/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/challenges/2017-01-18-fizzbuzz-kotlin/.idea/modules/codingdojojo.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/challenges/2017-01-18-fizzbuzz-kotlin/.idea/modules/codingdojojo_main.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
--------------------------------------------------------------------------------
/challenges/2017-01-18-fizzbuzz-kotlin/.idea/modules/codingdojojo_test.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
--------------------------------------------------------------------------------
/challenges/2017-01-18-fizzbuzz-kotlin/build.gradle:
--------------------------------------------------------------------------------
1 | group 'cheesecakelabs'
2 | version '1.0-SNAPSHOT'
3 |
4 | buildscript {
5 | ext.kotlin_version = '1.0.6'
6 |
7 | repositories {
8 | mavenCentral()
9 | }
10 | dependencies {
11 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
12 | }
13 | }
14 |
15 | apply plugin: 'java'
16 | apply plugin: 'kotlin'
17 |
18 | sourceCompatibility = 1.5
19 |
20 | mainClassName = 'codingdojojo.Main'
21 |
22 | repositories {
23 | mavenCentral()
24 | }
25 |
26 | dependencies {
27 | compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
28 | testCompile group: 'junit', name: 'junit', version: '4.11'
29 | testCompile "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version"
30 | }
31 |
--------------------------------------------------------------------------------
/challenges/2017-01-18-fizzbuzz-kotlin/build/classes/main/META-INF/codingdojojo_main.kotlin_module:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | MainKt
--------------------------------------------------------------------------------
/challenges/2017-01-18-fizzbuzz-kotlin/build/classes/main/Main.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CheesecakeLabs/codingdojo/e56bbbf27a91ce01054156e4e23fc76b7dbbf873/challenges/2017-01-18-fizzbuzz-kotlin/build/classes/main/Main.class
--------------------------------------------------------------------------------
/challenges/2017-01-18-fizzbuzz-kotlin/build/classes/main/MainKt.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CheesecakeLabs/codingdojo/e56bbbf27a91ce01054156e4e23fc76b7dbbf873/challenges/2017-01-18-fizzbuzz-kotlin/build/classes/main/MainKt.class
--------------------------------------------------------------------------------
/challenges/2017-01-18-fizzbuzz-kotlin/build/classes/test/MainTest$testFizzBuzz$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CheesecakeLabs/codingdojo/e56bbbf27a91ce01054156e4e23fc76b7dbbf873/challenges/2017-01-18-fizzbuzz-kotlin/build/classes/test/MainTest$testFizzBuzz$1.class
--------------------------------------------------------------------------------
/challenges/2017-01-18-fizzbuzz-kotlin/build/classes/test/MainTest$testFizzBuzz$2.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CheesecakeLabs/codingdojo/e56bbbf27a91ce01054156e4e23fc76b7dbbf873/challenges/2017-01-18-fizzbuzz-kotlin/build/classes/test/MainTest$testFizzBuzz$2.class
--------------------------------------------------------------------------------
/challenges/2017-01-18-fizzbuzz-kotlin/build/classes/test/MainTest.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CheesecakeLabs/codingdojo/e56bbbf27a91ce01054156e4e23fc76b7dbbf873/challenges/2017-01-18-fizzbuzz-kotlin/build/classes/test/MainTest.class
--------------------------------------------------------------------------------
/challenges/2017-01-18-fizzbuzz-kotlin/build/kotlin-build/caches/version.txt:
--------------------------------------------------------------------------------
1 | 11001
--------------------------------------------------------------------------------
/challenges/2017-01-18-fizzbuzz-kotlin/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CheesecakeLabs/codingdojo/e56bbbf27a91ce01054156e4e23fc76b7dbbf873/challenges/2017-01-18-fizzbuzz-kotlin/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/challenges/2017-01-18-fizzbuzz-kotlin/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Wed Jan 18 11:23:22 BRST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-3.1-all.zip
7 |
--------------------------------------------------------------------------------
/challenges/2017-01-18-fizzbuzz-kotlin/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Attempt to set APP_HOME
10 | # Resolve links: $0 may be a link
11 | PRG="$0"
12 | # Need this for relative symlinks.
13 | while [ -h "$PRG" ] ; do
14 | ls=`ls -ld "$PRG"`
15 | link=`expr "$ls" : '.*-> \(.*\)$'`
16 | if expr "$link" : '/.*' > /dev/null; then
17 | PRG="$link"
18 | else
19 | PRG=`dirname "$PRG"`"/$link"
20 | fi
21 | done
22 | SAVED="`pwd`"
23 | cd "`dirname \"$PRG\"`/" >/dev/null
24 | APP_HOME="`pwd -P`"
25 | cd "$SAVED" >/dev/null
26 |
27 | APP_NAME="Gradle"
28 | APP_BASE_NAME=`basename "$0"`
29 |
30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31 | DEFAULT_JVM_OPTS=""
32 |
33 | # Use the maximum available, or set MAX_FD != -1 to use that value.
34 | MAX_FD="maximum"
35 |
36 | warn ( ) {
37 | echo "$*"
38 | }
39 |
40 | die ( ) {
41 | echo
42 | echo "$*"
43 | echo
44 | exit 1
45 | }
46 |
47 | # OS specific support (must be 'true' or 'false').
48 | cygwin=false
49 | msys=false
50 | darwin=false
51 | nonstop=false
52 | case "`uname`" in
53 | CYGWIN* )
54 | cygwin=true
55 | ;;
56 | Darwin* )
57 | darwin=true
58 | ;;
59 | MINGW* )
60 | msys=true
61 | ;;
62 | NONSTOP* )
63 | nonstop=true
64 | ;;
65 | esac
66 |
67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68 |
69 | # Determine the Java command to use to start the JVM.
70 | if [ -n "$JAVA_HOME" ] ; then
71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72 | # IBM's JDK on AIX uses strange locations for the executables
73 | JAVACMD="$JAVA_HOME/jre/sh/java"
74 | else
75 | JAVACMD="$JAVA_HOME/bin/java"
76 | fi
77 | if [ ! -x "$JAVACMD" ] ; then
78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79 |
80 | Please set the JAVA_HOME variable in your environment to match the
81 | location of your Java installation."
82 | fi
83 | else
84 | JAVACMD="java"
85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86 |
87 | Please set the JAVA_HOME variable in your environment to match the
88 | location of your Java installation."
89 | fi
90 |
91 | # Increase the maximum file descriptors if we can.
92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93 | MAX_FD_LIMIT=`ulimit -H -n`
94 | if [ $? -eq 0 ] ; then
95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96 | MAX_FD="$MAX_FD_LIMIT"
97 | fi
98 | ulimit -n $MAX_FD
99 | if [ $? -ne 0 ] ; then
100 | warn "Could not set maximum file descriptor limit: $MAX_FD"
101 | fi
102 | else
103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104 | fi
105 | fi
106 |
107 | # For Darwin, add options to specify how the application appears in the dock
108 | if $darwin; then
109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110 | fi
111 |
112 | # For Cygwin, switch paths to Windows format before running java
113 | if $cygwin ; then
114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116 | JAVACMD=`cygpath --unix "$JAVACMD"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
158 | function splitJvmOpts() {
159 | JVM_OPTS=("$@")
160 | }
161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
163 |
164 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
165 | if [[ "$(uname)" == "Darwin" ]] && [[ "$HOME" == "$PWD" ]]; then
166 | cd "$(dirname "$0")"
167 | fi
168 |
169 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
170 |
--------------------------------------------------------------------------------
/challenges/2017-01-18-fizzbuzz-kotlin/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/challenges/2017-01-18-fizzbuzz-kotlin/readme.md:
--------------------------------------------------------------------------------
1 | # FizzBuzz
2 |
3 | In this problem, you must display a list from 1 to 100, one number in each line, with the following exceptions:
4 |
5 | * Divisible numbers by 3 should appear as `Fizz` instead of the number.
6 | * Divisible numbers by 5 should appear as `Buzz` instead of the number.
7 | * Divisible numbers by 3 and 5 should appear as `FizzBuzz` instead of the number.
8 |
9 | [Source](http://dojopuzzles.com/problemas/exibe/fizzbuzz/)
10 |
11 | # Kotlin Template
12 |
13 | ## Install and Run
14 | Install the IntelliJ IDEA with the Kotlin plugin, then just import the project and run it.
15 |
--------------------------------------------------------------------------------
/challenges/2017-01-18-fizzbuzz-kotlin/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'codingdojojo'
2 |
3 |
--------------------------------------------------------------------------------
/challenges/2017-01-18-fizzbuzz-kotlin/src/main/kotlin/Main.kt:
--------------------------------------------------------------------------------
1 | import java.util.*
2 |
3 | /**
4 | * Created by marciorodrigues on 18/01/17.
5 | */
6 |
7 | fun main(args : Array) {
8 |
9 | }
10 |
11 | class Main {
12 |
13 | fun fizzBuzz(input: Int) : Array {
14 | if (input < 1) { return arrayOf() }
15 |
16 | val multiples = Array(size = input) {""}
17 |
18 | for (n in 1..input) {
19 | var stringVar = ""
20 |
21 | if (n % 3 == 0) {
22 | stringVar += "Fizz"
23 | }
24 |
25 | if (n % 5 == 0) {
26 | stringVar += "Buzz"
27 | }
28 |
29 | if (stringVar.isEmpty()) {
30 | stringVar = n.toString()
31 | }
32 |
33 | multiples[n - 1] = stringVar
34 | }
35 |
36 | return multiples
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/challenges/2017-01-18-fizzbuzz-kotlin/src/test/kotlin/MainTest.kt:
--------------------------------------------------------------------------------
1 | import org.junit.Test
2 | import java.util.*
3 | import kotlin.test.assertEquals
4 | import kotlin.test.assertTrue
5 |
6 | /**
7 | * Created by marciorodrigues on 18/01/17.
8 | */
9 |
10 | class MainTest {
11 |
12 | @Test fun testFizzBuzz() {
13 | val main = Main()
14 | var n = 1
15 | var expected = arrayOf("1",
16 | "2",
17 | "Fizz",
18 | "4",
19 | "Buzz",
20 | "Fizz",
21 | "7",
22 | "8",
23 | "Fizz",
24 | "Buzz",
25 | "11",
26 | "Fizz",
27 | "13",
28 | "14",
29 | "FizzBuzz"
30 | )
31 | assertTrue { Arrays.equals(expected, main.fizzBuzz(n)) }
32 |
33 | n = 0
34 | expected = arrayOf()
35 | assertTrue { Arrays.equals(expected, main.fizzBuzz(n)) }
36 | }
37 |
38 | }
--------------------------------------------------------------------------------
/challenges/2017-01-25-get-number/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": ["latest"]
3 | }
4 |
--------------------------------------------------------------------------------
/challenges/2017-01-25-get-number/index.js:
--------------------------------------------------------------------------------
1 | import test from 'ava'
2 |
3 | const inputs = [
4 |
5 | ]
6 |
7 | const outputs = [
8 |
9 | ]
10 |
11 | // ABC -> 2
12 | // DEF -> 3
13 | // GHI -> 4
14 | // JKL -> 5
15 | // MNO -> 6
16 | // PQRS -> 7
17 | // TUV -> 8
18 | // WXYZ -> 9
19 |
20 | const map = {
21 | 'A': '2', 'B': '2', 'C': '2',
22 | 'D': '3', 'E': '3', 'F': '3',
23 | 'G': '4', 'H': '4', 'I': '4',
24 | 'J': '5', 'K': '5', 'L': '5',
25 | 'M': '6', 'N': '6', 'O': '6',
26 | 'P': '7', 'Q': '7', 'R': '7', 'S': '7',
27 | 'T': '8', 'U': '8', 'V': '8',
28 | 'W': '9', 'X': '9', 'Y': '9', 'Z': '9',
29 | }
30 |
31 |
32 | test(t => {
33 | t.is(getNumber('A'), '2')
34 | t.is(getNumber('ABC'), '222')
35 | t.is(getNumber('MY-LOVE'), '69-5683')
36 | t.is(getNumber('1-HOME-SWEET-HOME'), '1-4663-79338-4663')
37 | t.is(getNumber('MY-MISERABLE-JOB'), '69-647372253-562')
38 | t.is(getNumber('MY-MISE7ABLE-JOB'), '69-647372253-562')
39 | })
40 |
41 | function getNumber(value) {
42 | let response = ''
43 |
44 | for (var i = 0; i < value.length; i++) {
45 | const char = value[i]
46 | response += map[char] || char
47 | }
48 |
49 | return response
50 | }
51 |
--------------------------------------------------------------------------------
/challenges/2017-01-25-get-number/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "dojo-javascript",
3 | "version": "1.0.0",
4 | "main": "index.js",
5 | "license": "MIT",
6 | "scripts": {
7 | "test": "ava --watch index.js"
8 | },
9 | "devDependencies": {
10 | "ava": "^0.17.0",
11 | "babel-cli": "^6.18.0",
12 | "babel-core": "^6.18.2",
13 | "babel-preset-latest": "^6.16.0"
14 | },
15 | "ava": {
16 | "babel": "inherit"
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/challenges/2017-01-25-get-number/readme.md:
--------------------------------------------------------------------------------
1 | # Find the telephone number
2 |
3 | Some places it is common to remember a telephone number by associating its digits with characters, this way the phrase `MY LOVE` can be translated to `69 5683`. Of course there are some problems, as some phone numbers do not form a phrase and the numbers 0 and 1 are not associated with a char.
4 | The task is read an expression and find the telephone number based on the table below. One expression is constructed by upper case chars, hyphen and the numbers 1 and 0.
5 |
6 | ```
7 | Chars -> Number
8 | * ABC -> 2
9 | * DEF -> 3
10 | * GHI -> 4
11 | * JKL -> 5
12 | * MNO -> 6
13 | * PQRS -> 7
14 | * TUV -> 8
15 | * WXYZ -> 9
16 | ```
17 |
18 | The input consists in a set of expressions. Each expression is alone in one line and has C characters, where `1 ≤ C ≤ 30`. The input is determined by the end of file (EOF).
19 | For each expression you should print the telephone number correspondent.
20 |
21 | *Input Example*:
22 | ```
23 | 1-HOME-SWEET-HOME
24 | MY-MISERABLE-JOB
25 | ```
26 |
27 | *Out Example*:
28 | ```
29 | 1-4663-79338-4663
30 | 69-647372253-562
31 | ```
32 |
33 | [Source](http://dojopuzzles.com/problemas/exibe/encontre-o-telefone/)
34 |
35 | # Javascript Template
36 |
37 | ## Install
38 | `npm install`
39 |
40 | ## Run
41 | `npm test`
42 |
--------------------------------------------------------------------------------
/challenges/2017-02-01-bank-entries/dojo.playground/Contents.swift:
--------------------------------------------------------------------------------
1 | //: Playground - noun: a place where people can play
2 |
3 | import UIKit
4 | import XCTest
5 |
6 |
7 | class MainTests: XCTestCase {
8 | let inputInvalid = [
9 | "[2017-01-32 10:20:22] - Door open OK",
10 | "[2017-01-31 10:20:22] - Door open",
11 | "[2017-22-31 10:20:22] - Door open OK"
12 | ]
13 |
14 |
15 | let inputValid = [
16 | "[2017-01-31 09:20:22] - Door open OK",
17 | "[2017-01-31 10:20:22] - Door open OK",
18 | "[2017-01-31 11:20:22] - Door open OK",
19 | "[2017-01-31 12:20:22] - Door open OK",
20 | "[2017-01-31 13:20:22] - Door open OK",
21 | "[2017-01-31 17:20:22] - Door open OK",
22 | "[2017-02-31 19:20:22] - Door open OK"
23 | ]
24 |
25 | func testDates() {
26 | let main = Main()
27 | XCTAssertEqual(main.countInTimeRange(arr: inputValid), 4)
28 | }
29 |
30 | func testValidate() {
31 | let main = Main()
32 | inputValid.forEach { (value) in
33 | XCTAssertTrue(main.validate(str: value))
34 | }
35 | inputInvalid.forEach { (value) in
36 | XCTAssertFalse(main.validate(str: value))
37 | }
38 |
39 | }
40 | }
41 |
42 | class Main {
43 |
44 | func countInTimeRange(arr: Array) -> Int {
45 | var i = 0
46 | arr.forEach { (value) in
47 | if (validate(str: value)) {
48 | let components = value.components(separatedBy: " - ")
49 | let dateString = components[0]
50 | let date = dateStringToDate(dateString: dateString)
51 | if (isInTimeRange(date: date) ) {
52 | i += 1
53 | }
54 | }
55 | }
56 | return i
57 | }
58 |
59 | func isInTimeRange(date: Date?) -> Bool {
60 | guard let d = date else { return false }
61 | let calendar = Calendar.current
62 | let hour = calendar.component(.hour, from: d)
63 |
64 | return hour >= 10 && hour < 16
65 | }
66 |
67 | func validate(str: String) -> Bool{
68 | let components = str.components(separatedBy: " - ")
69 |
70 | if(!validateComponents(components: components)){
71 | return false
72 | }
73 |
74 | let message = components[1]
75 | if(!validateMessage(message: message)){
76 | return false
77 | }
78 |
79 | let dateString = components[0]
80 | if(!validateDateString(dateString: dateString)){
81 | return false
82 | }
83 |
84 | return true
85 | }
86 |
87 | private func validateComponents(components: [String]) -> Bool {
88 | return components.count == 2
89 | }
90 |
91 | private func validateMessage(message: String) -> Bool {
92 | if message != "Door open OK" { return false }
93 | return true
94 | }
95 |
96 | private func dateStringToDate(dateString: String) -> Date? {
97 | let date = dateString.replacingOccurrences(of: "[", with: "").replacingOccurrences(of: "]", with: "")
98 | let dateFormat = DateFormatter()
99 | dateFormat.dateFormat = "yyyy-MM-dd HH:mm:ss"
100 | return dateFormat.date(from: date)
101 | }
102 |
103 | private func validateDateString(dateString: String) -> Bool {
104 | return dateStringToDate(dateString: dateString) != nil
105 | }
106 | }
107 |
108 | MainTests.defaultTestSuite().run()
109 |
110 |
111 |
--------------------------------------------------------------------------------
/challenges/2017-02-01-bank-entries/dojo.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/challenges/2017-02-01-bank-entries/dojo.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/challenges/2017-02-01-bank-entries/dojo.playground/playground.xcworkspace/xcuserdata/ostanik.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CheesecakeLabs/codingdojo/e56bbbf27a91ce01054156e4e23fc76b7dbbf873/challenges/2017-02-01-bank-entries/dojo.playground/playground.xcworkspace/xcuserdata/ostanik.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/challenges/2017-02-01-bank-entries/dojo.playground/timeline.xctimeline:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/challenges/2017-02-01-bank-entries/readme.md:
--------------------------------------------------------------------------------
1 | # Bank Entries
2 |
3 | Every time someone entry on the largest bank in the city of Pirenopolis, a log file is written
4 | with the date and time the door was opened. Each record in the log file has the following format:
5 |
6 |
7 | ```
8 | [YYYY-mm-dd H:i:s] - Door open OK
9 | ```
10 |
11 | The bank manager needs to know how many people came in bank during the office hours,
12 | so he asked we to make a program that checks if the entries are valid and within bank's operating
13 | range. We should consider the bank's operating range between 10:00:00 until 16:00:00.
14 |
15 | [Source](http://dojopuzzles.com/problemas/exibe/entradas-no-banco/)
16 |
17 | # Swift Template
18 |
19 | ## Install
20 | You need Xcode 8!
21 |
22 | ## Run
23 | Just open the playground file and the Xcode will compile and run your changes automatically
24 |
--------------------------------------------------------------------------------
/challenges/2017-02-08-urinol/README.md:
--------------------------------------------------------------------------------
1 | # Distribution of urinals
2 |
3 | One problem faced by men in the use of urinals in public toilets is the embarrassment caused by another man urinating in the next urinal. A counter-situation is defined when two "users" should occupy adjacent urinals.
4 |
5 | Given a number of urinals in a tailet and the initial occupation of them (telling them which one already has a "user"), determine how many "users" can still use urinals and what position they have before so there will not be an embarrassing situation.
6 |
7 | [Source](http://dojopuzzles.com/problemas/exibe/distribuicao-de-mictorios/)
8 |
9 | # Python Template
10 |
11 | ## Install
12 | Tested with Python 3.
13 | Create a virtual environment and install the requirements with `pip install -r requirements.txt`
14 |
15 | ## Run
16 | Run the tests with `nosetests --with-watch`
17 |
--------------------------------------------------------------------------------
/challenges/2017-02-08-urinol/code.py:
--------------------------------------------------------------------------------
1 | import unittest
2 |
3 |
4 | URINOL_OCCUPIED = 'x'
5 | URINOL_FREE = '.'
6 |
7 | # Define your code here
8 | def create_urinol(quantity, occupied):
9 | urinol = []
10 |
11 | for i in range(quantity):
12 | urinol.append(URINOL_FREE)
13 |
14 | for i in occupied:
15 | urinol[i] = URINOL_OCCUPIED
16 |
17 | return urinol
18 |
19 | def get_position_of_users(urinol):
20 | aux = urinol[::]
21 | positions = []
22 | for i, urinol in enumerate(aux):
23 | if i == 0 and aux[i] == URINOL_FREE and aux[i+1] == URINOL_FREE:
24 | aux[i] = URINOL_OCCUPIED
25 | positions.append(i)
26 | continue
27 |
28 | if i == len(aux)-1 and aux[i-1] == URINOL_FREE and aux[i] == URINOL_FREE:
29 | aux[i] = URINOL_OCCUPIED
30 | positions.append(i)
31 | continue
32 |
33 | if aux[i-1] == URINOL_FREE and aux[i] == URINOL_FREE and aux[i+1] == URINOL_FREE:
34 | aux[i] = URINOL_OCCUPIED
35 | positions.append(i)
36 | return positions
37 |
38 | def get_number_of_users(urinol):
39 | return len(get_position_of_users(urinol))
40 |
41 | # Define your tests here
42 | class Testing(unittest.TestCase):
43 |
44 | def setUp(self):
45 | pass
46 |
47 | def test_create_urinol(self):
48 | self.assertEqual(
49 | create_urinol(3, [0, 2]),
50 | [URINOL_OCCUPIED, URINOL_FREE, URINOL_OCCUPIED]
51 | )
52 |
53 | self.assertEqual(
54 | create_urinol(5, [0, 2, 4]),
55 | [URINOL_OCCUPIED, URINOL_FREE, URINOL_OCCUPIED, URINOL_FREE, URINOL_OCCUPIED]
56 | )
57 |
58 | def test_get_number_of_users(self):
59 | urinol = create_urinol(3, [0, 2])
60 | self.assertEqual(
61 | get_number_of_users(urinol),
62 | 0
63 | )
64 |
65 | urinol = create_urinol(15, [0, 8, 12])
66 | self.assertEqual(
67 | get_number_of_users(urinol),
68 | 5
69 | )
70 |
71 | urinol = create_urinol(11, [0, 3, 5, 10])
72 | self.assertEqual(
73 | get_number_of_users(urinol),
74 | 1
75 | )
76 |
77 | def test_get_position_of_users(self):
78 | urinol = create_urinol(3, [0, 2])
79 | self.assertEqual(
80 | get_position_of_users(urinol),
81 | []
82 | )
83 |
84 | urinol = create_urinol(15, [0, 8, 12])
85 | self.assertEqual(
86 | get_position_of_users(urinol),
87 | [2, 4, 6, 10, 14]
88 | )
89 |
90 | urinol = create_urinol(11, [0, 3, 5, 10])
91 | self.assertEqual(
92 | get_position_of_users(urinol),
93 | [7]
94 | )
95 |
96 | # Executing the tests
97 | if __name__ == '__main__':
98 | unittest.main()
99 |
--------------------------------------------------------------------------------
/challenges/2017-02-08-urinol/requirements.txt:
--------------------------------------------------------------------------------
1 | nose==1.3.7
2 | nose-watch==0.9.1
3 |
--------------------------------------------------------------------------------
/challenges/2017-02-15-prime-words/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": ["latest"]
3 | }
4 |
--------------------------------------------------------------------------------
/challenges/2017-02-15-prime-words/index.js:
--------------------------------------------------------------------------------
1 | import test from 'ava'
2 |
3 | test(t => {
4 | t.is(charToNumeric('a'), 1)
5 | t.is(charToNumeric('z'), 26)
6 | t.is(charToNumeric('A'), 27)
7 | t.is(charToNumeric('Z'), 52)
8 | t.is(stringToNumeric('ab'), 3)
9 | t.is(stringToNumeric('abAC'), 59)
10 | t.is(isPrime(4),false)
11 | t.is(isPrime(3),true)
12 | t.is(isPrime(367),true)
13 | t.is(isStringNumericPrime('abAC'), true)
14 | t.is(isStringNumericPrime('ZZZZZ'), false)
15 | })
16 |
17 | function charToNumeric(char) {
18 | const numeric = char.charCodeAt(0) - 96
19 |
20 | if (numeric > 0) {
21 | return numeric
22 | }
23 | return numeric + 58
24 | }
25 |
26 | function stringToNumeric(string) {
27 | var number = 0
28 |
29 | for (var c of string) {
30 | number += charToNumeric(c)
31 | }
32 | return number
33 | }
34 |
35 | function isPrime(number) {
36 | for (var i = 2; i <= number / 2; i++){
37 | if (number % i === 0){
38 | return false
39 | }
40 | }
41 | return true
42 | }
43 |
44 | function isStringNumericPrime(inputString) {
45 | return isPrime(stringToNumeric(inputString))
46 | }
47 |
--------------------------------------------------------------------------------
/challenges/2017-02-15-prime-words/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "dojo-javascript",
3 | "version": "1.0.0",
4 | "main": "index.js",
5 | "license": "MIT",
6 | "scripts": {
7 | "test": "ava --watch index.js"
8 | },
9 | "devDependencies": {
10 | "ava": "^0.17.0",
11 | "babel-cli": "^6.18.0",
12 | "babel-core": "^6.18.2",
13 | "babel-preset-latest": "^6.16.0"
14 | },
15 | "ava": {
16 | "babel": "inherit"
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/challenges/2017-02-15-prime-words/readme.md:
--------------------------------------------------------------------------------
1 | # Prime Words
2 |
3 | A prime number is defined if it has exactly two divisors: the number one and itself. Examples are 2, 3, 5, 101, 367, 523.
4 |
5 | In this problem, you must read a word composed by only chars `[a-z][A-Z]`. Each char has a specific value: `a = 1`, `b = 2` until `z = 26`. Either way, `A = 27`, `B = 28` until `Z = 52`.
6 |
7 | You need to define if each word in a word set is prime or not. For it to be, the sum of the chars' value should be a primer number.
8 |
9 | [Source](http://dojopuzzles.com/problemas/exibe/palavras-primas/)
10 |
11 | # Javascript Template
12 |
13 | ## Install
14 | `npm install`
15 |
16 | ## Run
17 | `npm test`
18 |
--------------------------------------------------------------------------------
/challenges/2017-02-22-coin-change/README.md:
--------------------------------------------------------------------------------
1 | # Challenge
2 |
3 | **IMPORTANT:** We were not able to finish this challenge in our schedule time. So, yeah, life goes on.
4 |
5 | You are given coins of different denominations and a total amount of money. Write a function to compute the number of combinations that make up that amount. You may assume that you have infinite number of each kind of coin.
6 |
7 | **Note: You can assume that:**
8 | `0 <= amount <= 5000`
9 | `1 <= coin <= 5000`
10 | `the number of coins is less than 500`
11 | `the answer is guaranteed to fit into signed 32-bit integer`
12 |
13 | **Example 1:**
14 |
15 | ```
16 | Input: amount = 5, coins = [1, 2, 5]
17 | Output: 4
18 | Explanation: there are four ways to make up the amount:
19 | 5=5
20 | 5=2+2+1
21 | 5=2+1+1+1
22 | 5=1+1+1+1+1
23 | ```
24 |
25 | **Example 2:**
26 |
27 | ```
28 | Input: amount = 3, coins = [2]
29 | Output: 0
30 | Explanation: the amount of 3 cannot be made up just with coins of 2.
31 | ```
32 |
33 | **Example 3:**
34 |
35 | ```
36 | Input: amount = 10, coins = [10]
37 | Output: 1
38 | ```
39 |
40 | [Source](https://leetcode.com/problems/coin-change-2)
41 |
42 | # Go Template
43 |
44 | ## Install
45 | You need Go! This was tested with version 1.8.
46 | You'll also need [bro](https://github.com/marioidival/bro), a Go test runner with file watch. Install it with `go get github.com/marioidival/bro`.
47 |
48 | ## Run
49 | On the directory, run `bro`.
50 |
51 |
--------------------------------------------------------------------------------
/challenges/2017-02-22-coin-change/main.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | // Your code goes here
4 | func PrintHelloWorld() string {
5 | return "Hello World!"
6 | }
7 |
8 |
9 | func Sum(array []int) int {
10 | total := 0
11 | for _, value := range(array) {
12 | total += value
13 | }
14 | return total
15 | }
16 |
17 | func Combinations(amount int, coins []int) int {
18 | total := 0
19 |
20 | for _, value := range(coins) {
21 |
22 | newAmount := amount - value
23 |
24 | if newAmount == 0 {
25 | total += 1
26 | } else if newAmount > 0 {
27 | total += Combinations(newAmount, coins
28 | } else {
29 | total += 0
30 | }
31 | }
32 | return total
33 | }
34 |
35 | func main() {
36 | }
37 |
--------------------------------------------------------------------------------
/challenges/2017-02-22-coin-change/main_test.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import "testing"
4 |
5 | // Your tests go here
6 | func TestMain(t *testing.T) {
7 | if PrintHelloWorld() != "Hello World!" {
8 | t.Fatal("Not valid")
9 | }
10 |
11 | if Combinations(10, []int{10}) != 1 {
12 | t.Fatal("Not valid")
13 | }
14 |
15 | if Combinations(3, []int{2}) != 0 {
16 | t.Fatal("Not valid")
17 | }
18 |
19 | test := Combinations(5, []int{1,2,5})
20 | if test != 4 {
21 | t.Fatal("Not valid ", test)
22 | }
23 |
24 | test2 := Combinations(5, []int{5,2,1})
25 | if test2 != 4 {
26 | t.Fatal("Not valid ", test2)
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/challenges/2017-03-01-zigzag-py/README.md:
--------------------------------------------------------------------------------
1 | # ZigZag Conversion
2 |
3 | The string `PAYPALISHIRING` is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility).
4 |
5 | ```
6 | P A H N
7 | A P L S I I G
8 | Y I R
9 | ```
10 |
11 | And then read line by line: `PAHNAPLSIIGYIR`
12 |
13 | Write the code that will take a string and make this conversion given a number of rows:
14 |
15 | **Example:**
16 | `string convert(string text, int nRows);`
17 | `convert("PAYPALISHIRING", 3)` should return `PAHNAPLSIIGYIR`.
18 |
19 | [Source](https://leetcode.com/problems/zigzag-conversion/?tab=Description)
20 |
21 | [Solution Submission](https://leetcode.com/submissions/detail/95031131/)
22 |
23 | # Python Template
24 |
25 | ## Install
26 | Tested with Python 3.
27 | Create a virtual environment and install the requirements with `pip install -r requirements.txt`
28 |
29 | ## Run
30 | Run the tests with `nosetests --with-watch`
31 |
--------------------------------------------------------------------------------
/challenges/2017-03-01-zigzag-py/code.py:
--------------------------------------------------------------------------------
1 | import unittest
2 |
3 |
4 | def converter(text, num_rows):
5 | if not text or num_rows <= 1:
6 | return text
7 |
8 | result = []
9 |
10 | # TOP ROW
11 | for i in range(0, len(text), 2 * num_rows - 2):
12 | result.append(text[i])
13 |
14 | # MIDDLE ROWS
15 | for i in range(1, num_rows - 1):
16 | steps = [(num_rows - 1 - i) * 2, i * 2]
17 | flag = True
18 | pos = i
19 | while pos < len(text):
20 | result.append(text[pos])
21 | pos += steps[0] if flag else steps[1]
22 | flag = not flag
23 |
24 | # BOTTOM ROW
25 | for i in range(num_rows - 1, len(text), 2 * num_rows - 2):
26 | result.append(text[i])
27 |
28 | return ''.join(result)
29 |
30 |
31 | class TestConvert(unittest.TestCase):
32 | def test_1(self):
33 | self.assertEqual(
34 | converter("PAYPALISHIRING", 3),
35 | "PAHNAPLSIIGYIR"
36 | )
37 |
38 | def test_2(self):
39 | self.assertEqual(
40 | converter("AB", 2),
41 | "AB"
42 | )
43 |
44 | def test_3(self):
45 | self.assertEqual(
46 | converter('TOBEORNOTTOBETHATSTHEQUESTION', 8),
47 | 'THNOTAOBETIEBSTOOTSRTHENTEUOQ'
48 | )
49 |
50 |
51 | if __name__ == "__main__":
52 | unittest.main()
53 |
--------------------------------------------------------------------------------
/challenges/2017-03-01-zigzag-py/requirements.txt:
--------------------------------------------------------------------------------
1 | nose==1.3.7
2 | nose-watch==0.9.1
3 |
--------------------------------------------------------------------------------
/challenges/2017-03-01-zigzag/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": ["latest"]
3 | }
4 |
--------------------------------------------------------------------------------
/challenges/2017-03-01-zigzag/index.js:
--------------------------------------------------------------------------------
1 | import test from 'ava'
2 |
3 | test(t => {
4 | t.is(converter('PAYPALISHIRING', 3), 'PAHNAPLSIIGYIR')
5 | t.is(converter('TOBEORNOTTOBETHATSTHEQUESTION', 8), 'THNOTAOBETIEBSTOOTSRTHENTEUOQ')
6 | })
7 |
8 | function converter(text, numberOfRows) {
9 |
10 | let lowerBound = 0
11 | let upperBound = numberOfRows - 1
12 | let col = 0
13 | let row = 0
14 | let desc = true
15 |
16 | let matrix = []
17 |
18 | text.split('').forEach((x, i) => {
19 | if (!matrix[row])
20 | matrix[row] = []
21 | matrix[row][col] = x
22 |
23 | if (desc) {
24 | row += 1
25 | } else {
26 | row -= 1
27 | col += 1
28 | }
29 | if (row == upperBound) {
30 | desc = false
31 | }
32 |
33 | if (row == lowerBound) {
34 | desc = true
35 | }
36 | })
37 |
38 | return matrix.map(row => row.join('')).join('')
39 | }
40 |
41 |
--------------------------------------------------------------------------------
/challenges/2017-03-01-zigzag/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "dojo-javascript",
3 | "version": "1.0.0",
4 | "main": "index.js",
5 | "license": "MIT",
6 | "scripts": {
7 | "test": "ava --watch index.js"
8 | },
9 | "devDependencies": {
10 | "ava": "^0.17.0",
11 | "babel-cli": "^6.18.0",
12 | "babel-core": "^6.18.2",
13 | "babel-preset-latest": "^6.16.0"
14 | },
15 | "ava": {
16 | "babel": "inherit"
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/challenges/2017-03-01-zigzag/readme.md:
--------------------------------------------------------------------------------
1 | # ZigZag Conversion
2 |
3 | The string `PAYPALISHIRING` is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility).
4 |
5 | ```
6 | P A H N
7 | A P L S I I G
8 | Y I R
9 | ```
10 |
11 | And then read line by line: `PAHNAPLSIIGYIR`
12 |
13 | Write the code that will take a string and make this conversion given a number of rows:
14 |
15 | **Example:**
16 | `string convert(string text, int nRows);`
17 | `convert("PAYPALISHIRING", 3)` should return `PAHNAPLSIIGYIR`.
18 |
19 | [Source](https://leetcode.com/problems/zigzag-conversion/?tab=Description)
20 |
21 | # Javascript Template
22 |
23 | ## Install
24 |
25 | `npm install`
26 |
27 | ## Run
28 |
29 | `npm test`
30 |
--------------------------------------------------------------------------------
/challenges/2017-03-08-character-count/index.js:
--------------------------------------------------------------------------------
1 | import test from 'ava'
2 |
3 | const inputs = [
4 |
5 | ]
6 |
7 | const outputs = [
8 |
9 | ]
10 |
11 | test(t => {
12 | t.deepEqual(countString('aaabbc'), [{a: 3}, {b: 2}, {c: 1}])
13 | t.deepEqual(countString('aaabbca'), [{a: 4}, {b: 2}, {c: 1}])
14 | t.deepEqual(countString('aaabbbbbbca'), [{b: 6}, {a: 4}, {c: 1}])
15 | t.deepEqual(countString('aaab bbbb bca'), [{b: 6}, {a: 4}, {' ': 2}, {c: 1}])
16 | t.deepEqual(countString('aaab bbbb baaca'), [{a: 6}, {b: 6}, {' ': 2}, {c: 1}])
17 | t.deepEqual(countString('baaa bbbb baaca'), [{a: 6}, {b: 6}, {' ': 2}, {c: 1}])
18 | t.deepEqual(countString('baaa bbbb baaca '), [{' ': 6}, {a: 6}, {b: 6}, {c: 1}])
19 | t.deepEqual(countString('Coding do jojo'), [{o: 4}, {' ': 2}, {d: 2}, {j: 2}, {C: 1}, {g: 1}, {i: 1}, {n: 1}])
20 | })
21 |
22 | test(t => {
23 | t.deepEqual(functionalCountString('aaabbc'), [{a: 3}, {b: 2}, {c: 1}])
24 | t.deepEqual(functionalCountString('aaabbca'), [{a: 4}, {b: 2}, {c: 1}])
25 | t.deepEqual(functionalCountString('aaabbbbbbca'), [{b: 6}, {a: 4}, {c: 1}])
26 | t.deepEqual(functionalCountString('aaab bbbb bca'), [{b: 6}, {a: 4}, {' ': 2}, {c: 1}])
27 | t.deepEqual(functionalCountString('aaab bbbb baaca'), [{a: 6}, {b: 6}, {' ': 2}, {c: 1}])
28 | t.deepEqual(functionalCountString('baaa bbbb baaca'), [{a: 6}, {b: 6}, {' ': 2}, {c: 1}])
29 | t.deepEqual(functionalCountString('baaa bbbb baaca '), [{' ': 6}, {a: 6}, {b: 6}, {c: 1}])
30 | t.deepEqual(functionalCountString('Coding do jojo'), [{o: 4}, {' ': 2}, {d: 2}, {j: 2}, {C: 1}, {g: 1}, {i: 1}, {n: 1}])
31 | })
32 |
33 | const functionalCountString = (str) => {
34 | return str.split('').reduce((previous, current) => {
35 | const charVerificationArray = previous.filter((value) => Object.keys(value).includes(current))
36 |
37 | if (charVerificationArray.length) {
38 | const key = Object.keys(charVerificationArray[0])
39 | const value = charVerificationArray[0][key] + 1
40 | return [
41 | ...previous,
42 | {[key]: value}
43 | ]
44 | }
45 |
46 | return [
47 | ...previous,
48 | {[current]: 1}
49 | ]
50 | }, [])
51 | }
52 |
53 | function countString (str) {
54 | let charMap = {}
55 | let charOutput = []
56 |
57 | for (let char of str) {
58 | if (!charMap[char]) {
59 | charMap[char] = 1
60 | } else {
61 | charMap[char] += 1
62 | }
63 | }
64 |
65 | for (let key of Object.keys(charMap)) {
66 | charOutput.push({
67 | [key]: charMap[key]
68 | })
69 | }
70 |
71 | return charOutput.sort((a, b) => {
72 | if (a[Object.keys(a)] === b[Object.keys(b)]) {
73 | return Object.keys(a) > Object.keys(b)
74 | }
75 | return a[Object.keys(a)] < b[Object.keys(b)]
76 | })
77 | }
78 |
79 |
--------------------------------------------------------------------------------
/challenges/2017-03-08-character-count/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "dojo-javascript",
3 | "version": "1.0.0",
4 | "main": "index.js",
5 | "license": "MIT",
6 | "scripts": {
7 | "test": "ava --watch index.js"
8 | },
9 | "devDependencies": {
10 | "ava": "^0.17.0",
11 | "babel-cli": "^6.18.0",
12 | "babel-core": "^6.18.2",
13 | "babel-preset-latest": "^6.16.0"
14 | },
15 | "ava": {
16 | "babel": {
17 | "presets": ["latest"]
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/challenges/2017-03-08-character-count/readme.md:
--------------------------------------------------------------------------------
1 | # Count characters in a string
2 |
3 | Write a console application that outputs the results of the following analysis of the input string:
4 |
5 | For each unique character that appears in the input string, report the number of occurrences of that character in the input. Report each character on its own line, in descending order based on the number of occurrences. Each line should be formatted as follows:
6 |
7 | ```
8 | :
9 | ```
10 |
11 | There is no defined order for reporting characters that have the same number of occurrences. Such entries can appear in any order of your choosing in the output.
12 |
13 | Examples:
14 |
15 | **analyze aaabbc**
16 | ```javascript
17 | a: 3
18 | b: 2
19 | c: 1
20 | ```
21 |
22 |
23 | **analyze "I really want to work for Wingspan"**
24 | ```
25 | : 6
26 | o: 3
27 | r: 3
28 | a: 3
29 | n: 3
30 | w: 2
31 | l: 2
32 | t: 2
33 | k: 1
34 | W: 1
35 | p: 1
36 | g: 1
37 | i: 1
38 | I: 1
39 | f: 1
40 | y: 1
41 | s: 1
42 | e: 1
43 | ```
44 |
45 | [Source](https://github.com/turingschool/challenges/blob/master/character_count.markdown)
46 |
47 | *PS: In a second moment we tried a functional approach, but did not finish it due lack of time.*
48 |
49 | # Javascript Template
50 |
51 | ## Install
52 |
53 | `npm install`
54 |
55 | ## Run
56 |
57 | `npm test`
58 |
--------------------------------------------------------------------------------
/challenges/2017-03-15-atm-problem/index.js:
--------------------------------------------------------------------------------
1 | import test from 'ava'
2 |
3 | const BANK_BILLS = [100, 50, 50, 20, 10, 10, 10, 10, 10, 10, 10, 10]
4 |
5 | test(t => {
6 | t.is(isValidAmount(10), true)
7 | t.is(isValidAmount(21), false)
8 | t.is(isValidAmount(21.2), false)
9 | t.is(isValidAmount(10.11), false)
10 | t.deepEqual(gimmeMoney(500), [100, 100, 100, 100, 100])
11 | t.deepEqual(gimmeMoney(50), [50])
12 | t.deepEqual(gimmeMoney(51), [])
13 | t.deepEqual(gimmeMoney(470), [100, 100, 100, 100, 50, 20])
14 |
15 | t.deepEqual(gimmeMoney(30), [20, 10])
16 | t.deepEqual(gimmeMoney(80), [50, 20, 10])
17 |
18 | t.deepEqual(gimmeMoneyFromBank(250, BANK_BILLS), [100, 50, 50, 20, 10, 10, 10])
19 | t.deepEqual(gimmeMoneyFromBank(1250, BANK_BILLS), [])
20 | t.is(hasEnoughMoney(250, BANK_BILLS), true)
21 | t.deepEqual(gimmeMoneyFromBank(300, BANK_BILLS), [100, 50, 50, 20, 10, 10, 10, 10, 10, 10, 10, 10])
22 | t.deepEqual(gimmeMoneyFromBank(350, BANK_BILLS), [])
23 | })
24 |
25 | const ALL_BILLS = [100, 50, 20, 10]
26 |
27 | const isValidAmount = (value) => (value % 10 === 0)
28 |
29 | const gimmeMoney = (amount) => {
30 | if (!isValidAmount(amount))
31 | return []
32 |
33 | let result = []
34 | let rest = amount
35 | for (let bill of ALL_BILLS) {
36 | const numberOfBills = Math.floor(rest / bill)
37 | rest %= bill
38 | for (let i = 0; i < numberOfBills; i++ )
39 | result.push(bill)
40 | }
41 |
42 | return result
43 | }
44 |
45 | const gimmeMoneyFromBank = (amount, bankBills) => {
46 | if (!isValidAmount(amount)) {
47 | return []
48 | }
49 |
50 | if (!hasEnoughMoney(amount, bankBills)) {
51 | return []
52 | }
53 |
54 | let result = []
55 | let rest = amount
56 | for (let bill of bankBills) {
57 | if (rest < bill) {
58 | continue
59 | }
60 | rest -= bill
61 | result.push(bill)
62 | }
63 | return result
64 | }
65 |
66 | const hasEnoughMoney = (amount, bankBills) =>
67 | bankBills.reduce((previous, current) => current + previous, 0) >= amount
68 |
69 |
70 |
71 |
--------------------------------------------------------------------------------
/challenges/2017-03-15-atm-problem/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "dojo-javascript",
3 | "version": "1.0.0",
4 | "main": "index.js",
5 | "license": "MIT",
6 | "scripts": {
7 | "test": "ava --watch index.js"
8 | },
9 | "devDependencies": {
10 | "ava": "^0.17.0",
11 | "babel-cli": "^6.18.0",
12 | "babel-core": "^6.18.2",
13 | "babel-preset-latest": "^6.16.0"
14 | },
15 | "ava": {
16 | "babel": {
17 | "presets": ["latest"]
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/challenges/2017-03-15-atm-problem/readme.md:
--------------------------------------------------------------------------------
1 | # ATM Problem
2 |
3 | Develop a program that simulates note delivery when a customer cashes an ATM. The basic requirements are as follows:
4 |
5 | - Deliver the least number of notes
6 | - It is possible to extract the requested value with the available notes
7 | - Infinite customer balance
8 | - Quantity of infinity notes (one can put a finite amount of notes to increase the difficulty of the problem)
9 | - Available notes of R$100.00; R$50.00; R$20.00 and R$10.00
10 |
11 | [Source](http://dojopuzzles.com/problemas/exibe/caixa-eletronico/)
12 |
13 | # Javascript Template
14 |
15 | ## Install
16 |
17 | `npm install`
18 |
19 | ## Run
20 |
21 | `npm test`
22 |
--------------------------------------------------------------------------------
/challenges/2017-03-22-game-of-life/index.js:
--------------------------------------------------------------------------------
1 | import test from 'ava'
2 |
3 | const initialMatrix = [
4 | [1, 1, 0],
5 | [1, 0, 1],
6 | [0, 0, 1],
7 | ]
8 |
9 | const finalMatrix = [
10 | [1, 1, 0],
11 | [1, 0, 1],
12 | [0, 1, 0]
13 | ]
14 |
15 | const nextFinalMatrix = [
16 | [1, 1, 0],
17 | [1, 0, 1],
18 | [0, 1, 0]
19 | ]
20 |
21 | const anotherInitialMatrix = [
22 | [1, 0, 1],
23 | [0, 1, 1],
24 | [0, 1, 0],
25 | ]
26 |
27 | const anotherFinalMatrix = [
28 | [0, 0, 1],
29 | [1, 0, 1],
30 | [0, 1, 1],
31 | ]
32 |
33 | test(t => {
34 | t.is(calcNumNeighbors(initialMatrix, 0, 0), 2)
35 | t.is(calcNumNeighbors(initialMatrix, 1, 1), 5)
36 | t.is(calcNumNeighbors(initialMatrix, 2, 2), 1)
37 | t.is(calcNumNeighbors(initialMatrix, 3, 3), 0)
38 | t.deepEqual(nextCellState(1, 2), 1)
39 | t.deepEqual(nextCellState(1, 3), 1)
40 | t.deepEqual(nextCellState(1, 1), 0)
41 | t.deepEqual(nextCellState(1, 4), 0)
42 | t.deepEqual(nextCellState(0, 2), 0)
43 | t.deepEqual(nextCellState(0, 3), 1)
44 | t.deepEqual(nextCellState(0, 1), 0)
45 | t.deepEqual(nextCellState(0, 4), 0)
46 | t.deepEqual(nextStep(initialMatrix), finalMatrix)
47 | t.deepEqual(nextStep(finalMatrix), nextFinalMatrix)
48 | t.deepEqual(nextStep(anotherInitialMatrix), anotherFinalMatrix)
49 | })
50 |
51 | function calcNumNeighbors(matrix, lin, col) {
52 | let neighbors = 0
53 |
54 | if (lin < 0 || lin >= matrix.length || col < 0 || col >= matrix[0].length) {
55 | return 0
56 | }
57 |
58 | for (let line = lin-1; line <= lin +1 ; line++) {
59 | if (line < 0 || line >= matrix.length)
60 | continue
61 | for (let column = col-1; column <= col +1 ; column++) {
62 | if (column < 0 || column >= matrix[0].length)
63 | continue
64 | if (lin === line && col === column)
65 | continue
66 | neighbors += matrix[line][column]
67 | }
68 | }
69 | return neighbors
70 | }
71 |
72 | function nextCellState(currentState, numberOfNeighbors) {
73 | if (numberOfNeighbors < 2 || numberOfNeighbors > 3) {
74 | return 0
75 | }
76 | if (currentState == 0 && numberOfNeighbors == 2){
77 | return 0
78 | }
79 | return 1
80 | }
81 |
82 | function nextStep(matrix) {
83 | const resultMatrix = [[], [], []]
84 | for (let line = 0; line < matrix.length ; line++) {
85 | for (let column = 0; column < matrix[line].length ; column++) {
86 | const neighbors = calcNumNeighbors(matrix, line, column)
87 | const currentState = matrix[line][column]
88 | resultMatrix[line][column] = nextCellState(currentState, neighbors)
89 | }
90 | }
91 | return resultMatrix
92 | }
93 |
--------------------------------------------------------------------------------
/challenges/2017-03-22-game-of-life/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "dojo-javascript",
3 | "version": "1.0.0",
4 | "main": "index.js",
5 | "license": "MIT",
6 | "scripts": {
7 | "test": "ava --watch index.js"
8 | },
9 | "devDependencies": {
10 | "ava": "^0.17.0",
11 | "babel-cli": "^6.18.0",
12 | "babel-core": "^6.18.2",
13 | "babel-preset-latest": "^6.16.0"
14 | },
15 | "ava": {
16 | "babel": {
17 | "presets": ["latest"]
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/challenges/2017-03-22-game-of-life/readme.md:
--------------------------------------------------------------------------------
1 | # Game of Life
2 |
3 | Develop an algorithm that takes "one step" in the game of life. The behaviour examples may simply be the rules of the game:
4 |
5 | - Any live cell with fewer than two live neighbours dies, as if caused by underpopulation.
6 | - Any live cell with more than three live neighbours dies, as if by overcrowding.
7 | - Any live cell with two or three live neighbours lives on to the next generation.
8 | - Any dead cell with exactly three live neighbours becomes a live cell.
9 |
10 | You also have to think of things such as how to represent the board in a test-friendly way, and what "value" cells outside the board has. Or maybe the board does not have borders?
11 |
12 |
13 | [Source](https://leetcode.com/problems/zigzag-conversion/?tab=Description)
14 |
15 | # Javascript Template
16 |
17 | ## Install
18 |
19 | `npm install`
20 |
21 | ## Run
22 |
23 | `npm test`
24 |
--------------------------------------------------------------------------------
/challenges/2017-04-05-tennis-game/README.md:
--------------------------------------------------------------------------------
1 | # Tennis Game
2 |
3 | In this problem you will implement the rules of a simple tennis game (only two players). They are:
4 |
5 | * In each game, a player can have the following points: 0, 15, 30 or 40.
6 | * The players start with 0 points.
7 | * If the player has 40 points and wins the match, he wins the game.
8 | * If both players reach 40 points, there's a deuce.
9 | * Being in deuce, the player who wins the match will be in advantage.
10 | * If the player in advantage wins the match again, he wins the game.
11 | * If the player is in advantage and the other one wins the match, there's a deuce again.
12 |
13 | The code should receive both players score and the player that will win the match, returning the result score.
14 |
15 | [Source](http://dojopuzzles.com/problemas/exibe/partida-de-tenis/)
16 |
17 | # Haskell Template
18 |
19 | ## Install
20 | `cabal install --only-dependencies --enable-tests`
21 |
22 | ## Run
23 | `cabal test`
24 |
--------------------------------------------------------------------------------
/challenges/2017-04-05-tennis-game/codingdojo.cabal:
--------------------------------------------------------------------------------
1 | -- This file has been generated from package.yaml by hpack version 0.17.0.
2 | --
3 | -- see: https://github.com/sol/hpack
4 |
5 | name: codingdojo
6 | version: 0.0.0
7 | author: CheesecakeLabs
8 | maintainer: CheesecakeLabs
9 | copyright: (c) 2017 CheesecakeLabs
10 | build-type: Simple
11 | cabal-version: >= 1.10
12 |
13 | library
14 | hs-source-dirs:
15 | src
16 | ghc-options: -Wall
17 | build-depends:
18 | base == 4.*
19 | exposed-modules:
20 | Code
21 | default-language: Haskell2010
22 |
23 | test-suite spec
24 | type: exitcode-stdio-1.0
25 | main-is: Spec.hs
26 | hs-source-dirs:
27 | test
28 | ghc-options: -Wall
29 | build-depends:
30 | base == 4.*
31 | , codingdojo
32 | , hspec == 2.*
33 | other-modules:
34 | CodeSpec
35 | default-language: Haskell2010
36 |
--------------------------------------------------------------------------------
/challenges/2017-04-05-tennis-game/dist/build/Code.dyn_hi:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CheesecakeLabs/codingdojo/e56bbbf27a91ce01054156e4e23fc76b7dbbf873/challenges/2017-04-05-tennis-game/dist/build/Code.dyn_hi
--------------------------------------------------------------------------------
/challenges/2017-04-05-tennis-game/dist/build/Code.dyn_o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CheesecakeLabs/codingdojo/e56bbbf27a91ce01054156e4e23fc76b7dbbf873/challenges/2017-04-05-tennis-game/dist/build/Code.dyn_o
--------------------------------------------------------------------------------
/challenges/2017-04-05-tennis-game/dist/build/Code.hi:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CheesecakeLabs/codingdojo/e56bbbf27a91ce01054156e4e23fc76b7dbbf873/challenges/2017-04-05-tennis-game/dist/build/Code.hi
--------------------------------------------------------------------------------
/challenges/2017-04-05-tennis-game/dist/build/Code.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CheesecakeLabs/codingdojo/e56bbbf27a91ce01054156e4e23fc76b7dbbf873/challenges/2017-04-05-tennis-game/dist/build/Code.o
--------------------------------------------------------------------------------
/challenges/2017-04-05-tennis-game/dist/build/Code.p_hi:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CheesecakeLabs/codingdojo/e56bbbf27a91ce01054156e4e23fc76b7dbbf873/challenges/2017-04-05-tennis-game/dist/build/Code.p_hi
--------------------------------------------------------------------------------
/challenges/2017-04-05-tennis-game/dist/build/Code.p_o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CheesecakeLabs/codingdojo/e56bbbf27a91ce01054156e4e23fc76b7dbbf873/challenges/2017-04-05-tennis-game/dist/build/Code.p_o
--------------------------------------------------------------------------------
/challenges/2017-04-05-tennis-game/dist/build/autogen/Paths_codingdojo.hs:
--------------------------------------------------------------------------------
1 | {-# LANGUAGE CPP #-}
2 | {-# OPTIONS_GHC -fno-warn-missing-import-lists #-}
3 | {-# OPTIONS_GHC -fno-warn-implicit-prelude #-}
4 | module Paths_codingdojo (
5 | version,
6 | getBinDir, getLibDir, getDynLibDir, getDataDir, getLibexecDir,
7 | getDataFileName, getSysconfDir
8 | ) where
9 |
10 | import qualified Control.Exception as Exception
11 | import Data.Version (Version(..))
12 | import System.Environment (getEnv)
13 | import Prelude
14 |
15 | #if defined(VERSION_base)
16 |
17 | #if MIN_VERSION_base(4,0,0)
18 | catchIO :: IO a -> (Exception.IOException -> IO a) -> IO a
19 | #else
20 | catchIO :: IO a -> (Exception.Exception -> IO a) -> IO a
21 | #endif
22 |
23 | #else
24 | catchIO :: IO a -> (Exception.IOException -> IO a) -> IO a
25 | #endif
26 | catchIO = Exception.catch
27 |
28 | version :: Version
29 | version = Version [0,0,0] []
30 | bindir, libdir, dynlibdir, datadir, libexecdir, sysconfdir :: FilePath
31 |
32 | bindir = "/Users/danieloliveira/Library/Haskell/bin"
33 | libdir = "/Users/danieloliveira/Library/Haskell/ghc-8.0.2-x86_64/lib/codingdojo-0.0.0"
34 | dynlibdir = "/Users/danieloliveira/Library/Haskell/ghc-8.0.2-x86_64/lib/x86_64-osx-ghc-8.0.2"
35 | datadir = "/Users/danieloliveira/Library/Haskell/share/ghc-8.0.2-x86_64/codingdojo-0.0.0"
36 | libexecdir = "/Users/danieloliveira/Library/Haskell/libexec"
37 | sysconfdir = "/Users/danieloliveira/Library/Haskell/etc"
38 |
39 | getBinDir, getLibDir, getDynLibDir, getDataDir, getLibexecDir, getSysconfDir :: IO FilePath
40 | getBinDir = catchIO (getEnv "codingdojo_bindir") (\_ -> return bindir)
41 | getLibDir = catchIO (getEnv "codingdojo_libdir") (\_ -> return libdir)
42 | getDynLibDir = catchIO (getEnv "codingdojo_dynlibdir") (\_ -> return dynlibdir)
43 | getDataDir = catchIO (getEnv "codingdojo_datadir") (\_ -> return datadir)
44 | getLibexecDir = catchIO (getEnv "codingdojo_libexecdir") (\_ -> return libexecdir)
45 | getSysconfDir = catchIO (getEnv "codingdojo_sysconfdir") (\_ -> return sysconfdir)
46 |
47 | getDataFileName :: FilePath -> IO FilePath
48 | getDataFileName name = do
49 | dir <- getDataDir
50 | return (dir ++ "/" ++ name)
51 |
--------------------------------------------------------------------------------
/challenges/2017-04-05-tennis-game/dist/build/autogen/cabal_macros.h:
--------------------------------------------------------------------------------
1 | /* DO NOT EDIT: This file is automatically generated by Cabal */
2 |
3 | /* package codingdojo-0.0.0 */
4 | #define VERSION_codingdojo "0.0.0"
5 | #define MIN_VERSION_codingdojo(major1,major2,minor) (\
6 | (major1) < 0 || \
7 | (major1) == 0 && (major2) < 0 || \
8 | (major1) == 0 && (major2) == 0 && (minor) <= 0)
9 |
10 | /* package base-4.9.1.0 */
11 | #define VERSION_base "4.9.1.0"
12 | #define MIN_VERSION_base(major1,major2,minor) (\
13 | (major1) < 4 || \
14 | (major1) == 4 && (major2) < 9 || \
15 | (major1) == 4 && (major2) == 9 && (minor) <= 1)
16 |
17 | /* package hspec-2.4.3 */
18 | #define VERSION_hspec "2.4.3"
19 | #define MIN_VERSION_hspec(major1,major2,minor) (\
20 | (major1) < 2 || \
21 | (major1) == 2 && (major2) < 4 || \
22 | (major1) == 2 && (major2) == 4 && (minor) <= 3)
23 |
24 | /* tool alex-3.2.1 */
25 | #define TOOL_VERSION_alex "3.2.1"
26 | #define MIN_TOOL_VERSION_alex(major1,major2,minor) (\
27 | (major1) < 3 || \
28 | (major1) == 3 && (major2) < 2 || \
29 | (major1) == 3 && (major2) == 2 && (minor) <= 1)
30 |
31 | /* tool gcc-4.2.1 */
32 | #define TOOL_VERSION_gcc "4.2.1"
33 | #define MIN_TOOL_VERSION_gcc(major1,major2,minor) (\
34 | (major1) < 4 || \
35 | (major1) == 4 && (major2) < 2 || \
36 | (major1) == 4 && (major2) == 2 && (minor) <= 1)
37 |
38 | /* tool ghc-8.0.2 */
39 | #define TOOL_VERSION_ghc "8.0.2"
40 | #define MIN_TOOL_VERSION_ghc(major1,major2,minor) (\
41 | (major1) < 8 || \
42 | (major1) == 8 && (major2) < 0 || \
43 | (major1) == 8 && (major2) == 0 && (minor) <= 2)
44 |
45 | /* tool ghc-pkg-8.0.2 */
46 | #define TOOL_VERSION_ghc_pkg "8.0.2"
47 | #define MIN_TOOL_VERSION_ghc_pkg(major1,major2,minor) (\
48 | (major1) < 8 || \
49 | (major1) == 8 && (major2) < 0 || \
50 | (major1) == 8 && (major2) == 0 && (minor) <= 2)
51 |
52 | /* tool haddock-2.17.3 */
53 | #define TOOL_VERSION_haddock "2.17.3"
54 | #define MIN_TOOL_VERSION_haddock(major1,major2,minor) (\
55 | (major1) < 2 || \
56 | (major1) == 2 && (major2) < 17 || \
57 | (major1) == 2 && (major2) == 17 && (minor) <= 3)
58 |
59 | /* tool happy-1.19.5 */
60 | #define TOOL_VERSION_happy "1.19.5"
61 | #define MIN_TOOL_VERSION_happy(major1,major2,minor) (\
62 | (major1) < 1 || \
63 | (major1) == 1 && (major2) < 19 || \
64 | (major1) == 1 && (major2) == 19 && (minor) <= 5)
65 |
66 | /* tool hpc-0.67 */
67 | #define TOOL_VERSION_hpc "0.67"
68 | #define MIN_TOOL_VERSION_hpc(major1,major2,minor) (\
69 | (major1) < 0 || \
70 | (major1) == 0 && (major2) < 67 || \
71 | (major1) == 0 && (major2) == 67 && (minor) <= 0)
72 |
73 | /* tool hsc2hs-0.68.1 */
74 | #define TOOL_VERSION_hsc2hs "0.68.1"
75 | #define MIN_TOOL_VERSION_hsc2hs(major1,major2,minor) (\
76 | (major1) < 0 || \
77 | (major1) == 0 && (major2) < 68 || \
78 | (major1) == 0 && (major2) == 68 && (minor) <= 1)
79 |
80 | /* tool hscolour-1.24 */
81 | #define TOOL_VERSION_hscolour "1.24"
82 | #define MIN_TOOL_VERSION_hscolour(major1,major2,minor) (\
83 | (major1) < 1 || \
84 | (major1) == 1 && (major2) < 24 || \
85 | (major1) == 1 && (major2) == 24 && (minor) <= 0)
86 |
87 | #define CURRENT_COMPONENT_ID "codingdojo-0.0.0-O89NcY1WlHGQ8029dJqHh"
88 |
89 | #define CURRENT_PACKAGE_KEY "codingdojo-0.0.0-O89NcY1WlHGQ8029dJqHh"
90 |
91 |
--------------------------------------------------------------------------------
/challenges/2017-04-05-tennis-game/dist/build/libHScodingdojo-0.0.0-O89NcY1WlHGQ8029dJqHh-ghc8.0.2.dylib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CheesecakeLabs/codingdojo/e56bbbf27a91ce01054156e4e23fc76b7dbbf873/challenges/2017-04-05-tennis-game/dist/build/libHScodingdojo-0.0.0-O89NcY1WlHGQ8029dJqHh-ghc8.0.2.dylib
--------------------------------------------------------------------------------
/challenges/2017-04-05-tennis-game/dist/build/libHScodingdojo-0.0.0-O89NcY1WlHGQ8029dJqHh.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CheesecakeLabs/codingdojo/e56bbbf27a91ce01054156e4e23fc76b7dbbf873/challenges/2017-04-05-tennis-game/dist/build/libHScodingdojo-0.0.0-O89NcY1WlHGQ8029dJqHh.a
--------------------------------------------------------------------------------
/challenges/2017-04-05-tennis-game/dist/build/libHScodingdojo-0.0.0-O89NcY1WlHGQ8029dJqHh_p.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CheesecakeLabs/codingdojo/e56bbbf27a91ce01054156e4e23fc76b7dbbf873/challenges/2017-04-05-tennis-game/dist/build/libHScodingdojo-0.0.0-O89NcY1WlHGQ8029dJqHh_p.a
--------------------------------------------------------------------------------
/challenges/2017-04-05-tennis-game/dist/build/spec/spec:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CheesecakeLabs/codingdojo/e56bbbf27a91ce01054156e4e23fc76b7dbbf873/challenges/2017-04-05-tennis-game/dist/build/spec/spec
--------------------------------------------------------------------------------
/challenges/2017-04-05-tennis-game/dist/build/spec/spec-tmp/CodeSpec.hi:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CheesecakeLabs/codingdojo/e56bbbf27a91ce01054156e4e23fc76b7dbbf873/challenges/2017-04-05-tennis-game/dist/build/spec/spec-tmp/CodeSpec.hi
--------------------------------------------------------------------------------
/challenges/2017-04-05-tennis-game/dist/build/spec/spec-tmp/CodeSpec.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CheesecakeLabs/codingdojo/e56bbbf27a91ce01054156e4e23fc76b7dbbf873/challenges/2017-04-05-tennis-game/dist/build/spec/spec-tmp/CodeSpec.o
--------------------------------------------------------------------------------
/challenges/2017-04-05-tennis-game/dist/build/spec/spec-tmp/Main.hi:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CheesecakeLabs/codingdojo/e56bbbf27a91ce01054156e4e23fc76b7dbbf873/challenges/2017-04-05-tennis-game/dist/build/spec/spec-tmp/Main.hi
--------------------------------------------------------------------------------
/challenges/2017-04-05-tennis-game/dist/build/spec/spec-tmp/Main.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CheesecakeLabs/codingdojo/e56bbbf27a91ce01054156e4e23fc76b7dbbf873/challenges/2017-04-05-tennis-game/dist/build/spec/spec-tmp/Main.o
--------------------------------------------------------------------------------
/challenges/2017-04-05-tennis-game/dist/package.conf.inplace/codingdojo-0.0.0-O89NcY1WlHGQ8029dJqHh.conf:
--------------------------------------------------------------------------------
1 | name: codingdojo
2 | version: 0.0.0
3 | id: codingdojo-0.0.0-O89NcY1WlHGQ8029dJqHh
4 | key: codingdojo-0.0.0-O89NcY1WlHGQ8029dJqHh
5 | license: UnspecifiedLicense
6 | copyright: (c) 2017 CheesecakeLabs
7 | maintainer: CheesecakeLabs
8 | author: CheesecakeLabs
9 | exposed: True
10 | exposed-modules:
11 | Code
12 | abi:
13 | trusted: False
14 | import-dirs: /Users/danieloliveira/_cheesecakelabs/codingdojo/templates/haskell/dist/build
15 | library-dirs: /Users/danieloliveira/_cheesecakelabs/codingdojo/templates/haskell/dist/build
16 | dynamic-library-dirs: /Users/danieloliveira/_cheesecakelabs/codingdojo/templates/haskell/dist/build
17 | data-dir: /Users/danieloliveira/_cheesecakelabs/codingdojo/templates/haskell
18 | hs-libraries: HScodingdojo-0.0.0-O89NcY1WlHGQ8029dJqHh
19 | depends:
20 | base-4.9.1.0
21 | haddock-interfaces: /Users/danieloliveira/_cheesecakelabs/codingdojo/templates/haskell/dist/doc/html/codingdojo/codingdojo.haddock
22 | haddock-html: /Users/danieloliveira/_cheesecakelabs/codingdojo/templates/haskell/dist/doc/html/codingdojo
23 |
--------------------------------------------------------------------------------
/challenges/2017-04-05-tennis-game/dist/package.conf.inplace/package.cache:
--------------------------------------------------------------------------------
1 | ghcpkg C codingdojo-0.0.0
2 | codingdojo &codingdojo-0.0.0-O89NcY1WlHGQ8029dJqHh