2017 © Pedro Peláez
 

library phpwar

code battle with php

image

iannsp/phpwar

code battle with php

  • Wednesday, February 4, 2015
  • by iannsp
  • Repository
  • 6 Watchers
  • 26 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 6 Forks
  • 3 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

phpwar Build Status

Code War php, (*1)

PHPWar is a simple programming game where you develop your player and put this in the arena to fight against other players., (*2)

You can watch a game of two P1 Player into a 10X10 arena here, (*3)

Each game has an Arena and the dimension of the arena can set with:, (*4)

 <?php
$arena = new Iannsp\PhpWar\Arena(10,10);
?>

Each Game can have any number of players, even One [win warranty] ;), (*5)

 <?php
$arena = new Iannsp\PhpWar\Arena(10,10);
$players = array (
new Iannsp\PhpWar\Player\P1($arena->getWidth(), $arena->getHeight()),
new Iannsp\PhpWar\Player\P1($arena->getWidth(), $arena->getHeight())
);
$game = new Iannsp\PhpWar\Game($arena, $players);

At this moment you control the number of game rounds. The next step is develop the end control(and the game run for itself)., (*6)

$moves=0;
while($moves < 100){
    $game->round();
    $moves++;
}
?>

The playgame.php file is a sample about how to configure and set the game. It already print(bash) the game result, like this:, (*7)

    _____  _    _ _____   __          __        
   |  __ \| |  | |  __ \  \ \        / /        
   | |__) | |__| | |__) |  \ \  /\  / /_ _ _ __ 
   |  ___/|  __  |  ___/    \ \/  \/ / _` | '__|
   | |    | |  | | |         \  /\  / (_| | |   
   |_|    |_|  |_|_|          \/  \/ \__,_|_|   

 0  .  1  .  1  1  0  1  0  0 
 0  1  0  1  .  0  1  1  0  1 
 .  .  .  0  1  1  1  0  1  . 
 0  1  0  1  1  .  0  1  0  1 
 0  0  .  1  0  1  .  1  .  . 
 1  1  0  1  .  1  1  0  1  1 
 .  .  1  1  1  0  1  1  0  1 
 1  1  0  1  0  0  1  1  0  . 
 .  1  .  .  .  1  0  1  1  1 
 1  .  .  1  0  0  .  1  1  1 
 
 Result
 Player 0 has 28 position(s).
 Player 1 has 69 position(s).

The Versions

04/02 2015

dev-master

9999999-dev

code battle with php

  Sources   Download

GPL v3

The Requires

  • php >=5.4.0

 

The Development Requires

28/07 2014

dev-ApplicationServer

dev-ApplicationServer

code battle with php

  Sources   Download

GPL v3

The Requires

 

The Development Requires

28/07 2014

dev-Feedback

dev-Feedback

code battle with php

  Sources   Download

GPL v3

The Requires

  • php >=5.4.0

 

The Development Requires