File tree 10 files changed +3199
-0
lines changed
10 files changed +3199
-0
lines changed Original file line number Diff line number Diff line change
1
+ .DS_Store
2
+ node_modules
3
+ app.bundle.js
4
+ app.bundle.js.map
5
+ npm-debug *
Original file line number Diff line number Diff line change
1
+ ### Guessing game
2
+
3
+ ---
4
+ ⚠️ DO NOT SUBMIT PRS WITH SOLUTIONS TO THIS REPO ⚠️
5
+
6
+ ### Description
7
+
8
+ Your task is to implement ` GuessingGame ` class
9
+
10
+ #### Methods:
11
+
12
+ ##### ` setRange(min, max) `
13
+ this method accepts min and max value of range of number to guess
14
+
15
+ ##### ` guess() `
16
+ this method returns solution candidate (you make an assumption based on range and previous assumptions)
17
+
18
+ ##### ` lower() `
19
+ this method is called if prev call of ` guess() ` returned number which is lower than answer
20
+
21
+ ##### ` greater() `
22
+ this method is called if prev call of ` guess() ` returned number which is greater than answer
23
+
24
+ Your implementation should use [ binary search algorithm] ( https://en.wikipedia.org/wiki/Binary_search_algorithm ) under the hood to pass all tests
25
+
26
+ ### Prerequisites
27
+ * Install [ nodejs] ( https://nodejs.org/en/ ) (>= v6.9.4)
28
+ * open bash in this folder
29
+ * ` npm install `
30
+
31
+ ### Run tests
32
+ ``` sh
33
+ npm test
34
+ ```
35
+
36
+ ### Run in browser
37
+ ``` sh
38
+ npm start
39
+ ```
40
+
41
+ open http://localhost:8080
42
+
43
+ ---
44
+
45
+ © [ R1ZZU] ( https://github.com/R1ZZU )
Original file line number Diff line number Diff line change
1
+ <!DOCTYPE html>
2
+ < html lang ="en ">
3
+ < head >
4
+ < meta charset ="UTF-8 ">
5
+ < title > Document</ title >
6
+ < style >
7
+ body {
8
+ margin : 0 ;
9
+ }
10
+ </ style >
11
+ </ head >
12
+ < body >
13
+ < script src ="./app.bundle.js "> </ script >
14
+ </ body >
15
+ </ html >
Original file line number Diff line number Diff line change
1
+ const GuessingGame = require ( './src/guessing-game.js' ) ;
2
+
3
+ window . game = new GuessingGame ( ) ;
Original file line number Diff line number Diff line change
1
+ {
2
+ "name" : " guessing-game" ,
3
+ "version" : " 1.0.0" ,
4
+ "description" : " " ,
5
+ "scripts" : {
6
+ "test" : " mocha -r ./test/setup-mocha.js" ,
7
+ "start" : " webpack-dev-server"
8
+ },
9
+ "author" : " " ,
10
+ "license" : " ISC" ,
11
+ "devDependencies" : {
12
+ "chai" : " ^3.5.0" ,
13
+ "mocha" : " ^3.0.2" ,
14
+ "sinon" : " ^1.17.5" ,
15
+ "sinon-chai" : " ^2.8.0" ,
16
+ "webpack" : " ^1.13.1" ,
17
+ "webpack-dev-server" : " ^1.14.1"
18
+ }
19
+ }
Original file line number Diff line number Diff line change
1
+ {
2
+ "GuessingGame" : {
3
+ "weight" : 100 ,
4
+ "suitesWeights" : {
5
+ "#guess" : 100
6
+ }
7
+ }
8
+ }
Original file line number Diff line number Diff line change
1
+ class GuessingGame {
2
+ constructor ( ) { }
3
+
4
+ setRange ( min , max ) {
5
+
6
+ }
7
+
8
+ guess ( ) {
9
+
10
+ }
11
+
12
+ lower ( ) {
13
+
14
+ }
15
+
16
+ greater ( ) {
17
+
18
+ }
19
+ }
20
+
21
+ module . exports = GuessingGame ;
You can’t perform that action at this time.
0 commit comments