You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
coffee-table/index.php

31 lines
599 B

<?php
namespace Coffee;
require __DIR__ . '/vendor/autoload.php';
try {
$map = new Map([
[0, 1, 0, 1],
[1, 0, 0, 0],
[0, 0, 0, 1],
[0, 0, 0, 1]
]);
$table = new Table();
foreach ($map->describedByArray() as $mapRowIndex => $mapRow) {
foreach ($mapRow as $mapColumnIndex => $containsCoffee) {
if ($containsCoffee == true) {
$position = new Position($mapColumnIndex, $mapRowIndex);
$spot = new Spot($position);
$table->addSpot($spot);
}
}
}
var_dump($map->describedByArray());
}
catch (\Exception $e) {
echo 'Caught exception: ' . $e->getMessage() . "\n";
}