diff --git a/challenges/THE BOX/index.html b/challenges/THE BOX/index.html new file mode 100644 index 0000000..e132ce0 --- /dev/null +++ b/challenges/THE BOX/index.html @@ -0,0 +1,17 @@ + + + + THE BOX + + + +
+
+
+
+
+
+
+ + + diff --git a/challenges/THE BOX/style.css b/challenges/THE BOX/style.css new file mode 100644 index 0000000..adc4c58 --- /dev/null +++ b/challenges/THE BOX/style.css @@ -0,0 +1,56 @@ +div { + position: absolute; +} + +#orange { + background-color: #F1AB3c; + width: 400px; + height: 400px; + left: 160px; + top: 10px; +} + +#dark_green { + background-color: #68884b; + width: 140px; + height: 190px; + top: 10px; +} + +#light_green { + background-color: #7fBB4d; + width: 140px; + height: 190px; + top: 220px; +} + +#dark_blue { + background-color: #2669A4; + width: 290px; + height: 90px; + top: 420px; +} + +#medium_dark_blue { + background-color: #4994DC; + width: 90px; + height: 90px; + left: 310px; + top: 420px; +} + +#medium_light_blue { + background-color: #87BFF4; + width: 150px; + height: 40px; + top: 420px; + left: 410px; +} + +#light_blue { + background-color: #B6DBFE; + width: 150px; + height: 40px; + top: 470px; + left: 410px; +} \ No newline at end of file diff --git a/challenges/comprehension/explanation.txt b/challenges/comprehension/explanation.txt index e69de29..7d39bdc 100755 --- a/challenges/comprehension/explanation.txt +++ b/challenges/comprehension/explanation.txt @@ -0,0 +1,13 @@ + +@ defines an array or list or something of that nature + +% defines a variable + +$ defines an array or something + +The while loop takes a line from a text file and splits it by " " into an array. +Then the for each takes a chunk from that array and checks if it matches some string or regexp ( I have never used regexp's). If a match exists it then puts the chunk into an array or stack called storage. If a match does not exist it just shoves it into the second slot in the array assuming it starts at 0. + +The for each at the bottom prints the index and chunk from the array in storage with some pretty printing. + + diff --git a/challenges/strpos/strpos.php b/challenges/strpos/strpos.php index 0a4a756..a236fa9 100755 --- a/challenges/strpos/strpos.php +++ b/challenges/strpos/strpos.php @@ -1,8 +1,47 @@ 1) { // If array is larger than one char + $whole_peek = 1; + $still_matching = true; + + for ($chunk_index=1; $chunk_index < $count && $array_position + $whole_peek < count($whole_string_array); $chunk_index++,$whole_peek++) { + if ($chunk_string_char_array[$chunk_index] != $whole_string_array[$array_position + $whole_peek]) { + $still_matching = false; + continue; + } + } + if ($still_matching) { + return $array_position; + } + + } else { + return $array_position; + } + + } + $array_position++; + $whole_position++; + } + return false; } $alphabet = 'abcdefghijklmnopqrstuvwxyz'; @@ -13,6 +52,12 @@ function my_strpos(/* arguments go here! */) # Should print "6" print(my_strpos($alphabet, 'ghi') . "\n"); +print(my_strpos($alphabet, 'gh!') . "\n"); +print(my_strpos($alphabet, 'g!i') . "\n"); + +var_dump(my_strpos($alphabet, 'a', 0)); + + # Should print "bool(false)" var_dump(my_strpos($alphabet, 'u', 22));