Implement Tile.getSpotNumber

master
Peter Babič 8 years ago
parent 20d39e72a0
commit 70f40a1cfd
Signed by: peter.babic
GPG Key ID: 4BB075BC1884BA40
  1. 191
      .idea/workspace.xml
  2. 22
      src/Coffee/Map.php
  3. 2
      src/Coffee/Table.php
  4. 22
      src/Coffee/Tile.php
  5. 85
      tests/Coffee/MapTest.php
  6. 7
      tests/Coffee/TileTest.php

@ -4,10 +4,10 @@
<option name="ANALYZE_TEST_SOURCES" value="false" />
</component>
<component name="ChangeListManager">
<list default="true" id="65f95bb6-3a86-4ed6-841e-441936291ad4" name="Default" comment="Implement Table.getSpotIndexByPosition">
<list default="true" id="65f95bb6-3a86-4ed6-841e-441936291ad4" name="Default" comment="Implement Tile.getSpotNumber">
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/index.php" afterPath="$PROJECT_DIR$/index.php" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/Coffee/Table.php" afterPath="$PROJECT_DIR$/src/Coffee/Table.php" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/Coffee/Map.php" afterPath="$PROJECT_DIR$/src/Coffee/Map.php" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/tests/Coffee/MapTest.php" afterPath="$PROJECT_DIR$/tests/Coffee/MapTest.php" />
</list>
<ignored path="coffeetable.iws" />
<ignored path=".idea/workspace.xml" />
@ -37,17 +37,17 @@
<entry file="file://$PROJECT_DIR$/index.php">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="-12.666667">
<caret line="19" column="51" selection-start-line="19" selection-start-column="51" selection-end-line="19" selection-end-column="51" />
<caret line="22" column="9" selection-start-line="22" selection-start-column="9" selection-end-line="22" selection-end-column="9" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="Table.php" pinned="false" current-in-tab="false">
<file leaf-file-name="Table.php" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/Coffee/Table.php">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="-46.333332">
<caret line="74" column="41" selection-start-line="74" selection-start-column="41" selection-end-line="74" selection-end-column="41" />
<state vertical-scroll-proportion="3.7190082">
<caret line="100" column="59" selection-start-line="100" selection-start-column="59" selection-end-line="100" selection-end-column="59" />
<folding />
</state>
</provider>
@ -56,7 +56,7 @@
<file leaf-file-name="TableTest.php" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/tests/Coffee/TableTest.php">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="-21.037037">
<state vertical-scroll-proportion="-23.037037">
<caret line="111" column="28" selection-start-line="111" selection-start-column="28" selection-end-line="111" selection-end-column="28" />
<folding />
</state>
@ -66,7 +66,7 @@
<file leaf-file-name="Spot.php" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/Coffee/Spot.php">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="-21.037037">
<state vertical-scroll-proportion="-33.333332">
<caret line="55" column="23" selection-start-line="55" selection-start-column="23" selection-end-line="55" selection-end-column="23" />
<folding />
</state>
@ -76,7 +76,7 @@
<file leaf-file-name="SpotTest.php" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/tests/Coffee/SpotTest.php">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="-16.666666">
<state vertical-scroll-proportion="-13.407408">
<caret line="25" column="0" selection-start-line="25" selection-start-column="0" selection-end-line="25" selection-end-column="0" />
<folding />
</state>
@ -86,7 +86,7 @@
<file leaf-file-name="Position.php" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/Coffee/Position.php">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="-90.51852">
<state vertical-scroll-proportion="-116.666664">
<caret line="175" column="23" selection-start-line="175" selection-start-column="23" selection-end-line="175" selection-end-column="23" />
<folding />
</state>
@ -96,38 +96,38 @@
<file leaf-file-name="Map.php" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/Coffee/Map.php">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="57" column="12" selection-start-line="57" selection-start-column="12" selection-end-line="57" selection-end-column="64" />
<state vertical-scroll-proportion="14.740741">
<caret line="71" column="0" selection-start-line="71" selection-start-column="0" selection-end-line="71" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="Tile.php" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/Coffee/Tile.php">
<file leaf-file-name="MapTest.php" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/tests/Coffee/MapTest.php">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="2.2090163">
<caret line="72" column="20" selection-start-line="72" selection-start-column="20" selection-end-line="72" selection-end-column="20" />
<state vertical-scroll-proportion="-60.0">
<caret line="90" column="0" selection-start-line="90" selection-start-column="0" selection-end-line="90" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="TileTest.php" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/tests/Coffee/TileTest.php">
<file leaf-file-name="Tile.php" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/Coffee/Tile.php">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<state vertical-scroll-proportion="-76.666664">
<caret line="115" column="0" selection-start-line="115" selection-start-column="0" selection-end-line="115" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="PositionTest.php" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/tests/Coffee/PositionTest.php">
<file leaf-file-name="TileTest.php" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/tests/Coffee/TileTest.php">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="-1.2592592">
<caret line="21" column="37" selection-start-line="21" selection-start-column="37" selection-end-line="21" selection-end-column="37" />
<state vertical-scroll-proportion="-15.037037">
<caret line="43" column="55" selection-start-line="43" selection-start-column="55" selection-end-line="43" selection-end-column="55" />
<folding />
</state>
</provider>
@ -174,20 +174,20 @@
<option value="$PROJECT_DIR$/src/Coffee/Position.php" />
<option value="/usr/share/nginx/html/coffeetable/src/Coffee/Spot.php" />
<option value="/usr/share/nginx/html/coffeetable/index.php" />
<option value="$PROJECT_DIR$/src/Coffee/Tile.php" />
<option value="$PROJECT_DIR$/composer.json" />
<option value="$PROJECT_DIR$/tests/Coffee/MapTest.php" />
<option value="$PROJECT_DIR$/tests/Coffee/TileTest.php" />
<option value="/usr/share/nginx/html/coffeetable/src/Coffee/Table.php" />
<option value="$PROJECT_DIR$/Output.php" />
<option value="$PROJECT_DIR$/tests/Coffee/OutputTest.php" />
<option value="$PROJECT_DIR$/src/Coffee/Map.php" />
<option value="$PROJECT_DIR$/tests/Coffee/SpotTest.php" />
<option value="$PROJECT_DIR$/src/Coffee/Spot.php" />
<option value="$PROJECT_DIR$/tests/Coffee/PositionTest.php" />
<option value="$PROJECT_DIR$/tests/Coffee/TableTest.php" />
<option value="$PROJECT_DIR$/src/Coffee/Table.php" />
<option value="$PROJECT_DIR$/index.php" />
<option value="$PROJECT_DIR$/src/Coffee/Table.php" />
<option value="$PROJECT_DIR$/tests/Coffee/SpotTest.php" />
<option value="$PROJECT_DIR$/tests/Coffee/TileTest.php" />
<option value="$PROJECT_DIR$/src/Coffee/Tile.php" />
<option value="$PROJECT_DIR$/tests/Coffee/MapTest.php" />
<option value="$PROJECT_DIR$/src/Coffee/Map.php" />
</list>
</option>
</component>
@ -481,7 +481,7 @@
<recent name="$PROJECT_DIR$/Tests" />
</key>
</component>
<component name="RunManager" selected="PHP Script.index.php">
<component name="RunManager" selected="PHPUnit.Tests">
<configuration default="false" name="index.php" type="PhpLocalRunConfigurationType" factoryName="PHP Console" temporary="true" path="$PROJECT_DIR$/index.php">
<method />
</configuration>
@ -763,38 +763,50 @@
<option name="project" value="LOCAL" />
<updated>1458500376151</updated>
</task>
<option name="localTasksCounter" value="38" />
<task id="LOCAL-00038" summary="Present the first valid output of the namespace Coffee">
<created>1458502044397</created>
<option name="number" value="00038" />
<option name="project" value="LOCAL" />
<updated>1458502044397</updated>
</task>
<task id="LOCAL-00039" summary="Implement Tile.getSpotNumber">
<created>1458504793092</created>
<option name="number" value="00039" />
<option name="project" value="LOCAL" />
<updated>1458504793092</updated>
</task>
<option name="localTasksCounter" value="40" />
<servers />
</component>
<component name="TestHistory">
<history-entry file="Tests - 2016.03.20 at 19h 36m 47s.xml">
<history-entry file="Tests - 2016.03.20 at 19h 47m 37s.xml">
<configuration name="Tests" configurationId="PHPUnitRunConfigurationType" />
</history-entry>
<history-entry file="Tests - 2016.03.20 at 19h 37m 45s.xml">
<history-entry file="Tests - 2016.03.20 at 19h 48m 32s.xml">
<configuration name="Tests" configurationId="PHPUnitRunConfigurationType" />
</history-entry>
<history-entry file="Tests - 2016.03.20 at 19h 42m 31s.xml">
<history-entry file="Tests - 2016.03.20 at 19h 56m 06s.xml">
<configuration name="Tests" configurationId="PHPUnitRunConfigurationType" />
</history-entry>
<history-entry file="Tests - 2016.03.20 at 19h 45m 45s.xml">
<history-entry file="Tests - 2016.03.20 at 19h 56m 46s.xml">
<configuration name="Tests" configurationId="PHPUnitRunConfigurationType" />
</history-entry>
<history-entry file="Tests - 2016.03.20 at 19h 47m 05s.xml">
<history-entry file="Tests - 2016.03.20 at 19h 58m 56s.xml">
<configuration name="Tests" configurationId="PHPUnitRunConfigurationType" />
</history-entry>
<history-entry file="Tests - 2016.03.20 at 19h 47m 37s.xml">
<history-entry file="Tests - 2016.03.20 at 21h 05m 30s.xml">
<configuration name="Tests" configurationId="PHPUnitRunConfigurationType" />
</history-entry>
<history-entry file="Tests - 2016.03.20 at 19h 48m 32s.xml">
<history-entry file="Tests - 2016.03.20 at 21h 05m 46s.xml">
<configuration name="Tests" configurationId="PHPUnitRunConfigurationType" />
</history-entry>
<history-entry file="Tests - 2016.03.20 at 19h 56m 06s.xml">
<history-entry file="Tests - 2016.03.20 at 21h 05m 52s.xml">
<configuration name="Tests" configurationId="PHPUnitRunConfigurationType" />
</history-entry>
<history-entry file="Tests - 2016.03.20 at 19h 56m 46s.xml">
<history-entry file="Tests - 2016.03.20 at 21h 06m 41s.xml">
<configuration name="Tests" configurationId="PHPUnitRunConfigurationType" />
</history-entry>
<history-entry file="Tests - 2016.03.20 at 19h 58m 56s.xml">
<history-entry file="Tests - 2016.03.20 at 21h 10m 38s.xml">
<configuration name="Tests" configurationId="PHPUnitRunConfigurationType" />
</history-entry>
</component>
@ -809,20 +821,20 @@
</component>
<component name="ToolWindowManager">
<frame x="-2" y="0" width="1444" height="899" extended-state="0" />
<editor active="false" />
<editor active="true" />
<layout>
<window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.23333333" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.17222223" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32917705" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32917705" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="12" side_tool="true" content_ui="tabs" />
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32917705" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.32917705" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32917705" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32668328" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" x="0" y="355" width="1446" height="188" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.24964234" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="10" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.3241895" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3241895" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="PHP-CGI Server" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" />
@ -850,8 +862,6 @@
<component name="VcsManagerConfiguration">
<option name="CHECK_NEW_TODO" value="false" />
<option name="USE_COMMIT_MESSAGE_MARGIN" value="true" />
<MESSAGE value="Implement Map.isValidPosition" />
<MESSAGE value="Implement Map.isVisitedPosition" />
<MESSAGE value="Rename Tile to Position" />
<MESSAGE value="Move tests to separate namespaced directory" />
<MESSAGE value="Implemet Tile extends Position" />
@ -875,7 +885,9 @@
<MESSAGE value="Refactor largest Spot" />
<MESSAGE value="Refactor largest Spot and its size" />
<MESSAGE value="Implement Table.getSpotIndexByPosition" />
<option name="LAST_COMMIT_MESSAGE" value="Implement Table.getSpotIndexByPosition" />
<MESSAGE value="Present the first valid output of the namespace Coffee" />
<MESSAGE value="Implement Tile.getSpotNumber" />
<option name="LAST_COMMIT_MESSAGE" value="Implement Tile.getSpotNumber" />
<option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="true" />
<option name="REFORMAT_BEFORE_PROJECT_COMMIT" value="true" />
<option name="REARRANGE_BEFORE_PROJECT_COMMIT" value="true" />
@ -1192,104 +1204,105 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/tests/Coffee/MapTest.php">
<entry file="file:///usr/share/nginx/html/coffeetable/src/Coffee/Table.php">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="-8.0">
<caret line="12" column="0" selection-start-line="12" selection-start-column="0" selection-end-line="12" selection-end-column="0" />
<state vertical-scroll-proportion="0.7222222">
<caret line="102" column="26" selection-start-line="102" selection-start-column="26" selection-end-line="102" selection-end-column="26" />
</state>
</provider>
</entry>
<entry file="file:///usr/share/nginx/html/coffeetable/src/Coffee/Table.php">
<entry file="phar:///usr/share/webapps/bin/phpunit.phar/phpunit/Framework/TestCase.php">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.7222222">
<caret line="102" column="26" selection-start-line="102" selection-start-column="26" selection-end-line="102" selection-end-column="26" />
<state vertical-scroll-proportion="0.31893003">
<caret line="985" column="0" selection-start-line="985" selection-start-column="0" selection-end-line="985" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/Coffee/Map.php">
<entry file="file://$PROJECT_DIR$/tests/Coffee/PositionTest.php">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="57" column="12" selection-start-line="57" selection-start-column="12" selection-end-line="57" selection-end-column="64" />
<state vertical-scroll-proportion="-1.2592592">
<caret line="21" column="37" selection-start-line="21" selection-start-column="37" selection-end-line="21" selection-end-column="37" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/tests/Coffee/TileTest.php">
<entry file="file://$PROJECT_DIR$/tests/Coffee/SpotTest.php">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<state vertical-scroll-proportion="-13.407408">
<caret line="25" column="0" selection-start-line="25" selection-start-column="0" selection-end-line="25" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="phar:///usr/share/webapps/bin/phpunit.phar/phpunit/Framework/TestCase.php">
<entry file="file://$PROJECT_DIR$/tests/Coffee/TileTest.php">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.31893003">
<caret line="985" column="0" selection-start-line="985" selection-start-column="0" selection-end-line="985" selection-end-column="0" />
<state vertical-scroll-proportion="-15.037037">
<caret line="43" column="55" selection-start-line="43" selection-start-column="55" selection-end-line="43" selection-end-column="55" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/tests/Coffee/PositionTest.php">
<entry file="file://$PROJECT_DIR$/src/Coffee/Spot.php">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="-1.2592592">
<caret line="21" column="37" selection-start-line="21" selection-start-column="37" selection-end-line="21" selection-end-column="37" />
<state vertical-scroll-proportion="-33.333332">
<caret line="55" column="23" selection-start-line="55" selection-start-column="23" selection-end-line="55" selection-end-column="23" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/Coffee/Position.php">
<entry file="file://$PROJECT_DIR$/tests/Coffee/TableTest.php">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="-90.51852">
<caret line="175" column="23" selection-start-line="175" selection-start-column="23" selection-end-line="175" selection-end-column="23" />
<state vertical-scroll-proportion="-23.037037">
<caret line="111" column="28" selection-start-line="111" selection-start-column="28" selection-end-line="111" selection-end-column="28" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/Coffee/Spot.php">
<entry file="file://$PROJECT_DIR$/index.php">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="-21.037037">
<caret line="55" column="23" selection-start-line="55" selection-start-column="23" selection-end-line="55" selection-end-column="23" />
<state vertical-scroll-proportion="-12.666667">
<caret line="22" column="9" selection-start-line="22" selection-start-column="9" selection-end-line="22" selection-end-column="9" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/tests/Coffee/SpotTest.php">
<entry file="file://$PROJECT_DIR$/src/Coffee/Tile.php">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="-16.666666">
<caret line="25" column="0" selection-start-line="25" selection-start-column="0" selection-end-line="25" selection-end-column="0" />
<state vertical-scroll-proportion="-76.666664">
<caret line="115" column="0" selection-start-line="115" selection-start-column="0" selection-end-line="115" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/tests/Coffee/TableTest.php">
<entry file="file://$PROJECT_DIR$/tests/Coffee/MapTest.php">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="-21.037037">
<caret line="111" column="28" selection-start-line="111" selection-start-column="28" selection-end-line="111" selection-end-column="28" />
<state vertical-scroll-proportion="-60.0">
<caret line="90" column="0" selection-start-line="90" selection-start-column="0" selection-end-line="90" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/Coffee/Table.php">
<entry file="file://$PROJECT_DIR$/src/Coffee/Map.php">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="-46.333332">
<caret line="74" column="41" selection-start-line="74" selection-start-column="41" selection-end-line="74" selection-end-column="41" />
<state vertical-scroll-proportion="14.740741">
<caret line="71" column="0" selection-start-line="71" selection-start-column="0" selection-end-line="71" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/index.php">
<entry file="file://$PROJECT_DIR$/src/Coffee/Position.php">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="-12.666667">
<caret line="19" column="51" selection-start-line="19" selection-start-column="51" selection-end-line="19" selection-end-column="51" />
<state vertical-scroll-proportion="-116.666664">
<caret line="175" column="23" selection-start-line="175" selection-start-column="23" selection-end-line="175" selection-end-column="23" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/Coffee/Tile.php">
<entry file="file://$PROJECT_DIR$/src/Coffee/Table.php">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="2.2090163">
<caret line="72" column="20" selection-start-line="72" selection-start-column="20" selection-end-line="72" selection-end-column="20" />
<state vertical-scroll-proportion="3.7190082">
<caret line="100" column="59" selection-start-line="100" selection-start-column="59" selection-end-line="100" selection-end-column="59" />
<folding />
</state>
</provider>

