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


C++ Cell::HaveSolid方法代码示例

本文整理汇总了C++中Cell::HaveSolid方法的典型用法代码示例。如果您正苦于以下问题:C++ Cell::HaveSolid方法的具体用法?C++ Cell::HaveSolid怎么用?C++ Cell::HaveSolid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Cell的用法示例。


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

示例1: PareEnergyFull

void Margolus::PareEnergyFull(Cell& cellIn, Cell& cellOut, double& energy) {
    // modifier & active in one cell
    for (pSub & subA : cellIn.GetSubs()) {
        if (subA->GetType() == ACTIVE) {
            for (pSub & subM : cellIn.GetSubs()) {
                if (subM->GetType() == MODIFIER) {
                    energy += GetEnergyCell(subA->GetName(), subM->GetName());
                }
            }
        }
    }
    // other
    if (cellOut.HaveSolid()) {
        if (cellIn.HaveModifier()) {
            for (pSub & subIn : cellIn.GetSubs()) {
                if (subIn->GetType() != ACTIVE) {
                    energy += GetEnergy(subIn->GetName(), cellOut.GetSub(0)->GetName());
                }
            }
        } else {
            for (pSub & subIn : cellIn.GetSubs()) {
                energy += GetEnergy(subIn->GetName(), cellOut.GetSub(0)->GetName());
            }
        }
    } else {
        if (cellIn.HaveSolid()) {
            if (cellOut.HaveModifier()) {
                for (pSub & subOut : cellOut.GetSubs()) {
                    if (subOut->GetType() != ACTIVE) {
                        energy += GetEnergy(subOut->GetName(), cellIn.GetSub(0)->GetName());
                    }
                }
            } else {
                for (pSub & subOut : cellOut.GetSubs()) {
                    energy += GetEnergy(subOut->GetName(), cellIn.GetSub(0)->GetName());
                }
            }
        } else {
            for (pSub & subIn : cellIn.GetSubs()) {
                for (pSub & subOut : cellOut.GetSubs()) {
                    energy += GetEnergy(subIn->GetName(), subOut->GetName());
                }
            }
        }
    }
}
开发者ID:igmit,项目名称:MargolusCA-src,代码行数:46,代码来源:margolus_base.cpp

示例2: PareEnergy

void Margolus::PareEnergy(Cell& cellIn, Cell& cellOut, double& energy) {
    if (cellOut.HaveSolid()) {
        if (cellIn.HaveModifier()) {
            for (pSub & subIn : cellIn.GetSubs()) {
                if (subIn->GetType() != ACTIVE) {
                    energy += GetEnergy(subIn->GetName(), cellOut.GetSub(0)->GetName());
                }
            }
        } else {
            for (pSub & subIn : cellIn.GetSubs()) {
                energy += GetEnergy(subIn->GetName(), cellOut.GetSub(0)->GetName());
            }
        }
    }
}
开发者ID:igmit,项目名称:MargolusCA-src,代码行数:15,代码来源:margolus_base.cpp

示例3: memset

void Margolus::CreateRotateBlock3D(Block3D & block, Rotate3D rotate, cuint& ix,
        cuint& iy, cuint& iz, bool act, bool mod) {
    block.rotate = rotate;
    memset(block.move, 0, sizeof(block.move));
    // front
    for (uint x = 0; x < 2; ++x) {
        for (uint y = 0; y < 2; ++y) {
            for (uint z = 0; z < 2; ++z) {
                block.cells[x][y][z].Clear();
                for (pSub & sub : cells[ix + x][iy + y][iz + z].GetSubs()) {
                    if (sub->GetType() == ACTIVE || sub->GetType() == MODIFIER) {
                        x == 0 ? --block.move[1] : --block.move[2];
                        y == 0 ? --block.move[3] : --block.move[4];
                        z == 0 ? --block.move[5] : --block.move[6];
                    }
                }
            }
        }
    }
    
    switch (rotate) {
        case ClockWiceX:
            for (uint x = 0; x < 2; ++x) {
                for (uint i = 0; i < 4; ++i) {
                    Cell cell = cells[ix + x][iy + indexF[i][0]][iz + indexF[i][1]];

                    if (cell.HaveSolid()) {
                        block.cells[x][indexF[i][0]][indexF[i][1]] = cell;
                    } else {
                        if (cell.HaveActive()) {
                            uint q = act ? 1 : 0;
                            for (pSub & sub : cell.GetSubs()) {
                                if (sub->GetType() == ACTIVE) {
                                    block.cells[x][indexF[i + q][0]][indexF[i + q][1]].AddSub(sub);
                                }
                            }
                        }

                        if (cell.HaveModifier()) {
                            if (mod) {
                                for (pSub & sub : cell.GetSubs()) {
                                    if (sub->GetType() == MODIFIER) {
                                        int u = 1;
                                        while (true) {
                                            if (cells[ix + x][iy + indexF[i + u][0]][iz + indexF[i + u][1]].HaveSolid()) {
                                                ++u;
                                            } else {
                                                block.cells[x][indexF[i + u][0]][indexF[i + u][1]].AddSub(sub);
                                                break;
                                            }
                                        }
                                    }
                                }
                            } else {
                                for (pSub & sub : cell.GetSubs()) {
                                    if (sub->GetType() == MODIFIER) {
                                        block.cells[x][indexF[i][0]][indexF[i][1]].AddSub(sub);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            break;
        case CounterClockWiceX:
            for (uint x = 0; x < 2; ++x) {
                for (uint i = 0; i < 4; ++i) {
                    Cell cell = cells[ix + x][iy + indexB[i][0]][iz + indexB[i][1]];

                    if (cell.HaveSolid()) {
                        block.cells[x][indexB[i][0]][indexB[i][1]] = cell;
                    } else {
                        if (cell.HaveActive()) {
                            uint q = act ? 1 : 0;
                            for (pSub & sub : cell.GetSubs()) {
                                if (sub->GetType() == ACTIVE) {
                                    block.cells[x][indexB[i + q][0]][indexB[i + q][1]].AddSub(sub);
                                }
                            }
                        }

                        if (cell.HaveModifier()) {
                            if (mod) {
                                for (pSub & sub : cell.GetSubs()) {
                                    if (sub->GetType() == MODIFIER) {
                                        int u = 1;
                                        while (true) {
                                            if (cells[ix+ x][iy + indexB[i + u][0]][iz + indexB[i + u][1]].HaveSolid()) {
                                                ++u;
                                            } else {
                                                block.cells[x][indexB[i + u][0]][indexB[i + u][1]].AddSub(sub);
                                                break;
                                            }
                                        }
                                    }
                                }
                            } else {
                                for (pSub & sub : cell.GetSubs()) {
                                    if (sub->GetType() == MODIFIER) {
//.........这里部分代码省略.........
开发者ID:igmit,项目名称:MargolusCA-src,代码行数:101,代码来源:margolus_base.cpp


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