当前位置: 首页>>代码示例>>C++>>正文


C++ OutOfBoundsEx函数代码示例

本文整理汇总了C++中OutOfBoundsEx函数的典型用法代码示例。如果您正苦于以下问题:C++ OutOfBoundsEx函数的具体用法?C++ OutOfBoundsEx怎么用?C++ OutOfBoundsEx使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了OutOfBoundsEx函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: OutOfBoundsEx

	void Point::setValue(unsigned int i, double v)
	{
		if (i >= __dim) {
			throw OutOfBoundsEx(__dim, i);
		}
		__values[i] = v;
	}
开发者ID:bradlsum,项目名称:ucd-csci2312-pa3,代码行数:7,代码来源:Point.cpp

示例2: addStrategic

    void Game::addStrategic(unsigned x, unsigned y, Strategy *s) {
        int index = y + (x * __width);
        if (y >= __width || x >= __height) throw OutOfBoundsEx(__width, __height, x, y);
        if (__grid[index]) throw PositionNonemptyEx(x, y);

        __grid[index] = new Strategic(*this, Position(x, y), STARTING_AGENT_ENERGY, s);
    }
开发者ID:YuanmingShi,项目名称:ucd-csci2312-pa4,代码行数:7,代码来源:Game.cpp

示例3: addSimple

    void Game::addSimple(const Position &position, double energy) { // used for testing only
        int index = position.y + (position.x * __width);
        if (position.y >= __width || position.x >= __height) throw OutOfBoundsEx(__width, __height, position.x, position.y);
        if (__grid[index]) throw PositionNonemptyEx(position.x, position.y);

        __grid[index] = new Simple(*this, position, energy);
    }
开发者ID:YuanmingShi,项目名称:ucd-csci2312-pa4,代码行数:7,代码来源:Game.cpp

示例4: OutOfBoundsEx

    const double & Point::operator[] (unsigned int index) const
    {
        if (index >= __dim)
            throw OutOfBoundsEx(__dim,index);

        return __values[index];
    }
开发者ID:Nando2496,项目名称:ucd-csci2312-pa3,代码行数:7,代码来源:Point.cpp

示例5: addAdvantage

    void Game::addAdvantage(unsigned x, unsigned y) {
        int index = y + (x * __width);
        if (y >= __width || x >= __height) throw OutOfBoundsEx(__width, __height, x, y);
        if (__grid[index]) throw PositionNonemptyEx(x, y);

        __grid[index] = new Advantage(*this, Position(x, y), STARTING_RESOURCE_CAPACITY);
    }
开发者ID:YuanmingShi,项目名称:ucd-csci2312-pa4,代码行数:7,代码来源:Game.cpp

示例6: OutOfBoundsEx

 void Game::addFood(const Position &position) {
     int location = position.y + (position.x * __width);
     if (position.x < 0 || position.x >= __height || position.y < 0 || position.y >= __width)
         throw OutOfBoundsEx(__width, __height, position.x, position.y);
     if (__grid[location])
         throw PositionNonemptyEx(position.x, position.y);
     __grid[location] = new Food(*this, position,STARTING_RESOURCE_CAPACITY);
 }
开发者ID:AngryThundrWafl,项目名称:ucd-csci2312-pa4,代码行数:8,代码来源:Game.cpp

示例7: OutOfBoundsEx

 void Game::addSimple(const Position &position, double energy) {
     if (position.y >= __width || position.x >= __height) {
         throw OutOfBoundsEx(__width, __height, position.x, position.y);
     }
     if (__grid[(position.x * __width)+position.y]) {
         throw PositionNonemptyEx(position.x, position.y);
     }
     __grid[(position.x * __width)+position.y] = new Simple(*this, position, energy);
 }
开发者ID:SamridKC,项目名称:ucd-csci2312-pa4,代码行数:9,代码来源:Game.cpp

示例8: pos

 void Game::addAdvantage(unsigned x, unsigned y) {
     Position pos(x,y);
     int location = y +(x *__width);
     if (x < 0 || x >= __height || y < 0 || y >= __width)
         throw OutOfBoundsEx(__width, __height, x, y);
     if (__grid[location])
         throw PositionNonemptyEx(x, y);
     __grid[location] = new Advantage(*this, pos, STARTING_RESOURCE_CAPACITY);
 }
开发者ID:AngryThundrWafl,项目名称:ucd-csci2312-pa4,代码行数:9,代码来源:Game.cpp

示例9: OutOfBoundsEx

    const Piece* Game::getPiece(unsigned int x, unsigned int y) const
    {
         if(y >= __width ||  x >=__height)
             throw OutOfBoundsEx(__height, __width, x, y);


        if (__grid[y + (x * __width)] == nullptr) throw PositionEmptyEx(x, y);
        return __grid[y + (x * __width)];
    }
开发者ID:travinh,项目名称:ucd-csci2312-pa4,代码行数:9,代码来源:Game.cpp

示例10: OutOfBoundsEx

void Game::addSimple(unsigned x, unsigned y)
    {
        int place = y + x * __width;
        if (y >= __width || x >= __height)
            throw OutOfBoundsEx(__width, __height, x, y);
        
        if (__grid[place])
            throw PositionNonemptyEx(x, y);
        
        __grid[place] = new Simple(*this, Position(x, y), STARTING_AGENT_ENERGY);
    }
开发者ID:brummetj,项目名称:ucd-csci2312-pa4,代码行数:11,代码来源:Game.cpp

示例11: Advantage

    void Game::addAdvantage(const Position &position){
        Advantage *newAdvantage = new Advantage(*this, position, STARTING_RESOURCE_CAPACITY);
        
        if((position.y*__width + position.x)>__grid.size() || position.x > __width)
            throw OutOfBoundsEx(__width,__height,position.x,position.y);

        if((__grid[position.y*__width + position.x])!=nullptr)
            throw PositionNonemptyEx(position.x,position.y);
        
        __grid[position.y*__width + position.x] = newAdvantage;
    }
开发者ID:EvanDague,项目名称:ucd-csci2312-pa3,代码行数:11,代码来源:Game.cpp

示例12: DefaultAgentStrategy

    void Game::addStrategic(const Position &position, Strategy *s/* = new DefaultAgentStrategy()*/){
        Strategic *newStrat = new Strategic(*this, position, STARTING_AGENT_ENERGY,s);
        
        if((position.y*__width + position.x)>__grid.size() || position.x > __width)
            throw OutOfBoundsEx(__width,__height,position.x,position.y);

        if((__grid[position.y*__width + position.x])!=nullptr)
            throw PositionNonemptyEx(position.x,position.y);
        
        __grid[position.y*__width + position.x] = newStrat;
    }
开发者ID:EvanDague,项目名称:ucd-csci2312-pa3,代码行数:11,代码来源:Game.cpp

示例13: Simple

    void Game::addSimple(const Position &position, double energy){
        Simple *newSimple = new Simple(*this, position, STARTING_AGENT_ENERGY);
        
        if((position.y*__width + position.x)>__grid.size() || position.x > __width)
            throw OutOfBoundsEx(__width,__height,position.x,position.y);

        if((__grid[position.y*__width + position.x])!=nullptr)
            throw PositionNonemptyEx(position.x,position.y);
        
        __grid[position.y*__width + position.x] = newSimple;
    }
开发者ID:EvanDague,项目名称:ucd-csci2312-pa3,代码行数:11,代码来源:Game.cpp


注:本文中的OutOfBoundsEx函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。