@ -70,28 +70,6 @@ class Map {
return $this->tiles;
}
/**
* @return Tile[]
*/
public function getUnvisitedTiles() {
$array = [];
foreach ($this->getTiles() as $tile) {
if (!$tile->isVisited()) {
$array[] = $tile;
}
}
return $array;
}
public function getUnvisitedTile() {
foreach ($this->getTiles() as $tile) {
if (!$tile->isVisited()) {
return $tile;
}
}
return false;
}
/**
* @param Position $position

@ -98,7 +98,7 @@ class Table {
$this->updateCurrentSpot($currentTile->getPosition());
// Recursion
// TODO: Replace recursion by iteration
$this->recurseMap($currentTile);
$this->addCurrentSpot(); // (to this table)

@ -29,11 +29,17 @@ class Tile extends Position {
/**
* Tiles are inherently unvisited
*
* @var bool
*/
private $visited = false;
/**
* Zero means that the tile is not in the spot
*
* @var int
*/
private $spotNumber = 0;
/**
* Tile constructor.
*
@ -94,4 +100,18 @@ class Tile extends Position {
return new Position($this->getRow(), $this->getColumn());
}
/**
* @return int
*/
public function getSpotNumber() {
return $this->spotNumber;
}
/**
* @param int $spotNumber
*/
public function setSpotNumber($spotNumber) {
$this->spotNumber = $spotNumber;
}
}

