Code: Select all
$field[x1..x2].each do |x|
valid = false if x[y1..y2].include?(" ") == true
Code: Select all
$field[x1..x2].each do |x|
valid = false if x[y1..y2].include?(" ") == true
Code: Select all
#include <stdbool.h>
#include <string.h>
inline foo( char *** field, size_t x1, size_t x2, size_t y1, size_t y2 )
{
for ( size_t i1 = x1; i1 <= x2; ++i1 )
{
for ( size_t i2 = y1; i2 <= y2; ++i2 )
{
if ( strchr( field[i1][i2], ' ' ) != NULL )
{
return false;
}
}
}
return true;
}
Code: Select all
#include <vector>
#include <string>
using std::vector;
using std::string;
inline bool foo( vector< vector< string > > & field, size_t x1, , size_t x2, , size_t y1, , size_t y2 )
{
for ( size_t i1 = x1; i1 <= x2; ++i1 )
{
for ( size_t i2 = y2; i2 <= y2; ++i2 )
{
if ( field[i1][i2].find( ' ' ) != std::npos )
{
return false;
}
}
}
return true;
}
Code: Select all
$field[x1..x2].each do |x|
valid = false if x[y1..y2].include?(" ") == true
end
Code: Select all
if ((randomizer(2) == 1) && (x_backup != x1) && (x_backup != x2)) {
Code: Select all
int nr_rooms;
int random;
random = randomizer(85);
if( (random >= 5) && (random <= 10) ) nr_rooms = 2;
if( (random >= 11) && (random <= 20) ) nr_rooms = 3;
if( (random >= 21) && (random <= 30) ) nr_rooms = 4;
if( (random >= 31) && (random <= 40) ) nr_rooms = 5;
if( (random >= 41) && (random <= 50) ) nr_rooms = 6;
if( (random >= 51) && (random <= 60) ) nr_rooms = 7;
if( (random >= 61) && (random <= 70) ) nr_rooms = 8;
if( (random >= 71) && (random <= 81) ) nr_rooms = 9;
if( (random > 81) || (random < 5) ) nr_rooms = 10;
Code: Select all
while (valid == false)
Code: Select all
while (!valid)
Code: Select all
while(temp_x<=x2){
int j=y1;
while(j<=y2){
if (field[temp_x][j] == ".") valid = false;
j++;
}
temp_x++;
}
Code: Select all
while(temp_x<=x2 && valid){
int j=y1;
while(j<=y2){
if (field[temp_x][j] == "."){
valid = false;
break;
}
j++;
}
temp_x++;
}