@ -15,38 +15,6 @@ class MapTest extends \PHPUnit_Framework_TestCase {
$this->assertEquals([$tileA, $tileB], $map->getTiles());
}
public function testUnvisitedTile() {
$description = [
[1, 0],
[0, 1],
];
$map = new Map($description);
$tiles = $map->getTiles();
$tiles[0]->visit();
$tiles[3]->visit();
$tile = new Tile(1, 2, Tile::REPRESENTS_VOID);
$this->assertEquals($tile, $map->getUnvisitedTile());
}
public function testUnVisitedTiles() {
$description = [
[1, 0],
[0, 1],
];
$map = new Map($description);
$tiles = $map->getTiles();
$tiles[2]->visit();
$tiles[3]->visit();
$tileA = new Tile(1, 1, Tile::REPRESENTS_SPOT);
$tileB = new Tile(1, 2, Tile::REPRESENTS_VOID);
$this->assertEquals([$tileA, $tileB], $map->getUnvisitedTiles());
}
public function testDescribedByArray() {
$description = [
@ -121,57 +89,4 @@ class MapTest extends \PHPUnit_Framework_TestCase {
}
// public function testValidPosition() {
// $description = [
// [0, 1, 0, 1],
// [1, 0, 0, 0],
// [0, 0, 0, 1],
// [0, 0, 0, 1]
// ];
//
// $map = new Map($description);
// $position = new Position(3, 1);
// $this->assertTrue($map->hasValidPosition($position));
// }
//
// public function testInvalidPosition() {
// $description = [
// [0, 1, 0, 1],
// [1, 0, 0, 0],
// [0, 0, 0, 1],
// [0, 0, 0, 1]
// ];
//
// $map = new Map($description);
// $position = new Position(4, 5);
// $this->assertFalse($map->hasValidPosition($position));
// }
//
// public function testUnvisitedPosition() {
// $description = [
// [0, 1, 0, 1],
// [1, 0, 0, 0],
// [0, 0, 0, 1],
// [0, 0, 0, 1]
// ];
//
// $map = new Map($description);
// $position = new Position(1, 1);
// $this->assertFalse($map->isVisitedPosition($position));
// }
//
// public function testVisitedPosition() {
// $description = [
// [0, 1, 0, 1],
// [1, 0, 0, 0],
// [0, 0, 0, 1],
// [0, 0, 0, 1]
// ];
//
// $map = new Map($description);
// $position = new Position(1, 1);
// $map->visitPosition($position);
// $this->assertTrue($map->isVisitedPosition($position));
// }
}

@ -37,4 +37,11 @@ class TileTest extends \PHPUnit_Framework_TestCase {
$this->assertTrue($tile->isVisited());
}
public function testSpotNumber() {
$tile = new Tile(2, 2, Tile::REPRESENTS_SPOT);
$tile->setSpotNumber(4);
$this->assertEquals(4, $tile->getSpotNumber());
}
}

Loading…
Cancel
Save