blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 2 247 | content_id stringlengths 40 40 | detected_licenses listlengths 0 57 | license_type stringclasses 2 values | repo_name stringlengths 4 111 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 58 | visit_date timestamp[ns]date 2015-07-25 18:16:41 2023-09-06 10:45:08 | revision_date timestamp[ns]date 1970-01-14 14:03:36 2023-09-06 06:22:19 | committer_date timestamp[ns]date 1970-01-14 14:03:36 2023-09-06 06:22:19 | github_id int64 3.89k 689M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 25 values | gha_event_created_at timestamp[ns]date 2012-06-07 00:51:45 2023-09-14 21:58:52 ⌀ | gha_created_at timestamp[ns]date 2008-03-27 23:40:48 2023-08-24 19:49:39 ⌀ | gha_language stringclasses 159 values | src_encoding stringclasses 34 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 7 10.5M | extension stringclasses 111 values | filename stringlengths 1 195 | text stringlengths 7 10.5M |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
c566763956c2ffa12890f766373d5f2d7dcfc0aa | e49606a1b8462fc7df235e0220ee165315e7d765 | /src/game/scenes/Scene.h | d5c72fb5499f1e460f8e7d90253f47793cb239e3 | [
"MIT"
] | permissive | TheOpenSpaceProgram/new-ospgl | b761050d67f05109692ee872b1c3c67da20c78a1 | ece4d7628eb5d8fecac22c990769bbcf5d64c0fb | refs/heads/master | 2023-08-31T18:09:23.581949 | 2023-08-28T19:26:07 | 2023-08-28T19:26:07 | 215,908,160 | 42 | 8 | MIT | 2023-07-17T07:39:28 | 2019-10-18T00:16:25 | C++ | UTF-8 | C++ | false | false | 980 | h | Scene.h | #pragma once
#include <gui/GUIInput.h>
#include <gui/GUIScreen.h>
#include <string>
class OSP;
// Scenes handle user interaction with the universe, either via seeing
// and controlling vehicles or other task (creating vehicles, discovering technology...)
class Scene
{
public:
// A global GUI input is required for all screens (so they are compatible with each other and debug tools)
GUIInput gui_input;
// Called the frame the scene is loaded
virtual void load() = 0;
// It's your responsability to call universe->update(dt) (or not)
virtual void pre_update() = 0;
// Called after pre_update, so entities have already run 1 update! (If you called universe->update)
virtual void update() = 0;
// Called from bullet callback
virtual void physics_update(double bdt) = 0;
virtual void render() = 0;
// Called the frame the scene is unloaded
virtual void unload() = 0;
virtual void do_imgui_debug() = 0;
virtual std::string get_name() = 0;
virtual ~Scene() {}
};
|
2a384219bd592efab128534a103fcecaf20a5d49 | f69f0dd412077c970d7c2a6eb9269aa43da1a27a | /Enemy.h | cc46bd2d1f4db0e450647647d388a630af985d8b | [] | no_license | Saruntaey/TopDownGame | 14ff8762af7be30fcb9d327aa0d5c09588cea382 | 08e7e37d03d98c52b38cd16c637624232583d0fa | refs/heads/master | 2023-07-19T13:56:10.275306 | 2021-09-12T10:14:33 | 2021-09-12T10:14:33 | 405,597,272 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 740 | h | Enemy.h | #ifndef _ENEMY_H_
#define _ENEMY_H_
#include "raylib.h"
#include "raymath.h"
#include "character.h"
#include "Player.h"
#include "Hero.h"
class Enemy: public Player
{
public:
Enemy(Character *characterArr, Hero *hero_target, Vector2 pos);
virtual Vector2 getScreenPos() override;
virtual Vector2 getMapPos() override;
virtual void tick(float dT) override;
private:
Hero *target {nullptr};
void updatePos() override;
Vector2 distance;
// attack
float attack_radius {50.f};
float chase_radius {200.f};
float damage {5.f};
bool isDmgEffect {false};
// animateDeath
bool isAnimateDeath {false};
int animateCount {};
bool isCount {false};
};
#endif |
ff187248b12573be0599ebddca31638eab9d8652 | 07149121ce4292d1bead18e284047227fbe9c573 | /Source/Drivers/PS1080/Formats/XnFormatsMirror.cpp | 367de347311f4c817cafcac77853a6946eb93ee4 | [
"IJG",
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | PersonifyInc/OpenNI2 | 4f4ff3069fc57aecb28b88506789639cb32286f7 | a9fec0e8662dd06b0a379dd0d6d190f8cc4fa639 | refs/heads/master | 2020-04-05T22:45:24.632490 | 2020-02-14T09:27:38 | 2020-02-14T09:27:38 | 10,258,048 | 1 | 1 | Apache-2.0 | 2020-02-14T09:27:40 | 2013-05-24T02:47:24 | C++ | UTF-8 | C++ | false | false | 6,335 | cpp | XnFormatsMirror.cpp | /*****************************************************************************
* *
* OpenNI 2.x Alpha *
* Copyright (C) 2012 PrimeSense Ltd. *
* *
* This file is part of OpenNI. *
* *
* Licensed under the Apache License, Version 2.0 (the "License"); *
* you may not use this file except in compliance with the License. *
* You may obtain a copy of the License at *
* *
* http://www.apache.org/licenses/LICENSE-2.0 *
* *
* Unless required by applicable law or agreed to in writing, software *
* distributed under the License is distributed on an "AS IS" BASIS, *
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
* See the License for the specific language governing permissions and *
* limitations under the License. *
* *
*****************************************************************************/
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
#include <XnPlatform.h>
#include <XnCore.h>
#include "XnFormats.h"
#include <XnOS.h>
#include <XnLog.h>
//---------------------------------------------------------------------------
// Defines
//---------------------------------------------------------------------------
#define XN_MIRROR_MAX_LINE_SIZE 1920*3
//---------------------------------------------------------------------------
// Code
//---------------------------------------------------------------------------
XnStatus XnMirrorOneBytePixels(XnUChar* pBuffer, XnUInt32 nBufferSize, XnUInt32 nLineSize)
{
// Local function variables
XnUInt8* pSrc = pBuffer;
XnUInt8 pLineBuffer[XN_MIRROR_MAX_LINE_SIZE];
XnUInt8* pSrcEnd = pSrc + nBufferSize;
XnUInt8* pDest = NULL;
XnUInt8* pDestVal = &pLineBuffer[0] + nLineSize - 1;
XnUInt8* pDestEnd = &pLineBuffer[0] - 1;
if (nLineSize > XN_MIRROR_MAX_LINE_SIZE)
{
return (XN_STATUS_INTERNAL_BUFFER_TOO_SMALL);
}
while (pSrc < pSrcEnd)
{
xnOSMemCopy(pLineBuffer, pSrc, nLineSize);
pDest = pDestVal;
while (pDest != pDestEnd)
{
*pSrc = *pDest;
pSrc++;
pDest--;
}
}
// All is good...
return (XN_STATUS_OK);
}
XnStatus XnMirrorTwoBytePixels(XnUChar* pBuffer, XnUInt32 nBufferSize, XnUInt32 nLineSize)
{
// Local function variables
XnUInt16* pSrc = (XnUInt16*)pBuffer;
XnUInt16 pLineBuffer[XN_MIRROR_MAX_LINE_SIZE];
XnUInt16* pSrcEnd = pSrc + nBufferSize / sizeof(XnUInt16);
XnUInt16* pDest = NULL;
XnUInt16* pDestVal = &pLineBuffer[0] + nLineSize - 1;
XnUInt16* pDestEnd = &pLineBuffer[0] - 1;
XnUInt16 nMemCpyLineSize = (XnUInt16)(nLineSize * sizeof(XnUInt16));
XnUInt16 nValue;
if (nLineSize > XN_MIRROR_MAX_LINE_SIZE)
{
return (XN_STATUS_INTERNAL_BUFFER_TOO_SMALL);
}
while (pSrc < pSrcEnd)
{
xnOSMemCopy(pLineBuffer, pSrc, nMemCpyLineSize);
pDest = pDestVal;
while (pDest != pDestEnd)
{
nValue = pDest[0];
pSrc[0] = nValue;
pDest--;
pSrc++;
}
}
// All is good...
return (XN_STATUS_OK);
}
XnStatus XnMirrorThreeBytePixels(XnUChar* pBuffer, XnUInt32 nBufferSize, XnUInt32 nLineSize)
{
// Local function variables
XnUInt8* pSrc = pBuffer;
XnUInt8 pLineBuffer[XN_MIRROR_MAX_LINE_SIZE];
XnUInt8* pSrcEnd = pSrc + nBufferSize;
XnUInt8* pDest = NULL;
XnUInt8* pDestVal = &pLineBuffer[0] + nLineSize * 3 - 1;
XnUInt8* pDestEnd = &pLineBuffer[0] - 1;
XnUInt16 nMemCpyLineSize = (XnUInt16)(nLineSize * 3);
if (nMemCpyLineSize > XN_MIRROR_MAX_LINE_SIZE)
{
return (XN_STATUS_INTERNAL_BUFFER_TOO_SMALL);
}
while (pSrc < pSrcEnd)
{
xnOSMemCopy(pLineBuffer, pSrc, nMemCpyLineSize);
pDest = pDestVal;
while (pDest != pDestEnd)
{
*pSrc = *(pDest-2);
*(pSrc+1) = *(pDest-1);
*(pSrc+2) = *pDest;
pSrc+=3;
pDest-=3;
}
}
// All is good...
return (XN_STATUS_OK);
}
XnStatus XnMirrorYUV422Pixels(XnUChar* pBuffer, XnUInt32 nBufferSize, XnUInt32 nLineSize)
{
// Local function variables
XnUInt8* pSrc = pBuffer;
XnUInt8 pLineBuffer[XN_MIRROR_MAX_LINE_SIZE];
XnUInt8* pSrcEnd = (XnUInt8*)pSrc + nBufferSize;
XnUInt8* pDest = NULL;
XnUInt8* pDestVal = &pLineBuffer[(nLineSize/2-1)*sizeof(XnUInt32)]; // last element
XnUInt8* pDestEnd = &pLineBuffer[0]; // first element
XnUInt32 nMemCpyLineSize = nLineSize/2*sizeof(XnUInt32);
if (nMemCpyLineSize > XN_MIRROR_MAX_LINE_SIZE)
{
return (XN_STATUS_INTERNAL_BUFFER_TOO_SMALL);
}
while (pSrc < pSrcEnd)
{
xnOSMemCopy(pLineBuffer, pSrc, nMemCpyLineSize);
pDest = pDestVal;
while (pDest >= pDestEnd)
{
pSrc[0] = pDest[0]; // u
pSrc[1] = pDest[3]; // y1 <-> y2
pSrc[2] = pDest[2]; // v
pSrc[3] = pDest[1]; // y2 <-> y1
pSrc += 4;
pDest -= 4;
}
}
// All is good...
return (XN_STATUS_OK);
}
XnStatus XnFormatsMirrorPixelData(OniPixelFormat nOutputFormat, XnUChar* pBuffer, XnUInt32 nBufferSize, XnUInt32 nXRes)
{
// Validate the input/output pointers (to make sure none of them is NULL)
XN_VALIDATE_INPUT_PTR(pBuffer);
switch (nOutputFormat)
{
case ONI_PIXEL_FORMAT_SHIFT_9_2:
case ONI_PIXEL_FORMAT_DEPTH_1_MM:
case ONI_PIXEL_FORMAT_DEPTH_100_UM:
case ONI_PIXEL_FORMAT_GRAY16:
return XnMirrorTwoBytePixels(pBuffer, nBufferSize, nXRes);
case ONI_PIXEL_FORMAT_GRAY8:
return XnMirrorOneBytePixels(pBuffer, nBufferSize, nXRes);
case ONI_PIXEL_FORMAT_YUV422:
return XnMirrorYUV422Pixels(pBuffer, nBufferSize, nXRes);
case ONI_PIXEL_FORMAT_RGB888:
return XnMirrorThreeBytePixels(pBuffer, nBufferSize, nXRes);
default:
xnLogError(XN_MASK_FORMATS, "Mirror was not implemented for output format %d", nOutputFormat);
XN_ASSERT(FALSE);
return XN_STATUS_ERROR;
}
}
|
f4632be7908708fdd60675684c080f3daab6db7e | 8d9c5e6d67fa09d47e861b5f770f24beea2cb83f | /matrix/Multiplicable.hpp | fa99646c73d9062d81ca97df5260505c9b130407 | [] | no_license | Oleg-E-Bakharev/matrix | 2571321a456e3f9d60e5ad708bb8baf9bb7d26d7 | e349d6dcdc36489953819f37e855343bdbcbde85 | refs/heads/master | 2020-03-10T14:45:28.895002 | 2018-05-08T16:50:42 | 2018-05-08T16:50:42 | 129,434,266 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,474 | hpp | Multiplicable.hpp | //
// Multiplicable.h
// matrix
//
// Created by Oleg Bakharev on 17/04/2018.
// Copyright © 2018 Oleg Bakharev. All rights reserved.
//
// Аспект для перемножения
#ifndef Multiplicable_h
#define Multiplicable_h
#include <assert.h>
template <class Vector> class VectorMultiplicable {
public:
template <class Other>
// Не можем использовать Vector::instance_type отому что мы база Vector, но можем использовать Other::value_type.
friend typename Other::value_type operator*(const Vector& v, const Other& o) {
typename Vector::value_type result = 0;
for (size_t i = 0; i < v.size(); i++) {
result += v[i] * o[i];
}
return result;
}
};
template <class Matrix> class MatrixMultiplicable {
public:
template <class Other>
// Не можем использовать Matrix::instance_type отому что мы база Matrix, но можем использовать Other::instance_type.
friend typename Other::instance_type operator*(const Matrix& m, const Other& o) {
assert(m.width() == o.height());
typename Matrix::instance_type result(m.height(), o.width());
for (size_t i = 0; i < m.height(); i++) {
for (size_t j = 0; j < o.width(); j++) {
result[i][j] = m.row(i) * o.col(j);
}
}
return result;
}
};
#endif /* Multiplicable_h */
|
9dd238d02839f58cc3bc722202f71f642e6ecff6 | 1c63f13d977ee78542c30e6e7066db6fb0b5f680 | /07-C++模板/04-让模板能够根据具体的类型调用不同的算法(显示具体化)/04-让模板能够根据具体的类型调用不同的算法(显示具体化)/main.cpp | a17c47ada37d8d85e8129fde00356bb2c3224508 | [
"Apache-2.0"
] | permissive | yongdaimi/cpp | 32ab7ab4bf3b4c5fdafecfd0a048988fa6abc700 | fdc4102b8a028a34ae8dcbc85d0ebe7b9923ae09 | refs/heads/master | 2020-03-18T02:54:27.788739 | 2018-09-05T02:32:37 | 2018-09-05T02:32:37 | 134,213,070 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 856 | cpp | main.cpp | #include <iostream>
#include <string>
#include <stdlib.h>
using namespace std;
typedef struct
{
string name;
int age;
float score;
} STU;
template<class T> const T& Max(const T &a, const T &b);
template<> const STU& Max(const STU &a, const STU &b);
ostream & operator<<(ostream &out, const STU &stu);
int main01()
{
int a = 10, b = 20;
cout << Max(a, b) << endl;
STU stu1 = {"xp.chen", 20, 95.5};
STU stu2 = {"hy.gao", 19, 94.5};
cout << Max(stu1, stu2) << endl;
system("pause");
return 0;
}
template<class T> const T& Max(const T &a, const T &b)
{
return a > b ? a : b;
}
template<> const STU& Max(const STU &a, const STU &b)
{
return a.score > b.score ? a : b;
}
ostream & operator<<(ostream &out, const STU &stu)
{
cout << stu.name << ", " << stu.age << ", " << stu.score << endl;
return cout;
}
|
4aae9a68e69c67280a069d6e9c3fe7e469f3bc7a | 51f08e2fc0b3a24377737a33727def8a4da89b76 | /src/ECS/Components/AnimationComponent.cpp | 46c7bd90462a970fd61b99e70fcc5c9a112472ce | [
"MIT"
] | permissive | InversePalindrome/ProceduralX | bf820373247d4341732b57cf17f62a004a75e2d6 | f53d734970be4300f06db295d25e1a012b1a8fd9 | refs/heads/master | 2020-12-29T11:36:06.410204 | 2020-05-11T21:38:12 | 2020-05-11T21:38:12 | 238,593,940 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,691 | cpp | AnimationComponent.cpp | /*
Copyright (c) 2020 Inverse Palindrome
ProceduralX - ECS/Components/AnimationComponent.cpp
https://inversepalindrome.com/
*/
#include "ECS/Components/AnimationComponent.hpp"
void ECS::Components::AnimationComponent::update(const sf::Time& deltaTime)
{
animator.update(deltaTime);
}
void ECS::Components::AnimationComponent::animate(sf::Sprite& sprite)
{
animator.animate(sprite);
}
void ECS::Components::AnimationComponent::playAnimation(State state)
{
animator.playAnimation(state, animationMap[state].loop);
}
void ECS::Components::AnimationComponent::stopAnimation()
{
animator.stopAnimation();
}
void ECS::Components::AnimationComponent::addAnimation(State state, const std::function<void(sf::Sprite&, float)>& animation,
const AnimationData& animationData)
{
animationMap[state] = animationData;
animator.addAnimation(state, animation, sf::seconds(animationData.duration.count()));
}
bool ECS::Components::AnimationComponent::isPlayingAnimation() const
{
return animator.isPlayingAnimation();
}
bool ECS::Components::AnimationComponent::hasAnimation(State state) const
{
return animationMap.count(state);
}
ECS::Components::AnimationComponent::Iterator ECS::Components::AnimationComponent::begin()
{
return animationMap.begin();
}
ECS::Components::AnimationComponent::Iterator ECS::Components::AnimationComponent::end()
{
return animationMap.end();
}
ECS::Components::AnimationComponent::ConstIterator ECS::Components::AnimationComponent::begin() const
{
return animationMap.cbegin();
}
ECS::Components::AnimationComponent::ConstIterator ECS::Components::AnimationComponent::end() const
{
return animationMap.cend();
} |
de63eed959a9511ea4358ef3e0937fdf38544c08 | 00f1cfc73ba05f72373fbdfd303f6f34dd3a533e | /JLJcore.m/src/hashfunc.cpp | 25849e2eb1c5d46c863baaac9c705a3be957fbb4 | [] | no_license | weltermann17/just-like-java | 07c7f6164d636688f9d09cdc8421e51d84fdb25f | 6517f1c1015e0b17a023b1b475fcc2f3eed9bade | refs/heads/master | 2020-06-06T08:32:13.367694 | 2014-07-01T21:19:06 | 2014-07-01T21:19:06 | 21,002,059 | 4 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 15,740 | cpp | hashfunc.cpp | // hashfunc.cpp
//********************************************************************
#ifndef hashfunc_cpp
#define hashfunc_cpp
//********************************************************************
#include <jlj/core/hashing/hashfunc.h>
//********************************************************************
/*
--------------------------------------------------------------------
lookup2.c, by Bob Jenkins, December 1996, Public Domain.
hash1(), hash2(), hash3, and mix() are externally useful functions.
Routines to test the hash are included if SELF_TEST is defined.
You can use this free for any purpose. It has no warranty.
--------------------------------------------------------------------
*/
#undef SELF_TEST
#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>
//********************************************************************
NAMESPACE_BEGIN(jlj)
NAMESPACE_BEGIN(core)
NAMESPACE_BEGIN(hashing)
//********************************************************************
#define hashsize(n) ((unsigned long)1<<(n))
#define hashmask(n) (hashsize(n)-1)
//********************************************************************
extern const int HASHMAXSIGNIFICANTLENGTH = 80;
//********************************************************************
/*
--------------------------------------------------------------------
mix -- mix 3 32-bit values reversibly.
For every delta with one or two bit set, and the deltas of all three
high bits or all three low bits, whether the original value of a,b,c
is almost all zero or is uniformly distributed,
* If mix() is run forward or backward, at least 32 bits in a,b,c
have at least 1/4 probability of changing.
* If mix() is run forward, every bit of c will change between 1/3 and
2/3 of the time. (Well, 22/100 and 78/100 for some 2-bit deltas.)
mix() was built out of 36 single-cycle latency instructions in a
structure that could supported 2x parallelism, like so:
a -= b;
a -= c; x = (c>>13);
b -= c; a ^= x;
b -= a; x = (a<<8);
c -= a; b ^= x;
c -= b; x = (b>>13);
...
Unfortunately, superscalar Pentiums and Sparcs can't take advantage
of that parallelism. They've also turned some of those single-cycle
latency instructions into multi-cycle latency instructions. Still,
this is the fastest good hash I could find. There were about 2^^68
to choose from. I only looked at a billion or so.
--------------------------------------------------------------------
*/
#define mix(a,b,c) \
{ \
a -= b; a -= c; a ^= (c>>13); \
b -= c; b -= a; b ^= (a<<8); \
c -= a; c -= b; c ^= (b>>13); \
a -= b; a -= c; a ^= (c>>12); \
b -= c; b -= a; b ^= (a<<16); \
c -= a; c -= b; c ^= (b>>5); \
a -= b; a -= c; a ^= (c>>3); \
b -= c; b -= a; b ^= (a<<10); \
c -= a; c -= b; c ^= (b>>15); \
}
/* same, but slower, works on systems that might have 8 byte unsigned long's */
#define mix2(a,b,c) \
{ \
a -= b; a -= c; a ^= (c>>13); \
b -= c; b -= a; b ^= (a<< 8); \
c -= a; c -= b; c ^= ((b&0xffffffff)>>13); \
a -= b; a -= c; a ^= ((c&0xffffffff)>>12); \
b -= c; b -= a; b = (b ^ (a<<16)) & 0xffffffff; \
c -= a; c -= b; c = (c ^ (b>> 5)) & 0xffffffff; \
a -= b; a -= c; a = (a ^ (c>> 3)) & 0xffffffff; \
b -= c; b -= a; b = (b ^ (a<<10)) & 0xffffffff; \
c -= a; c -= b; c = (c ^ (b>>15)) & 0xffffffff; \
}
//********************************************************************
/*
--------------------------------------------------------------------
hash1() -- hash a variable-length key into a 32-bit value
k : the key (the unaligned variable-length array of bytes)
len : the length of the key, counting by bytes
level : can be any 4-byte value
Returns a 32-bit value. Every bit of the key affects every bit of
the return value. Every 1-bit and 2-bit delta achieves avalanche.
About 36+6len instructions.
The best hash table sizes are powers of 2. There is no need to do
mod a prime (mod is sooo slow!). If you need less than 32 bits,
use a bitmask. For example, if you need only 10 bits, do
h = (h & hashmask(10));
In which case, the hash table should have hashsize(10) elements.
If you are hashing n strings (unsigned char **)k, do it like this:
for (i=0, h=0; i<n; ++i) h = hash( k[i], len[i], h);
By Bob Jenkins, 1996. bob_jenkins@burtleburtle.net. You may use this
code any way you wish, private, educational, or commercial. It's free.
See http://burlteburtle.net/bob/hash/evahash.html
Use for hash table lookup, or anything where one collision in 2^32 is
acceptable. Do NOT use for cryptographic purposes.
--------------------------------------------------------------------
*/
#ifdef WIN32
unsigned long int hash3(unsigned char *k,
unsigned long int length,
unsigned long int step,
unsigned long int initvalue);
#endif
unsigned long hash1(unsigned char *k, /* the key */
unsigned long length, /* the length of the key */
unsigned long step, /* step over in unsigned longs */
unsigned long initval) /* the previous hash, or an arbitrary value */
{
#ifdef WIN32
return hash3(k, length, step, initval);
#else
if (0 == k || 0 == length || 0 == step) return 0;
unsigned long a,b,c,len;
/* Set up the internal state */
len = length;
a = b = 0x9e3779b9; /* the golden ratio; an arbitrary value */
c = initval; /* the previous hash value */
/*---------------------------------------- handle most of the key */
while (len >= step * 12)
{
a += (k[0] +((unsigned long)k[1]<<8) +((unsigned long)k[2]<<16) +((unsigned long)k[3]<<24));
b += (k[4] +((unsigned long)k[5]<<8) +((unsigned long)k[6]<<16) +((unsigned long)k[7]<<24));
c += (k[8] +((unsigned long)k[9]<<8) +((unsigned long)k[10]<<16)+((unsigned long)k[11]<<24));
mix(a,b,c);
k += step * 12;
len -= step * 12;
}
/*------------------------------------- handle the last 11 bytes */
c += length;
switch(len) /* all the case statements fall through */
{
case 11: c+=((unsigned long)k[10]<<24);
case 10: c+=((unsigned long)k[9]<<16);
case 9 : c+=((unsigned long)k[8]<<8);
/* the first byte of c is reserved for the length */
case 8 : b+=((unsigned long)k[7]<<24);
case 7 : b+=((unsigned long)k[6]<<16);
case 6 : b+=((unsigned long)k[5]<<8);
case 5 : b+=k[4];
case 4 : a+=((unsigned long)k[3]<<24);
case 3 : a+=((unsigned long)k[2]<<16);
case 2 : a+=((unsigned long)k[1]<<8);
case 1 : a+=k[0];
/* case 0: nothing left to add */
}
mix(a,b,c);
/*-------------------------------------------- report the result */
return c;
#endif
}
/*
--------------------------------------------------------------------
This works on all machines. hash2() is identical to hash1() on
little-endian machines, except that the length has to be measured
in unsigned longs instead of bytes. It is much faster than hash1(). It
requires
-- that the key be an array of unsigned long's, and
-- that all your machines have the same endianness, and
-- that the length be the number of unsigned long's in the key
--------------------------------------------------------------------
*/
unsigned long hash2(unsigned long *k, /* the key */
unsigned long length, /* the length of the key, in unsigned longs */
unsigned long step, /* step over in unsigned longs */
unsigned long initval) /* the previous hash, or an arbitrary value */
{
if (0 == k || 0 == length || 0 == step) return 0;
unsigned long a,b,c,len;
/* Set up the internal state */
len = length;
a = b = 0x9e3779b9; /* the golden ratio; an arbitrary value */
c = initval; /* the previous hash value */
/*---------------------------------------- handle most of the key */
while (len >= step * 3)
{
a += k[0];
b += k[1];
c += k[2];
mix(a,b,c);
k += step * 3;
len -= step * 3;
}
/*-------------------------------------- handle the last 2 unsigned long's */
c += length;
switch(len) /* all the case statements fall through */
{
/* c is reserved for the length */
case 2 : b+=k[1];
case 1 : a+=k[0];
/* case 0: nothing left to add */
}
mix(a,b,c);
/*-------------------------------------------- report the result */
return c;
}
/*
--------------------------------------------------------------------
This is identical to hash1() on little-endian machines (like Intel
x86s or VAXen). It gives nondeterministic results on big-endian
machines. It is faster than hash1(), but a little slower than
hash2(), and it requires
-- that all your machines be little-endian
--------------------------------------------------------------------
*/
#ifdef WIN32
unsigned long hash3(unsigned char *k, /* the key */
unsigned long length, /* the length of the key */
unsigned long step, /* step over in unsigned longs */
unsigned long initval) /* the previous hash, or an arbitrary value */
{
if (0 == k || 0 == length || 0 == step) return 0;
unsigned long a,b,c,len;
/* Set up the internal state */
len = length;
a = b = 0x9e3779b9; /* the golden ratio; an arbitrary value */
c = initval; /* the previous hash value */
/*---------------------------------------- handle most of the key */
#ifdef WIN32
intptr_t kk = (intptr_t) k;
if (kk&3)
#else
if (((unsigned long)k)&3)
#endif
{
while (len >= step * 12) /* unaligned */
{
a += (k[0] +((unsigned long)k[1]<<8) +((unsigned long)k[2]<<16) +((unsigned long)k[3]<<24));
b += (k[4] +((unsigned long)k[5]<<8) +((unsigned long)k[6]<<16) +((unsigned long)k[7]<<24));
c += (k[8] +((unsigned long)k[9]<<8) +((unsigned long)k[10]<<16)+((unsigned long)k[11]<<24));
mix(a,b,c);
k += step * 12;
len -= step * 12;
}
}
else
{
while (len >= step * 12) /* aligned */
{
a += *(unsigned long *)(k+0);
b += *(unsigned long *)(k+4);
c += *(unsigned long *)(k+8);
mix(a,b,c);
k += step * 12;
len -= step * 12;
}
}
/*------------------------------------- handle the last 11 bytes */
c += length;
switch(len) /* all the case statements fall through */
{
case 11: c+=((unsigned long)k[10]<<24);
case 10: c+=((unsigned long)k[9]<<16);
case 9 : c+=((unsigned long)k[8]<<8);
/* the first byte of c is reserved for the length */
case 8 : b+=((unsigned long)k[7]<<24);
case 7 : b+=((unsigned long)k[6]<<16);
case 6 : b+=((unsigned long)k[5]<<8);
case 5 : b+=k[4];
case 4 : a+=((unsigned long)k[3]<<24);
case 3 : a+=((unsigned long)k[2]<<16);
case 2 : a+=((unsigned long)k[1]<<8);
case 1 : a+=k[0];
/* case 0: nothing left to add */
}
mix(a,b,c);
/*-------------------------------------------- report the result */
return c;
}
#endif
#undef SELF_TEST
#ifdef SELF_TEST
/* used for timings */
void driver1()
{
unsigned long buf[256];
unsigned long i;
unsigned long h=0;
for (i=0; i<256; ++i)
{
h = hash(buf,i,h);
}
}
/* check that every input bit changes every output bit half the time */
#define HASHSTATE 1
#define HASHLEN 1
#define MAXPAIR 80
#define MAXLEN 70
void driver2()
{
unsigned char qa[MAXLEN+1], qb[MAXLEN+2], *a = &qa[0], *b = &qb[1];
unsigned long c[HASHSTATE], d[HASHSTATE], i, j=0, k, l, m, z;
unsigned long e[HASHSTATE],f[HASHSTATE],g[HASHSTATE],h[HASHSTATE];
unsigned long x[HASHSTATE],y[HASHSTATE];
unsigned long hlen;
printf("No more than %d trials should ever be needed \n",MAXPAIR/2);
for (hlen=0; hlen < MAXLEN; ++hlen)
{
z=0;
for (i=0; i<hlen; ++i) /*----------------------- for each input byte, */
{
for (j=0; j<8; ++j) /*------------------------ for each input bit, */
{
for (m=1; m<8; ++m) /*------------ for serveral possible initvals, */
{
for (l=0; l<HASHSTATE; ++l) e[l]=f[l]=g[l]=h[l]=x[l]=y[l]=~((unsigned long)0);
/*---- check that every output bit is affected by that input bit */
for (k=0; k<MAXPAIR; k+=2)
{
unsigned long finished=1;
/* keys have one bit different */
for (l=0; l<hlen+1; ++l) {a[l] = b[l] = (unsigned char)0;}
/* have a and b be two keys differing in only one bit */
a[i] ^= (k<<j);
a[i] ^= (k>>(8-j));
c[0] = hash(a, hlen, m);
b[i] ^= ((k+1)<<j);
b[i] ^= ((k+1)>>(8-j));
d[0] = hash(b, hlen, m);
/* check every bit is 1, 0, set, and not set at least once */
for (l=0; l<HASHSTATE; ++l)
{
e[l] &= (c[l]^d[l]);
f[l] &= ~(c[l]^d[l]);
g[l] &= c[l];
h[l] &= ~c[l];
x[l] &= d[l];
y[l] &= ~d[l];
if (e[l]|f[l]|g[l]|h[l]|x[l]|y[l]) finished=0;
}
if (finished) break;
}
if (k>z) z=k;
if (k==MAXPAIR)
{
printf("Some bit didn't change: ");
printf("%.8lx %.8lx %.8lx %.8lx %.8lx %.8lx ",
e[0],f[0],g[0],h[0],x[0],y[0]);
printf("i %ld j %ld m %ld len %ld\n",i,j,m,hlen);
}
if (z==MAXPAIR) goto done;
}
}
}
done:
if (z < MAXPAIR)
{
printf("Mix success %2ld bytes %2ld initvals ",i,m);
printf("required %ld trials\n",z/2);
}
}
printf("\n");
}
/* Check for reading beyond the end of the buffer and alignment problems */
void driver3()
{
unsigned char buf[MAXLEN+20], *b;
unsigned long len;
unsigned char q[] = "This is the time for all good men to come to the aid of their country";
unsigned char qq[] = "xThis is the time for all good men to come to the aid of their country";
unsigned char qqq[] = "xxThis is the time for all good men to come to the aid of their country";
unsigned char qqqq[] = "xxxThis is the time for all good men to come to the aid of their country";
unsigned long h,i,j,ref,x,y;
printf("Endianness. These should all be the same:\n");
printf("%.8lx\n", hash(q, sizeof(q)-1, (unsigned long)0));
printf("%.8lx\n", hash(qq+1, sizeof(q)-1, (unsigned long)0));
printf("%.8lx\n", hash(qqq+2, sizeof(q)-1, (unsigned long)0));
printf("%.8lx\n", hash(qqqq+3, sizeof(q)-1, (unsigned long)0));
printf("\n");
for (h=0, b=buf+1; h<8; ++h, ++b)
{
for (i=0; i<MAXLEN; ++i)
{
len = i;
for (j=0; j<i; ++j) *(b+j)=0;
/* these should all be equal */
ref = hash(b, len, (unsigned long)1);
*(b+i)=(unsigned char)~0;
*(b-1)=(unsigned char)~0;
x = hash(b, len, (unsigned long)1);
y = hash(b, len, (unsigned long)1);
if ((ref != x) || (ref != y))
{
printf("alignment error: %.8lx %.8lx %.8lx %ld %ld\n",ref,x,y,h,i);
}
}
}
}
/* check for problems with nulls */
void driver4()
{
unsigned char buf[1];
unsigned long h,i,state[HASHSTATE];
buf[0] = ~0;
for (i=0; i<HASHSTATE; ++i) state[i] = 1;
printf("These should all be different\n");
for (i=0, h=0; i<8; ++i)
{
h = hash(buf, (unsigned long)0, h);
printf("%2ld 0-byte strings, hash is %.8lx\n", i, h);
}
}
int testdriver()
{
driver1(); /* test that the key is hashed: used for timings */
driver2(); /* test that whole key is hashed thoroughly */
driver3(); /* test that nothing but the key is hashed */
driver4(); /* test hashing multiple buffers (all buffers are null) */
return 1;
}
#endif /* SELF_TEST */
//********************************************************************
NAMESPACE_END(hashing)
NAMESPACE_END(core)
NAMESPACE_END(jlj)
//********************************************************************
#endif
// eof
|
f4c716d7b43ff2a60af708019590e42979ccbd87 | d2fb039690e969555f73aa0a1d7a54ad66c40025 | /myveclist/test.hpp | 3df5d489d750edd386c6f665b34b2d41ed639b31 | [
"MIT"
] | permissive | mibzman/DataStructures | 9c87b24c9dbe48bfba5166085666c788b83a2eb7 | 213060b060a46b22d49dc1108e57db2a1ae9cf8d | refs/heads/master | 2021-03-22T03:07:09.767614 | 2017-01-21T03:33:14 | 2017-01-21T03:33:14 | 68,960,938 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 353 | hpp | test.hpp | // Copyright (C) 2016 Andrew Sutton
// All rights reserved.
#ifndef Test_HPP
#define Test_HPP
// Define the maximum number of elements for the test.
constexpr int N = 50000;
// Defines the "step" size of the test. The test starts with an initial
// data size of S, and increments that value by S until N is reached.
constexpr int S = 1000;
#endif
|
bd2e7c8bf2d45f890a3450c1e193341e66eb8e9f | 253034b631a5d2f7af8ffa74f6dbe312317613bb | /chassis.cpp | dd2e6a3bf1872de1e2518abe2bb49af926083e4c | [] | no_license | evaneliasyoung/cgoggles | 23467950e9678b792e4acccdd37610387d8aac36 | 290d2616d6425bc9e8cc1cf66d2073971d941296 | refs/heads/master | 2021-06-21T09:22:17.927575 | 2020-02-29T23:59:38 | 2020-02-29T23:59:38 | 175,095,454 | 0 | 3 | null | null | null | null | UTF-8 | C++ | false | false | 3,920 | cpp | chassis.cpp | /**
* @file chassis.cpp
* @brief The implementation for the Chassis class.
*
* @author Evan Elias Young
* @date 2019-09-11
* @date 2020-02-28
* @copyright Copyright 2019-2020 Evan Elias Young. All rights reserved.
*/
#include "pch.h"
#include "chassis.h"
#include "os.h"
#pragma region "Constructors"
/**
* @brief Construct a new Chassis object
*/
Chassis::Chassis()
{
manufacturer = "";
model = "";
type = "";
version = "";
serial = "";
assetTag = "";
}
/**
* @brief Construct a new Chassis object
*
* @param plt The platform of the system
*/
Chassis::Chassis(std::uint8_t plt)
{
manufacturer = "";
model = "";
type = "";
version = "";
serial = "";
assetTag = "";
switch (plt)
{
case OS_WIN:
GetWin();
break;
case OS_MAC:
GetMac();
break;
case OS_LUX:
GetLux();
break;
}
}
/**
* @brief Construct a new Chassis object from another Chassis object
*
* @param o The Chassis object to copy from
*/
Chassis::Chassis(const Chassis &o)
{
manufacturer = o.manufacturer;
type = o.type;
model = o.model;
version = o.version;
serial = o.serial;
assetTag = o.assetTag;
}
#pragma endregion "Contructors"
#pragma region "Constructors' Assistants"
/**
* @brief Fills in the OS information for Darwin systems
*/
void Chassis::GetMac() {}
/**
* @brief Fills in the OS information for Windows systems
*/
void Chassis::GetWin()
{
std::string wmic = getWmicPath();
std::map<std::string, std::string> dataMap = runMultiWmic("path Win32_SystemEnclosure get Manufacturer,Model,ChassisTypes,Version,SerialNumber,PartNumber", &wmic);
std::smatch mt;
std::string *cases = new std::string[36]{
"Other",
"Unknown",
"Desktop",
"Low Profile Desktop",
"Pizza Box",
"Mini Tower",
"Tower",
"Portable",
"Laptop",
"Notebook",
"Hand Held",
"Docking Station",
"All in One",
"Sub Notebook",
"Space-Saving",
"Lunch Box",
"Main System Chassis",
"Expansion Chassis",
"SubChassis",
"Bus Expansion Chassis",
"Peripheral Chassis",
"Storage Chassis",
"Rack Mount Chassis",
"Sealed-Case PC",
"Multi-System Chassis",
"Compact PCI",
"Advanced TCA",
"Blade",
"Blade Enclosure",
"Tablet",
"Concertible",
"Detachable",
"IoT Gateway ",
"Embedded PC",
"Mini PC",
"Stick PC"};
std::string temp = dataMap["ChassisTypes"];
if (std::regex_search(temp, mt, std::regex(R"((\d+))", std::regex_constants::ECMAScript | std::regex_constants::icase)))
{
type = cases[std::stoi(mt[1]) - 1];
}
else
{
type = "Unknown";
}
manufacturer = dataMap["Manufacturer"];
model = dataMap["Model"];
version = dataMap["Version"];
serial = dataMap["SerialNumber"];
assetTag = dataMap["PartNumber"];
}
/**
* @brief Fills in the OS information for Linux systems
*/
void Chassis::GetLux() {}
#pragma endregion "Constructors' Assistants"
#pragma region "Operators"
/**
* @brief Reserves memory for a new Chassis object
*
* @param size The amount of memory to allocate
* @return void* A pointer to the allocated memory
*/
void *Chassis::operator new(std::size_t size)
{
void *o = ::new (Chassis);
return o;
}
/**
* @brief Sets equal two Chassis objects
*
* @param o The Chassis object to copy from
*/
void Chassis::operator=(const Chassis &o)
{
if (&o == this)
{
return;
}
manufacturer = o.manufacturer;
model = o.model;
type = o.type;
version = o.version;
serial = o.serial;
assetTag = o.assetTag;
}
/**
* @brief Sets equal two Chassis objects
*
* @param o The Chassis object to copy from
*/
void Chassis::operator=(Chassis *o)
{
manufacturer = o->manufacturer;
model = o->model;
type = o->type;
version = o->version;
serial = o->serial;
assetTag = o->assetTag;
}
#pragma endregion "Operators"
|
89306c44a355e835e667347983eea2108fa1e0b3 | d60e4f98f5959da43769bebbc1dcbe9251402515 | /P028/main.cpp | 97fa320c74845cf5108beeb497594541e6efe9ff | [] | no_license | lepatrick714/Euler | 1ef370407a42216ef92043fb68e708b8dd7bee48 | dfa27e40833bd16b8987b5cc46909c81360fc8fe | refs/heads/master | 2021-01-20T19:50:14.245950 | 2016-08-19T05:14:03 | 2016-08-19T05:14:03 | 61,683,898 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 943 | cpp | main.cpp | #include <iostream>
#include <chrono>
#include <ctime>
using namespace std;
void sumOfDiagonals(const int limita) {
int result = 1;
int current = 1;
int numRows = 1;
int ctr = 2;
int times = 0;
while(numRows != limita) {
current+=ctr;
result += current;
times++;
if(times == 4) {
times = 0;
ctr+=2;
numRows+=2;
}
}
cout << "The sum of a " << numRows << "x" << numRows << " is: " << result << endl;
}
int main(int argc, const char**argv) {
typedef chrono::high_resolution_clock Clock;
int limit = 1;
cout << "Please enter the number of rows: ";
cin >> limit;
cout << endl;
auto t1 = Clock::now();
sumOfDiagonals(limit);
auto t2 = Clock::now();
chrono::milliseconds ns = chrono::duration_cast<chrono::milliseconds>(t2-t1);
cout << ns.count() << " milliseconds" << endl;
return 0;
}
|
c24ae8b3b1f28847ffb87aa892681c27d67c6be5 | 32ad7faee067506d4738c1b08dafb1e528466824 | /Nifty Mountain Paths/main.cpp | fdc0ad3bbed6809eb9780296b03e8a4df21337e3 | [] | no_license | muhwang12/ICS4U | 4809953c7eaa106e82b92bc3e32744136fd786bf | 6cba223a284b7feb7e71e416a6e5af06871f1413 | refs/heads/master | 2022-02-07T07:43:50.562849 | 2019-08-02T00:55:01 | 2019-08-02T00:55:01 | 104,916,988 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 18,828 | cpp | main.cpp | /*****************************************************************************
* Name: Matthew Wang *
* *
* Date: September 20, 2017 *
* *
* Purpose: To map out a topographical map corresponding to a data *
* file that gives the elevations of each point. To also *
* use said elevation values to map out different paths to *
* take from east to west that try to change the least in *
* elevation. *
* *
* Usage: First, type in the algorithm you would like to use. *
* The program will then output red paths and their *
* corresponding information. Finally, the path with *
* the least changes will be outlined in green. *
* *
* Revision History: *
* *
* Known Issues: *
* *
*****************************************************************************/
#include <iostream>
#include <fstream>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <apmatrix.h>
#include <allegro5/allegro.h> // For allegro, must be in compiler search path.
#include <allegro5/allegro_native_dialog.h> // for message box
#include <allegro5/allegro_primitives.h>
#include <allegro5/allegro_ttf.h>
#include <allegro5/allegro_font.h>
#include <random>
#define RED al_map_rgb(255, 0, 0)
#define GREEN al_map_rgb(0, 255, 0)
//Constant global variables
const int mapW_c = 844;
const int mapH_c = 480;
const char fileName_c[] = "Colorado_844x480.dat";
ALLEGRO_DISPLAY *printedMap = nullptr;
using namespace std;
//Prototypes
bool MapDataDrawer(apmatrix<short> &map);
short findMin(apmatrix<short> map);
short findMax(apmatrix<short> map);
void drawMap(apmatrix<short> map, short lowestElevation, short highestElevation);
int drawPath(apmatrix<short> &map, int startRow, apvector<int> &pathCols);
int drawAllPaths(apmatrix<short> map, int algorithm);
void printElevation(short lowestElevation, int algorithm, int elevChange);
int drawDownhillPath(apmatrix<short> &map, int startRow,
apvector<int> &path, int &lowestElevPoint, int &lowestCol);
//main function
int main(int argc, char *argv[]) {
//Declaring Variables
apmatrix<short> map (mapH_c, mapW_c, 0);
short minElev = 0;
short maxElev = 0;
int decision = -1;
// Initialize Allegro
al_init();
// Initialize display
printedMap = al_create_display(mapW_c, mapH_c);
// Always check if your allegro routines worked successfully.
if (!printedMap) {
al_show_native_message_box(printedMap, "Error", "Error", "Failed to initialize display!",
nullptr, ALLEGRO_MESSAGEBOX_ERROR);
return -1;
}
bool readFile = MapDataDrawer(map);
if (readFile == false){
cerr << "File failed to read data into map matrix variable";
}
//Finds highest and lowest elevations
maxElev = findMax(map);
cout << "The highest point is " << maxElev << " m." << endl;
minElev = findMin(map);
cout << "The lowest point is " << minElev << " m." << endl;
//Input algorithm choice
while(decision != 0 && decision != 1) {
cout << "Choose your algorithm"
<< " (Type 0 for Greedy Algorithm and type 1 for Downhill Algorithm)"
<< ": ";
cin >> decision;
}
drawMap(map, minElev, maxElev);
int total = drawAllPaths(map, decision);
printElevation(minElev, decision, total);
al_flip_display();
al_rest(100);
// Exit with no errors
return 0;
}
//Reads data from given file into a 2D array (an apmatrix)
bool MapDataDrawer(apmatrix<short> &map)
{
ifstream fileIn;
fileIn.open(fileName_c);
if (!fileIn){
cerr << "Unable to open file";
return false;
}
else {
for (int i = 0; i < map.numrows(); i++){
for (int j = 0; j < map.numcols(); j++){
fileIn >> map[i][j];
}
}
}
fileIn.close();
return true;
}
//Returns the minimum elevation value in the map
short findMin(apmatrix<short> map)
{
short temp = map[0][0];
for (int i = 0; i < map.numrows(); i++){
for (int j = 0; j < map.numcols(); j++){
if (temp > map[i][j]){
temp = map[i][j];
}
}
}
return temp;
}
//Returns the maximum elevation value in the map
short findMax(apmatrix<short> map)
{
short temp = 0;
for (int i = 0; i < map.numrows(); i++){
for (int j = 0; j < map.numcols(); j++){
if (temp < map[i][j]) {
temp = map[i][j];
}
}
}
return temp;
}
//Draws map based on elevation values and their ratio to the highest elevation
void drawMap(apmatrix<short> map, short lowestElevation, short highestElevation)
{
const short maxColorValue_c = 255;
// Monochrome Version
/*float multiplier = 0;
for(int i = 0; i < map.numcols(); i++){
for(int j = 0; j < map.numrows(); j++){
multiplier = (map[j][i] - lowestElevation) / ((float)highestElevation - lowestElevation);
al_draw_pixel(i, j, al_map_rgb(multiplier*maxColorValue_c, multiplier*maxColorValue_c, multiplier*maxColorValue_c));
}
}*/
// Colored Version
/* For loop that separates the height elevation into three categories based on color:
Above 2700m: White/ Gray
Between 1800m and 2700m: Purple
Below 1800m: Green
The lighter the shade, the higher the elevation
*/
int heightLimits[2] = {1800, 2700};
for (int y = 0; y < map.numrows(); y++) {
for (int x = 0; x < map.numcols(); x++) {
if (map[y][x] <= heightLimits[0]) {
//Shades of gray and white for the highest areas
int shade = (map[y][x] - lowestElevation) * maxColorValue_c / (heightLimits[0] - lowestElevation);
al_draw_pixel(x, y, al_map_rgb(0, shade, 0));
}
else if ((map[y][x] > heightLimits[0]) && (map[y][x] <= heightLimits[1])) {
//Shades of purple for middle areas
int shade[3];
//Decimal value for the relative shade of red
shade[0] = (heightLimits[0] - map[y][x]) * (240 - 160)
/ (heightLimits[1] - heightLimits[0]) + 160;
//Decimal value for the relative shade of green
shade[1] = (heightLimits[0] - map[y][x]) * (102 - 34)
/ (heightLimits[1] - heightLimits[0]) + 102;
//Decimal value for the relative shade of blue
shade[2] = (heightLimits[0] - map[y][x]) * (240 - 160)
/ (heightLimits[1] - heightLimits[0]) + 240;
al_draw_pixel(x, y, al_map_rgb(shade[0], shade[1], shade[2]));
}
else {
//Shades of green for lower areas
int shade = (map[y][x] - heightLimits[1]) * (maxColorValue_c - 160)
/ (highestElevation - heightLimits[1]) + 160;
al_draw_pixel(x, y, al_map_rgb(shade, shade, shade));
}
}
}
}
//Draws one path based on the row stated
int drawPath(apmatrix<short> &map, int startRow, apvector<int> &pathCols)
{
//Declaring Variables
srand((unsigned)time(0));
//The changes in the three directions: index 0 is Up, index 1 is Down, and index 2 is Right
short direction[3] = {0};
int change = 0;
int row = startRow;
//For loop that finds every point on a path
for(int j = 0; j < map.numcols()-1; j++){
//Declaring variables based on
short currentElev = map[row][j];
short elevRight = map[row][j+1];
short elevUp;
short elevDown;
short choice; //Choice variable for which direction to go
//If statement that prevents out-of-bound errors
if (row == 0){
elevUp = 50000;
elevDown = map[row+1][j+1];
}
else if (row == 479){
elevUp = map[row-1][j+1];
elevDown = 50000;
}
else {
elevUp = map[row-1][j+1];
elevDown = map[row+1][j+1];
}
//cout << "row: " << row << " ";
//cout << "column: " << j << "\t";
//cout << "current" << currentElev << " elevUP" << elevUp << " ElevD" << elevDown << " ElevR" << elevRight << " ";
direction[0] = abs(currentElev - elevUp);
direction[1] = abs(currentElev - elevDown);
direction[2] = abs(currentElev - elevRight);
//cout << "latercur" << currentElev << " dir1 " << direction[0] << " dir2 " << direction[1] << " dir3 " << direction[2] << " ";
//If statement checking for which direction is best
if (direction[0] < direction[1] && direction[0] < direction[2]){
choice = 0;
//cout << row << " ";
// cout << "up" << endl;
}
else if (direction[1] < direction[0] && direction[1] < direction[2]){
choice = 1;
//cout << row << " ";
// cout << "down" << endl;
}
else if (direction[2] < direction[0] && direction[2] < direction[1]){
choice = 2;
//cout << row << " ";
// cout << "right" << endl;
}
else if (direction[0] == direction[1] && direction[2] > direction[0]){
choice = rand() % 2;
//cout << row << " ";
//cout << "choice:" << choice << " ";
//cout << "dir4" << endl;
}
else if (direction[0] == direction[2] && direction[1] > direction[0]){
choice = 2*(rand() % 2);
//cout << row << " ";
//cout << "choice:" << choice << " ";
//cout << "dir5" << endl;
}
else if (direction[1] == direction[2] && direction[0] > direction[1]){
choice = (rand() % 2) + 1;
//cout << row << " ";
//cout << "choice:" << choice << " ";
//cout << "dir6" << endl;
}
else if (direction[1] == direction[2] && direction[0] == direction[1]){
choice = rand() % 3;
}
else {
return -1;
cout << "invalid" << endl;
}
//Switch statement that implements the choice made by the if statement
switch (choice){
case 0: row--;
change += direction[0];
break;
case 1: row++;
change += direction[1];
break;
case 2: change += direction[2];
break;
default: break;
}
pathCols[j] = row;
al_draw_pixel(j, row, RED);
}
//cout << "Total cols" << map.numcols() << endl;
return change;
}
//Draws one path based on the row stated with a priority of going downhill as much as possible
int drawDownhillPath(apmatrix<short> &map, int startRow,
apvector<int> &path, int &lowestElevPoint, int &lowestCol)
{
//Declaring Variables
srand((unsigned)time(0));
//The changes in the three directions: index 0 is Up, index 1 is Down, and index 2 is Right
int direction[3];
int change = 0;
int row = startRow;
int lowestPoint = -1;
int tempLowCol = 0;
int elev[3]; //Elevations of the three directions
//For loop that finds every point on a path
for(int j = 0; j < map.numcols()-1; j++){
int currentElev = map[row][j];
short choice; //Choice variable for which direction to go
elev[2] = map[row][j+1];
//cout << change << " ";
//If statement that prevents out-of-bound errors
if (row == 0){
elev[0] = 100000;
elev[1] = map[row+1][j+1];
}
else if (row == 479){
elev[0] = map[row-1][j+1];
elev[1] = 100000;
}
else {
elev[0] = map[row-1][j+1];
elev[1] = map[row+1][j+1];
}
//cout << "row: " << row << " ";
//cout << "column: " << j << "\t";
//cout << "current" << currentElev << " elevUP" << elev[0] << " ElevD" << elev[1] << " ElevR" << elev[2] << " ";
direction[0] = currentElev - elev[0];
direction[1] = currentElev - elev[1];
direction[2] = currentElev - elev[2];
//cout << "latercur" << currentElev << " dir1 " << direction[0] << " dir2 " << direction[1] << " dir3 " << direction[2] << endl;
//If statement checking for which direction is best
if (direction[0] > direction[1] && direction[0] > direction[2]){
choice = 0;
//cout << row << " ";
// cout << "up" << endl;
}
else if (direction[1] > direction[0] && direction[1] > direction[2]){
choice = 1;
//cout << row << " ";
// cout << "down" << endl;
}
else if (direction[2] > direction[0] && direction[2] > direction[1]){
choice = 2;
//cout << row << " ";
// cout << "right" << endl;
}
else if (direction[0] == direction[1] && direction[2] < direction[0]){
choice = rand() % 2;
//cout << row << " ";
//cout << "choice:" << choice << " ";
//cout << "dir4" << endl;
}
else if (direction[0] == direction[2] && direction[1] < direction[0]){
choice = 2*(rand() % 2);
//cout << row << " ";
//cout << "choice:" << choice << " ";
//cout << "dir5" << endl;
}
else if (direction[1] == direction[2] && direction[0] < direction[1]){
choice = (rand() % 2) + 1;
//cout << row << " ";
//cout << "choice:" << choice << " ";
//cout << "dir6" << endl;
}
else if (direction[1] == direction[2] && direction[0] == direction[1]){
choice = rand() % 3;
}
else {
return -1;
cout << "invalid" << endl;
}
//Switch statement that implements the choice made by the if statement
switch (choice){
case 0: row--;
change += abs(direction[0]);
break;
case 1: row++;
change += abs(direction[1]);
break;
case 2: change += abs(direction[2]);
break;
default: break;
}
//Calculating for lowest point per starting row
if (lowestPoint < 0 || elev[choice] < lowestPoint){
lowestPoint = elev[choice];
tempLowCol = j;
}
path[j] = row;
al_draw_pixel(j, row, RED);
}
//cout << "Total cols" << map.numcols() << endl;
lowestElevPoint = lowestPoint;
lowestCol = tempLowCol;
return change;
}
//Draws all the possible paths, then marks the shortest one
int drawAllPaths(apmatrix<short> map, int algorithm)
{
//Declaring Variables
apvector<int> bestRunCols(map.numcols());
apvector<int> runCols(map.numcols());
int totalChange = 0;
int smallestChange = -1;
short smallestRow = 0;
int lowestPoint = 0;
int lowestCol = 0;
//For loop that draws out all the paths and prints their corresponding information in command line
for (int x = 0; x < map.numrows(); x++){
//Different algorithms and their different outputs
if (algorithm == 0){
totalChange = drawPath(map, x, runCols);
cout << "Row: " << x << " " << "Total change: " << totalChange << "m" << endl;
}
else {
totalChange = drawDownhillPath(map, x, runCols, lowestPoint, lowestCol);
cout << "Coords for lowest point in row " << x << ": "
<< "(" << x << ", " << lowestCol << ")" << endl
<< "Elevation: " << lowestPoint << " "
<< "Total change: " << totalChange << "m" << endl;
lowestPoint = 0;
}
if (smallestChange < 0 || smallestChange > totalChange){
smallestChange = totalChange;
smallestRow = x;
bestRunCols = runCols;
}
totalChange = 0;
}
//Prints best run information in command line
cout << endl
<< "Smallest index: " << smallestRow << endl
<< "Total elevation change: " << smallestChange << "m" << endl;
//Prints best run in green
for (int i = 0; i < map.numcols(); i++){
al_draw_pixel(i, bestRunCols[i], GREEN);
}
return smallestChange;
}
//Prints chosen algorithm, lowest elevation point, and total elevation change on the map
void printElevation(short lowestElevation, int algorithm, int elevChange)
{
char algName[20] = "";
al_init_font_addon(); // initialize the font addon
al_init_ttf_addon();// initialize the ttf (True Type Font) addon
ALLEGRO_FONT *font = al_load_ttf_font("font.ttf", 30, 0);
if (!font){
cout << "Could not load 'font.ttf'";
}
switch (algorithm){
case 0: strcpy(algName, "Greedy Algorithm");
break;
case 1: strcpy(algName, "Downhill Algorithm");
break;
default: break;
}
al_draw_textf(font, al_map_rgb(255,255,255), 235, 50, ALLEGRO_ALIGN_CENTRE, "Algorithm: %s", algName);
al_draw_textf(font, al_map_rgb(255,255,255), 200, 100, ALLEGRO_ALIGN_CENTRE, "Lowest Elevation: %dm", lowestElevation);
al_draw_textf(font, al_map_rgb(255,255,255), 250, 150, ALLEGRO_ALIGN_CENTRE, "Total Elevation Change: %dm", elevChange);
}
|
d02655e508a1506d0185cf711226938fb8054845 | 82ea9226e7389a1e204a066404621704de342118 | /roboteq_node/include/stringUtil.h | 0a176957c5b6a030fac9a845b0d2dc768b28a726 | [] | no_license | v-i-s-h/revo_robot | 184c4d48e7308950e9ad091def32e52f1d5c5ff4 | b8fe54eed05e40ac2be6d0b8ec31d32866ae8ac1 | refs/heads/master | 2021-01-24T09:27:30.107225 | 2014-09-08T23:36:20 | 2014-09-08T23:36:20 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 505 | h | stringUtil.h | #ifndef __STRING_UTIL_H__
#define __STRING_UTIL_H__
#include <string>
#include <vector>
typedef std::vector<std::string> TStrParam;
class StringUtil
{
public:
static TStrParam split(const std::string& str, char ch = ' ');
static std::string trimRight(const std::string& str, char ch = ' ');
static std::string trimLeft(const std::string& str, char ch = ' ');
static std::string trimBoth(const std::string& str, char ch = ' ');
};
#endif // __STRING_UTIL_H__
|
870be005d60bff3cadcd1f70750256c938cc71d5 | a66158687390b7793977b462eca5878509cb35c3 | /T Compiler/Type.cxx | dac0b148c20983238a151b2ecb57fa04cf698151 | [] | no_license | moogar0880/CS-Selections | c2e612aae359db5cd20a1fb824bdfb96b5ca29ab | d662d49057ba7bb45ab5dfa8b5feccd3965f3f5e | refs/heads/master | 2016-09-06T02:46:21.635410 | 2013-09-18T06:45:15 | 2013-09-18T06:45:15 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 12,609 | cxx | Type.cxx | /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Type representation for T language
*
* NOTE: Don't use Type methods directly. Rather use indirectly via
* TypeModule. See Type.h for more information.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
#include <iostream>
using namespace std;
#include <stdio.h>
#include "SymbolTable.h"
#include "Type.h"
extern bool terminalErrors;
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Abstract Type class
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
Type::Type(){}
Type::~Type(){}
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* None Type class
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
TypeNone::TypeNone(){}
TypeNone::~TypeNone(){}
char* TypeNone::toString(){
return (char *) "<no type>";
}
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Deref Type class
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
TypeDeref::TypeDeref(){}
TypeDeref::~TypeDeref(){}
char* TypeDeref::toString(){
return (char *) "deref";
}
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Error Type class
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
TypeError::TypeError(){}
TypeError::~TypeError(){}
char* TypeError::toString(){
return (char *) "<error type>";
}
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Int Type class
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
TypeInt::TypeInt(){}
TypeInt::~TypeInt(){}
char* TypeInt::toString(){
return (char *) "int";
}
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Null Type class
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
TypeNull::TypeNull(){}
TypeNull::~TypeNull(){}
char* TypeNull::toString(){
return (char *) "Null Type";
}
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Class Type class
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
TypeClass::TypeClass(char* n){
name = n;
parent = NULL;
classTable = new SymbolTable();
hasDeclaredDestructor = false;
hasDeclaredConstructor = false;
}
TypeClass::~TypeClass(){
delete name;
delete parent;
delete classTable;
}
char* TypeClass::getName(){
return name;
}
bool TypeClass::getItem(char* n, Type*& type){
return classTable->lookup(n,type);
}
void TypeClass::add(char* n, Type* type){
if( !strcmp(type->toString(), "method") ){
if( ((TypeMethod*)type)->isDestructor && hasDeclaredDestructor ){
cerr << "ERROR: Multiple " << n << " destructors declared! Aborting compilation" << endl;
terminalErrors = true;
}
else if( ((TypeMethod*)type)->isDestructor ){
hasDeclaredDestructor = true;
destructor = (TypeMethod*)type;
}
else{
if(((TypeMethod*)type)->isConstructor)
hasDeclaredConstructor = true;
if( !classTable->installMethod(((TypeMethod*)type)) )
cerr << "ERROR: 1 Redeclaration of " << n << endl;
}
}
else{
if( !classTable->install(n,type) ){
cerr << "ERROR: 2 Redeclaration of " << n << " " << type->toString() << endl;
}
}
}
void TypeClass::setParent(Type* p){
parent = (TypeClass*)p;
}
TypeClass* TypeClass::getParent(){
return parent;
}
SymbolTable* TypeClass::getSymbolTable(){
return classTable;
}
char* TypeClass::toString(){
return getName();
}
TypeMethod* TypeClass::getDestructor(){
return destructor;
}
void TypeClass::inheritFields(){
if( strcmp(name,(char*)"Object") ){
TypeClass* scan = parent;
SymbolTableRecord* str;
Type* tmp;
// if( scan != NULL )
// cerr << scan == types->classType((char*)"Object") << endl;
while( scan != NULL && strcmp(scan->getName(),(char*)"Object") ){
str = scan->getSymbolTable()->head;
while( str != NULL ){
if( !getItem(str->name,tmp) ){
add(str->name, str->type);
}
str = str->next;
}
scan = scan->parent;
}
}
}
void TypeClass::toVMT(){
cout <<"#\t" << name << "$VMT\n";
cout << "\t.data\n" << name << "$VMT:\n\t.long ";
if( parent != NULL )
cout << parent->getName() << "$VMT";
else
cout << "0";
// Can assume that the destructor will exist by code gen time
cout << "\n\t.long " << name << "$Destructor\n";
// Fill inherited methods into VMT
TypeClass* parentScan = parent;
std::vector<TypeClass*> v;
std::vector<TypeMethod*> inheritedMethods, myMethods;
if( parentScan != NULL ){
v.push_back(parentScan);
while( parentScan->parent != NULL ){
parentScan = parentScan->parent;
v.push_back(parentScan);
}
}
std::vector<TypeClass*>::reverse_iterator it;
for(it = v.rbegin(); it != v.rend(); ++it){
SymbolTableRecord* str;
if( (*it)->getSymbolTable() != NULL && (*it)->getSymbolTable()->methodHead != NULL ){
str = (*it)->getSymbolTable()->methodHead;
while(str != NULL){
if( !strcmp(((TypeMethod*)str->type)->toString(),"method")){
((TypeMethod*)str->type)->owner = (*it)->getName();
inheritedMethods.push_back(((TypeMethod*)str->type));
}
str = str->next;
}
}
}
SymbolTableRecord* scan = classTable->methodHead;
while( scan != NULL ){
if( !strcmp(((TypeMethod*)scan->type)->toString(), "method")){
myMethods.push_back(((TypeMethod*)scan->type));
//cerr << ((TypeMethod*)scan->type)->signatureString() << "\n";
}
scan = scan->next;
}
std::vector<TypeMethod*>::iterator it1;
std::vector<TypeMethod*>::reverse_iterator it2;
for(it1 = myMethods.begin(); it1 != myMethods.end(); ++it1){
for(it2 = inheritedMethods.rbegin(); it2 != inheritedMethods.rend(); ++it2){
if((*it1) != NULL && (*it2) != NULL){
if(!strcmp((*it1)->signatureString(),(*it2)->signatureString())){
if(strcmp((*it1)->owner,(*it2)->owner)){
(*it2) = (*it1);
(*it1) = NULL;
}
}
}
}
}
for(it2 = inheritedMethods.rbegin(); it2 != inheritedMethods.rend(); ++it2 ){
if( (*it2) != NULL && !(*it2)->isConstructor ){
cout << "\t.long ";
(*it2)->toVMTString();
vmt.push_back((*it2));
cout << "\n";
}
}
for(it1 = myMethods.begin(); it1 != myMethods.end(); ++it1 ){
if( (*it1) != NULL ){
cout << "\t.long ";
(*it1)->toVMTString(name);
vmt.push_back((*it1));
cout << "\n";
}
}
cout << "\t.text\n";
cout <<"#\tEnd of " << name << "$VMT\n";
}
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Method Type class
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
TypeMethod::TypeMethod(char* n, Type* ret, bool cons, bool dest){
name = n;
returnType = ret;
isConstructor = cons;
isDestructor = dest;
if( returnType == NULL ){
signature.push_back(new TypeNull());
}
else{
signature.push_back(returnType);
}
paramCount = 0;
}
TypeMethod::~TypeMethod(){
delete name;
delete returnType;
}
char* TypeMethod::getName(){
return name;
}
Type* TypeMethod::getReturnType(){
return returnType;
}
SymbolTable* TypeMethod::exportAsSymbolTable(){
SymbolTable* toRet = new SymbolTable();
std::vector<SymbolTableRecord*>::iterator it;
for( it = parameters.end(); it != parameters.begin(); --it){
if( toRet->head == NULL )
toRet->head = (*it);
else{
(*it)->next = toRet->head;
toRet->head = (*it);
}
}
return toRet;
}
bool TypeMethod::hasParam(char* n, Type*& type){
std::vector<SymbolTableRecord*>::iterator it;
for( it = parameters.begin(); it != parameters.end(); ++it){
if( strcmp((*it)->name,n) == 0 ){
type = (*it)->type;
return true;
}
}
return false;
}
bool TypeMethod::hasParam(char* n){
std::vector<SymbolTableRecord*>::iterator it;
for( it = parameters.begin(); it != parameters.end(); ++it){
if( strcmp((*it)->name,n) == 0 ){
return true;
}
}
return false;
}
bool TypeMethod::addParam(char* n, Type* type){
paramCount++;
if( !hasParam(n) ){
parameters.push_back(new SymbolTableRecord(n,type));
signature.push_back(type);
return true;
}
return false; //Can not have parameters with the same name
}
char* TypeMethod::toString(){
return (char*)"method";
}
void TypeMethod::toVMTString(){
cout << owner << "$" << name;
std::vector<Type*>::iterator it;
it = signature.begin();
// Need to skip return type
if( it != signature.end() ){
while( ++it != signature.end() ){
cout << "_" << (*it)->toString();
}
}
}
void TypeMethod::toVMTString(char* o){
cout << o << "$" << name;
std::vector<Type*>::iterator it;
it = signature.begin();
// Need to skip return type
if( it != signature.end() ){
while( ++it != signature.end() ){
cout << "_" << (*it)->toString();
}
}
}
char* TypeMethod::signatureString(){
char* toRet = new char[500];
strcpy(toRet,name);
std::vector<Type*>::iterator it;
it = signature.begin();
// Need to skip return type
if( it != signature.end() ){
while( ++it != signature.end() ){
strcat(toRet,"_");
strcat(toRet, (*it)->toString());
}
}
return toRet;
}
char* TypeMethod::getMunged(char* owner){
int size = 500;
char* toRet = new char[size];
strcpy(toRet, owner);
strcat(toRet, "$");
if(isDestructor)
strcat(toRet, "Destructor");
else
strcat(toRet, name);
std::vector<Type*>::iterator it;
it = signature.begin();
// Need to skip return type
if( it != signature.end() ){
while( ++it != signature.end() ){
strcat(toRet,"_");
strcat(toRet, (*it)->toString());
}
}
return toRet;
}
std::vector<Type*> TypeMethod::getSig(){
return signature;
}
// Compare the signatures of two TypeMethods
//bool TypeMethod::operator == (const std::vector<Type*> otherSig) const{
bool TypeMethod::operator== (const TypeMethod* other ){
std::vector<Type*> otherSig = other->signature;
if( signature.size() != otherSig.size() )
return false;
std::vector<Type*>::iterator mySigIt;
mySigIt = signature.begin();
std::vector<Type*>::iterator otherSigIt;
otherSigIt = otherSig.begin();
// If any of the parameters types don't line up then the methods are not
// comparable
while( mySigIt != signature.end() ){
if( !strcmp((*mySigIt)->toString(),(*otherSigIt)->toString())){
cerr << "DEBUG TypeMethod " << (*mySigIt) << ", " << (*otherSigIt) << endl;
mySigIt++;
otherSigIt++;
}
else{
return false;
}
}
return true;
}
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* TypeModule Class
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
TypeModule::TypeModule(){
intTypeInternal = (Type*) new TypeInt();
errorTypeInternal = (Type*) new TypeError();
noTypeInternal = (Type*) new TypeNone();
nullTypeInternal = (Type*) new TypeNull();
derefTypeInternal = (Type*) new TypeDeref();
}
//Search TypeModule and determine if a class with name n exists
bool TypeModule::containsClassType(char* n){
std::vector<TypeClass*>::iterator it;
for(it = classTypes.begin(); it != classTypes.end(); ++it ){
if( strcmp((*it)->getName(),n) == 0 )
return true; //if class type already exists
}
return false;
}
// Create new ClassType with name n
Type* TypeModule::createNewClassType(char * n){
if( containsClassType(n) ){ //compile time error
return NULL;
}
else{
TypeClass* t = new TypeClass(n);
classTypes.push_back(t);
return t;
}
}
TypeModule::~TypeModule(){
delete intTypeInternal;
delete errorTypeInternal;
delete noTypeInternal;
classTypes.erase(classTypes.begin(), classTypes.end());
}
Type* TypeModule::intType(){
return intTypeInternal;
}
Type* TypeModule::errorType(){
return errorTypeInternal;
}
Type* TypeModule::noType(){
return noTypeInternal;
}
Type* TypeModule::nullType(){
return nullTypeInternal;
}
Type* TypeModule::derefType(){
return derefTypeInternal;
}
TypeClass* TypeModule::classType(char* name){
std::vector<TypeClass*>::iterator it;
for(it = classTypes.begin(); it != classTypes.end(); ++it ){
if( strcmp((*it)->getName(),name) == 0 ){
return *it;
}
}
return NULL;
}
std::vector<TypeClass*> TypeModule::getClassList(){
return classTypes;
} |
263ad6f666cf20399aae68537b54fba1f6175bce | a7775b0612b451d39568ded286adcdb87fdc95d9 | /Siv3D/src/Siv3D/Physics2D/SivPhysics2D.cpp | bf5e6042d158ac28e5b1ad500254a0b7570e3c10 | [
"MIT"
] | permissive | wynd2608/OpenSiv3D | 6061360a3086197e22eb9fef0788b5401751ba6c | 92a57cd901ca98b0172e992cc684a99c4755ba71 | refs/heads/master | 2020-08-02T00:02:24.914254 | 2019-05-25T17:09:48 | 2019-05-25T17:09:48 | 73,573,550 | 8 | 1 | null | 2017-07-12T13:08:10 | 2016-11-12T19:27:12 | C++ | UTF-8 | C++ | false | false | 52,359 | cpp | SivPhysics2D.cpp | //-----------------------------------------------
//
// This file is part of the Siv3D Engine.
//
// Copyright (c) 2008-2019 Ryo Suzuki
// Copyright (c) 2016-2019 OpenSiv3D Project
//
// Licensed under the MIT License.
//
//-----------------------------------------------
# include <Siv3D/Physics2D.hpp>
# include <Siv3D/Circle.hpp>
# include <Siv3D/Triangle.hpp>
# include <Siv3D/Polygon.hpp>
# include <Siv3D/Graphics2D.hpp>
# include <Siv3D/MultiPolygon.hpp>
# include "Physics2DUtility.hpp"
# include "P2WorldDetail.hpp"
# include "P2BodyDetail.hpp"
# include "P2PivotJointDetail.hpp"
# include "P2DistanceJointDetail.hpp"
# include "P2RopeJointDetail.hpp"
# include "P2SliderJointDetail.hpp"
# include "P2WheelJointDetail.hpp"
namespace s3d
{
std::array<P2Contact, 2>::const_iterator P2Collision::begin() const noexcept
{
return contacts.begin();
}
std::array<P2Contact, 2>::const_iterator P2Collision::end() const noexcept
{
return contacts.begin() + num_contacts;
}
////////////////////////////////////////////////
//
// P2World
//
////////////////////////////////////////////////
P2World::P2World(const double gravity)
: P2World(Vec2(0.0, gravity))
{
}
P2World::P2World(const Vec2& gravity)
: pImpl(std::make_shared<P2WorldDetail>(gravity))
{
}
void P2World::setSleepEnabled(const bool enabled)
{
pImpl->getData().SetAllowSleeping(enabled);
}
bool P2World::getSleepEnabled() const
{
return pImpl->getData().GetAllowSleeping();
}
void P2World::setGravity(const double gravity)
{
setGravity(Vec2(0.0, gravity));
}
void P2World::setGravity(const Vec2& gravity)
{
pImpl->getData().SetGravity(detail::ToB2Vec2(gravity));
}
Vec2 P2World::getGravity() const
{
return detail::ToVec2(pImpl->getData().GetGravity());
}
void P2World::shiftOrigin(const Vec2& newOrigin)
{
pImpl->getData().ShiftOrigin(detail::ToB2Vec2(newOrigin));
}
void P2World::update(const double timeStep, const int32 velocityIterations, const int32 positionIterations) const
{
return pImpl->update(timeStep, velocityIterations, positionIterations);
}
P2Body P2World::createDummy(const Vec2& center, const P2BodyType bodyType)
{
return pImpl->createDummy(*this, center, bodyType);
}
P2Body P2World::createLine(const Vec2& center, const Line& line, const P2Material& material, const P2Filter& filter, const P2BodyType bodyType)
{
return pImpl->createLine(*this, center, line, material, filter, bodyType);
}
P2Body P2World::createLineString(const Vec2& center, const LineString& lines, const P2Material& material, const P2Filter& filter, const P2BodyType bodyType)
{
return pImpl->createLineString(*this, center, lines, material, filter, bodyType);
}
P2Body P2World::createClosedLineString(const Vec2& center, const LineString& lines, const P2Material& material, const P2Filter& filter, const P2BodyType bodyType)
{
return pImpl->createClosedLineString(*this, center, lines, material, filter, bodyType);
}
P2Body P2World::createCircle(const Vec2& center, double r, const P2Material& material, const P2Filter& filter, const P2BodyType bodyType)
{
return pImpl->createCircle(*this, center, Circle(r), material, filter, bodyType);
}
P2Body P2World::createCircle(const Vec2& center, const Circle& circle, const P2Material& material, const P2Filter& filter, const P2BodyType bodyType)
{
return pImpl->createCircle(*this, center, circle, material, filter, bodyType);
}
P2Body P2World::createRect(const Vec2& center, const SizeF& size, const P2Material& material, const P2Filter& filter, const P2BodyType bodyType)
{
return pImpl->createRect(*this, center, RectF(Arg::center(0, 0), size), material, filter, bodyType);
}
P2Body P2World::createRect(const Vec2& center, const RectF& rect, const P2Material& material, const P2Filter& filter, const P2BodyType bodyType)
{
return pImpl->createRect(*this, center, rect, material, filter, bodyType);
}
P2Body P2World::createTriangle(const Vec2& center, const Triangle& triangle, const P2Material& material, const P2Filter& filter, const P2BodyType bodyType)
{
return pImpl->createTriangle(*this, center, triangle, material, filter, bodyType);
}
P2Body P2World::createQuad(const Vec2& center, const Quad& quad, const P2Material& material, const P2Filter& filter, const P2BodyType bodyType)
{
return pImpl->createQuad(*this, center, quad, material, filter, bodyType);
}
P2Body P2World::createPolygon(const Vec2& center, const Polygon& polygon, const P2Material& material, const P2Filter& filter, const P2BodyType bodyType)
{
return pImpl->createPolygon(*this, center, polygon, material, filter, bodyType);
}
P2Body P2World::createPolygons(const Vec2& center, const MultiPolygon& polygons, const P2Material& material, const P2Filter& filter, const P2BodyType bodyType)
{
const size_t num_polygons = polygons.size();
if (num_polygons == 0)
{
return createDummy(center, bodyType);
}
else if (num_polygons == 1)
{
return createPolygon(center, polygons.front(), material, filter, bodyType);
}
else
{
P2Body body = createPolygon(center, polygons.front(), material, filter, bodyType);
for (size_t i = 1; i < num_polygons; ++i)
{
body.addPolygon(polygons[i], material, filter);
}
return body;
}
}
P2Body P2World::createStaticDummy(const Vec2& center)
{
return createDummy(center, P2BodyType::Static);
}
P2Body P2World::createStaticLine(const Vec2& center, const Line& line, const P2Material& material, const P2Filter& filter)
{
return createLine(center, line, material, filter, P2BodyType::Static);
}
P2Body P2World::createStaticLineString(const Vec2& center, const LineString& lines, const P2Material& material, const P2Filter& filter)
{
return createLineString(center, lines, material, filter, P2BodyType::Static);
}
P2Body P2World::createStaticClosedLineString(const Vec2& center, const LineString& lines, const P2Material& material, const P2Filter& filter)
{
return createClosedLineString(center, lines, material, filter, P2BodyType::Static);
}
P2Body P2World::createStaticCircle(const Vec2& center, double r, const P2Material& material, const P2Filter& filter)
{
return createCircle(center, r, material, filter, P2BodyType::Static);
}
P2Body P2World::createStaticCircle(const Vec2& center, const Circle& circle, const P2Material& material, const P2Filter& filter)
{
return createCircle(center, circle, material, filter, P2BodyType::Static);
}
P2Body P2World::createStaticRect(const Vec2& center, const SizeF& size, const P2Material& material, const P2Filter& filter)
{
return createRect(center, size, material, filter, P2BodyType::Static);
}
P2Body P2World::createStaticRect(const Vec2& center, const RectF& rect, const P2Material& material, const P2Filter& filter)
{
return createRect(center, rect, material, filter, P2BodyType::Static);
}
P2Body P2World::createStaticTriangle(const Vec2& center, const Triangle& triangle, const P2Material& material, const P2Filter& filter)
{
return createTriangle(center, triangle, material, filter, P2BodyType::Static);
}
P2Body P2World::createStaticQuad(const Vec2& center, const Quad& quad, const P2Material& material, const P2Filter& filter)
{
return createQuad(center, quad, material, filter, P2BodyType::Static);
}
P2Body P2World::createStaticPolygon(const Vec2& center, const Polygon& polygon, const P2Material& material, const P2Filter& filter)
{
return createPolygon(center, polygon, material, filter, P2BodyType::Static);
}
P2Body P2World::createStaticPolygons(const Vec2& center, const MultiPolygon& polygons, const P2Material& material, const P2Filter& filter)
{
return createPolygons(center, polygons, material, filter, P2BodyType::Static);
}
P2Body P2World::createKinematicDummy(const Vec2& center)
{
return createDummy(center, P2BodyType::Kinematic);
}
P2Body P2World::createKinematicLine(const Vec2& center, const Line& line, const P2Material& material, const P2Filter& filter)
{
return createLine(center, line, material, filter, P2BodyType::Kinematic);
}
P2Body P2World::createKinematicLineString(const Vec2& center, const LineString& lines, const P2Material& material, const P2Filter& filter)
{
return createLineString(center, lines, material, filter, P2BodyType::Kinematic);
}
P2Body P2World::createKinematicClosedLineString(const Vec2& center, const LineString& lines, const P2Material& material, const P2Filter& filter)
{
return createClosedLineString(center, lines, material, filter, P2BodyType::Kinematic);
}
P2Body P2World::createKinematicCircle(const Vec2& center, double r, const P2Material& material, const P2Filter& filter)
{
return createCircle(center, r, material, filter, P2BodyType::Kinematic);
}
P2Body P2World::createKinematicCircle(const Vec2& center, const Circle& circle, const P2Material& material, const P2Filter& filter)
{
return createCircle(center, circle, material, filter, P2BodyType::Kinematic);
}
P2Body P2World::createKinematicRect(const Vec2& center, const SizeF& size, const P2Material& material, const P2Filter& filter)
{
return createRect(center, size, material, filter, P2BodyType::Kinematic);
}
P2Body P2World::createKinematicRect(const Vec2& center, const RectF& rect, const P2Material& material, const P2Filter& filter)
{
return createRect(center, rect, material, filter, P2BodyType::Kinematic);
}
P2Body P2World::createKinematicTriangle(const Vec2& center, const Triangle& triangle, const P2Material& material, const P2Filter& filter)
{
return createTriangle(center, triangle, material, filter, P2BodyType::Kinematic);
}
P2Body P2World::createKinematicQuad(const Vec2& center, const Quad& quad, const P2Material& material, const P2Filter& filter)
{
return createQuad(center, quad, material, filter, P2BodyType::Kinematic);
}
P2Body P2World::createKinematicPolygon(const Vec2& center, const Polygon& polygon, const P2Material& material, const P2Filter& filter)
{
return createPolygon(center, polygon, material, filter, P2BodyType::Kinematic);
}
P2Body P2World::createKinematicPolygons(const Vec2& center, const MultiPolygon& polygons, const P2Material& material, const P2Filter& filter)
{
return createPolygons(center, polygons, material, filter, P2BodyType::Kinematic);
}
P2Body P2World::createDynamicDummy(const Vec2& center)
{
return createDummy(center, P2BodyType::Dynamic);
}
P2Body P2World::createDynamicLine(const Vec2& center, const Line& line, const P2Material& material, const P2Filter& filter)
{
return createLine(center, line, material, filter, P2BodyType::Dynamic);
}
P2Body P2World::createDynamicLineString(const Vec2& center, const LineString& lines, const P2Material& material, const P2Filter& filter)
{
return createLineString(center, lines, material, filter, P2BodyType::Dynamic);
}
P2Body P2World::createDynamicClosedLineString(const Vec2& center, const LineString& lines, const P2Material& material, const P2Filter& filter)
{
return createClosedLineString(center, lines, material, filter, P2BodyType::Dynamic);
}
P2Body P2World::createDynamicCircle(const Vec2& center, double r, const P2Material& material, const P2Filter& filter)
{
return createCircle(center, r, material, filter, P2BodyType::Dynamic);
}
P2Body P2World::createDynamicCircle(const Vec2& center, const Circle& circle, const P2Material& material, const P2Filter& filter)
{
return createCircle(center, circle, material, filter, P2BodyType::Dynamic);
}
P2Body P2World::createDynamicRect(const Vec2& center, const SizeF& size, const P2Material& material, const P2Filter& filter)
{
return createRect(center, size, material, filter, P2BodyType::Dynamic);
}
P2Body P2World::createDynamicRect(const Vec2& center, const RectF& rect, const P2Material& material, const P2Filter& filter)
{
return createRect(center, rect, material, filter, P2BodyType::Dynamic);
}
P2Body P2World::createDynamicTriangle(const Vec2& center, const Triangle& triangle, const P2Material& material, const P2Filter& filter)
{
return createTriangle(center, triangle, material, filter, P2BodyType::Dynamic);
}
P2Body P2World::createDynamicQuad(const Vec2& center, const Quad& quad, const P2Material& material, const P2Filter& filter)
{
return createQuad(center, quad, material, filter, P2BodyType::Dynamic);
}
P2Body P2World::createDynamicPolygon(const Vec2& center, const Polygon& polygon, const P2Material& material, const P2Filter& filter)
{
return createPolygon(center, polygon, material, filter, P2BodyType::Dynamic);
}
P2Body P2World::createDynamicPolygons(const Vec2& center, const MultiPolygon& polygons, const P2Material& material, const P2Filter& filter)
{
return createPolygons(center, polygons, material, filter, P2BodyType::Dynamic);
}
P2PivotJoint P2World::createPivotJoint(const P2Body& bodyA, const P2Body& bodyB, const Vec2& anchorPos)
{
return pImpl->createPivotJoint(*this, bodyA, bodyB, anchorPos);
}
P2DistanceJoint P2World::createDistanceJoint(const P2Body& bodyA, const Vec2& anchorPosA, const P2Body& bodyB, const Vec2& anchorPosB, const double length)
{
return pImpl->createDistanceJoint(*this, bodyA, anchorPosA, bodyB, anchorPosB, length);
}
P2RopeJoint P2World::createRopeJoint(const P2Body& bodyA, const Vec2& anchorPosA, const P2Body& bodyB, const Vec2& anchorPosB, const double maxLength)
{
return pImpl->createRopeJoint(*this, bodyA, anchorPosA, bodyB, anchorPosB, maxLength);
}
P2SliderJoint P2World::createSliderJoint(const P2Body& bodyA, const P2Body& bodyB, const Vec2& anchorPos, const Vec2& normalizedAxis)
{
return pImpl->createSliderJoint(*this, bodyA, bodyB, anchorPos, normalizedAxis);
}
const HashTable<P2ContactPair, P2Collision>& P2World::getCollisions() const
{
return pImpl->getCollisions();
}
b2World* P2World::getWorldPtr() const
{
return pImpl->getWorldPtr();
}
////////////////////////////////////////////////
//
// P2Body
//
////////////////////////////////////////////////
P2Body::P2Body()
: pImpl(std::make_shared<P2BodyDetail>())
{
}
P2Body::P2Body(P2World& world, P2BodyID id, const Vec2& center, const P2BodyType bodyType)
: pImpl(std::make_shared<P2BodyDetail>(world, id, center, bodyType))
{
pImpl->setUserData(pImpl.get());
}
P2BodyID P2Body::id() const
{
return pImpl->id();
}
bool P2Body::isEmpty() const
{
return (pImpl->id() == 0);
}
P2Body::operator bool() const
{
return !isEmpty();
}
P2Body& P2Body::addLine(const Line& line, const P2Material& material, const P2Filter& filter)
{
if (isEmpty())
{
return *this;
}
pImpl->addLine(line, material, filter);
return *this;
}
P2Body& P2Body::addLineString(const LineString& lines, const P2Material& material, const P2Filter& filter)
{
if (isEmpty())
{
return *this;
}
pImpl->addLineString(lines, false, material, filter);
return *this;
}
P2Body& P2Body::addClosedLineString(const LineString& lines, const P2Material& material, const P2Filter& filter)
{
if (isEmpty())
{
return *this;
}
pImpl->addLineString(lines, true, material, filter);
return *this;
}
P2Body& P2Body::addCircle(const Circle& circle, const P2Material& material, const P2Filter& filter)
{
if (isEmpty())
{
return *this;
}
pImpl->addCircle(circle, material, filter);
return *this;
}
P2Body& P2Body::addRect(const SizeF& size, const P2Material& material, const P2Filter& filter)
{
return addRect(RectF(Arg::center(0.0, 0.0), size), material, filter);
}
P2Body& P2Body::addRect(const RectF& rect, const P2Material& material, const P2Filter& filter)
{
if (isEmpty())
{
return *this;
}
pImpl->addRect(rect, material, filter);
return *this;
}
P2Body& P2Body::addTriangle(const Triangle& triangle, const P2Material& material, const P2Filter& filter)
{
if (isEmpty())
{
return *this;
}
pImpl->addTriangle(triangle, material, filter);
return *this;
}
P2Body& P2Body::addQuad(const Quad& quad, const P2Material& material, const P2Filter& filter)
{
if (isEmpty())
{
return *this;
}
pImpl->addQuad(quad, material, filter);
return *this;
}
P2Body& P2Body::addPolygon(const Polygon& polygon, const P2Material& material, const P2Filter& filter)
{
if (isEmpty())
{
return *this;
}
pImpl->addPolygon(polygon, material, filter);
return *this;
}
P2Body& P2Body::addPolygons(const MultiPolygon& polygons, const P2Material& material, const P2Filter& filter)
{
if (isEmpty())
{
return *this;
}
for (const auto& polygon : polygons)
{
pImpl->addPolygon(polygon, material, filter);
}
return *this;
}
P2Body& P2Body::setSleepEnabled(bool enabled)
{
if (isEmpty())
{
return *this;
}
pImpl->getBody().SetSleepingAllowed(enabled);
return *this;
}
bool P2Body::getSleepEnabled() const
{
if (isEmpty())
{
return true;
}
return pImpl->getBody().IsSleepingAllowed();
}
P2Body& P2Body::setAwake(const bool awake)
{
if (isEmpty())
{
return *this;
}
pImpl->getBody().SetAwake(awake);
return *this;
}
bool P2Body::isAwake() const
{
if (isEmpty())
{
return true;
}
return pImpl->getBody().IsAwake();
}
P2Body& P2Body::setPos(const double x, const double y)
{
return setPos(Vec2(x, y));
}
P2Body& P2Body::setPos(const Vec2& pos)
{
if (isEmpty())
{
return *this;
}
pImpl->getBody().SetTransform(detail::ToB2Vec2(pos), pImpl->getBody().GetAngle());
return *this;
}
P2Body& P2Body::moveBy(const double x, const double y)
{
return moveBy(Vec2(x, y));
}
P2Body& P2Body::moveBy(const Vec2& v)
{
return setPos(getPos() + v);
}
P2Body& P2Body::setAngle(const double angle)
{
if (isEmpty())
{
return *this;
}
pImpl->getBody().SetTransform(pImpl->getBody().GetPosition(), static_cast<float32>(angle));
return *this;
}
P2Body& P2Body::rotateBy(const double angle)
{
return setAngle(getAngle() + angle);
}
P2Body& P2Body::setTransform(const double x, const double y, const double angle)
{
return setTransform(Vec2(x, y), angle);
}
P2Body& P2Body::setTransform(const Vec2& pos, const double angle)
{
if (isEmpty())
{
return *this;
}
pImpl->getBody().SetTransform(detail::ToB2Vec2(pos), static_cast<float32>(angle));
return *this;
}
P2Body& P2Body::applyForce(const Vec2& force)
{
if (isEmpty())
{
return *this;
}
pImpl->getBody().ApplyForceToCenter(detail::ToB2Vec2(force), true);
return *this;
}
P2Body& P2Body::applyForce(const Vec2& force, const Vec2& offset)
{
if (isEmpty())
{
return *this;
}
pImpl->getBody().ApplyForce(detail::ToB2Vec2(force), pImpl->getBody().GetWorldCenter() + detail::ToB2Vec2(offset), true);
return *this;
}
P2Body& P2Body::applyForceAt(const Vec2& force, const Vec2& pos)
{
if (isEmpty())
{
return *this;
}
pImpl->getBody().ApplyForce(detail::ToB2Vec2(force), detail::ToB2Vec2(pos), true);
return *this;
}
P2Body& P2Body::applyLinearImpulse(const Vec2& force)
{
if (isEmpty())
{
return *this;
}
pImpl->getBody().ApplyLinearImpulseToCenter(detail::ToB2Vec2(force), true);
return *this;
}
P2Body& P2Body::applyLinearImpulse(const Vec2& force, const Vec2& offset)
{
if (isEmpty())
{
return *this;
}
pImpl->getBody().ApplyLinearImpulse(detail::ToB2Vec2(force), pImpl->getBody().GetWorldCenter() + detail::ToB2Vec2(offset), true);
return *this;
}
P2Body& P2Body::applyLinearImpulseAt(const Vec2& force, const Vec2& pos)
{
if (isEmpty())
{
return *this;
}
pImpl->getBody().ApplyLinearImpulse(detail::ToB2Vec2(force), detail::ToB2Vec2(pos), true);
return *this;
}
P2Body& P2Body::applyTorque(const double torque)
{
if (isEmpty())
{
return *this;
}
pImpl->getBody().ApplyTorque(static_cast<float32>(torque), true);
return *this;
}
P2Body& P2Body::applyAngularImpulse(const double torque)
{
if (isEmpty())
{
return *this;
}
pImpl->getBody().ApplyAngularImpulse(static_cast<float32>(torque), true);
return *this;
}
Vec2 P2Body::getPos() const
{
if (isEmpty())
{
return Vec2(0, 0);
}
return detail::ToVec2(pImpl->getBody().GetPosition());
}
double P2Body::getAngle() const
{
if (isEmpty())
{
return 0.0;
}
return pImpl->getBody().GetAngle();
}
std::pair<Vec2, double> P2Body::getTransform() const
{
if (isEmpty())
{
return{ Vec2(0,0), 0.0 };
}
return{ detail::ToVec2(pImpl->getBody().GetPosition()), pImpl->getBody().GetAngle() };
}
P2Body& P2Body::setVelocity(const Vec2& v)
{
if (isEmpty())
{
return *this;
}
pImpl->getBody().SetLinearVelocity(detail::ToB2Vec2(v));
return *this;
}
Vec2 P2Body::getVelocity() const
{
if (isEmpty())
{
return Vec2(0, 0);
}
return detail::ToVec2(pImpl->getBody().GetLinearVelocity());
}
P2Body& P2Body::setAngularVelocity(const double omega)
{
if (isEmpty())
{
return *this;
}
pImpl->getBody().SetAngularVelocity(static_cast<float32>(omega));
return *this;
}
double P2Body::getAngularVelocity() const
{
if (isEmpty())
{
return 0.0;
}
return pImpl->getBody().GetAngularVelocity();
}
P2Body& P2Body::setDamping(double damping)
{
if (isEmpty())
{
return *this;
}
pImpl->getBody().SetLinearDamping(static_cast<float32>(damping));
return *this;
}
double P2Body::getDamping() const
{
if (isEmpty())
{
return 0.0;
}
return pImpl->getBody().GetLinearDamping();
}
P2Body& P2Body::setAngularDamping(const double damping)
{
if (isEmpty())
{
return *this;
}
pImpl->getBody().SetAngularDamping(static_cast<float32>(damping));
return *this;
}
double P2Body::getAngularDamping() const
{
if (isEmpty())
{
return 0.0;
}
return pImpl->getBody().GetAngularDamping();
}
P2Body& P2Body::setGravityScale(const double scale)
{
if (isEmpty())
{
return *this;
}
pImpl->getBody().SetGravityScale(static_cast<float32>(scale));
return *this;
}
double P2Body::getGravityScale() const
{
if (isEmpty())
{
return 1.0;
}
return pImpl->getBody().GetGravityScale();
}
double P2Body::getMass() const
{
if (isEmpty())
{
return 0.0;
}
return pImpl->getBody().GetMass();
}
double P2Body::getInertia() const
{
if (isEmpty())
{
return 0.0;
}
return pImpl->getBody().GetInertia();
}
P2Body& P2Body::setBodyType(P2BodyType bodyType)
{
if (isEmpty())
{
return *this;
}
pImpl->getBody().SetType(static_cast<b2BodyType>(bodyType));
return *this;
}
P2BodyType P2Body::getBodyType() const
{
if (isEmpty())
{
return P2BodyType::Static;
}
return static_cast<P2BodyType>(pImpl->getBody().GetType());
}
P2Body& P2Body::setFixedRotation(const bool fixedRotation)
{
if (isEmpty())
{
return *this;
}
pImpl->getBody().SetFixedRotation(fixedRotation);
return *this;
}
bool P2Body::isFixedRotation() const
{
if (isEmpty())
{
return false;
}
return pImpl->getBody().IsFixedRotation();
}
void P2Body::draw(const ColorF& color) const
{
if (isEmpty())
{
return;
}
for (const auto& shape : pImpl->getShapes())
{
shape->draw(color);
}
}
void P2Body::drawFrame(const double thickness, const ColorF& color) const
{
if (isEmpty())
{
return;
}
for (const auto& shape : pImpl->getShapes())
{
shape->drawFrame(thickness, color);
}
}
void P2Body::drawWireframe(const double thickness, const ColorF& color) const
{
if (isEmpty())
{
return;
}
for (const auto& shape : pImpl->getShapes())
{
shape->drawWireframe(thickness, color);
}
}
size_t P2Body::num_shapes() const
{
if (isEmpty())
{
return 0;
}
return pImpl->getShapes().size();
}
P2Shape& P2Body::shape(const size_t index)
{
if (isEmpty())
{
throw std::out_of_range("P2Body::shape() P2Body is empty.");
}
return *pImpl->getShapes()[index];
}
const P2Shape& P2Body::shape(const size_t index) const
{
if (isEmpty())
{
throw std::out_of_range("P2Body::shape() P2Body is empty.");
}
return *pImpl->getShapes()[index];
}
std::shared_ptr<P2Shape> P2Body::shapePtr(const size_t index) const
{
return pImpl->getShapes()[index];
}
b2Body* P2Body::getBodyPtr() const
{
return pImpl->getBodyPtr();
}
////////////////////////////////////////////////
//
// P2Shape
//
////////////////////////////////////////////////
void P2Shape::setDensity(const double density)
{
for (auto& fixture : m_fixtures.fixtures)
{
fixture->SetDensity(static_cast<float32>(density));
}
}
double P2Shape::getDensity() const
{
return m_fixtures.fixtures[0]->GetDensity();
}
void P2Shape::setFriction(const double friction)
{
for (auto& fixture : m_fixtures.fixtures)
{
fixture->SetFriction(static_cast<float32>(friction));
}
}
double P2Shape::getFriction() const
{
return m_fixtures.fixtures[0]->GetFriction();
}
void P2Shape::setRestitution(const double restitution)
{
for (auto& fixture : m_fixtures.fixtures)
{
fixture->SetRestitution(static_cast<float32>(restitution));
}
}
double P2Shape::getRestitution() const
{
return m_fixtures.fixtures[0]->GetRestitution();
}
void P2Shape::setFilter(const P2Filter& filter)
{
b2Filter filterData;
filterData.categoryBits = filter.categoryBits;
filterData.maskBits = filter.maskBits;
filterData.groupIndex = filter.groupIndex;
for (auto& fixture : m_fixtures.fixtures)
{
fixture->SetFilterData(filterData);
}
}
P2Filter P2Shape::getFilter() const
{
const auto& filterData = m_fixtures.fixtures[0]->GetFilterData();
P2Filter filter;
filter.categoryBits = filterData.categoryBits;
filter.maskBits = filterData.maskBits;
filter.groupIndex = filterData.groupIndex;
return filter;
}
////////////////////////////////////////////////
//
// P2Line
//
////////////////////////////////////////////////
P2Line::P2Line(b2Body& body, const Line& line, const P2Material& material, const P2Filter& filter)
: m_pShape(std::make_unique<b2EdgeShape>())
{
m_pShape->Set(detail::ToB2Vec2(line.begin), detail::ToB2Vec2(line.end));
const b2FixtureDef fixtureDef = detail::MakeFixtureDef(m_pShape.get(), material, filter);
m_fixtures.fixtures.push_back(body.CreateFixture(&fixtureDef));
}
P2ShapeType P2Line::getShapeType() const
{
return P2ShapeType::Line;
}
void P2Line::draw(const ColorF& color) const
{
getLine().draw(detail::P2LineThickness / Graphics2D::GetMaxScaling(), color);
}
void P2Line::drawFrame(const double thickness, const ColorF& color) const
{
getLine().draw(thickness / Graphics2D::GetMaxScaling(), color);
}
void P2Line::drawWireframe(const double thickness, const ColorF& color) const
{
getLine().draw(thickness / Graphics2D::GetMaxScaling(), color);
}
Line P2Line::getLine() const
{
const b2Transform& transform = m_fixtures.fixtures[0]->GetBody()->GetTransform();
return Line(detail::CalcVec2(m_pShape->m_vertex1, transform), detail::CalcVec2(m_pShape->m_vertex2, transform));
}
////////////////////////////////////////////////
//
// P2LineString
//
////////////////////////////////////////////////
P2LineString::P2LineString(b2Body& body, const LineString& lines, const bool closed, const P2Material& material, const P2Filter& filter)
: m_pShape(std::make_unique<b2ChainShape>())
, m_closed(closed)
{
Array<b2Vec2> points(lines.size());
for (size_t i = 0; i < lines.size(); ++i)
{
points[i].Set(static_cast<float32>(lines[i].x), static_cast<float32>(lines[i].y));
}
m_lineString.resize(points.size() + m_closed);
if (closed)
{
m_pShape->CreateLoop(points.data(), static_cast<int32>(points.size()));
}
else
{
m_pShape->CreateChain(points.data(), static_cast<int32>(points.size()));
}
const b2FixtureDef fixtureDef = detail::MakeFixtureDef(m_pShape.get(), material, filter);
m_fixtures.fixtures.push_back(body.CreateFixture(&fixtureDef));
}
P2ShapeType P2LineString::getShapeType() const
{
return P2ShapeType::LineString;
}
bool P2LineString::isClosed() const
{
return m_closed;
}
void P2LineString::draw(const ColorF& color) const
{
if (m_closed)
{
getLineString().drawClosed(detail::P2LineThickness / Graphics2D::GetMaxScaling(), color);
}
else
{
getLineString().draw(detail::P2LineThickness / Graphics2D::GetMaxScaling(), color);
}
}
void P2LineString::drawFrame(const double thickness, const ColorF& color) const
{
if (m_closed)
{
getLineString().drawClosed(thickness / Graphics2D::GetMaxScaling(), color);
}
else
{
getLineString().draw(thickness / Graphics2D::GetMaxScaling(), color);
}
}
void P2LineString::drawWireframe(const double thickness, const ColorF& color) const
{
if (m_closed)
{
getLineString().drawClosed(thickness / Graphics2D::GetMaxScaling(), color);
}
else
{
getLineString().draw(thickness / Graphics2D::GetMaxScaling(), color);
}
}
const LineString& P2LineString::getLineString() const
{
const b2Transform& transform = m_fixtures.fixtures[0]->GetBody()->GetTransform();
Vec2* pDst = m_lineString.data();
const b2Vec2* pSrc = m_pShape->m_vertices;
for (int32 i = 0; i < m_pShape->m_count; ++i)
{
*pDst++ = detail::CalcVec2(*pSrc++, transform);
}
return m_lineString;
}
////////////////////////////////////////////////
//
// P2Circle
//
////////////////////////////////////////////////
P2Circle::P2Circle(b2Body& body, const Circle& circle, const P2Material& material, const P2Filter& filter)
: m_pShape(std::make_unique<b2CircleShape>())
{
m_pShape->m_radius = static_cast<float32>(circle.r);
m_pShape->m_p.Set(static_cast<float32>(circle.x), static_cast<float32>(circle.y));
const b2FixtureDef fixtureDef = detail::MakeFixtureDef(m_pShape.get(), material, filter);
m_fixtures.fixtures.push_back(body.CreateFixture(&fixtureDef));
}
P2ShapeType P2Circle::getShapeType() const
{
return P2ShapeType::Circle;
}
void P2Circle::draw(const ColorF& color) const
{
getCircle().draw(color);
}
void P2Circle::drawFrame(const double thickness, const ColorF& color) const
{
getCircle().drawFrame(thickness / Graphics2D::GetMaxScaling(), color);
}
void P2Circle::drawWireframe(const double thickness, const ColorF& color) const
{
getCircle().drawFrame(thickness / Graphics2D::GetMaxScaling(), color);
}
Circle P2Circle::getCircle() const
{
return Circle(detail::CalcVec2(m_pShape->m_p, m_fixtures.fixtures[0]->GetBody()->GetTransform()), m_pShape->m_radius);
}
////////////////////////////////////////////////
//
// P2Rect
//
////////////////////////////////////////////////
P2Rect::P2Rect(b2Body& body, const RectF& rect, const P2Material& material, const P2Filter& filter)
: m_pShape(std::make_unique<b2PolygonShape>())
{
m_pShape->SetAsBox(static_cast<float32>(rect.w * 0.5f), static_cast<float32>(rect.h * 0.5f), detail::ToB2Vec2(rect.center()), 0.0f);
const b2FixtureDef fixtureDef = detail::MakeFixtureDef(m_pShape.get(), material, filter);
m_fixtures.fixtures.push_back(body.CreateFixture(&fixtureDef));
}
P2ShapeType P2Rect::getShapeType() const
{
return P2ShapeType::Rect;
}
void P2Rect::draw(const ColorF& color) const
{
getQuad().draw(color);
}
void P2Rect::draw(const ColorF(&colors)[4]) const
{
getQuad().draw(colors[0], colors[1], colors[2], colors[3]);
}
void P2Rect::draw(Arg::top_<ColorF> topColor, Arg::bottom_<ColorF> bottomColor) const
{
draw({ *topColor, *topColor, *bottomColor, *bottomColor });
}
void P2Rect::draw(Arg::left_<ColorF> leftColor, Arg::right_<ColorF> rightColor) const
{
draw({ *leftColor, *rightColor, *rightColor, *leftColor });
}
void P2Rect::drawFrame(const double thickness, const ColorF& color) const
{
getQuad().drawFrame(thickness / Graphics2D::GetMaxScaling(), color);
}
void P2Rect::drawWireframe(const double thickness, const ColorF& color) const
{
getQuad().drawFrame(thickness / Graphics2D::GetMaxScaling(), color);
}
Quad P2Rect::getQuad() const
{
const b2Transform& transform = m_fixtures.fixtures[0]->GetBody()->GetTransform();
return Quad(
detail::CalcVec2(m_pShape->m_vertices[0], transform),
detail::CalcVec2(m_pShape->m_vertices[1], transform),
detail::CalcVec2(m_pShape->m_vertices[2], transform),
detail::CalcVec2(m_pShape->m_vertices[3], transform));
}
////////////////////////////////////////////////
//
// P2Triangle
//
////////////////////////////////////////////////
P2Triangle::P2Triangle(b2Body& body, const Triangle& triangle, const P2Material& material, const P2Filter& filter)
: m_pShape(std::make_unique<b2PolygonShape>())
{
const b2Vec2 points[3] = { detail::ToB2Vec2(triangle.p0), detail::ToB2Vec2(triangle.p1), detail::ToB2Vec2(triangle.p2) };
m_pShape->Set(points, 3);
const b2FixtureDef fixtureDef = detail::MakeFixtureDef(m_pShape.get(), material, filter);
m_fixtures.fixtures.push_back(body.CreateFixture(&fixtureDef));
}
P2ShapeType P2Triangle::getShapeType() const
{
return P2ShapeType::Triangle;
}
void P2Triangle::draw(const ColorF& color) const
{
getTriangle().draw(color);
}
void P2Triangle::drawFrame(const double thickness, const ColorF& color) const
{
getTriangle().drawFrame(thickness / Graphics2D::GetMaxScaling(), color);
}
void P2Triangle::drawWireframe(const double thickness, const ColorF& color) const
{
getTriangle().drawFrame(thickness / Graphics2D::GetMaxScaling(), color);
}
Triangle P2Triangle::getTriangle() const
{
const b2Transform& transform = m_fixtures.fixtures[0]->GetBody()->GetTransform();
return Triangle(
detail::CalcVec2(m_pShape->m_vertices[0], transform),
detail::CalcVec2(m_pShape->m_vertices[1], transform),
detail::CalcVec2(m_pShape->m_vertices[2], transform));
}
////////////////////////////////////////////////
//
// P2Quad
//
////////////////////////////////////////////////
P2Quad::P2Quad(b2Body& body, const Quad& quad, const P2Material& material, const P2Filter& filter)
: m_pShape(std::make_unique<b2PolygonShape>())
{
const b2Vec2 points[4] = { detail::ToB2Vec2(quad.p0), detail::ToB2Vec2(quad.p1), detail::ToB2Vec2(quad.p2), detail::ToB2Vec2(quad.p3) };
m_pShape->Set(points, 4);
const b2FixtureDef fixtureDef = detail::MakeFixtureDef(m_pShape.get(), material, filter);
m_fixtures.fixtures.push_back(body.CreateFixture(&fixtureDef));
}
P2ShapeType P2Quad::getShapeType() const
{
return P2ShapeType::Quad;
}
void P2Quad::draw(const ColorF& color) const
{
getQuad().draw(color);
}
void P2Quad::drawFrame(const double thickness, const ColorF& color) const
{
getQuad().drawFrame(thickness / Graphics2D::GetMaxScaling(), color);
}
void P2Quad::drawWireframe(const double thickness, const ColorF& color) const
{
getQuad().drawFrame(thickness / Graphics2D::GetMaxScaling(), color);
}
Quad P2Quad::getQuad() const
{
const b2Transform& transform = m_fixtures.fixtures[0]->GetBody()->GetTransform();
return Quad(
detail::CalcVec2(m_pShape->m_vertices[0], transform),
detail::CalcVec2(m_pShape->m_vertices[1], transform),
detail::CalcVec2(m_pShape->m_vertices[2], transform),
detail::CalcVec2(m_pShape->m_vertices[3], transform));
}
////////////////////////////////////////////////
//
// P2Polygon
//
////////////////////////////////////////////////
P2Polygon::P2Polygon(b2Body& body, const Polygon& polygon, const P2Material& material, const P2Filter& filter)
: m_basePolygon(polygon)
{
b2PolygonShape m_shape;
for (size_t i = 0; i < polygon.num_triangles(); ++i)
{
const auto triangle = polygon.triangle(i);
const b2Vec2 points[3] = { detail::ToB2Vec2(triangle.p0), detail::ToB2Vec2(triangle.p1), detail::ToB2Vec2(triangle.p2) };
m_shape.Set(points, 3);
const b2FixtureDef fixtureDef = detail::MakeFixtureDef(&m_shape, material, filter);
m_fixtures.fixtures.push_back(body.CreateFixture(&fixtureDef));
}
}
P2ShapeType P2Polygon::getShapeType() const
{
return P2ShapeType::Polygon;
}
void P2Polygon::draw(const ColorF& color) const
{
const b2Transform& transform = m_fixtures.fixtures[0]->GetBody()->GetTransform();
m_basePolygon.drawTransformed(transform.q.s, transform.q.c, Vec2(transform.p.x, transform.p.y), color);
}
void P2Polygon::drawFrame(const double thickness, const ColorF& color) const
{
getPolygon().drawFrame(thickness / Graphics2D::GetMaxScaling(), color);
}
void P2Polygon::drawWireframe(const double thickness, const ColorF& color) const
{
getPolygon().drawWireframe(thickness / Graphics2D::GetMaxScaling(), color);
}
Polygon P2Polygon::getPolygon() const
{
const b2Transform& transform = m_fixtures.fixtures[0]->GetBody()->GetTransform();
return m_basePolygon.transformed(transform.q.s, transform.q.c, Vec2(transform.p.x, transform.p.y));
}
////////////////////////////////////////////////
//
// P2PivotJoint
//
////////////////////////////////////////////////
P2PivotJoint::P2PivotJoint(P2World& world, const P2Body& bodyA, const P2Body& bodyB, const Vec2& anchorPos)
: pImpl(std::make_shared<P2PivotJointDetail>(world, bodyA, bodyB, anchorPos))
{
}
Vec2 P2PivotJoint::getAnchorPos() const
{
if (!pImpl)
{
return Vec2::Zero();
}
return detail::ToVec2(pImpl->getJoint().GetAnchorA());
}
double P2PivotJoint::getJointAngle() const
{
if (!pImpl)
{
return 0.0;
}
return pImpl->getJoint().GetJointAngle();
}
double P2PivotJoint::getJointAngleSpeed() const
{
if (!pImpl)
{
return 0.0;
}
return pImpl->getJoint().GetJointSpeed();
}
P2PivotJoint& P2PivotJoint::setLimitEnabled(const bool enabled)
{
if (!pImpl)
{
return *this;
}
pImpl->getJoint().EnableLimit(enabled);
return *this;
}
bool P2PivotJoint::getLimitEnabled() const
{
if (!pImpl)
{
return false;
}
return pImpl->getJoint().IsLimitEnabled();
}
P2PivotJoint& P2PivotJoint::setLimits(const double lower, const double upper)
{
if (!pImpl)
{
return * this;
}
pImpl->getJoint().SetLimits(static_cast<float32>(lower), static_cast<float32>(upper));
return *this;
}
std::pair<double, double> P2PivotJoint::getLimits() const
{
if (!pImpl)
{
return{ 0.0, 0.0 };
}
return{ pImpl->getJoint().GetLowerLimit(), pImpl->getJoint().GetLowerLimit() };
}
P2PivotJoint& P2PivotJoint::setMotorEnabled(const bool enabled)
{
if (!pImpl)
{
return *this;
}
pImpl->getJoint().EnableMotor(enabled);
return *this;
}
bool P2PivotJoint::getMotorEnabled() const
{
if (!pImpl)
{
return false;
}
return pImpl->getJoint().IsMotorEnabled();
}
P2PivotJoint& P2PivotJoint::setMotorSpeed(const double speed)
{
if (!pImpl)
{
return *this;
}
pImpl->getJoint().SetMotorSpeed(static_cast<float32>(speed));
return *this;
}
double P2PivotJoint::getMotorSpeed() const
{
if (!pImpl)
{
return 0.0;
}
return pImpl->getJoint().GetMotorSpeed();
}
P2PivotJoint& P2PivotJoint::setMaxMotorTorque(const double torque)
{
if (!pImpl)
{
return *this;
}
pImpl->getJoint().SetMaxMotorTorque(static_cast<float32>(torque));
return *this;
}
double P2PivotJoint::getMaxMotorTorque() const
{
if (!pImpl)
{
return 0.0;
}
return pImpl->getJoint().GetMaxMotorTorque();
}
Vec2 P2PivotJoint::getReactionForce(const double inv_dt) const
{
if (!pImpl)
{
return Vec2::Zero();
}
return detail::ToVec2(pImpl->getJoint().GetReactionForce(static_cast<float32>(inv_dt)));
}
double P2PivotJoint::getReactionTorque(const double inv_dt) const
{
if (!pImpl)
{
return 0.0;
}
return pImpl->getJoint().GetReactionTorque(static_cast<float32>(inv_dt));
}
double P2PivotJoint::getMotorTorque(const double inv_dt) const
{
if (!pImpl)
{
return 0.0;
}
return pImpl->getJoint().GetMotorTorque(static_cast<float32>(inv_dt));
}
void P2PivotJoint::draw(const ColorF& color) const
{
if (!pImpl)
{
return;
}
const Vec2 anchorPos = detail::ToVec2(pImpl->getJoint().GetAnchorA());
Circle(anchorPos, detail::P2AnchorR / Graphics2D::GetMaxScaling()).draw(color);
}
////////////////////////////////////////////////
//
// P2DistanceJoint
//
////////////////////////////////////////////////
P2DistanceJoint::P2DistanceJoint(P2World& world, const P2Body& bodyA, const Vec2& anchorPosA, const P2Body& bodyB, const Vec2& anchorPosB, const double length)
: pImpl(std::make_shared<P2DistanceJointDetail>(world, bodyA, anchorPosA, bodyB, anchorPosB, length))
{
}
Vec2 P2DistanceJoint::getAnchorPosA() const
{
if (!pImpl)
{
return Vec2::Zero();
}
return detail::ToVec2(pImpl->getJoint().GetAnchorA());
}
Vec2 P2DistanceJoint::getAnchorPosB() const
{
if (!pImpl)
{
return Vec2::Zero();
}
return detail::ToVec2(pImpl->getJoint().GetAnchorB());
}
Vec2 P2DistanceJoint::getReactionForce(const double inv_dt) const
{
if (!pImpl)
{
return Vec2::Zero();
}
return detail::ToVec2(pImpl->getJoint().GetReactionForce(static_cast<float32>(inv_dt)));
}
double P2DistanceJoint::getReactionTorque(const double inv_dt) const
{
if (!pImpl)
{
return 0.0;
}
return pImpl->getJoint().GetReactionTorque(static_cast<float32>(inv_dt));
}
P2DistanceJoint& P2DistanceJoint::setLength(const double length)
{
if (!pImpl)
{
return *this;
}
pImpl->getJoint().SetLength(static_cast<float32>(length));
return *this;
}
double P2DistanceJoint::getLength() const
{
if (!pImpl)
{
return 0.0;
}
return pImpl->getJoint().GetLength();
}
P2DistanceJoint& P2DistanceJoint::setFrequencyHz(const double hz)
{
if (!pImpl)
{
return *this;
}
pImpl->getJoint().SetFrequency(static_cast<float32>(hz));
return *this;
}
double P2DistanceJoint::getFrequencyHz() const
{
if (!pImpl)
{
return 0.0;
}
return pImpl->getJoint().GetFrequency();
}
P2DistanceJoint& P2DistanceJoint::setDampingRatio(const double ratio)
{
if (!pImpl)
{
return *this;
}
pImpl->getJoint().SetDampingRatio(static_cast<float32>(ratio));
return *this;
}
double P2DistanceJoint::getDampingRatio() const
{
if (!pImpl)
{
return 0.0;
}
return pImpl->getJoint().GetDampingRatio();
}
void P2DistanceJoint::draw(const ColorF& color) const
{
if (!pImpl)
{
return;
}
const Vec2 anchorPosA = detail::ToVec2(pImpl->getJoint().GetAnchorA());
const Vec2 anchorPosB = detail::ToVec2(pImpl->getJoint().GetAnchorB());
const double scale = 1.0 / Graphics2D::GetMaxScaling();
Circle(anchorPosA, detail::P2AnchorR * scale).draw(color);
Circle(anchorPosB, detail::P2AnchorR * scale).draw(color);
Line(anchorPosA, anchorPosB).draw(detail::P2LineThickness * scale, color);
}
////////////////////////////////////////////////
//
// P2RopeJoint
//
////////////////////////////////////////////////
P2RopeJoint::P2RopeJoint(P2World& world, const P2Body& bodyA, const Vec2& anchorPosA, const P2Body& bodyB, const Vec2& anchorPosB, const double maxLength)
: pImpl(std::make_shared<P2RopeJointDetail>(world, bodyA, anchorPosA, bodyB, anchorPosB, maxLength))
{
}
Vec2 P2RopeJoint::getAnchorPosA() const
{
if (!pImpl)
{
return Vec2::Zero();
}
return detail::ToVec2(pImpl->getJoint().GetAnchorA());
}
Vec2 P2RopeJoint::getAnchorPosB() const
{
if (!pImpl)
{
return Vec2::Zero();
}
return detail::ToVec2(pImpl->getJoint().GetAnchorB());
}
Vec2 P2RopeJoint::getReactionForce(const double inv_dt) const
{
if (!pImpl)
{
return Vec2::Zero();
}
return detail::ToVec2(pImpl->getJoint().GetReactionForce(static_cast<float32>(inv_dt)));
}
double P2RopeJoint::getReactionTorque(const double inv_dt) const
{
if (!pImpl)
{
return 0.0;
}
return pImpl->getJoint().GetReactionTorque(static_cast<float32>(inv_dt));
}
P2RopeJoint& P2RopeJoint::setMaxLength(const double maxLength)
{
if (!pImpl)
{
return *this;
}
pImpl->getJoint().SetMaxLength(static_cast<float32>(maxLength));
return *this;
}
double P2RopeJoint::getMaxLength() const
{
if (!pImpl)
{
return 0.0;
}
return pImpl->getJoint().GetMaxLength();
}
void P2RopeJoint::draw(const ColorF& color) const
{
if (!pImpl)
{
return;
}
const Vec2 anchorPosA = detail::ToVec2(pImpl->getJoint().GetAnchorA());
const Vec2 anchorPosB = detail::ToVec2(pImpl->getJoint().GetAnchorB());
const double scale = 1.0 / Graphics2D::GetMaxScaling();
Circle(anchorPosA, detail::P2AnchorR * scale).draw(color);
Circle(anchorPosB, detail::P2AnchorR * scale).draw(color);
Line(anchorPosA, anchorPosB).draw(detail::P2LineThickness * scale, color);
}
////////////////////////////////////////////////
//
// P2SliderJoint
//
////////////////////////////////////////////////
P2SliderJoint::P2SliderJoint(P2World& world, const P2Body& bodyA, const P2Body& bodyB, const Vec2& anchorPos, const Vec2& normalizedAxis)
: pImpl(std::make_shared<P2SliderJointDetail>(world, bodyA, bodyB, anchorPos, normalizedAxis))
{
}
Vec2 P2SliderJoint::getAnchorPosA() const
{
if (!pImpl)
{
return Vec2::Zero();
}
return detail::ToVec2(pImpl->getJoint().GetAnchorA());
}
Vec2 P2SliderJoint::getAnchorPosB() const
{
if (!pImpl)
{
return Vec2::Zero();
}
return detail::ToVec2(pImpl->getJoint().GetAnchorB());
}
double P2SliderJoint::getJointTranslation() const
{
if (!pImpl)
{
return 0.0;
}
return pImpl->getJoint().GetJointTranslation();
}
double P2SliderJoint::getJointSpeed() const
{
if (!pImpl)
{
return 0.0;
}
return pImpl->getJoint().GetJointSpeed();
}
P2SliderJoint& P2SliderJoint::setLimitEnabled(const bool enabled)
{
if (!pImpl)
{
return *this;
}
pImpl->getJoint().EnableLimit(enabled);
return *this;
}
bool P2SliderJoint::getLimitEnabled() const
{
if (!pImpl)
{
return false;
}
return pImpl->getJoint().IsLimitEnabled();
}
P2SliderJoint& P2SliderJoint::setLimits(const double lower, const double upper)
{
if (!pImpl)
{
return *this;
}
pImpl->getJoint().SetLimits(static_cast<float32>(lower), static_cast<float32>(upper));
return *this;
}
std::pair<double, double> P2SliderJoint::getLimits() const
{
if (!pImpl)
{
return{ 0.0, 0.0 };
}
return{ pImpl->getJoint().GetLowerLimit(), pImpl->getJoint().GetLowerLimit() };
}
P2SliderJoint& P2SliderJoint::setMotorEnabled(const bool enabled)
{
if (!pImpl)
{
return *this;
}
pImpl->getJoint().EnableMotor(enabled);
return *this;
}
bool P2SliderJoint::getMotorEnabled() const
{
if (!pImpl)
{
return false;
}
return pImpl->getJoint().IsMotorEnabled();
}
P2SliderJoint& P2SliderJoint::setMotorSpeed(const double speed)
{
if (!pImpl)
{
return *this;
}
pImpl->getJoint().SetMotorSpeed(static_cast<float32>(speed));
return *this;
}
double P2SliderJoint::getMotorSpeed() const
{
if (!pImpl)
{
return 0.0;
}
return pImpl->getJoint().GetMotorSpeed();
}
P2SliderJoint& P2SliderJoint::setMaxMotorForce(const double force)
{
if (!pImpl)
{
return *this;
}
pImpl->getJoint().SetMaxMotorForce(static_cast<float32>(force));
return *this;
}
double P2SliderJoint::getMaxMotorForce() const
{
if (!pImpl)
{
return 0.0;
}
return pImpl->getJoint().GetMaxMotorForce();
}
double P2SliderJoint::getMotorForce(const double inv_dt) const
{
if (!pImpl)
{
return 0.0;
}
return pImpl->getJoint().GetMotorForce(static_cast<float32>(inv_dt));
}
Vec2 P2SliderJoint::getReactionForce(const double inv_dt) const
{
if (!pImpl)
{
return Vec2::Zero();
}
return detail::ToVec2(pImpl->getJoint().GetReactionForce(static_cast<float32>(inv_dt)));
}
double P2SliderJoint::getReactionTorque(const double inv_dt) const
{
if (!pImpl)
{
return 0.0;
}
return pImpl->getJoint().GetReactionTorque(static_cast<float32>(inv_dt));
}
void P2SliderJoint::draw(const ColorF& color) const
{
if (!pImpl)
{
return;
}
const Vec2 anchorPosA = detail::ToVec2(pImpl->getJoint().GetAnchorA());
const Vec2 anchorPosB = detail::ToVec2(pImpl->getJoint().GetAnchorB());
const double scale = 1.0 / Graphics2D::GetMaxScaling();
Circle(anchorPosA, detail::P2AnchorR * scale).draw(color);
Circle(anchorPosB, detail::P2AnchorR * scale).draw(color);
Line(anchorPosA, anchorPosB).draw(detail::P2LineThickness * scale, color);
}
////////////////////////////////////////////////
//
// P2WheelJoint
//
////////////////////////////////////////////////
P2WheelJoint::P2WheelJoint(P2World& world, const P2Body& bodyA, const P2Body& bodyB, const Vec2& anchor, const Vec2& axis)
: pImpl(std::make_shared<P2WheelJointDetail>(world, bodyA, bodyB, anchor, axis))
{
}
Vec2 P2WheelJoint::getAnchorPosA() const
{
if (!pImpl)
{
return Vec2::Zero();
}
return detail::ToVec2(pImpl->getJoint().GetAnchorA());
}
Vec2 P2WheelJoint::getAnchorPosB() const
{
if (!pImpl)
{
return Vec2::Zero();
}
return detail::ToVec2(pImpl->getJoint().GetAnchorB());
}
Vec2 P2WheelJoint::getReactionForce(const double inv_dt) const
{
if (!pImpl)
{
return Vec2::Zero();
}
return detail::ToVec2(pImpl->getJoint().GetReactionForce(static_cast<float32>(inv_dt)));
}
double P2WheelJoint::getReactionTorque(const double inv_dt) const
{
if (!pImpl)
{
return 0.0;
}
return pImpl->getJoint().GetReactionTorque(static_cast<float32>(inv_dt));
}
double P2WheelJoint::getJointTranslation() const
{
if (!pImpl)
{
return 0.0;
}
return pImpl->getJoint().GetJointTranslation();
}
double P2WheelJoint::getJointLinearSpeed() const
{
if (!pImpl)
{
return 0.0;
}
return pImpl->getJoint().GetJointLinearSpeed();
}
double P2WheelJoint::getJointAngle() const
{
if (!pImpl)
{
return 0.0;
}
return pImpl->getJoint().GetJointAngle();
}
double P2WheelJoint::getJointAngularSpeed() const
{
if (!pImpl)
{
return 0.0;
}
return pImpl->getJoint().GetJointAngularSpeed();
}
P2WheelJoint& P2WheelJoint::setMotorEnabled(const bool enabled)
{
if (!pImpl)
{
return *this;
}
pImpl->getJoint().EnableMotor(enabled);
return *this;
}
bool P2WheelJoint::getMotorEnabled() const
{
if (!pImpl)
{
return false;
}
return pImpl->getJoint().IsMotorEnabled();
}
P2WheelJoint& P2WheelJoint::setMotorSpeed(const double speed)
{
if (!pImpl)
{
return *this;
}
pImpl->getJoint().SetMotorSpeed(static_cast<float32>(speed));
return *this;
}
double P2WheelJoint::getMotorSpeed() const
{
if (!pImpl)
{
return 0.0;
}
return pImpl->getJoint().GetMotorSpeed();
}
P2WheelJoint& P2WheelJoint::setMaxMotorTorque(const double torque)
{
if (!pImpl)
{
return *this;
}
pImpl->getJoint().SetMaxMotorTorque(static_cast<float32>(torque));
return *this;
}
double P2WheelJoint::getMaxMotorTorque() const
{
if (!pImpl)
{
return 0.0;
}
return pImpl->getJoint().GetMaxMotorTorque();
}
double P2WheelJoint::getMotorTorque(const double inv_dt) const
{
if (!pImpl)
{
return 0.0;
}
return pImpl->getJoint().GetMotorTorque(static_cast<float32>(inv_dt));
}
P2WheelJoint& P2WheelJoint::setSpringFrequencyHz(const double hz)
{
if (!pImpl)
{
return *this;
}
pImpl->getJoint().SetSpringFrequencyHz(static_cast<float32>(hz));
return *this;
}
double P2WheelJoint::getSpringFrequencyHz() const
{
if (!pImpl)
{
return 0.0;
}
return pImpl->getJoint().GetSpringFrequencyHz();
}
P2WheelJoint& P2WheelJoint::setSpringDampingRatio(const double ratio)
{
if (!pImpl)
{
return *this;
}
pImpl->getJoint().SetSpringDampingRatio(static_cast<float32>(ratio));
return *this;
}
double P2WheelJoint::getSpringDampingRatio() const
{
if (!pImpl)
{
return 0.0;
}
return pImpl->getJoint().GetSpringDampingRatio();
}
void P2WheelJoint::draw(const ColorF& color) const
{
if (!pImpl)
{
return;
}
const Vec2 anchorPosA = detail::ToVec2(pImpl->getJoint().GetAnchorA());
const Vec2 anchorPosB = detail::ToVec2(pImpl->getJoint().GetAnchorB());
const double scale = 1.0 / Graphics2D::GetMaxScaling();
Circle(anchorPosA, detail::P2AnchorR * scale).draw(color);
Circle(anchorPosB, detail::P2AnchorR * scale).draw(color);
Line(anchorPosA, anchorPosB).draw(detail::P2LineThickness * scale, color);
}
}
|
3fd27cfbdfa2401408821b6edc59ea45b181aa63 | 80901815430006de125bbea7d0a82fd7dad3fb32 | /ExprPlus.h | 1ca2587072e12c37e91f1d5cf62e7a092d8d8ea2 | [] | no_license | HexaTeam4212/TPCompiloLouisLucie | 07aade149a5588967ac239fea96466a35aa6821a | e3d2cdfa244def275236b3ae925fb0ebd9e45345 | refs/heads/master | 2021-01-06T13:20:29.748159 | 2020-02-28T14:49:09 | 2020-02-28T14:49:09 | 241,339,949 | 0 | 0 | null | 2020-02-28T02:46:03 | 2020-02-18T11:05:46 | C++ | UTF-8 | C++ | false | false | 507 | h | ExprPlus.h | //
// Created by Louis on 18/02/2020.
//
#ifndef TP_EXPRPLUS_H
#define TP_EXPRPLUS_H
#include "Symbol.h"
#include "Expression.h"
class ExprPlus : public Expression{
public:
explicit ExprPlus(Expression* eg,Expression* ed) : expr_gauche(eg), expr_droit(ed) {}
~ExprPlus();
void display();
int getValue() override;
Expression* geteg();
Expression* geted();
private:
Expression* expr_gauche;
Expression* expr_droit;
};
#endif //TP_EXPRPLUS_H
|
10d758d0eed3cf2bd850d52876b636b366f3f513 | 2b1b459706bbac83dad951426927b5798e1786fc | /src/devices/bin/driver_manager/inspect.h | a74ab5c7dfb4bae942e026b1fdcdf0b0f5d15112 | [
"BSD-2-Clause"
] | permissive | gnoliyil/fuchsia | bc205e4b77417acd4513fd35d7f83abd3f43eb8d | bc81409a0527580432923c30fbbb44aba677b57d | refs/heads/main | 2022-12-12T11:53:01.714113 | 2022-01-08T17:01:14 | 2022-12-08T01:29:53 | 445,866,010 | 4 | 3 | BSD-2-Clause | 2022-10-11T05:44:30 | 2022-01-08T16:09:33 | C++ | UTF-8 | C++ | false | false | 4,584 | h | inspect.h | // Copyright 2020 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SRC_DEVICES_BIN_DRIVER_MANAGER_INSPECT_H_
#define SRC_DEVICES_BIN_DRIVER_MANAGER_INSPECT_H_
#include <lib/ddk/binding.h>
#include <lib/inspect/cpp/inspect.h>
#include <lib/zx/channel.h>
#include <lib/zx/result.h>
#include <fbl/array.h>
#include <fbl/ref_ptr.h>
#include "src/lib/storage/vfs/cpp/pseudo_dir.h"
#include "src/lib/storage/vfs/cpp/synchronous_vfs.h"
#include "src/lib/storage/vfs/cpp/vmo_file.h"
class Device;
struct ProtocolInfo {
const char* name;
fbl::RefPtr<fs::PseudoDir> devnode;
uint32_t id;
uint32_t flags;
uint32_t seqcount;
};
static const inline ProtocolInfo kProtoInfos[] = {
#define DDK_PROTOCOL_DEF(tag, val, name, flags) {name, nullptr, val, flags, 0},
#include <lib/ddk/protodefs.h>
};
class InspectDevfs {
public:
// Use Create instead.
explicit InspectDevfs(fbl::RefPtr<fs::PseudoDir> root_dir, fbl::RefPtr<fs::PseudoDir> class_dir);
static zx::result<InspectDevfs> Create(const fbl::RefPtr<fs::PseudoDir>& root_dir);
std::tuple<fbl::RefPtr<fs::PseudoDir>, uint32_t*> GetProtoDir(uint32_t id);
// Get protocol |id| directory if it exists, else create one.
std::tuple<fbl::RefPtr<fs::PseudoDir>, uint32_t*> GetOrCreateProtoDir(uint32_t id);
// Delete protocol |id| directory if no files are present.
void RemoveEmptyProtoDir(uint32_t id);
zx::result<> AddClassDirEntry(const fbl::RefPtr<Device>& dev);
zx::result<> Publish(const fbl::RefPtr<Device>& dev);
void Unpublish(Device* dev);
private:
fbl::RefPtr<fs::PseudoDir> root_dir_;
fbl::RefPtr<fs::PseudoDir> class_dir_;
std::array<ProtocolInfo, std::size(kProtoInfos)> proto_infos_;
};
class InspectManager {
public:
explicit InspectManager(async_dispatcher_t* dispatcher);
InspectManager() = delete;
zx::result<fidl::ClientEnd<fuchsia_io::Directory>> Connect();
fs::PseudoDir& diagnostics_dir() { return *diagnostics_dir_; }
fbl::RefPtr<fs::PseudoDir> driver_host_dir() { return driver_host_dir_; }
inspect::Node& root_node() { return inspector_.GetRoot(); }
inspect::Node& devices() { return devices_; }
inspect::UintProperty& device_count() { return device_count_; }
inspect::Inspector& inspector() { return inspector_; }
std::optional<InspectDevfs>& devfs() { return devfs_; }
private:
inspect::Inspector inspector_;
std::unique_ptr<fs::SynchronousVfs> diagnostics_vfs_;
fbl::RefPtr<fs::PseudoDir> diagnostics_dir_ = fbl::MakeRefCounted<fs::PseudoDir>();
fbl::RefPtr<fs::PseudoDir> driver_host_dir_ = fbl::MakeRefCounted<fs::PseudoDir>();
inspect::UintProperty device_count_;
inspect::Node devices_;
// The inspect devfs instance
std::optional<InspectDevfs> devfs_;
};
class DeviceInspect {
public:
// |devices| and |device_count| should outlive DeviceInspect class
DeviceInspect(inspect::Node& devices, inspect::UintProperty& device_count, std::string name,
zx::vmo vmo);
~DeviceInspect();
inspect::Node& device_node() { return device_node_; }
std::optional<fbl::RefPtr<fs::VmoFile>> file() { return vmo_file_; }
void set_state(const std::string& state) { state_.Set(state); }
void set_local_id(uint64_t local_id) { local_id_.Set(local_id); }
// These methods below are for static values and should be called only once. Calling it more than
// once will lead to duplicate entries.
void set_topological_path(const std::string& path) {
device_node_.CreateString("topological_path", path, &static_values_);
}
void set_protocol_id(uint32_t value) {
device_node_.CreateUint("protocol_id", value, &static_values_);
}
void set_type(const std::string& type) {
device_node_.CreateString("type", type, &static_values_);
}
void set_flags(uint32_t flags) { device_node_.CreateUint("flags", flags, &static_values_); }
void set_properties(const fbl::Array<const zx_device_prop_t>& props);
void set_driver(const std::string& libname) {
device_node_.CreateString("driver", libname, &static_values_);
}
private:
inspect::UintProperty& device_count_node_;
inspect::Node device_node_;
// Reference to nodes with static properties
inspect::ValueList static_values_;
inspect::StringProperty state_;
// Unique id of the device in a driver host
inspect::UintProperty local_id_;
// Inspect VMO returned via devfs's inspect nodes.
std::optional<fbl::RefPtr<fs::VmoFile>> vmo_file_;
};
#endif // SRC_DEVICES_BIN_DRIVER_MANAGER_INSPECT_H_
|
5068f3709dfad6fdb4def124f84a6615377161a8 | b71556aee4654b48e91ba8124a3a8ded26de273e | /contest/USSTforces #19 (Div .2 + Div. 3)/F.cpp | 27490e4272d38eef151bb8b4db68b70b587825b1 | [] | no_license | young-zy/algorithm | 0255a327390c6b149870b34fbd34816dc002e82e | 536eddd9a6bc03e81c566afa05c53f555eb14a86 | refs/heads/master | 2021-07-23T07:23:29.929221 | 2020-04-23T16:33:28 | 2020-04-23T16:33:28 | 149,439,464 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 463 | cpp | F.cpp | #include<bits/stdc++.h>
#define endl "\n"
#define INF 0x3f3f3f3f
using namespace std;
long long a[100005];
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
long long n;
cin>>n;
a[1] = 1;
for(int i = 2; i<=50;i++){
a[i] = 2*a[i-1]+(1LL<<(i-1));
}
n--;
long long ans = 0;
for(int i = 0; i<50;i++){
if(n & (1LL<<i)){
ans+=a[i]+(1LL<<i);
}
}
cout<<ans;
return 0;
} |
045647d748a861739212d5a9a11e36d17438e473 | 16dcce7bb52b65dad10ca15c834dd7193cc7c766 | /cg/lab2/Include/Geometry/primitives/polar_point.h | 777b5c78225eb42ab6cbfc554e3eb580865f0033 | [] | no_license | ioffe/polytech-8term | f1915111413a60669f01317d1b304c5d21fb128d | cbdb4488e02dc0bd0ed8e0eb606f3d653970f138 | refs/heads/master | 2021-01-20T00:40:19.852577 | 2011-05-01T14:16:22 | 2011-05-01T14:16:22 | 1,682,152 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,972 | h | polar_point.h | #pragma once
#include <geometry\xmath.h>
#include <common\no_deduce.h>
#include "point.h"
#include "polar_point_fwd.h"
namespace cg
{
template<typename scalar, int N> struct polar_point_t ;
// operations
template<typename scalar, int N> polar_point_t<scalar,N> operator * (polar_point_t<scalar,N> const & a, NO_DEDUCE(scalar) b) ;
template<typename scalar, int N> polar_point_t<scalar,N> operator * (NO_DEDUCE(scalar) b, polar_point_t<scalar,N> const & a) ;
}
//
namespace cg
{
#pragma pack(push,1)
template<typename scalar>
struct polar_point_t<scalar,2>
{
scalar range, course;
polar_point_t(scalar range = 1, scalar course = 0) ;
template <class _scalar> polar_point_t(polar_point_t<_scalar,2> const & other ) ;
polar_point_t(point_t<scalar,2> const & pt) ;
operator point_t<scalar,2> () const ;
polar_point_t & operator *= (scalar m ) ;
};
template<typename scalar>
struct polar_point_t<scalar,3>
{
scalar range, course, pitch;
polar_point_t(scalar range = 1, scalar course = 0, scalar pitch = 0) ;
template <class _scalar> polar_point_t(polar_point_t<_scalar,3> const & other ) ;
polar_point_t(point_t<scalar,3> const & pt) ;
operator point_t<scalar,3> () const ;
polar_point_t & operator *= (scalar m) ;
};
#pragma pack(pop)
}
/////////////////////////////////////////////////////////////////////////
// Implementation
namespace cg
{
template<typename S>
polar_point_t<S,2>::polar_point_t(S range, S course)
: range(range)
, course(course)
{
}
template <class S> template <class _S>
polar_point_t<S,2>::polar_point_t(polar_point_t<_S,2> const & other )
: range ( (S)other.range )
, course ( (S)other.course )
{
}
template <class S>
polar_point_t<S,2>::polar_point_t(point_t<S,2> const & pt)
: range ( (S)cg::sqrt(sqr(pt.x) + sqr(pt.y)) )
, course ( (S)rad2grad(atan2(pt.x, pt.y)) )
{
}
template <class S>
polar_point_t<S,2>::operator point_t<S,2> () const
{
return point_t<S,2>( (S)range * sin(grad2rad(course)),
(S)range * cos(grad2rad(course)));
}
template <class S>
polar_point_t<S,2> & polar_point_t<S,2>::operator *= (S m )
{
range *= m;
return *this;
}
//
template<typename S>
polar_point_t<S,3>::polar_point_t(S range, S course, S pitch)
: range (range)
, course(course)
, pitch (pitch)
{
}
template <class S> template <class _S>
polar_point_t<S,3>::polar_point_t(polar_point_t<_S,3> const & other )
: range ( (S)other.range )
, course ( (S)other.course )
, pitch ( (S)other.pitch )
{
}
template <class S>
polar_point_t<S,3>::polar_point_t(point_t<S,3> const & pt)
{
S n2d = (S)(sqr(pt.x) + sqr(pt.y));
range = (S)cg::sqrt (n2d + (S)sqr(pt.z));
course = (S)rad2grad(atan2 (pt.x, pt.y));
pitch = (S)rad2grad(atan2 ((S)pt.z, cg::sqrt(n2d) ));
}
template <class S>
polar_point_t<S,3>::operator point_t<S,3> () const
{
S st = cos(grad2rad(pitch));
return point_t<S,3>( (S) range * st * sin(grad2rad(course)),
(S) range * st * cos(grad2rad(course)),
(S) range * sin(grad2rad(pitch)));
}
template <class S>
polar_point_t<S,3> & polar_point_t<S,3>::operator *= (S m )
{
range *= m;
return *this;
}
// operations
template<typename S, int N>
polar_point_t<S,N> operator * (polar_point_t<S,N> const & a, NO_DEDUCE(S) b)
{
return polar_point_t<S,N>(a) *= b ;
}
template<typename S, int N>
polar_point_t<S,N> operator * (NO_DEDUCE(S) b, polar_point_t<S,N> const & a)
{
return polar_point_t<S,N>(a) *= b ;
}
template<typename S>
polar_point_t<S,2> blend(polar_point_t<S,2> const & a, polar_point_t<S,2> const & b, double t)
{
return polar_point_t<S,2> ( blend(a.range, b.range, t), norm180(b.course + norm180(a.course-b.course)*t) ) ;
}
template<typename S>
polar_point_t<S,3> blend(polar_point_t<S,3> const & a, polar_point_t<S,3> const & b, double t)
{
return polar_point_t<S,3> ( blend(a.range, b.range, t),
norm180(b.course + norm180(a.course-b.course)*t),
norm180(b.pitch + norm180(a.pitch-b.pitch)*t) ) ;
}
template<typename S>
bool eq( polar_point_t<S,2> const & a, polar_point_t<S,2> const & b, S eps = epsilon<S>() )
{
return eq_zero(norm180(a.course-b.course), eps) && eq(a.range, b.range, eps) ;
}
template<typename S>
bool eq( polar_point_t<S,3> const & a, polar_point_t<S,3> const & b, S eps = epsilon<S>() )
{
return eq_zero(norm180(a.course-b.course), eps) && eq_zero(norm180(a.pitch-b.pitch), eps) && eq(a.range, b.range, eps) ;
}
} |
ccbe43be9d8e41eca9d94781a812ba1839e97476 | d6b2f9eff89efb295c87fb6aa80e9dac38b7f2bc | /Concurrency/ThreadTest.h | 0cac84a56e4c3bf4fe609d985e0acc1a7fa2e1b4 | [] | no_license | Dgcf/Concurrency | 1f88eee78f23f25c960ac88ca75c69635395ddce | be30c1e272ce0004084a0ca8a8d21f54ece712bd | refs/heads/master | 2022-10-28T13:29:59.194663 | 2020-06-15T13:59:03 | 2020-06-15T13:59:03 | 270,188,743 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 209 | h | ThreadTest.h | #pragma once
#include "common.h"
class ThreadTest
{
public:
ThreadTest();
void Start();
void Join();
void ThreadFunc();
void ThrowException() const;
private:
std::thread t_;
};
//void StartThread();
|
fcd13719fe6e3c6e4feb44cd283a0bc4957de272 | f451899297221cfbe8c6a25c4a0cfb8cba66a890 | /Geographic Information System (GIS)/implementation/src/Seq2D.cpp | bc6e435a57a1b87a656b0134db7b4c7fd7491bb2 | [] | no_license | andyh98/In-Course-Projects | 4002f171fea87c2242664697fba2305029308620 | 50843066cff29826f5af9fb3e879d21a3002a9b2 | refs/heads/master | 2020-03-07T11:46:42.557384 | 2018-09-14T02:52:56 | 2018-09-14T02:52:56 | 127,463,539 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,958 | cpp | Seq2D.cpp | #include <vector>
#include <iostream>
#include "../include/Exceptions.h"
#include "../include/LineADT.h"
#include "../include/PointADT.h"
#include "../include/PathADT.h"
#include "../include/MapTypes.h"
#include "../include/Seq2D.h"
template<class T>
Seq2D<T>::Seq2D(std::vector< std::vector<T> > S, double scl){
int sizeRow = S.at(0).size();
if (scl <= 0 || S.size() == 0 || S.at(0).size() == 0)
throw invalid_argument();
for (int i = 1; i < S.size(); i++){
if (sizeRow != S.at(i).size())
throw invalid_argument();
}
this->s = S;
this->scale = scl;
this->nCol = S.size();
this->nRow = sizeRow;
}
template<class T>
void Seq2D<T>::set(PointT p, T v){
if (!validPoint(p))
throw outside_bounds();
this->s.at(p.y()).at(p.x()) = v;
}
template<class T>
T Seq2D<T>::get(PointT p){
if (!validPoint(p))
throw outside_bounds();
return this->s.at(p.y()).at(p.x());
}
template<class T>
int Seq2D<T>::getNumRow(){
return this->nRow;
}
template<class T>
int Seq2D<T>::getNumCol(){
return this->nCol;
}
template<class T>
double Seq2D<T>::getScale(){
return this->scale;
}
template<class T>
int Seq2D<T>::count(T t){
int counts = 0;
for (int i = 0; i < nRow && validRow(i); i++){
for (int j = 0; j < nCol && validCol(j); j++){
if (this->s.at(i).at(j) == t)
counts++;
}
}
return counts;
}
template<class T>
int Seq2D<T>::count(LineT l, T t){
if (!validLine(l))
throw invalid_argument();
int counts = 0;
for (int i =0 ; i < l.len(); i++){
if (this->s.at(pointsInLine(l).at(i).y()).at(pointsInLine(l).at(i).x()) == t)
counts++;
}
return counts;
}
template<class T>
int Seq2D<T>::count(PathT pth, T t){
if (!validPath(pth))
throw invalid_argument();
int counts=0;
for (int i =0 ; i < pth.size(); i++){
counts += count(pth.line(i), t);
}
return counts;
}
template<class T>
double Seq2D<T>::length(PathT pth){
if (!validPath(pth))
throw invalid_argument();
return (pth.len())*(this->scale);
}
template<class T>
bool Seq2D<T>::connected(PointT p1, PointT p2){
if (!validPoint(p1) || !validPoint(p2))
throw invalid_argument();
this->check = false;
this->checked.clear();
return PointsAdjacent(p1,p2);
}
template<class T>
bool Seq2D<T>::pointChecked(PointT x){
for (int i = 0; i < this->checked.size() ; i++){
if (this->checked.at(i).x() == x.x()
&& this->checked.at(i).y() == x.y())
return true;
}
return false;
}
template<class T>
bool Seq2D<T>::PointsAdjacent(PointT p1,PointT p2){
std::vector<PointT> adjacent;
PointT W = PointT(p1.translate(-1,0));
PointT E = PointT(p1.translate(1,0));
PointT N = PointT(p1.translate(0,1));
PointT S = PointT(p1.translate(0,-1));
if (validPoint(W) && get(p1) == get(W) && (!pointChecked(W))) {adjacent.push_back(W); this->checked.push_back(W);}
if (validPoint(E) && get(p1) == get(E) && (!pointChecked(E))) {adjacent.push_back(E); this->checked.push_back(E);}
if (validPoint(N) && get(p1) == get(N) && (!pointChecked(N))) {adjacent.push_back(N); this->checked.push_back(N);}
if (validPoint(S) && get(p1) == get(S) && (!pointChecked(S))) {adjacent.push_back(S); this->checked.push_back(S);}
for (int i = 0; i < adjacent.size(); i++){
if (adjacent.at(i).x() == p2.x() && adjacent.at(i).y() == p2.y())
return true;
}
//search through each adjacent point
for (int i = 0; i < adjacent.size(); i++)
check = PointsAdjacent(adjacent.at(i), p2);
if (check) return true;
return false;
}
//local fns
template<class T>
bool Seq2D<T>::validRow(int i){
return 0 <= i && i <= this->nRow - 1;
}
template<class T>
bool Seq2D<T>::validCol(int j){
return 0 <= j && j <= this->nCol - 1;
}
template<class T>
bool Seq2D<T>::validPoint(PointT p){
return validRow(p.y()) && validCol(p.x());
}
template<class T>
bool Seq2D<T>::validLine(LineT l){
for (int i =0 ; i < l.len(); i++){
if (!validPoint(pointsInLine(l).at(i)))
return false;
}
return true;
}
template<class T>
bool Seq2D<T>::validPath(PathT pth){
for (int i =0 ; i < pth.len(); i++){
for (int line = 0; line < pth.size(); line++)
if (!validLine(pth.line(line)))
return false;
}
return true;
}
template<class T>
std::vector<PointT> Seq2D<T>::pointsInLine(LineT l){
int xval = 0;
int yval = 0;
switch (l.orient()){
case W: xval = -1;
case E: xval = 1;
case N: yval = 1;
case S: yval = -1;
}
std::vector<PointT> linepts;
for (int i = 0; i < l.len(); i++){
linepts.push_back(l.strt().translate(xval * i,yval * i));
}
return linepts;
}
template<class T>
std::vector<PointT> Seq2D<T>::pointsInPath(PathT p){
std::vector<PointT> points;
//iterate through the lines p.size()
for (int i =0 ; i < p.size(); i++){
//iterate through the points in each line to append to a new sequence of points.
for (int j =0 ; j < p.line(i).len(); j++){
points.push_back(pointsInLine(p.line(i)).at(j));
}
}
return points;
}
template class Seq2D < LanduseT >;
template class Seq2D < int >; |
9e74139b6ea33f5a7729eff77ebeaae560840b66 | 6bcdb9e8836cd60e972be865beb50fbfefdfa650 | /examples/signal/benchmark.cpp | 455a52ae7ecaea05ad17c63b2211a0b9d1a2467f | [
"BSL-1.0"
] | permissive | pmiddend/fcppt | 4dbba03f7386c1e0d35c21aa0e88e96ed824957f | 9f437acbb10258e6df6982a550213a05815eb2be | refs/heads/master | 2020-09-22T08:54:49.438518 | 2019-11-30T14:14:04 | 2019-11-30T14:14:04 | 225,129,546 | 0 | 0 | BSL-1.0 | 2019-12-01T08:31:12 | 2019-12-01T08:31:11 | null | UTF-8 | C++ | false | false | 1,608 | cpp | benchmark.cpp | // Copyright Carl Philipp Reh 2009 - 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#if defined(FCPPT_EXAMPLES_SIGNAL_BENCHMARK_USE_FCPPT)
#include <fcppt/signal/object.hpp>
#include <fcppt/signal/auto_connection_container.hpp>
#elif defined(FCPPT_EXAMPLES_SIGNAL_BENCHMARK_USE_BOOST_SIGNALS2)
#include <fcppt/config/external_begin.hpp>
#include <boost/signals2.hpp>
#include <vector>
#include <fcppt/config/external_end.hpp>
#else
#error "Wrong option"
#endif
#include <fcppt/config/external_begin.hpp>
#include <iostream>
#include <ostream>
#include <cstddef>
#include <fcppt/config/external_end.hpp>
namespace
{
void
f()
{
static unsigned i = 0;
if(++i % 10000 == 0)
std::cout << "|\n";
}
std::size_t const max_iterations = 1000000;
}
int
main()
{
#if defined(FCPPT_EXAMPLES_SIGNAL_BENCHMARK_USE_FCPPT)
typedef
fcppt::signal::object<void()>
signal_type;
signal_type s;
fcppt::signal::auto_connection_container manager;
for(std::size_t i = 0; i < max_iterations; ++i)
manager.push_back(
s.connect(
signal_type::function(
&f
)
)
);
s();
#elif defined(FCPPT_EXAMPLES_SIGNAL_BENCHMARK_USE_BOOST_SIGNALS2)
typedef
boost::signals2::signal<void()>
signal_type;
signal_type s;
typedef
std::vector<boost::signals2::connection>
connection_manager;
connection_manager manager;
manager.reserve(
max_iterations);
for(std::size_t i = 0; i < max_iterations; ++i)
manager.push_back(
s.connect(
&f));
s();
#endif
}
|
4e86f9de42969b2e87f86d901e5411d99db14c71 | b94bfc13c1e593bf7393ed6adbcd630cc6692b7a | /wfmaxplugins/attrib/attrib.cc | ae1a527ca69d0a444797de9a7aeb55cdda6482d4 | [] | no_license | WorldFoundry/WorldFoundry | 341cd45695ab112a92cefd4ade692734e55695b4 | 5c507edddb84d2b27b7c248fb8aa79c2fdc7ce22 | refs/heads/master | 2021-01-25T07:27:49.731410 | 2010-05-06T19:14:28 | 2010-05-06T19:14:28 | 641,648 | 6 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 29,941 | cc | attrib.cc | // attrib.cc
#include <global.hp>
#include "attrib.h"
#include "oad.hpp"
#include <io.h>
#include <windowsx.h>
#include "../lib/registry.h"
#include "buttons/int.h"
#include "buttons/fixed.h"
#include "buttons/objref.h"
#include "buttons/colorpck.h"
#include "buttons/dropmenu.h"
#include "buttons/propshet.h"
#include "buttons/group.h"
#include "buttons/cycle.h"
#include "buttons/filename.h"
#include "buttons/meshname.h"
#include "buttons/checkbox.h"
#include "buttons/xdata.h"
#include "buttons/classref.h"
#include "buttons/mailbox.h"
#include "buttons/combobox.h"
#include "buttons/string.h"
#include "util.h"
#include <stdarg.h>
//#include <strstream>
//#include <pigsys/pigsys.h>
#include <iffwrite.hp>
void
Error( const char* buf, ... )
{
static char buffer[ 1024 ];
va_list arglist;
va_start( arglist, buf );
vsprintf( buffer, buf, arglist );
va_end( arglist );
MessageBox(GetCOREInterface()->GetMAXHWnd(), buffer, "Attrib Error", MB_OK);
}
Attributes theAttributes;
class AttributesClassDesc : public ClassDesc
{
public:
int IsPublic() {return true;}
void* Create(BOOL loading = FALSE) {return &theAttributes;}
const TCHAR* ClassName() {return "Attributes";}
SClass_ID SuperClassID() {return UTILITY_CLASS_ID;}
Class_ID ClassID() {return Attrib_ClassID; }
const TCHAR* Category() {return _T("World Foundry");}
};
static AttributesClassDesc appDataTestDesc;
ClassDesc* GetPropertiesDesc() {return &appDataTestDesc;}
#if 0
LRESULT CALLBACK
RollupWndProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
{
//assert( theSelect._headerWndProc );
if ( msg == WM_RBUTTONDOWN )
{
int x = LOWORD( lParam );
int y = HIWORD( lParam );
RECT rectParentParent;
GetWindowRect( GetParent( GetParent( hwnd ) ), &rectParentParent );
RECT rect;
GetWindowRect( hwnd, &rect );
x += rect.left - rectParentParent.left;
lParam = MAKELONG( x, y );
//SendMessage( GetParent( GetParent( hwnd ) ), WM_COLUMN_RBUTTONDOWN, col, lParam );
return 0;
}
else
return theSelect._headerWndProc( hwnd, msg, wParam, lParam );
}
#endif
uiDialog* theActiveGadget;
BOOL CALLBACK
AttributesDlgProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam )
{
try
{
switch ( msg )
{
#if 0
case WM_CTLCOLOREDIT:
{
HDC hdcEdit = (HDC)wParam;
HWND hwndEdit = (HWND)lParam;
#if 0
uiDialog* pGadget = (uiDialog*)GetWindowLong( hwndEdit, GWL_USERDATA );
DWORD colorText;
if ( pGadget )
colorText = GetSysColor( COLOR_BTNHIGHLIGHT );
else
colorText = GetSysColor( COLOR_WINDOWTEXT );
SetTextColor( hdcEdit, colorText );
#endif
assert( theAttributes._hBrushStatic );
return (LRESULT)theAttributes._hBrushStatic;
break;
}
#endif
case WM_INITDIALOG:
theAttributes.Init();
break;
case WM_DESTROY:
theAttributes.Destroy();
break;
case WM_COMMAND:
{
switch ( LOWORD( wParam ) )
{
#if 0
case IDM_ENABLED:
{
assert( theActiveGadget );
//theActiveGadget->_bUserOverrideEnable = FALSE;
//theActiveGadget = NULL; ?
theAttributes.refreshGadgetEnabledStates();
break;
}
case IDM_COMBOBOX:
case IDM_CYCLEBUTTON:
case IDM_SLIDER:
{
break;
}
//TEST CODE
case IDC_OPEN:
{
HWND hwnd = GetDlgItem( hWnd, IDC_ROLLUP );
assert( hwnd );
char szRollup[ 10 ];
Edit_GetText( hwnd, szRollup, sizeof( szRollup ) );
int nRollup = atoi( szRollup );
assert( theMainPanel );
IRollupWindow* pRollup = GetIRollup( theMainPanel );
assert( pRollup );
pRollup->SetPanelOpen( nRollup, TRUE );
ReleaseIRollup( pRollup );
break;
}
case IDC_CLOSE:
{
HWND hwnd = GetDlgItem( hWnd, IDC_ROLLUP );
assert( hwnd );
char szRollup[ 10 ];
Edit_GetText( hwnd, szRollup, sizeof( szRollup ) );
int nRollup = atoi( szRollup );
break;
}
#endif
case IDC_COPY:
theAttributes.CopyAttributes();
break;
case IDC_PASTE:
theAttributes.PasteAttributes();
break;
case IDC_PREVIOUS:
theAttributes.OnPrevious();
break;
case IDC_NEXT:
theAttributes.OnNext();
break;
case IDC_OBJECT_NAME:
{
char szObjectName[ 256 ];
// Read field name
assert( theAttributes._hwndObjectName );
int err = ComboBox_GetText( theAttributes._hwndObjectName, szObjectName, sizeof( szObjectName ) );
assert( err != CB_ERR );
static int idxSelected = CB_ERR;
UINT notification = HIWORD( wParam );
if ( notification == CBN_SETFOCUS )
{
idxSelected = ComboBox_GetCurSel( theAttributes._hwndObjectName );
DisableAccelerators();
}
else if ( ( notification == CBN_KILLFOCUS ) || ( notification == CBN_DROPDOWN ) )
{
theAttributes.FillInObjectList();
err = ComboBox_SetCurSel( theAttributes._hwndObjectName, idxSelected );
assert( err != CB_ERR );
if ( notification == CBN_KILLFOCUS )
EnableAccelerators();
}
else if ( notification == CBN_EDITUPDATE )
{
theAttributes._theSelection->SetName( szObjectName );
theAttributes.UpdateCopyPasteButtons( szObjectName );
}
else if ( notification == CBN_SELCHANGE )
{
theAttributes.OnObjectName();
}
#if 0
else
{
char buffer[ 256 ];
sprintf( buffer, "notification = %d\n", notification );
OutputDebugString( buffer );
}
#endif
break;
}
default:
{
HWND hwndCtl = (HWND)lParam;
if ( hwndCtl == theAttributes._hwndClassName )
{
UINT notification = HIWORD( wParam );
if ( notification == CBN_SELCHANGE )
theAttributes.OnClassName();
}
else
{
if ( theActiveGadget = (uiDialog*)GetWindowLong( hwndCtl, GWL_USERDATA ) )
theActiveGadget->activate( (HWND)lParam );
theAttributes.refreshGadgetEnabledStates();
}
}
}
break;
}
#if MAX_RELEASE < 2000
case WM_LBUTTONDOWN:
case WM_LBUTTONUP:
case WM_MOUSEMOVE:
if ( theAttributes.ip )
theAttributes.ip->RollupMouseMessage(hWnd,msg,wParam,lParam);
break;
#endif
default:
return FALSE;
}
}
catch ( Exception /*theException*/ )
{
}
return TRUE;
}
// Resets the Object list to the names of the objects
void
Attributes::FillInObjectList()
{
assert( _hwndObjectName );
ComboBox_ResetContent( _hwndObjectName );
// List object names
for ( int i=0; i<ip->GetSelNodeCount(); ++i )
{
ComboBox_AddString( _hwndObjectName, ip->GetSelNode( i )->GetName() );
}
}
void
Attributes::OnClassName()
{
assert( _hwndClassName );
int idx = ComboBox_GetCurSel( _hwndClassName );
if ( idx != CB_ERR )
{
char szClassName[ 512 ];
ComboBox_GetLBText( _hwndClassName, idx, szClassName );
assert( strchr( szClassName, '[' ) );
strcpy( szClassName, strchr( szClassName, '[' ) + 1 );
assert( strchr( szClassName, '.' ) );
*( strchr( szClassName, '.' ) ) = '\0';
if ( strcmp( _szClassName, szClassName ) != 0 )
{
INode* savedSelection = _theSelection;
strcpy( _szClassName, szClassName );
DestroyAttributes();
_theSelection = savedSelection;
CreateAttributes( szClassName );
}
}
}
// Move to the specified (index) entry in the Object list
// Does nothing if new index is current index [mostly to avoid visible flash]
void
Attributes::_Navigate( int index )
{
assert( ip );
assert( 0 <= index && index < ip->GetSelNodeCount() );
INode* newSel = ip->GetSelNode( index );
assert( newSel );
assert( _theSelection );
if ( newSel != _theSelection )
{
DestroyAttributes();
_theSelection = newSel;
assert( _theSelection );
CreateAttributes();
SetObjectSelected( index );
}
}
// BUTTON: Go to the selected object
void
Attributes::OnObjectName()
{
assert( _hwndObjectName );
int index = ComboBox_GetCurSel( _hwndObjectName );
_Navigate( index );
}
// BUTTON: Go to previous object
void
Attributes::OnPrevious()
{
assert( _hwndObjectName );
int index = ComboBox_GetCurSel( _hwndObjectName );
_Navigate( index - 1 );
}
// BUTTON: Go to next object
void
Attributes::OnNext()
{
assert( _hwndObjectName );
int index = ComboBox_GetCurSel( _hwndObjectName );
_Navigate( index + 1 );
}
// Updates the "Copy" button to say "Copy _objectName_"
void
Attributes::UpdateCopyPasteButtons( const char* szObjectName )
{
FILE* fpAttrib = fopen( Attrib_OAD_Clipboard, "rb" );
int cbClass;
char* pClass;
pClass = (char*)LoadBinaryFile( Attrib_ClassName_Clipboard, cbClass );
assert( _hwndPaste );
assert( ip );
if ( pClass && fpAttrib && ( ip->GetSelNodeCount() != 0 ) )
{
char szBuffer[ 256 ];
sprintf( szBuffer, "Paste class\n%s", pClass );
if ( ip->GetSelNodeCount() > 1 )
strcat( szBuffer, "..." );
Button_SetText( _hwndPaste, szBuffer );
Button_Enable( _hwndPaste, true );
}
else
{
Button_SetText( _hwndPaste, "Paste" );
Button_Enable( _hwndPaste, false );
}
if ( pClass )
free( pClass );
if ( fpAttrib )
fclose( fpAttrib );
assert( _hwndCopy );
if ( ip->GetSelNodeCount() == 0 )
{
Button_SetText( _hwndCopy, "Copy" );
Button_Enable( _hwndCopy, false );
}
else
{
assert( szObjectName );
char szBuffer[ 128 ];
sprintf( szBuffer, "Copy object\n%s", szObjectName );
Button_SetText( _hwndCopy, szBuffer );
Button_Enable( _hwndCopy, true );
}
}
void
Attributes::SetObjectSelected( int index )
{
assert( index != CB_ERR );
ComboBox_SetCurSel( _hwndObjectName, index );
ComboBox_Enable( _hwndObjectName, true );
assert( _hwndPrevious );
Button_Enable( _hwndPrevious, index != 0 );
assert( _hwndNext );
assert( ip );
Button_Enable( _hwndNext, index != ip->GetSelNodeCount() - 1 );
UpdateCopyPasteButtons( _theSelection->GetName() );
}
void
Attributes::SetClassButton()
{
assert( _szClassName && *_szClassName );
assert( _hwndClassName );
for ( int idxClass=0; idxClass<ComboBox_GetCount( _hwndClassName ); ++idxClass )
{
char* szClassName = (char*)alloca(
ComboBox_GetLBTextLen( _hwndClassName, idxClass ) + sizeof( '\0' ) );
assert( szClassName );
ComboBox_GetLBText( _hwndClassName, idxClass, szClassName );
char* pLeftParen = strchr( szClassName, '[' );
if ( pLeftParen )
{
if ( strncmp( pLeftParen+1, _szClassName, strlen( _szClassName ) ) == 0 )
break;
}
}
assert( idxClass != ComboBox_GetCount( _hwndClassName ) );
ComboBox_SetCurSel( _hwndClassName, idxClass );
ComboBox_Enable( _hwndClassName, true );
}
void
Attributes::CopyAttributes()
{
AppDataChunk* adClass = _theSelection->GetAppDataChunk( appDataTestDesc.ClassID(), UTILITY_CLASS_ID, SLOT_CLASS );
if ( adClass )
{
FILE* fp = fopen( Attrib_ClassName_Clipboard, "wb" );
assert( fp );
fwrite( adClass->data, sizeof( char ), adClass->length, fp );
fclose( fp );
}
else
{
_unlink( Attrib_ClassName_Clipboard );
_unlink( Attrib_OAD_Clipboard );
UpdateCopyPasteButtons( _theSelection->GetName() );
return;
}
AppDataChunk* adOad = _theSelection->GetAppDataChunk( appDataTestDesc.ClassID(), UTILITY_CLASS_ID, SLOT_OAD );
if ( adOad )
{
FILE* fp = fopen( Attrib_OAD_Clipboard, "wb" );
assert( fp );
fwrite( adOad->data, sizeof( char ), adOad->length, fp );
fclose( fp );
}
else
{
_unlink( Attrib_ClassName_Clipboard );
_unlink( Attrib_OAD_Clipboard );
UpdateCopyPasteButtons( _theSelection->GetName() );
return;
}
UpdateCopyPasteButtons( _theSelection->GetName() );
}
UINT buttonPressed;
BOOL CALLBACK
MultiPasteDlgProc( HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam )
{
if ( msg == WM_INITDIALOG )
{
HICON _hIcon = LoadIcon( hInstance, MAKEINTRESOURCE( IDI_WF ) );
assert( _hIcon );
SetClassLong( hDlg, GCL_HICON, (LONG)_hIcon );
HWND _hwndObjectName = theAttributes._hwndObjectName;
assert( _hwndObjectName );
int idx = ComboBox_GetCurSel( _hwndObjectName );
assert( idx != CB_ERR );
char szObjectName[ 512 ];
ComboBox_GetLBText( _hwndObjectName, idx, szObjectName );
char szButtonText[ 256 ];
HWND hwnd = GetDlgItem( hDlg, IDC_OBJECT );
assert( hwnd );
sprintf( szButtonText, "&%s", szObjectName );
Button_SetText( hwnd, szButtonText );
hwnd = GetDlgItem( hDlg, IDC_ALLSELECTED );
int nObjects = ComboBox_GetCount( _hwndObjectName );
sprintf( szButtonText, "&All %d objects selected", nObjects );
Button_SetText( hwnd, szButtonText );
}
else if ( msg == WM_COMMAND )
{
int button = LOWORD( wParam );
switch ( button )
{
case IDC_OBJECT:
case IDC_ALLSELECTED:
{
buttonPressed = button;
EndDialog( hDlg, TRUE );
return TRUE;
}
case IDCANCEL:
{
EndDialog( hDlg, FALSE );
return FALSE;
}
}
}
return FALSE;
}
void
Attributes::PasteAttributes()
{
assert( _hwndObjectName );
int nObjects = ComboBox_GetCount( _hwndObjectName );
assert( nObjects > 0 );
int idxStart, idxEnd;
if ( nObjects == 1 )
{
idxStart = ComboBox_GetCurSel( _hwndObjectName );
assert( idxStart != CB_ERR );
idxEnd = idxStart + 1;
}
else
{
assert( hInstance );
_hwndMax = GetCOREInterface()->GetMAXHWnd();
assert( _hwndMax );
if ( !DialogBox( hInstance, MAKEINTRESOURCE( IDD_MULTI_PASTE ), _hwndMax, MultiPasteDlgProc ) )
return;
if ( buttonPressed == IDC_OBJECT )
{
idxStart = ComboBox_GetCurSel( _hwndObjectName );
assert( idxStart != CB_ERR );
idxEnd = idxStart + 1;
}
else if ( buttonPressed == IDC_ALLSELECTED )
{
idxStart = 0;
idxEnd = nObjects;
}
}
int idxSelected = ComboBox_GetCurSel( _hwndObjectName );
assert( idxSelected != CB_ERR );
int cbClass;
char* pClass;
pClass = (char*)LoadBinaryFile( Attrib_ClassName_Clipboard, cbClass );
if ( !pClass )
return;
int cbAttrib;
char* pAttrib;
pAttrib = (char*)LoadBinaryFile( Attrib_OAD_Clipboard, cbAttrib );
if ( !pAttrib )
{
free( pClass );
return;
}
assert( pClass );
assert( pAttrib );
for ( int i=idxStart; i<idxEnd; ++i )
{
assert( ip );
int nSelectedObjects = ip->GetSelNodeCount();
assert( 0 <= i && i < nSelectedObjects );
char szObjectName[ 512 ];
ComboBox_GetLBText( _hwndObjectName, i, szObjectName );
assert( *szObjectName );
//Animatable* newSel = _theSelection;
INode* newSel = ip->GetSelNode( i );
assert( newSel );
newSel->RemoveAppDataChunk( appDataTestDesc.ClassID(), UTILITY_CLASS_ID, SLOT_CLASS );
newSel->AddAppDataChunk( appDataTestDesc.ClassID(), UTILITY_CLASS_ID, SLOT_CLASS, cbClass, pClass );
newSel->RemoveAppDataChunk( appDataTestDesc.ClassID(), UTILITY_CLASS_ID, SLOT_OAD );
newSel->AddAppDataChunk( appDataTestDesc.ClassID(), UTILITY_CLASS_ID, SLOT_OAD, cbAttrib, pAttrib );
}
assert( _theSelection );
INode* savedSelection = theAttributes._theSelection;
theAttributes.DestroyGadgets();
theAttributes._theSelection = savedSelection;
theAttributes.CreateAttributes();
UpdateCopyPasteButtons( _theSelection->GetName() );
}
Attributes::~Attributes()
{
assert( _hBrushStatic );
DeleteObject( _hBrushStatic );
assert( _fontWingdings );
DeleteObject( _fontWingdings );
}
Attributes::Attributes()
{
_hBrushStatic = CreateSolidBrush( GetSysColor( COLOR_WINDOWTEXT ) );
assert( _hBrushStatic );
iu = NULL;
ip = NULL;
hPanel = NULL;
_numGadgets = 0;
for ( int i=0; i<_MAX_GADGETS; ++i )
_gadgets[ i ] = NULL;
_oad = NULL;
_theSelection = NULL;
{
LOGFONT logFontWingdings =
{
-14, // LONG lfHeight;
0, // LONG lfWidth;
0, // LONG lfEscapement;
0, // LONG lfOrientation;
FW_NORMAL, // LONG lfWeight;
FALSE, // BYTE lfItalic;
FALSE, // BYTE lfUnderline;
FALSE, // BYTE lfStrikeOut;
SYMBOL_CHARSET, // BYTE lfCharSet;
OUT_TT_ONLY_PRECIS, // BYTE lfOutPrecision;
CLIP_DEFAULT_PRECIS, // BYTE lfClipPrecision;
DEFAULT_QUALITY, // BYTE lfQuality;
DEFAULT_PITCH | FF_DECORATIVE,// BYTE lfPitchAndFamily;
"Wingdings" // TCHAR lfFaceName[LF_FACESIZE];
};
_fontWingdings = CreateFontIndirect( &logFontWingdings );
assert( _fontWingdings );
}
x = y = 0;
szGroupName = NULL;
// Create list of class names
_hPanelClass = NULL;
_numClasses = 0;
for ( i=0; i<50; ++i )
_szClasses[ i ] = NULL;
const char szRegWorldFoundry[] = "Software\\World Foundry\\GDK";
int success;
success = GetLocalMachineStringRegistryEntry( szRegWorldFoundry, "WORLD_FOUNDRY_DIR",
szWorldFoundryDir, sizeof( szWorldFoundryDir ) );
if ( !success )
Error( "WORLD_FOUNDRY_DIR not set in registry" );
success = GetLocalMachineStringRegistryEntry( szRegWorldFoundry, "OAD_DIR",
szOadDir, sizeof( szOadDir ) );
if ( !success )
Error( "OAD_DIR not set in registry" );
{ // Get classes available in the OAD directory (.oad files)
char szOadFileSpec[ _MAX_PATH ];
sprintf( szOadFileSpec, "%s/*.oad", szOadDir );
_finddata_t findFile;
long dirHandle = _findfirst( szOadFileSpec, &findFile );
if ( dirHandle != -1 )
{
char szFilename[ _MAX_PATH ];
sprintf( szFilename, "%s/%s", szOadDir, findFile.name );
FILE* fp = fopen( szFilename, "rb" );
assert( fp );
oadHeader header;
fread( &header, 1, sizeof( header ), fp );
fclose( fp );
_szClasses[ _numClasses ] = (char*)malloc(
strlen( header.name ) + sizeof( " [" ) + strlen( findFile.name ) + sizeof( "]" ) + sizeof( '\0' ) );
assert( _szClasses[ _numClasses ] );
strcpy( _szClasses[ _numClasses ], header.name );
strcat( _szClasses[ _numClasses ], " [" );
strcat( _szClasses[ _numClasses ], _strlwr( findFile.name ) );
strcat( _szClasses[ _numClasses ], "]" );
++_numClasses;
while ( _findnext( dirHandle, &findFile ) == 0 )
{
char szFilename[ _MAX_PATH ];
sprintf( szFilename, "%s/%s", szOadDir, findFile.name );
FILE* fp = fopen( szFilename, "rb" );
assert( fp );
oadHeader header;
fread( &header, 1, sizeof( header ), fp );
fclose( fp );
_szClasses[ _numClasses ] = (char*)malloc(
strlen( header.name ) + 2 + strlen( findFile.name ) + 1 + 1 );
assert( _szClasses[ _numClasses ] );
strcpy( _szClasses[ _numClasses ], header.name );
strcat( _szClasses[ _numClasses ], " [" );
strcat( _szClasses[ _numClasses ], _strlwr( findFile.name ) );
strcat( _szClasses[ _numClasses ], "]" );
++_numClasses;
}
}
}
}
HWND
Attributes::CreateWindowEx( DWORD dwExStyle, LPCTSTR lpClassName, LPCTSTR lpWindowName,
DWORD dwStyle, int x, int y, int nWidth, int nHeight,
HWND hWndParent, HMENU hMenu, HINSTANCE hInstance, LPVOID lpParam )
{
return ::CreateWindowEx( dwExStyle,
lpClassName,
lpWindowName,
WS_CHILD | WS_VISIBLE | dwStyle,
theAttributes.x + x,
y,
nWidth,
nHeight,
hWndParent,
hMenu,
hInstance,
lpParam );
}
uiDialog*
Attributes::findGadget( const char* szName, buttonType ) const
{
for ( int i=0; i<_numGadgets; ++i )
{
assert( _gadgets[ i ] );
if ( ( strcmp( _gadgets[ i ]->fieldName(), szName ) == 0 ) )
return _gadgets[ i ];
}
return NULL;
}
uiDialog*
Attributes::findGadget( const char* szName ) const
{
for ( int i=0; i<_numGadgets; ++i )
{
assert( _gadgets[ i ] );
if ( ( strcmp( _gadgets[ i ]->variableName(), szName ) == 0 ) )
return _gadgets[ i ];
}
return NULL;
}
typeDescriptor* pEndOfTypeDescriptors;
void
Attributes::FillInClassReference( HWND hwndCombo, const char* szClassName )
{
assert( hwndCombo );
assert( _font );
SetWindowFont( hwndCombo, _font, TRUE );
assert( _numClasses > 0 );
assert( ComboBox_GetCount( hwndCombo ) == 0 );
for ( int i=0; i<_numClasses; ++i )
{
int err = ComboBox_AddString( hwndCombo, _szClasses[i] );
assert( err != CB_ERR );
}
if ( szClassName )
{
}
}
void
Attributes::CreateAttributes( const char* IszClassName )
{
assert( !hPanel );
assert( ip );
assert( hInstance );
assert( _theSelection );
hPanel = NULL;
if ( !IszClassName )
{ // Read AppData for class name (default to DEFAULT_CLASS if no AppData)
AppDataChunk* adClass = _theSelection->GetAppDataChunk( appDataTestDesc.ClassID(), UTILITY_CLASS_ID, SLOT_CLASS );
strcpy( _szClassName, adClass ? (char*)adClass->data : DEFAULT_CLASS );
}
else
strcpy( _szClassName, IszClassName );
{ // Create the class rollup
// !!! I want this to go away, but I don't know how to do it yet...
if ( !_hPanelClass )
{
_hPanelClass = theAttributes.ip->AddRollupPage(
hInstance,
MAKEINTRESOURCE(IDD_CLASSNAME),
AttributesDlgProc,
"Class",
0 );
assert( _hPanelClass );
_hwndObjectName = GetDlgItem( _hPanelClass, IDC_OBJECT_NAME );
assert( _hwndObjectName );
_hwndPrevious = GetDlgItem( _hPanelClass, IDC_PREVIOUS );
assert( _hwndPrevious );
_hwndNext = GetDlgItem( _hPanelClass, IDC_NEXT );
assert( _hwndNext );
assert( _font );
_hwndCopy = GetDlgItem( _hPanelClass, IDC_COPY );
assert( _hwndCopy );
SetWindowFont( _hwndCopy, _font, TRUE );
_hwndPaste = GetDlgItem( _hPanelClass, IDC_PASTE );
assert( _hwndPaste );
SetWindowFont( _hwndPaste, _font, TRUE );
_hwndClassName = GetDlgItem( _hPanelClass, IDC_CLASS_NAME );
assert( _hwndClassName );
FillInClassReference( _hwndClassName, _szClassName );
} // !_hPanelClass
} // class rollup
assert( _hwndCopy );
Button_Enable( _hwndCopy, true );
assert( _hwndPaste );
Button_Enable( _hwndPaste, true );
_numGadgets = 0;
for ( int i=0; i<_MAX_GADGETS; ++i )
_gadgets[ i ] = NULL;
try
{
_oad = new Oad( _szClassName );
}
catch ( Exception /*theException*/ )
{
// TODO:
OutputDebugString( "exception" );
return;
}
assert( _oad );
typeDescriptor* td = _oad->startOfTypeDescriptors();
int len = _oad->len();
pEndOfTypeDescriptors = (typeDescriptor*)( ((char*)td) + len );
y = 0;
int size = 0;
for ( ; size<_oad->len(); size += sizeof( typeDescriptor ), ++td )
{
if ( td->showAs == SHOW_AS_HIDDEN )
continue;
//assert( *td->szEnableExpression == '\0' || *td->szEnableExpression == '1' );
#define BUTTON( __type__, __class__ ) \
case BUTTON_##__type__: \
{ \
uiDialog* field = new __class__( td ); \
assert( field ); \
field->make_dialog_gadgets( hPanel ); \
y += 18; \
_gadgets[ _numGadgets ] = field; \
++_numGadgets; \
break; \
}
switch ( td->type )
{
case BUTTON_INT32:
{
uiDialog* field;
if ( td->showAs == SHOW_AS_COLOR )
field = new ColorPicker( td );
else if ( td->showAs == SHOW_AS_DROPMENU )
field = new DropMenu( td );
else if ( td->showAs == SHOW_AS_RADIOBUTTONS )
field = new CycleButton( td );
else if ( td->showAs == SHOW_AS_CHECKBOX )
field = new CheckBox( td );
else if ( td->showAs == SHOW_AS_MAILBOX )
field = new Mailbox( td );
else if ( td->showAs == SHOW_AS_COMBOBOX )
field = new ComboBox( td );
/*
else if ( td->showAs == SHOW_AS_FOURCC )
field = new FourCC( td );
*/
else
field = new Int32( td );
assert( field );
field->make_dialog_gadgets( hPanel );
y += 18;
_gadgets[ _numGadgets++ ] = field;
// ++_numGadgets;
break;
}
BUTTON( FIXED32, Fixed32 )
BUTTON( OBJECT_REFERENCE, ObjectReference )
BUTTON( STRING, String )
case BUTTON_FILENAME:
{
uiDialog* field;
if ( strcmp( "Mesh Name", td->name ) == 0 )
field = new MeshName( td );
else
field = new Filename( td );
assert( field );
field->make_dialog_gadgets( hPanel );
y += 18;
_gadgets[ _numGadgets++ ] = field;
// ++_numGadgets;
break;
}
BUTTON( GROUP_START, Group )
BUTTON( XDATA, XData )
BUTTON( CLASS_REFERENCE, ClassReference )
case BUTTON_GROUP_STOP:
{
assert( szGroupName );
Group* field = (Group*)findGadget( szGroupName, BUTTON_GROUP_START );
field->endGroup();
assert( field );
y += 8;
break;
}
case BUTTON_PROPERTY_SHEET:
{
extern HWND retPanel;
uiDialog* field = new RollUp( td );
assert( field );
field->make_dialog_gadgets( NULL );
hPanel = retPanel;
_gadgets[ _numGadgets ] = field;
++_numGadgets;
break;
}
default:
OutputDebugString( td->name );
OutputDebugString( "\n" );
break;
}
}
assert( size == _oad->len() );
#if defined( DO_OAD_IFF )
#else
AppDataChunk* adOad = _theSelection->GetAppDataChunk( appDataTestDesc.ClassID(), UTILITY_CLASS_ID, SLOT_OAD );
if ( adOad )
{ // Apply fields stored in AppData overriding the defaults contained in the .oad file
byte* xdataStart = (byte*)adOad->data;
byte* xdata = xdataStart;
while ( xdata < (byte*)adOad->data + adOad->length )
{
byte* pFieldStart = xdata; // Remember starting place in case we need to skip over all the data
int size = *((int*)xdata);
//assert( size > 0 );
xdata += sizeof( int );
buttonType bt = *((int*)xdata);
xdata += sizeof( int );
visualRepresentation showAs = *((int*)xdata);
xdata += sizeof( int );
const char* szFieldName = (const char*)xdata;
xdata += strlen( szFieldName ) + 1;
uiDialog* gadget = findGadget( szFieldName, bt );
if ( gadget )
gadget->reset( xdata );
else
xdata = pFieldStart + size;
}
}
#endif
refreshGadgetEnabledStates();
SetClassButton();
}
void
Attributes::refreshGadgetEnabledStates()
{
for ( int i=0; i<_numGadgets; ++i )
{
assert( _gadgets[ i ] );
_gadgets[ i ]->checkEnable();
}
}
void
Attributes::DestroyClass()
{
if ( _hPanelClass )
{
ip->DeleteRollupPage( _hPanelClass );
_hPanelClass = 0;
}
}
void
Attributes::DestroyGadgets()
{
if ( hPanel )
{
assert( ip );
for ( int i=0; i<_numGadgets; ++i )
{
assert( _gadgets[ i ] );
delete _gadgets[ i ];
}
_numGadgets = 0;
hPanel = NULL;
}
if ( _oad )
delete _oad, _oad = NULL;
}
void
Attributes::DestroyAttributes( bool bApply )
{
if ( hPanel )
Apply();
DestroyGadgets();
}
void
Attributes::BeginEditParams( Interface* ip, IUtil* iu )
{
try
{
this->iu = iu;
this->ip = ip;
assert( ip );
_font = ip->GetIObjParam()->GetAppHFont();
assert( _font );
if ( ip->GetSelNodeCount() != 0 )
{
_theSelection = ip->GetSelNode( 0 );
assert( _theSelection );
CreateAttributes();
FillInObjectList();
SetObjectSelected( 0 );
}
}
catch ( Exception /*theException*/ )
{
}
}
void
Attributes::EndEditParams( Interface* ip, IUtil* iu )
{
try
{
DestroyAttributes();
DestroyClass();
}
catch ( Exception /*theException*/ )
{
}
this->iu = NULL;
this->ip = NULL;
}
void
Attributes::SelectionSetChanged( Interface* ip, IUtil* iu )
{
try
{
if ( ip->GetSelNodeCount() > 0 )
{
if ( _theSelection != ip->GetSelNode( 0 ) )
DestroyAttributes();
}
if ( _hwndObjectName )
{
while ( ComboBox_GetCount( _hwndObjectName ) )
ComboBox_DeleteString( _hwndObjectName, 0 );
}
if ( ip->GetSelNodeCount() == 0 )
{
if ( _hwndClassName )
ComboBox_Enable( _hwndClassName, false );
if ( _hwndPrevious )
Button_Enable( _hwndPrevious, false );
if ( _hwndObjectName )
ComboBox_Enable( _hwndObjectName, false );
if ( _hwndNext )
Button_Enable( _hwndNext, false );
if ( _hwndCopy )
Button_Enable( _hwndCopy, false );
if ( _hwndPaste )
Button_Enable( _hwndPaste, false );
DestroyAttributes();
_theSelection = NULL;
}
else
{
if ( !_theSelection || ( _theSelection != ip->GetSelNode( 0 ) ) )
{
_theSelection = ip->GetSelNode( 0 );
assert( _theSelection );
CreateAttributes();
}
FillInObjectList();
SetObjectSelected( 0 );
}
}
catch ( Exception /*theException*/ )
{
}
}
void
Attributes::Init()
{ // Called on creation of each rollup page
}
void
Attributes::Destroy()
{
}
extern int hdump( HINSTANCE, HWND, void* data, int size );
void
Attributes::Apply()
{
assert( _theSelection );
#if 0
{
ostrstream str;
IffWriterBinary _iff( str );
_iff.enterChunk( ID( "OAD" ) );
for ( int i=0; i<_numGadgets; ++i )
{
assert( _gadgets[ i ] );
if ( _gadgets[ i ]->canSave() )
{
// _iff << _gadgets[ i ]->fieldName();
_iff << *( _gadgets[ i ] );
}
}
_iff.exitChunk();
ofstream out( "d:\\test.bin", ios::binary );
assert( out.good() );
out << str.rdbuf();
}
#endif
int size = 0;
for ( int i=0; i<_numGadgets; ++i )
{
assert( _gadgets[ i ] );
if ( _gadgets[ i ]->canSave() )
size += _gadgets[ i ]->storedDataSize();
}
byte* xdata = (byte*)malloc( size );
assert( xdata );
byte* xdataStart = xdata;
for ( i=0; i<_numGadgets; ++i )
{
//MessageBox( hPanel, _gadgets[i]->fieldName(), _gadgets[i]->fieldName(), MB_OK );
assert( _gadgets[ i ] );
if ( _gadgets[ i ]->canSave() )
{
byte* pXdataBefore = xdata;
_gadgets[ i ]->copy_to_xdata( xdata );
//assert( pXdataBefore != xdata );
assert( xdata == pXdataBefore + _gadgets[i]->storedDataSize() );
}
}
assert( xdata == xdataStart + size );
assert( _hwndClassName );
int idx = ComboBox_GetCurSel( _hwndClassName );
assert( idx != CB_ERR );
int len = ComboBox_GetLBTextLen( _hwndClassName, idx );
assert( len != CB_ERR );
char* szClassName = (char*)malloc( len + 1 );
assert( szClassName );
ComboBox_GetLBText( _hwndClassName, idx, szClassName );
const char* pLeftParen = strchr( szClassName, '[' );
if ( pLeftParen )
{
strcpy( szClassName, pLeftParen + 1 );
assert( strchr( szClassName, '.' ) );
*( strchr( szClassName, '.' ) ) = '\0';
}
_theSelection->RemoveAppDataChunk( appDataTestDesc.ClassID(), UTILITY_CLASS_ID, SLOT_CLASS );
_theSelection->AddAppDataChunk( appDataTestDesc.ClassID(), UTILITY_CLASS_ID, SLOT_CLASS, strlen(szClassName)+1, szClassName );
if ( strcmp( szClassName, "disabled" ) != 0 )
{
_theSelection->RemoveAppDataChunk( appDataTestDesc.ClassID(), UTILITY_CLASS_ID, SLOT_OAD );
_theSelection->AddAppDataChunk( appDataTestDesc.ClassID(), UTILITY_CLASS_ID, SLOT_OAD, size, xdataStart );
#if 0
{
//hdump( hInstance, NULL, xdataStart, size );
FILE* fp = fopen( "c:\\xdata.bin", "wb" );
if ( fp )
{
fwrite( xdataStart, sizeof( byte ), size, fp );
fclose( fp );
}
}
#endif
}
}
|
dd9d6ff7af1ab781085ea15bcab5c5b463e744dc | 2483664ee827ced824af5f3e0076c0f7e6c776b0 | /model/BoardModel.cpp | 6d626b61d60fdf52b5ff05de1331e033aa2846a2 | [] | no_license | JacquelinLouis/cpp-chess | 6c4ca076d75cdf315365c1db93aefdf69f8d7a24 | 60060ac3d4d4fdce0883263b3fc4977de21ccfc2 | refs/heads/master | 2023-03-15T07:19:46.348877 | 2020-05-01T09:47:25 | 2020-05-01T09:47:25 | 195,662,091 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,657 | cpp | BoardModel.cpp | #include "BoardModel.h"
BoardModel::BoardModel() {
initialize();
}
void BoardModel::initialize() {
initialize_white();
initialize_black();
notify();
}
PieceModel * BoardModel::get(int x, int y) const {
if (-1 < x && x < BOARD_SIZE && -1 < y && y < BOARD_SIZE)
return m_board[x + y * BOARD_SIZE];
return nullptr;
}
PieceModel * BoardModel::get(const Position & position) const {
if (inBoard(position))
return m_board[position[X] + position[Y] * BOARD_SIZE];
return nullptr;
}
void BoardModel::set(PieceModel * pieceModel, const Position & position) {
if (internalSet(pieceModel, position))
notify();
}
bool BoardModel::internalSet(PieceModel * pieceModel, const Position & position) {
if (!inBoard(position))
return false;
int newPosition = position[X] + position[Y] * BOARD_SIZE;
m_board[newPosition] = pieceModel;
return true;
}
PieceModel * BoardModel::move(const Position & origin,
const Position & destination) {
if (!inBoard(origin) || !inBoard(destination))
return nullptr;
PieceModel * destPiece = get(destination);
PieceModel * oriPiece = get(origin);
set(oriPiece, destination);
set(nullptr, origin);
return destPiece;
}
bool BoardModel::inBoard(const Position & position) {
return -1 < position[X] && position[X] < BOARD_SIZE
&& -1 < position[Y] && position[Y] < BOARD_SIZE;
}
void BoardModel::initialize_white() {
m_board[0] = new PieceModel(PieceModel::Type::ROOK, PieceModel::Color::WHITE);
m_board[1] = new PieceModel(PieceModel::Type::KNIGHT, PieceModel::Color::WHITE);;
m_board[2] = new PieceModel(PieceModel::Type::BISHOP, PieceModel::Color::WHITE);;
m_board[3] = new PieceModel(PieceModel::Type::QUEEN, PieceModel::Color::WHITE);;
m_board[4] = new PieceModel(PieceModel::Type::KING, PieceModel::Color::WHITE);;
m_board[5] = new PieceModel(PieceModel::Type::BISHOP, PieceModel::Color::WHITE);;
m_board[6] = new PieceModel(PieceModel::Type::KNIGHT, PieceModel::Color::WHITE);;
m_board[7] = new PieceModel(PieceModel::Type::ROOK, PieceModel::Color::WHITE);;
m_board[BOARD_SIZE] = new PieceModel(PieceModel::Type::PAWN, PieceModel::Color::WHITE);
m_board[BOARD_SIZE + 1] = new PieceModel(PieceModel::Type::PAWN, PieceModel::Color::WHITE);
m_board[BOARD_SIZE + 2] = new PieceModel(PieceModel::Type::PAWN, PieceModel::Color::WHITE);
m_board[BOARD_SIZE + 3] = new PieceModel(PieceModel::Type::PAWN, PieceModel::Color::WHITE);
m_board[BOARD_SIZE + 4] = new PieceModel(PieceModel::Type::PAWN, PieceModel::Color::WHITE);
m_board[BOARD_SIZE + 5] = new PieceModel(PieceModel::Type::PAWN, PieceModel::Color::WHITE);
m_board[BOARD_SIZE + 6] = new PieceModel(PieceModel::Type::PAWN, PieceModel::Color::WHITE);
m_board[BOARD_SIZE + 7] = new PieceModel(PieceModel::Type::PAWN, PieceModel::Color::WHITE);
}
void BoardModel::initialize_black() {
int lastPosition = BOARD_SIZE * (BOARD_SIZE - 2);
m_board[lastPosition] = new PieceModel(PieceModel::Type::PAWN, PieceModel::Color::BLACK);
m_board[lastPosition + 1] = new PieceModel(PieceModel::Type::PAWN, PieceModel::Color::BLACK);
m_board[lastPosition + 2] = new PieceModel(PieceModel::Type::PAWN, PieceModel::Color::BLACK);
m_board[lastPosition + 3] = new PieceModel(PieceModel::Type::PAWN, PieceModel::Color::BLACK);
m_board[lastPosition + 4] = new PieceModel(PieceModel::Type::PAWN, PieceModel::Color::BLACK);
m_board[lastPosition + 5] = new PieceModel(PieceModel::Type::PAWN, PieceModel::Color::BLACK);
m_board[lastPosition + 6] = new PieceModel(PieceModel::Type::PAWN, PieceModel::Color::BLACK);
m_board[lastPosition + 7] = new PieceModel(PieceModel::Type::PAWN, PieceModel::Color::BLACK);
lastPosition = BOARD_SIZE * (BOARD_SIZE - 1);
m_board[lastPosition] = new PieceModel(PieceModel::Type::ROOK, PieceModel::Color::BLACK);
m_board[lastPosition + 1] = new PieceModel(PieceModel::Type::KNIGHT, PieceModel::Color::BLACK);
m_board[lastPosition + 2] = new PieceModel(PieceModel::Type::BISHOP, PieceModel::Color::BLACK);
m_board[lastPosition + 3] = new PieceModel(PieceModel::Type::KING, PieceModel::Color::BLACK);
m_board[lastPosition + 4] = new PieceModel(PieceModel::Type::QUEEN, PieceModel::Color::BLACK);
m_board[lastPosition + 5] = new PieceModel(PieceModel::Type::BISHOP, PieceModel::Color::BLACK);
m_board[lastPosition + 6] = new PieceModel(PieceModel::Type::KNIGHT, PieceModel::Color::BLACK);
m_board[lastPosition + 7] = new PieceModel(PieceModel::Type::ROOK, PieceModel::Color::BLACK);
} |
0599a715d9661c867fca7fca7c0f6273ed977f7b | 1a7ba96e2fcc2e80c01c936de8ad9acbd0e208e8 | /mapmakingsrc/writer.cpp | 572f158a5229fdce917713dc791b0aa9f9301165 | [] | no_license | linuxnoodle/ddr-but-you-have-to-be-on-beat-and-everything | 91e764199139f93bef03f322e056c52959cad3bf | 75d0ca67ae5bd7f92a81b9872e7f478bc25a2a6a | refs/heads/master | 2023-04-02T23:06:55.700162 | 2021-04-14T13:40:51 | 2021-04-14T13:40:51 | 348,827,520 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,373 | cpp | writer.cpp | #include <iostream>
#include <vector>
#include <fstream>
struct note {
int channel;
bool show;
float length, distance, speed;
};
void writeMapFile(std::ostream& s, const std::vector<note>& data){
unsigned int len = data.size();
s.write((char*)&len, sizeof(len));
s.write((const char*)&data[0], len * sizeof(note));
}
std::vector<note> notes;
void writeNote(int channel, float length, float distance, float bpm){
note currentNote;
currentNote.channel = channel;
currentNote.length = length;
currentNote.distance = distance;
currentNote.speed = (1/bpm)/60;
currentNote.show = true;
notes.push_back(currentNote);
}
// Yes, I should probably make it so that you don't have to individually set the notes for everything.
// No, I do not have enough time to do that.
int main(){
writeNote(0, 32, 110.5, 104.23);
writeNote(1, 32, 142.3, 104.23);
writeNote(2, 32, 174.1, 104.23);
writeNote(3, 32, 210, 104.23);
for (unsigned long int i = 0; i < notes.size(); ++i){
std::cout << "channel: " << notes[i].channel << "\nlength: " << notes[i].length << "\ndistance: " << notes[i].distance << "\nspeed: " << notes[i].speed << "\nshow: " << notes[i].show << "\n\n";
}
std::ofstream outputMap = std::ofstream("output.map", std::ios::out);
writeMapFile(outputMap, notes);
return 0;
}
|
7369f14bd7223038476930c342cd3f082b6b2a8e | 508d89f78f80d960f85be70fac74fb9f3a7bbab0 | /week4/fizzbuzz/main.cpp | 116905cf37292e4942fd156330ba0749552c84eb | [] | no_license | BroVic/course_materials_may2018 | 51e917cbe14bf31a9f648be1d773b7ec6446406d | 6ebd2660ca7a793cb70e79903cc154176a190405 | refs/heads/master | 2020-03-15T07:14:50.101708 | 2018-07-17T18:26:38 | 2018-07-17T18:26:38 | 132,025,202 | 0 | 0 | null | 2018-06-04T23:06:07 | 2018-05-03T16:57:18 | C++ | UTF-8 | C++ | false | false | 89 | cpp | main.cpp | #include "fizzbuzz.h"
int main() {
int num = 20;
fizzbuzz(num);
return 0;
} |
46a4ab10fbba38630149791f070fb440e6518d8d | b7f3edb5b7c62174bed808079c3b21fb9ea51d52 | /remoting/host/pointer_lock_detector.h | d170252c468e4cf4a75b727f7e656f33d141ec38 | [
"BSD-3-Clause"
] | permissive | otcshare/chromium-src | 26a7372773b53b236784c51677c566dc0ad839e4 | 64bee65c921db7e78e25d08f1e98da2668b57be5 | refs/heads/webml | 2023-03-21T03:20:15.377034 | 2020-11-16T01:40:14 | 2020-11-16T01:40:14 | 209,262,645 | 18 | 21 | BSD-3-Clause | 2023-03-23T06:20:07 | 2019-09-18T08:52:07 | null | UTF-8 | C++ | false | false | 1,082 | h | pointer_lock_detector.h | // Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef REMOTING_HOST_POINTER_LOCK_DETECTOR_H_
#define REMOTING_HOST_POINTER_LOCK_DETECTOR_H_
#include "remoting/protocol/input_filter.h"
namespace remoting {
// Non-filtering InputStub implementation which detects changes into or out of
// relative pointer mode, which corresponds to client-side pointer lock.
class PointerLockDetector : public protocol::InputFilter {
public:
class EventHandler {
public:
virtual void OnPointerLockChanged(bool active) = 0;
};
PointerLockDetector(InputStub* input_stub, EventHandler* event_handler_);
~PointerLockDetector() override;
// InputStub overrides.
void InjectMouseEvent(const protocol::MouseEvent& event) override;
private:
EventHandler* event_handler_;
bool has_triggered_ = false;
bool is_active_ = false;
DISALLOW_COPY_AND_ASSIGN(PointerLockDetector);
};
} // namespace remoting
#endif // REMOTING_HOST_POINTER_LOCK_DETECTOR_H_
|
03009d5fb495575911978705fb45542d3c499dbc | 3aa4a878f7818b9847957459c3594a4cc5c74d0d | /CARP/io_utils.h | 2988378a271cb93ad5340953fdbd2bc0d9c8eae2 | [] | no_license | JasonAchillious/Evolution-Computing | fbee5e37818c21a0ee8d6235bb4db42719fd7dc6 | 8ad1f94a0cea0d4258de9a161bb7f9d3a8ae2dd2 | refs/heads/master | 2021-03-14T22:57:03.293522 | 2020-06-27T13:53:05 | 2020-06-27T13:53:05 | 246,801,498 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 419 | h | io_utils.h | //
// Created by 志翔 on 2020/6/1.
//
#ifndef SAHID_IO_H
#define SAHID_IO_H
#include <string>
#include <io.h>
#include <time.h>
#include "functions.h"
void getFiles( std::string path, std::vector<std::string>& files );
void read_file (std::string file_path);
void write_result (char* output_result_dir, std::string file_path);
void write_result (const char* output_file, individual idv);
#endif //SAHID_IO_H
|
71bf85bb91565bcf00880a38b6ce8c2af1c75e56 | 0a61b1a9982be43bf205286a9e6fbeb1356c976e | /src/examples/009Chapter/9-5-3-string-search/main.cpp | c12ffa1e6bb0f1e99f8186061c32b48c797d57d7 | [
"MIT"
] | permissive | artgonzalez/cpp-primer | d551c63918d1ba415808d883a154d68fbd1b7f8d | 0317e11b5821860d38a236f24c6f7d76638386f3 | refs/heads/main | 2023-03-09T14:51:33.759711 | 2021-02-27T02:14:22 | 2021-02-27T02:14:22 | 338,088,594 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 251 | cpp | main.cpp | #include<iostream>
#include<string>
using std::cout; using std::string;
int main()
{
string name("Elvis Presley");
auto index = name.find("Pre");
cout<<index<<"\n";
index = name.find("king");
cout<<index<<"\n";
return 0;
} |
de5b3fddd5c77da873609697a3712cf3b006dd86 | 58e77f9292b28b64e5a4215c3c1202f2d58066f0 | /mainwindow.h | 79ed034fa7e4c64fe32bfcf8a3a78631810afc35 | [] | no_license | friedsam/AI_Network | 1d2177e3009edbd438c804b39936031f67630777 | 70c1bdde191cf620c8324bc87c304736127a16fa | refs/heads/master | 2021-07-02T21:21:15.944280 | 2017-09-15T21:57:30 | 2017-09-15T21:57:30 | 103,704,643 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,114 | h | mainwindow.h | #ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <qwt_plot.h>
#include <qwt_plot_curve.h>
#include "aicontroller.h"
struct data{
std::vector<double> time;
std::vector<double> Defl;
std::vector<double> z;
int size;
};
typedef data data_t;
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
data_t loadData();
DataSet_t *loadData2();
void plotData();
private:
// all the GUI stuff
Ui::MainWindow *ui;
QwtPlot *mainPlot;
QwtPlot *smoothPlot;
QwtPlot *secondDerivationPlot;
QwtPlotCurve *mainCurve;
QwtPlotCurve *smoothCurve;
QwtPlotCurve *secondDerivationCurve;
// all the GUI parameters
std::string currentInputPath;
int currentTrainingNr;
int currentTestingNr;
int currentValidationNr;
int currentEpochNr;
int currentGenerationsNr;
int currentPopulationNr;
double currentMutationNr;
double currentCrossoverNr;
int currentCurveNr;
int currentExperimentNr;
// all the backend processing stuff
AiController controller;
AiTrainingSet *trainingSet;
AiTrainingSet *testingSet;
AiTrainingSet *validationSet;
void setupGraphs();
QwtPlotCurve *getMainCurve();
QwtPlotCurve *getSmoothCurve();
QwtPlotCurve *getSecondDerivationCurve();
void updateDataSets();
void resetGA();
private Q_SLOTS:
// listeners for GUI events
void on_experimentNr_valueChanged(int);
void on_curveNr_valueChanged(int);
void on_inputPathField_textChanged(QString);
void on_trainingNr_valueChanged(int);
void on_testingNr_valueChanged(int);
void on_validationNr_valueChanged(int);
void on_numEpochsSB_valueChanged(int);
void on_numGenerationsSB_valueChanged(int);
void on_numPopulationSB_valueChanged(int);
void on_mutationSB_valueChanged(double);
void on_crossoverSB_valueChanged(double);
void on_loadDataButton_clicked();
void on_startTrainingButton_clicked();
};
#endif // MAINWINDOW_H
|
202e6de4835d9bffd881c25c818253bf6c4beed7 | a28d5c4c4fd403e0abf3f6fe38c98ed812d5c346 | /Old-Code/题解代码/acm/字符串操作(函数,字符串操作函数练习).cpp | 2161c965e2cec8245956895f45bddf0e2ef961f3 | [] | no_license | Krstar233/krits-code-workplace | 72d62abd5c9e983571e22244a93a818213cf649f | 40272de11e40751d7f1e0fb620c147295891eaa0 | refs/heads/master | 2023-03-10T22:03:17.870529 | 2021-02-25T16:09:56 | 2021-02-25T16:09:56 | 312,511,956 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,729 | cpp | 字符串操作(函数,字符串操作函数练习).cpp | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
void copy(char strs[][505], int n, int x, int l, char s[]);
void add(char s1[], char s2[], char s[]);
int find(char strs[][505], char s[], int n);
int rfind(char strs[][505], char s[], int n);
void insert(char strs[][505], char s[], int n, int x);
void reset(char strs[][505], char s[], int n);
int main()
{
int N;
int n, x, l;
char s1[505], s2[505], s[505];
char cmd[20];
char strs[25][505];
int i;
scanf("%d", &N);
getchar();
for (i = 0; i < N; i++)
{
gets(strs[i]);
}
while (1)
{
scanf("%s", cmd);
if (strcmp(cmd, "copy") == 0)
{
scanf("%d %d %d", &n, &x, &l);
copy(strs, n - 1, x, l, s);
puts(s);
}
else if (strcmp(cmd, "add") == 0)
{
scanf("%s %s", s1, s2);
add(s1, s2, s);
puts(s);
}
else if (strcmp(cmd, "find") == 0)
{
scanf("%s %d", s, &n);
printf("%d\n", find(strs, s, n - 1));
}
else if (strcmp(cmd, "rfind") == 0)
{
scanf("%s %d", s, &n);
printf("%d\n", rfind(strs, s, n - 1));
}
else if (strcmp(cmd, "insert") == 0)
{
scanf("%s %d %d", s, &n, &x);
insert(strs, s, n - 1, x);
puts(strs[n - 1]);
}
else if (strcmp(cmd, "reset") == 0)
{
scanf("%s %d", s, &n);
reset(strs, s, n - 1);
puts(strs[n - 1]);
}
else if (strcmp(cmd, "over") == 0)
exit(0);
}
}
void copy(char strs[][505], int n, int x, int l, char s[])
{
strncpy(s, strs[n] + x, l);
s[l] = '\0';
}
void add(char s1[], char s2[], char s[])
{
int flag = 1;
int i;
int n1 = 0, n2 = 0, n = 0;
int t_str[505];
for (i = 0; i < strlen(s1); i++)
{
if (!(s1[i] >= '0' && s1[i] <= '9'))
break;
}
if (i < strlen(s1))
flag = 0;
for (i = 0; i < strlen(s2); i++)
{
if (!(s2[i] >= '0' && s2[i] <= '9'))
break;
}
if (i < strlen(s2))
flag = 0;
if (flag)
{
for (i = 0; i < strlen(s1); i++)
{
n1 *= 10;
n1 += s1[i] - '0';
}
for (i = 0; i < strlen(s2); i++)
{
n2 *= 10;
n2 += s2[i] - '0';
}
if (n1 < 0 || n1 > 99999)
flag = 0;
else if (n2 < 0 || n2 > 99999)
flag = 0;
}
if (flag)
{
n = n1 + n2;
i = 0;
if (n == 0)
{
s[0] = '0';
s[1] = '\0';
return;
}
while (n != 0)
{
t_str[i] = n % 10 + '0';
n /= 10;
i++;
}
for (int j = 0; j < i; j++)
{
s[j] = t_str[i - j - 1];
}
s[i] = '\0';
}
else
{
for (i = 0; i <= strlen(s1); i++)
{
s[i] = s1[i];
}
strcat(s, s2);
}
}
int find(char strs[][505], char s[], int n)
{
int s_length = strlen(s);
char str[505];
int str_length;
int flag = 0;
int i, j;
strcpy(str, strs[n]);
str_length = strlen(str);
for (i = 0; i < str_length; i++)
{
if (str[i] == s[0])
{
for (j = 0; j < s_length; j++)
{
if (str[i + j] != s[j])
break;
}
if (j == s_length)
{
flag = 1;
break;
}
}
}
if (flag)
return i;
else
return str_length;
}
int rfind(char strs[][505], char s[], int n)
{
int s_length = strlen(s);
char str[505];
int str_length;
int flag = 0;
int i, j;
strcpy(str, strs[n]);
str_length = strlen(str);
for (i = str_length - 1; i >= 0; i--)
{
if (str[i] == s[0])
{
for (j = 0; j < s_length; j++)
{
if (str[i + j] != s[j])
break;
}
if (j == s_length)
{
flag = 1;
break;
}
}
}
if (flag)
return i;
else
return str_length;
}
void insert(char strs[][505], char s[], int n, int x)
{
char str[505];
int str_length, s_length = strlen(s);
int i;
strcpy(str, strs[n]);
str_length = strlen(str);
for (i = str_length + s_length; i >= x + s_length; i--)
{
str[i] = str[i - s_length];
}
for (i = 0; i < s_length; i++)
{
str[x + i] = s[i];
}
strcpy(strs[n], str);
}
void reset(char strs[][505], char s[], int n)
{
strcpy(strs[n], s);
}
|
cdbbfa279d35eb5a943a815ebc751448c00a610b | 324e0e73a7bdd129a5bd9db8e17f11389755da07 | /WindowsLibrary/TransactionFile.h | 3dd6d58e007a11d9de85e02e4c77c40f4d00a1f7 | [] | no_license | LemonPG/Alternate | 575de192ee3b41db3d47cbd140177d9dd95ea94c | c49a9f8b2061ea1d5de8b5c846a1abb1e3684192 | refs/heads/master | 2023-02-28T15:35:39.529073 | 2021-02-06T18:20:58 | 2021-02-06T18:20:58 | null | 0 | 0 | null | null | null | null | SHIFT_JIS | C++ | false | false | 1,765 | h | TransactionFile.h | //! @file TransactionFile.h
//! @brief トランザクションNTFSに関するAPIを集約したクラス
//! @author kumakuma0421@gmail.com
//! @date 2020.3.27
#pragma once
#include "framework.h"
#include "WindowsLibrary.h"
#include "File.h"
namespace alt
{
//! @class TransactionFileUtility
//! @brief トランザクションNTFSに関するユーティリティクラス
//! @sa http://s-kita.hatenablog.com/entry/20121217/1355764523
class DLL_DECLSPEC TransactionFileUtility : public HandleLibrary
{
public:
BOOL Init(LPWSTR lpwszDescription);
BOOL Commit();
BOOL Rollback();
BOOL CreateFolder(LPCTSTR lpctszFolderName);
BOOL Delete(LPCTSTR lpctszFileName);
BOOL Copy(LPCTSTR lpctszSrcFileName, LPCTSTR lpctszDstFileName);
BOOL Move(LPCTSTR lpctszSrcFileName, LPCTSTR lpctszDstFileName);
BOOL MakeSymbolicLink(LPCTSTR lpctszSrcFileName, LPCTSTR lpctszLinkFileName, BOOL isFile = TRUE);
BOOL MakeHardLink(LPCTSTR lpctszSrcFileName, LPCTSTR lpctszLinkFileName);
};
//! @class TransactionFile
//! @brief トランザクションNTFSに関するクラス
class DLL_DECLSPEC TransactionFile : public File
{
public:
//! @brief ファイルを作成、オープンします。
//! @param[in] hTransaction トランザクションハンドル
//! @param[in] pctszFileName (作成するファイル名)
//! @param[in] dwDesiredAccess {GENERIC_READ, GENERIC_WRITE, GENERIC_ALL}
//! @param[in] dwShareMode {FILE_SHARE_READ, FILE_SHARE_WRITE}
//! @param[in] dwCreationDisposition {CREATE_ALWAYS, OPEN_EXISTING}
//! @return BOOL
//! @retval TRUE(成功)
//! @retval FALSE(失敗)
BOOL Create(HANDLE hTransaction, LPCTSTR pctszFileName, DWORD dwDesiredAccess, DWORD dwShareMode, DWORD dwCreationDisposition);
};
} |
81d22dc385fadbc3c44d38ad5df96ca2fd21ce72 | 8faace78ec76d25b337a0918966c63e4fe40bb4a | /dyros_jet_controller/src/dyros_jet_model.cpp | 925614bd316110fc167ad213b02237b2f9ae1787 | [
"BSD-2-Clause"
] | permissive | myeongju2313/jet_walking_MJ | d21f256448e00b13369c3f83b2a6d1fb55eaab44 | 375f3a20423470b977365ec7e83d53b85113fad7 | refs/heads/master | 2023-03-21T22:28:17.589311 | 2021-03-09T03:30:19 | 2021-03-09T03:30:19 | 345,871,326 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 13,135 | cpp | dyros_jet_model.cpp | #include "dyros_jet_controller/dyros_jet_model.h"
namespace dyros_jet_controller
{
// https://stackoverflow.com/questions/8016780/undefined-reference-to-static-constexpr-char
constexpr const char* DyrosJetModel::EE_NAME[4];
constexpr const size_t DyrosJetModel::HW_TOTAL_DOF;
constexpr const size_t DyrosJetModel::MODEL_DOF;
constexpr const size_t DyrosJetModel::MODEL_WITH_VIRTUAL_DOF;
constexpr const size_t DyrosJetModel::HW_HAND_DOF;
// These should be replaced by YAML or URDF or something
const std::string DyrosJetModel::JOINT_NAME[DyrosJetModel::HW_TOTAL_DOF] = {
"L_HipYaw","L_HipRoll","L_HipPitch","L_KneePitch","L_AnklePitch","L_AnkleRoll",
"R_HipYaw","R_HipRoll","R_HipPitch","R_KneePitch","R_AnklePitch","R_AnkleRoll",
"WaistPitch","WaistYaw",
"L_ShoulderPitch","L_ShoulderRoll","L_ShoulderYaw","L_ElbowRoll","L_WristYaw","L_WristRoll","L_HandYaw",
"R_ShoulderPitch","R_ShoulderRoll","R_ShoulderYaw","R_ElbowRoll","R_WristYaw","R_WristRoll","R_HandYaw",
"HeadYaw", "HeadPitch", "R_Gripper", "L_Gripper"};
// TODO: How to get joint map directly from RBDL?
/*
const std::map<string, unsigned int> JOINT_MAP = {
{"L_HipYaw", 0},
{"L_HipRoll", 1},"L_HipPitch","L_KneePitch","L_AnklePitch","L_AnkleRoll",
"R_HipYaw","R_HipRoll","R_HipPitch","R_KneePitch","R_AnklePitch","R_AnkleRoll",
"WaistPitch","WaistYaw",
"L_ShoulderPitch","L_ShoulderRoll","L_ShoulderYaw","L_ElbowRoll","L_WristYaw","L_WristRoll","L_HandYaw",
"R_ShoulderPitch","R_ShoulderRoll","R_ShoulderYaw","R_ElbowRoll","R_WristYaw","R_WristRoll","R_HandYaw",
"HeadYaw", "HeadPitch", "R_Gripper", "L_Gripper"
};
*/
// Dynamixel Hardware IDs
const int DyrosJetModel::JOINT_ID[DyrosJetModel::HW_TOTAL_DOF] = {
16,18,20,22,24,26, // 6
15,17,19,21,23,25, // 6
28,27, // waist yaw - roll order 2
2,4,6,8,10,12,14, // 7
1,3,5,7,9,11,13, // 7
29,30,31,32}; // 4
DyrosJetModel::DyrosJetModel() :
joint_start_index_{0, 6, 14, 21}
{
base_position_.setZero();
q_.setZero();
q_ext_.setZero();
extencoder_init_flag_ = false;
std::string desc_package_path = ros::package::getPath("dyros_jet_description");
std::string urdf_path = desc_package_path + "/robots/dyros_jet_robot.urdf";
ROS_INFO("Loading DYROS JET description from = %s",urdf_path.c_str());
RigidBodyDynamics::Addons::URDFReadFromFile(urdf_path.c_str(), &model_, true, false);
ROS_INFO("Successfully loaded.");
ROS_INFO("Total DoF = %d", model_.dof_count);
ROS_INFO("Total DoF = %d", model_.q_size);
//model_.mJoints[0].)
if(model_.dof_count != MODEL_WITH_VIRTUAL_DOF)
{
ROS_WARN("The DoF in the model file and the code do not match.");
ROS_WARN("Model file = %d, Code = %d", model_.dof_count, (int)MODEL_WITH_VIRTUAL_DOF);
}
// waist = 12
//joint_start_index_[EE_LEFT_HAND] = 14;
//joint_start_index_[EE_RIGHT_HAND] = 21;
for (size_t i=0; i<4; i++)
{
end_effector_id_[i] = model_.GetBodyId(EE_NAME[i]);
ROS_INFO("%s: id - %d",EE_NAME[i], end_effector_id_[i]);
std::cout << model_.mBodies[end_effector_id_[i]].mCenterOfMass << std::endl;
}
for (size_t i=0; i<HW_TOTAL_DOF; i++)
{
joint_name_map_[JOINT_NAME[i]] = i;
}
}
void DyrosJetModel::test()
{
Eigen::Matrix<double, DyrosJetModel::MODEL_WITH_VIRTUAL_DOF, 1> q_vjoint;
q_vjoint.setZero();
updateKinematics(q_vjoint, q_vjoint);
std::cout << "left_leg_jacobian_" << std::endl;
std::cout << leg_jacobian_[0] << std::endl << std::endl;
std::cout << "right_leg_jacobian_" << std::endl;
std::cout << leg_jacobian_[1] << std::endl;
std::cout << "left_arm_jacobian_" << std::endl;
std::cout << arm_jacobian_[0] << std::endl << std::endl;
std::cout << "right_arm_jacobian_" << std::endl;
std::cout << arm_jacobian_[1] << std::endl;
std::cout << "currnet_transform_" << std::endl;
std::cout << currnet_transform_[0].translation() << std::endl << std::endl;
std::cout << currnet_transform_[1].translation() << std::endl << std::endl;
std::cout << currnet_transform_[2].translation() << std::endl << std::endl;
std::cout << currnet_transform_[3].translation() << std::endl << std::endl;
std::cout << "com" << std::endl;
std::cout << com_<< std::endl;
}
void DyrosJetModel::updateKinematics(const Eigen::VectorXd& q, const Eigen::VectorXd& qdot)
{
q_virtual_ = q;
q_virtual_dot_ = qdot;
RigidBodyDynamics::UpdateKinematicsCustom(model_, &q, &qdot, NULL);
getInertiaMatrix34DoF(&full_inertia_mat_);
getInertiaMatrix18DoF(&leg_inertia_mat_);
getCenterOfMassPosition(&com_);
getCenterOfMassPositionDot(&comDot_);
for(unsigned int i=0; i<4; i++)
{
getTransformEndEffector((EndEffector)i, &currnet_transform_[i]);
if (i < 2)
{
getJacobianMatrix6DoF((EndEffector)i, &leg_jacobian_[i]);
getJacobianMatrix18DoF((EndEffector)i, &leg_with_vlink_jacobian_[i]);
}
else
{
getJacobianMatrix7DoF((EndEffector)i, &arm_jacobian_[i-2]);
}
}
}
void DyrosJetModel::updateSensorData(const Eigen::Vector6d &r_ft, const Eigen::Vector6d &l_ft, const Eigen::Vector12d &q_ext, const Eigen::Vector3d &acc, const Eigen::Vector3d &angvel, const Eigen::Vector3d &grav_rpy)
{
r_ft_wrench_ = r_ft;
l_ft_wrench_ = l_ft;
q_ext_ = q_ext;
accel_ = acc;
angvel_ = angvel;
grav_rpy_ = grav_rpy;
}
void DyrosJetModel::updateSimCom(const Eigen::Vector3d &sim_com)
{
com_simulation_ = sim_com;
}
void DyrosJetModel::updateSimGyro(const Eigen::Vector3d &sim_gyro)
{
gyro_simulation_ = sim_gyro;
}
void DyrosJetModel::updateSimAccel(const Eigen::Vector3d &sim_accel)
{
accel_simulation_ = sim_accel;
}
void DyrosJetModel::updateSimRfoot(const Eigen::Isometry3d &sim_rfoot)
{
rfoot_simulation_ = sim_rfoot;
}
void DyrosJetModel::updateSimLfoot(const Eigen::Isometry3d &sim_lfoot)
{
lfoot_simulation_ = sim_lfoot;
}
void DyrosJetModel::updateSimBase(const Eigen::Isometry3d &sim_base)
{
base_simulation_ = sim_base;
}
void DyrosJetModel::updateMujCom(const Eigen::Vector6d &sim_lfoot)
{
q_virtual_1 = sim_lfoot;
}
void DyrosJetModel::updateMujComDot(const Eigen::Vector6d &sim_base)
{
q_dot_virtual_1 = sim_base;
}
void DyrosJetModel::getTransformEndEffector // must call updateKinematics before calling this function
(EndEffector ee, Eigen::Isometry3d* transform_matrix)
{
//Eigen::Vector3d gghg = RigidBodyDynamics::CalcBodyToBaseCoordinates(model_, q_virtual_, end_effector_id_[ee], base_position_, false);
transform_matrix->translation() = RigidBodyDynamics::CalcBodyToBaseCoordinates
(model_, q_virtual_, end_effector_id_[ee], base_position_, false);
transform_matrix->linear() = RigidBodyDynamics::CalcBodyWorldOrientation
(model_, q_virtual_, end_effector_id_[ee], false).transpose();
}
void DyrosJetModel::getTransformEndEffector // must call updateKinematics before calling this function
(EndEffector ee, Eigen::Vector3d* position, Eigen::Matrix3d* rotation)
{
*position = RigidBodyDynamics::CalcBodyToBaseCoordinates
(model_, q_virtual_, end_effector_id_[ee], base_position_, false);
*rotation = RigidBodyDynamics::CalcBodyWorldOrientation(
model_, q_virtual_ , end_effector_id_[ee], false).transpose();
}
void DyrosJetModel::getTransformEndEffector
(EndEffector ee, const Eigen::VectorXd& q, bool update_kinematics,
Eigen::Vector3d* position, Eigen::Matrix3d* rotation)
{
Eigen::Matrix<double, 34, 1> q_new;
q_new = q_virtual_;
switch (ee)
{
case EE_LEFT_FOOT:
case EE_RIGHT_FOOT:
q_new.segment<6>(joint_start_index_[ee]) = q;
break;
case EE_LEFT_HAND:
case EE_RIGHT_HAND:
q_new.segment<7>(joint_start_index_[ee]) = q;
break;
}
if (update_kinematics)
{
q_virtual_ = q_new;
}
*position = RigidBodyDynamics::CalcBodyToBaseCoordinates
(model_,q_new,end_effector_id_[ee], base_position_, update_kinematics);
*rotation = RigidBodyDynamics::CalcBodyWorldOrientation(
model_, q_new, end_effector_id_[ee], update_kinematics).transpose();
// RigidBodyDynamics::Calcpo
// model_.mBodies[0].mCenterOfMass
}
void DyrosJetModel::getJacobianMatrix6DoF
(EndEffector ee, Eigen::Matrix<double, 6, 6> *jacobian)
{
Eigen::MatrixXd full_jacobian(6,MODEL_WITH_VIRTUAL_DOF);
full_jacobian.setZero();
RigidBodyDynamics::CalcPointJacobian6D(model_, q_virtual_, end_effector_id_[ee],
Eigen::Vector3d::Zero(), full_jacobian, false);
switch (ee)
{
case EE_LEFT_FOOT:
case EE_RIGHT_FOOT:
// swap
jacobian->block<3, 6>(0, 0) = full_jacobian.block<3, 6>(3, joint_start_index_[ee]+6);
jacobian->block<3, 6>(3, 0) = full_jacobian.block<3, 6>(0, joint_start_index_[ee]+6);
break;
case EE_LEFT_HAND:
case EE_RIGHT_HAND:
//*jacobian = full_jacobian.block<6, 7>(0, joint_start_index_[ee]);
ROS_ERROR("Arm is 7 DoF. Please call getJacobianMatrix7DoF");
break;
}
}
void DyrosJetModel::getJacobianMatrix7DoF
(EndEffector ee, Eigen::Matrix<double, 6, 7> *jacobian)
{
Eigen::MatrixXd full_jacobian(6,MODEL_WITH_VIRTUAL_DOF);
full_jacobian.setZero();
RigidBodyDynamics::CalcPointJacobian6D(model_, q_virtual_, end_effector_id_[ee],
Eigen::Vector3d::Zero(), full_jacobian, false);
switch (ee)
{
case EE_LEFT_FOOT:
case EE_RIGHT_FOOT:
// swap
ROS_ERROR("Leg is 6 DoF. Please call getJacobianMatrix7DoF");
break;
case EE_LEFT_HAND:
case EE_RIGHT_HAND:
//*jacobian = full_jacobian.block<6, 7>(0, joint_start_index_[ee]);
jacobian->block<3, 7>(0, 0) = full_jacobian.block<3, 7>(3, joint_start_index_[ee]+6);
jacobian->block<3, 7>(3, 0) = full_jacobian.block<3, 7>(0, joint_start_index_[ee]+6);
break;
}
}
void DyrosJetModel::getJacobianMatrix18DoF(EndEffector ee, Eigen::Matrix<double, 6, 18> *jacobian)
{
// Non-realtime
Eigen::MatrixXd full_jacobian(6,MODEL_WITH_VIRTUAL_DOF);
full_jacobian.setZero();
RigidBodyDynamics::CalcPointJacobian6D(model_, q_virtual_, end_effector_id_[ee],
Eigen::Vector3d::Zero(), full_jacobian, false);
switch (ee)
{
case EE_LEFT_FOOT:
// swap
// Virtual Link
jacobian->block<3, 6>(0, 0) = full_jacobian.block<3, 6>(3, 0);
jacobian->block<3, 6>(3, 0) = full_jacobian.block<3, 6>(0, 0);
// left Leg Link
jacobian->block<3, 6>(0, 6) = full_jacobian.block<3, 6>(3, joint_start_index_[ee]+6);
jacobian->block<3, 6>(3, 6) = full_jacobian.block<3, 6>(0, joint_start_index_[ee]+6);
break;
case EE_RIGHT_FOOT:
// swap
// Virtual Link
jacobian->block<3, 6>(0, 0) = full_jacobian.block<3, 6>(3, 0);
jacobian->block<3, 6>(3, 0) = full_jacobian.block<3, 6>(0, 0);
// right Leg Link
jacobian->block<3, 6>(0, 12) = full_jacobian.block<3, 6>(3, joint_start_index_[ee]+6);
jacobian->block<3, 6>(3, 12) = full_jacobian.block<3, 6>(0, joint_start_index_[ee]+6);
break;
case EE_LEFT_HAND:
case EE_RIGHT_HAND:
//*jacobian = full_jacobian.block<6, 7>(0, joint_start_index_[ee]);
ROS_ERROR("Arm is 7 DoF. Please call getJacobianMatrix7DoF");
break;
}
}
void DyrosJetModel::getCenterOfMassPosition(Eigen::Vector3d* position)
{
RigidBodyDynamics::Math::Vector3d position_temp,position_dot;
position_temp.setZero();
Eigen::Matrix<double, 34, 1> qddot;
qddot.setZero();
//Eigen::Vector3d com_vel;
//Eigen::Vector3d angular_momentum;
double mass;
RigidBodyDynamics::Utils::CalcCenterOfMass(model_, q_virtual_, q_virtual_dot_, mass, position_temp, &position_dot, NULL, false);
//RigidBodyDynamics::Utils::CalcCenterOfMass(model_, q_, qdot, mass, position_temp, NULL, NULL, false);
//RigidBodyDynamics::Utils::CalcCenterOfMass(model_, q_, qdot, mass, position_temp);
*position = position_temp;
}
void DyrosJetModel::getCenterOfMassPositionDot(Eigen::Vector3d* position)
{
RigidBodyDynamics::Math::Vector3d position_temp, position_dot;
position_temp.setZero();
Eigen::Matrix<double, 34, 1> qddot;
qddot.setZero();
//Eigen::Vector3d com_vel;
//Eigen::Vector3d angular_momentum;
double mass;
RigidBodyDynamics::Utils::CalcCenterOfMass(model_, q_virtual_, q_virtual_dot_, mass, position_temp, &position_dot, NULL,false);
//RigidBodyDynamics::Utils::CalcCenterOfMass(model_, q_, qdot, mass, position_temp, NULL, NULL, false);
//RigidBodyDynamics::Utils::CalcCenterOfMass(model_, q_, qdot, mass, position_temp);
*position = position_dot;
}
void DyrosJetModel::getInertiaMatrix34DoF(Eigen::Matrix<double, 34, 34> *inertia)
{
// Non-realtime
Eigen::MatrixXd full_inertia(MODEL_WITH_VIRTUAL_DOF, MODEL_WITH_VIRTUAL_DOF);
full_inertia.setZero();
RigidBodyDynamics::CompositeRigidBodyAlgorithm(model_, q_virtual_, full_inertia, false);
inertia->block<34, 34>(0, 0) = full_inertia.block<34, 34>(0, 0);
}
void DyrosJetModel::getInertiaMatrix18DoF(Eigen::Matrix<double, 18, 18> *leg_inertia)
{
// Non-realtime
Eigen::MatrixXd full_inertia(MODEL_WITH_VIRTUAL_DOF, MODEL_WITH_VIRTUAL_DOF);
full_inertia.setZero();
RigidBodyDynamics::CompositeRigidBodyAlgorithm(model_, q_virtual_, full_inertia, false);
leg_inertia->block<18, 18>(0, 0) = full_inertia.block<18, 18>(0, 0);
}
}
|
01cc9525bce2151b63fffb85fbf1cd5d913e6423 | 9b979b907d19049073e66b33d696930ea3a63a68 | /Orientada_Objetos/Evento.hpp | 98a6668e0a3846338adc378c1efcffd3141c2920 | [] | no_license | vsapiens/Orientada_Objetos | 2068ba5463b4cd8e50a77005a5300c157a94b5ec | 2a08ffbd390710f82274e7e22e2e38b8a3ca5604 | refs/heads/master | 2021-03-22T04:38:17.000819 | 2018-05-13T00:41:10 | 2018-05-13T00:41:10 | 116,847,223 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,005 | hpp | Evento.hpp | #ifndef Evento_hpp
#define Evento_hpp
#include <stdio.h>
#include "Reloj.hpp"
class Evento
{
public:
Evento();
Evento(Reloj, int, string);
void setInicio(Reloj);
void setDuracion(int);
void setAsunto(string);
Reloj getInicio();
int getDuracion();
string getAsunto();
private:
int duracion;
string asunto;
Reloj inicio;
};
Evento::Evento()
{
inicio.setHora(8);
inicio.setMinu(0);
duracion = 30;
asunto = "Evento";
}
Evento::Evento(Reloj Tiemp, int Dur, string Asunt)
{
inicio = Tiemp;
duracion = Dur;
asunto = Asunt;
}
void Evento::setInicio(Reloj inicio)
{
this->inicio = inicio;
}
void Evento::setDuracion(int duracion)
{
this->duracion = duracion;
}
void Evento::setAsunto(string asunto)
{
this->asunto = asunto;
}
Reloj Evento::getInicio()
{
return inicio;
}
int Evento::getDuracion()
{
return duracion;
}
string Evento::getAsunto()
{
return asunto;
}
#endif /* Evento_hpp */
|
33b3dfe2dd6d29e42b2bd6abee55c2d13e3998c3 | b5dbf4a20e1f99b28b552b020ba05f726dd6df68 | /RTTECPlugin/DataNotifier.cpp | e732b5c086920f75af38b85ae59cd7063463232c | [] | no_license | chanpi/RTTECPlugin | dfd8a79c0c234a083028ca68099ea4ec469ccc3c | 239e8cfc4eda83ec9502b8806ec4e33b3e6b369b | refs/heads/master | 2020-05-31T11:57:39.158065 | 2012-04-10T12:59:04 | 2012-04-10T12:59:04 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,099 | cpp | DataNotifier.cpp | #include "StdAfx.h"
#include "DataNotifier.h"
#include "RTTECAccessor.h"
DataNotifier::DataNotifier(void)
{
m_accessor = new RTTECAccessor();
m_socketHandler = INVALID_SOCKET;
}
DataNotifier::~DataNotifier(void)
{
delete m_accessor;
}
void DataNotifier::Initialize(LPCSTR ipAddress, USHORT uPort)
{
m_socketHandler = m_accessor->InitializeUDPSocket(&m_address, ipAddress, uPort);
}
void DataNotifier::UnInitialize(void)
{
if (m_socketHandler != INVALID_SOCKET) {
closesocket(m_socketHandler);
m_socketHandler = INVALID_SOCKET;
}
}
int DataNotifier::Notify(NotifyDataFormat* pData)
{
//{
// NotifyDataFormat f = (NotifyDataFormat)*pData;
// int height = 0;
// Bytes2Int(f.bodyHeight, &height);
// TCHAR szBuffer[32];
// _stprintf_s(szBuffer, 32, _T(">>> %d\n"), height);
// OutputDebugString(szBuffer);
//}
int sendBytes = 0;
if (m_socketHandler != INVALID_SOCKET) {
sendBytes = sendto(m_socketHandler, (const char*)pData, sizeof(NotifyDataFormat), 0, (const sockaddr*)&m_address, sizeof(m_address));
}
return sendBytes;
} |
87ebae7b39d86567b59cec8d23305f2a5aff4c8b | e6e073673cdbef380abeba89cbf2618d4f680b2d | /CST 126-2/DateList.cpp | 52f2beb435e04fb960d43672cafde8e69c657afa | [] | no_license | mklump/CS_OIT2005Degree_Accademic_Work | 2a7d10a73caff65d43421d5bb71de0ca94bb69d4 | 785c4649a6e43ebca81b7c03b3cba8f9ecf78bcc | refs/heads/master | 2021-01-10T06:45:56.185811 | 2016-03-21T15:04:23 | 2016-03-21T15:04:23 | 54,396,605 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,775 | cpp | DateList.cpp | //--------------------------------------------------------------------
// Author: P. Hannan
// Date Created: 11 Feb 2002
// Last Change Date:
// Project: Pull together all the date list code from the slides
// Filename: DateList.cpp
//
// Overview: Provides a linked list of dates.
//
// Input: None
//
// Output: A list of dates.
//
//--------------------------------------------------------------------
// NOTE: This program needs a function to delete the list.
//
#include <iostream>
using namespace std;
struct Date {
int day, month, year;
Date * next;
};
typedef Date * DatePtr;
//--------------------------------------------------------------------
// Prints our list of Dates
void PrintList(DatePtr list);
// Create a single node in our list
DatePtr CreateNode(int dy, int mn, int yr);
//--------------------------------------------------------------------
void main (void)
{
DatePtr head, temp;
head = NULL;
for (int i = 1; i<5; i++) {
temp = CreateNode(i,02,2002);
temp->next = head; // Insert at front
head = temp; // add the rest of list
}
PrintList(head);
}
//--------------------------------------------------------------------
// Insert your functions here.
//--------------------------------------------------------------------
DatePtr CreateNode(int dy, int mn, int yr)
{
DatePtr temp = new Date;
temp->day = dy; // Initialize structure
temp->month = mn;
temp->year = yr;
temp->next = NULL; // We aren't inserting yet
return(temp);
}
void PrintList(DatePtr list)
{
DatePtr temp = list;
while (temp != NULL)
{
cout << temp->month << ":";
cout << temp->day << ":";
cout << temp->year << endl;
temp = temp->next;
}
} |
67c32fcbdff3822ffc5485ea9fb8a478d4e686ca | ebe8246fb06c08fff880d5356ada6c8abf796aa0 | /Chetverikov/include/ScListDecoder.h | 072fedef9b3ac3897710236ec10b720fd91fe9f5 | [] | no_license | ISChetverikov/PolarCodesUnion | d6e6156d0b0a0e90cd4e8f08796c8fe27e4dcb38 | 6fe1818c7845808f19efa256a7ee36f7e2a2ef46 | refs/heads/master | 2023-02-05T10:21:46.141613 | 2020-12-24T14:44:47 | 2020-12-24T14:44:47 | 290,478,579 | 4 | 7 | null | 2020-12-24T14:44:48 | 2020-08-26T11:31:53 | Jupyter Notebook | UTF-8 | C++ | false | false | 889 | h | ScListDecoder.h | #pragma once
#include "ScCrcAidedDecoder.h"
class ScListDecoder : public ScCrcAidedDecoder {
protected:
int _L;
std::vector<std::vector<std::vector<double>>> _beliefTrees;
std::vector<std::vector<std::vector<int>>> _uhatTrees;
std::vector<std::vector<int>> _candidates;
std::vector<double> _metrics;
// optimization allocation
// At each step: _areTakenZero[i] = 1 if i-th path with added zero is taken
std::vector<bool> _areTakenZero;
std::vector<bool> _areTakenOne;
void PassDownList(size_t iter);
void PassUpList(size_t iter);
void DecodeListInternal(std::vector<double> inLlr);
// fill _areTakenZero and _areTakeOne
void FillListMask(size_t iter);
double StepMetric(double belief, int decision);
std::vector<int> TakeListResult();
public:
ScListDecoder(PolarCode * code, int L);
std::vector<int> Decode(std::vector<double> llr) override;
~ScListDecoder() {};
}; |
763558a6a7c0a6629e52b82390caeaf3c467f2de | a5a7c59b04a1a64fe34653c7970c3cf173f9c1df | /mechanics/src/collision/bullet/Bullet1DR.hpp | 42906624c37818af74f1640dcf90ceb3b522ac4a | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | siconos/siconos | a7afdba41a2bc1192ad8dcd93ac7266fa281f4cf | 82a8d1338bfc1be0d36b5e8a9f40c1ad5384a641 | refs/heads/master | 2023-08-21T22:22:55.625941 | 2023-07-17T13:07:32 | 2023-07-17T13:07:32 | 37,709,357 | 166 | 33 | Apache-2.0 | 2023-07-17T12:31:16 | 2015-06-19T07:55:53 | C | UTF-8 | C++ | false | false | 1,379 | hpp | Bullet1DR.hpp | /* Siconos is a program dedicated to modeling, simulation and control
* of non smooth dynamical systems.
*
* Copyright 2022 INRIA.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef Bullet1DR_hpp
#define Bullet1DR_hpp
#include "BulletSiconosFwd.hpp"
#include <NewtonEuler1DR.hpp>
class Bullet1DR : public NewtonEuler1DR {
private:
ACCEPT_SERIALIZATION(Bullet1DR);
SP::btManifoldPoint _contactPoints;
public:
Bullet1DR(SP::btManifoldPoint);
SP::btManifoldPoint contactPoint() const { return _contactPoints; };
/**
to compute the output y = h(t,q,z) of the Relation
\param time current time value
\param q coordinates of the dynamical systems involved in the relation
\param y the resulting vector
*/
void computeh(double time, const BlockVector &q, SiconosVector &y) override;
ACCEPT_STD_VISITORS();
};
#endif
|
15b762e4232a47f7ce9aac92c9b3afff5cc99930 | de0aef68593179bdd58ee7a5d2c67faa586cdf20 | /capture_thread.cpp | 1b7927f4351fa5cd6b4bfc435f19c59710d576d9 | [] | no_license | Neo03/Detective | 5e0840541902b9e243e9666502e06bc73f8f575e | c4e17c04a21d021458c20ddc853d4005e40623d2 | refs/heads/master | 2021-01-03T19:46:18.529111 | 2020-02-13T13:07:44 | 2020-02-13T13:07:44 | 240,213,862 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,731 | cpp | capture_thread.cpp | #include <QTime>
#include <QDebug>
#include "utilities.h"
#include "capture_thread.h"
CaptureThread::CaptureThread(int camera, QMutex *lock):
running(false), cameraID(camera), videoPath(""), data_lock(lock)
{
frame_width = frame_height = 0;
taking_photo = false;
}
CaptureThread::CaptureThread(QString videoPath, QMutex *lock):
running(false), cameraID(-1), videoPath(videoPath), data_lock(lock)
{
frame_width = frame_height = 0;
taking_photo = false;
}
CaptureThread::~CaptureThread() {
}
void CaptureThread::run() {
running = true;
//cv::VideoCapture cap(cameraID);
cv::VideoCapture cap("/root/Video/Cat1_1.mp4");
cv::Mat tmp_frame;
frame_width = cap.get(cv::CAP_PROP_FRAME_WIDTH);
frame_height = cap.get(cv::CAP_PROP_FRAME_HEIGHT);
classifier = new cv::CascadeClassifier(OPENCV_DATA_DIR "haarcascades/haarcascade_frontalcatface_extended.xml");
// classifier = new cv::CascadeClassifier("../boston-bull/cascade.xml");
// classifier = new cv::CascadeClassifier("../no-entry/cascade.xml");
while(running) {
cap >> tmp_frame;
if (tmp_frame.empty()) {
break;
}
// tmp_frame = cv::imread("../boston-bull/boston-bull-predict.png");
// tmp_frame = cv::imread("../no-entry/no-entry-predict.png");
if(taking_photo) {
takePhoto(tmp_frame);
}
#ifdef TIME_MEASURE
int64 t0 = cv::getTickCount();
#endif
// определение объектов
detectObjects(tmp_frame);
#ifdef TIME_MEASURE
int64 t1 = cv::getTickCount();
double t = (t1-t0) * 1000 /cv::getTickFrequency();
qDebug() << "Detecting time on a single frame: " << t <<"ms";
#endif
cvtColor(tmp_frame, tmp_frame, cv::COLOR_BGR2RGB);
data_lock->lock();
frame = tmp_frame;
data_lock->unlock();
emit frameCaptured(&frame);
}
cap.release();
delete classifier;
classifier = nullptr;
running = false;
}
void CaptureThread::takePhoto(cv::Mat &frame)
{
QString photo_name = Utilities::newPhotoName();
QString photo_path = Utilities::getPhotoPath(photo_name, "jpg");
cv::imwrite(photo_path.toStdString(), frame);
emit photoTaken(photo_name);
taking_photo = false;
}
void CaptureThread::detectObjects(cv::Mat &frame)
{
vector<cv::Rect> objects;
classifier->detectMultiScale(frame, objects, 1.3, 5);
cv::Scalar color = cv::Scalar(0, 0, 255); // red
//рисуем ограниченные квадраты
for(size_t i = 0; i < objects.size(); i++){
cv::rectangle(frame, objects[i], color, 2);
}
}
|
0ebd218754bba3775c03de96c7c55348f97a82f4 | 54135e8470c6ba387fa3e1496b5dfd15d1bc2b96 | /Array/sort_an_array_of_0's_1's_and_2's.cpp | ebdd93261548742ea7fcc2c2fd9c5efe1bc5ed5f | [] | no_license | Falcon20/Data-Structures-and-Algorithms | b4d278bbe1a0cf208338a204b2ad204e34c4c6ef | 9e2322792bfac5f898594835353ed801f5b75f55 | refs/heads/master | 2022-10-25T18:02:22.118862 | 2022-10-15T18:06:41 | 2022-10-15T18:06:41 | 122,109,353 | 2 | 9 | null | 2022-10-15T18:06:41 | 2018-02-19T19:21:20 | C++ | UTF-8 | C++ | false | false | 1,013 | cpp | sort_an_array_of_0's_1's_and_2's.cpp | // Problem link - https://practice.geeksforgeeks.org/problems/sort-an-array-of-0s-1s-and-2s/0
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
int t,n;
cin>>t;
while(t--)
{
cin>>n;
int a[n];
for(int i = 0;i<n;i++)
{
cin>>a[i];
}
int low = 0; // to store the value of next 0
int mid = 0; // to iterate
int high = n-1; // to store the value of next 2
while(mid <= high)
{
switch(a[mid])
{
case 0:
swap(a[low], a[mid]);
low++;
mid++;
break;
case 1:
mid++;
break;
case 2:
swap(a[mid], a[high]);
high--;
break;
}
}
for(int i =0;i<n;i++)
cout<<a[i]<<" ";
cout<<"\n";
}
return 0;
} |
d1c618b3271699ddc4e68c5f98ef244c5cd79719 | c54b1363ec869a360a8d075dbb2136fe7cfe23c8 | /71A.cpp | 67d7309c7b4959247591f2a8a70ecf2c2edc43cc | [] | no_license | Robiul001/Codeforces | 535f800e6c0593775dca4f0737a82caa80b879f3 | 3677a208816f1e2b75f566cd8c7b7fbeb13c9cfd | refs/heads/master | 2021-01-25T13:47:36.528066 | 2020-02-15T18:05:29 | 2020-02-15T18:05:29 | 123,614,479 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 450 | cpp | 71A.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int testcase,n,k,l;
char ch[101];
cin>>testcase;
gets(ch);
cout<<endl;
for(int i=0;i<testcase;i++){
gets(ch);
n=strlen(ch);
if(n<=10){
puts(ch);
cout<<endl;
}else{
k=n-2;
cout<<ch[0]<<n-2<<ch[n-1]<<endl;
// cout<<i<<endl;
}
}
return 0;
}
|
8637d83eb91cdf884c60197af947058d2eb7c4d0 | 5dec86e71d9b6ad0eb66ba0e8b57edbf18fe9cc5 | /皮肤检测/skin/skin/skin.cpp | c8633ad4c96fa30e90dcdd9fdf738055e7d6b620 | [] | no_license | cqnu/demo_opencv | 8f73d79e84cbd91d9744bb080e32647539a4a16a | c40aa78df11e13db9851ea013240f118227434b6 | refs/heads/master | 2021-09-22T18:09:12.877825 | 2018-09-12T08:40:15 | 2018-09-12T08:40:15 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,046 | cpp | skin.cpp | #include <iostream>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <cvaux.h>
#include <highgui.h>
using namespace cv;
#if 1
class skin_detector
{
public:
Mat RGB_detector(Mat &img)
{
Mat detect = img.clone();
detect.setTo(0);
if (img.empty()||img.channels()!=3)
{
return detect;
}
for (int i = 0; i < img.rows; i++)
{
for (int j = 0; i < img.cols; j++)
{
uchar* p_detect = detect.ptr<uchar>(i, j);
uchar *p_img = img.ptr<uchar>(i, j);
if ((p_img[2] > 95 && p_img[1] > 40 && p_img[0] > 20 &&
(MAX(p_img[0], MAX(p_img[1], p_img[2])) - MIN(p_img[0], MIN(p_img[1], p_img[2])) > 15) &&
abs(p_img[2] - p_img[1]) > 15 && p_img[2] > p_img[1] && p_img[1] > p_img[0]) ||
(p_img[2] > 200 && p_img[1] > 210 && p_img[0] > 170 && abs(p_img[2] - p_img[1]) <= 15 &&
p_img[2] > p_img[0] && p_img[1] > p_img[0]))
{
p_detect[0] = p_img[0];
p_detect[1] = p_img[1];
p_detect[2] = p_img[2];
}
}
}
}
};
#endif
int main(int argc, char **argv)
{
return 0;
} |
48a4b75f3e36e757b8ebdbbab5ab9907edd37b48 | 7536f5d95e5094b20d360a3a6427acbb2c1cd368 | /engr_tools/predictionator/vxcommon/config_cds.cpp | e342579a6bcb3e429247c2ec102f99ee53b5892c | [] | no_license | ebadusb/Trima_12.4 | 6804354151afd5d70014ccea3ced73b054cd2eea | 8e3d59f14f30b1b5bd1c3696703c2a024c2e4c5f | refs/heads/master | 2022-11-12T19:30:35.576215 | 2019-08-19T19:16:23 | 2019-08-19T19:16:23 | 274,995,217 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 71,054 | cpp | config_cds.cpp |
/*******************************************************************************
*
* Copyright (c) 2002 by Gambro BCT, Inc. All rights reserved.
*
* TITLE: config_cds.cpp
* Config Common Data Store
*
* AUTHOR: Regis McGarry
*
* ABSTRACT: This file declares the body of the Config CDS
*
* HISTORY: $Log: config_cds.cpp $
* HISTORY: Revision 1.2 2007/11/14 23:33:38Z dslausb
* HISTORY: Take out trima_opsys (it no longer exists).
* HISTORY: Revision 1.1 2005/12/16 21:49:49Z rm70006
* HISTORY: Initial revision
* HISTORY: Revision 1.49 2004/05/07 21:42:04Z rm70006
* HISTORY: IT 6963.
* HISTORY: Fix problem in config.dat where the crc file was being set to read only and was interfering with EMS updates.
* HISTORY: Revision 1.48 2003/11/25 15:34:39Z rm10919
* HISTORY: Make the weight-volumes from config donor volume screen reflect if there is a four way cut off or not.
* HISTORY: Revision 1.47 2003/10/16 16:06:44Z rm70006
* HISTORY: IT 6518. Fixed problem with logging.
* HISTORY: Revision 1.46 2003/09/10 23:33:17Z jd11007
* HISTORY: Revision 1.45 2003/08/19 12:31:22Z rm70006
* HISTORY: IT 6277. Fix template syntax so it will compile on Windows.
* HISTORY: Revision 1.44 2003/08/11 15:47:20Z ms10234
* HISTORY: 6227 - changes to detect missing elements
* HISTORY: Revision 1.43 2003/08/06 15:41:58Z rm70006
* HISTORY: IT 6277. Added checking for audio level of 2.
* HISTORY: Revision 1.42 2003/07/09 16:26:30Z sb07663
* HISTORY: Changes to allow Vista offline prediction build (under IT6119)
* HISTORY: Revision 1.41 2003/06/26 22:36:50Z jl11312
* HISTORY: - added support for sw.dat
* HISTORY: Revision 1.40 2003/06/19 18:40:39Z ms10234
* HISTORY: 5829 - changes for PFR
* HISTORY: Revision 1.39 2003/04/21 18:38:23Z rm70006
* HISTORY: IT 5953.
* HISTORY:
* HISTORY: default product designator to 1 for all offline procedures.
* HISTORY: Revision 1.38 2003/04/18 20:03:39Z rm70006
* HISTORY: IT 5671.
* HISTORY:
* HISTORY: Fixed wrong column labels.
* HISTORY: Revision 1.37 2003/04/09 16:44:32Z sb07663
* HISTORY: Minor ifdef mod to allow offline use (checked in under IT5808)
* HISTORY: Revision 1.36 2003/04/08 16:33:13Z jl11312
* HISTORY: - changed Get() call to GetRef()
* HISTORY: Revision 1.35 2003/04/03 17:51:00Z rm10919
* HISTORY: donor volume changes
* HISTORY: Revision 1.34 2003/04/03 14:59:46Z jl11312
* HISTORY: - modified to use new log levels
* HISTORY: - moved config data to a periodic log table
* HISTORY: Revision 1.33 2003/04/01 22:13:13Z rm10919
* HISTORY: Changes for audit tracking and donor volume configuration.
* HISTORY: Revision 1.32 2003/02/24 20:12:38Z jl11312
* HISTORY: - corrected handling of config.dat related alarms
* HISTORY: Revision 1.31 2003/01/30 17:59:52 rm70006
* HISTORY: Add ability to get back error strings in valid calls.
* HISTORY: Revision 1.30 2003/01/23 18:15:21Z ms10234
* HISTORY: added log config function
* HISTORY: Revision 1.29 2003/01/10 20:51:16Z sb07663
* HISTORY: added max concurrent option back in
* HISTORY: Revision 1.28 2003/01/10 17:52:37Z rm70006
* HISTORY: Make changes for 5.J config changes.
* HISTORY: Revision 1.27 2002/12/30 17:58:21Z rm70006
* HISTORY: RBC Replacement Fluid field was mistakenly being validated against the range for MAX Return Pressure.
* HISTORY: Revision 1.26 2002/12/19 16:19:16Z jl11312
* HISTORY: - added readConfig function
* HISTORY: Revision 1.25 2002/12/11 18:33:28 sb07663
* HISTORY: Changes for offline use - ability to read from a path + conditional win32 compilation
* HISTORY: Revision 1.23 2002/11/27 14:46:55Z jl11312
* HISTORY: - removed unused Valid override in LangConfigElement
* HISTORY: Revision 1.22 2002/11/25 15:50:04 rm70006
* HISTORY: Use more strict syntax for templates to support T2.2 compiler.
* HISTORY: Revision 1.21 2002/11/19 19:09:29Z jl11312
* HISTORY: - added missing Register calls
* HISTORY: Revision 1.20 2002/11/18 18:31:00 jl11312
* HISTORY: - modifications to improve compile speed, reduce inline function sizes
* HISTORY: Revision 1.19 2002/10/31 19:55:31 rm70006
* HISTORY: Make changes resulting from _debug and _fatal no longer being static member vars.
* HISTORY: Revision 1.18 2002/10/29 15:51:40Z rm70006
* HISTORY: Added assignment operator to CDS.
* HISTORY: Revision 1.17 2002/10/18 20:01:46Z rm70006
* HISTORY: Changed register call to remove role.
* HISTORY: Revision 1.16 2002/10/04 13:39:12Z rm70006
* HISTORY: Fixed problem with blood type conversion with predict std::list.
* HISTORY: Revision 1.15 2002/10/01 19:20:15Z rm70006
* HISTORY: Fixed bug in predict std::list copy. Added logging of predict std::list.
* HISTORY: Revision 1.14 2002/09/26 21:35:20Z rm70006
* HISTORY: Fix problems with updating the predict procedure std::list.
* HISTORY: Revision 1.13 2002/09/26 19:05:29Z rm70006
* HISTORY: Fix bug in Write and Validate to use correct type of value.
* HISTORY: Make datafile var to be static so all instances can write after one of them reads.
* HISTORY: Revision 1.12 2002/09/25 16:02:35Z rm70006
* HISTORY: Had to add a new call to DataStore to return a reference since the get call changed.
* HISTORY: Revision 1.11 2002/08/23 14:59:37Z rm70006
* HISTORY: Fixed bug with read and unwanted float conversion.
* HISTORY: Revision 1.9 2002/07/18 21:26:12Z rm70006
* HISTORY: Added update of procedure std::list for predict.
* HISTORY: Changed to be multiwriter. Removed code to read config file on startup.
* HISTORY: Revision 1.8 2002/07/05 19:57:03Z rm70006
* HISTORY: Added predict-style procedure std::list.
* HISTORY: Revision 1.7 2002/07/05 16:39:21Z rm70006
* HISTORY: Added ConfigChanged message send call. Write function automatically sends message.
* HISTORY: Revision 1.6 2002/07/02 20:44:37Z sb07663
* HISTORY: typo fix for platelet priority B element
* HISTORY: Revision 1.5 2002/07/02 19:34:12 rm70006
* HISTORY: Move std::list init code to register function so that it occurs after elements have been bound.
* HISTORY: Revision 1.4 2002/06/26 21:30:20Z rm70006
* HISTORY: Move template routines to .h file.
* HISTORY: Revision 1.3 2002/06/24 19:45:51Z rm70006
* HISTORY: Add default constructor/destructor
* HISTORY: Revision 1.2 2002/06/21 21:29:59Z sb07663
* HISTORY: Added error.h, needed for FATAL_ERROR calls
* HISTORY: Revision 1.1 2002/06/19 17:50:32 rm70006
* HISTORY: Initial revision
*******************************************************************************/
#include <vxWorks.h>
#ifndef WIN32
#pragma implementation "config_cds.h"
#include "../os/trima_options.h"
#else
#include <cstdio>
#endif
#include "config_cds.h"
#include "datalog_periodic.h"
#include "filenames.h"
#include "trimamessages.h"
#include "an_alarm.h"
#include "bloodtype.h"
#include "messagesystem.h"
#include "filehelp.h"
static CCfgVarList _Lst(1);
//
// Write
//
template <class dataType> bool ConfigElement<dataType>::Write(CDatFileReader &datfile)
{
ConfigVarList item;
// Don't write unless the section is valid.
if (!Valid())
return false;
for (CONFIG_VAR_LIST::iterator i = _list.begin(); i != _list.end(); ++i)
{
item = *i;
switch (item._storage_type)
{
case ConfigVarList::INT:
if (!datfile.SetInt(item._info->Section() , item._info->Name() , *item._data_ptr.valuei))
{
DataLog(log_level_control_alarm_detail)
<< "Couldn't write to Config. Section(" << item._info->Section()
<< "), Name(" << item._info->Name()
<< "), Value(" << *item._data_ptr.valuei << ")." << endmsg;
anAlarmMsg alarm(CONFIGDAT_BAD_FILE);
alarm.setAlarm();
}
break;
case ConfigVarList::FLOAT:
if (!datfile.SetFloat(item._info->Section() , item._info->Name() , *item._data_ptr.valuef))
{
DataLog(log_level_control_alarm_detail)
<< "Couldn't write to Config. Section(" << item._info->Section()
<< "), Name(" << item._info->Name()
<< "), Value(" << *item._data_ptr.valuef << ")." << endmsg;
anAlarmMsg alarm(CONFIGDAT_BAD_FILE);
alarm.setAlarm();
}
break;
case ConfigVarList::UNKNOWN:
default:
DataLog(log_level_control_alarm_detail)
<< "Config Element not recognized. Section(" << item._info->Section()
<< "), storage_type(" << item._storage_type
<< "), Name(" << item._info->Name()
<< "Value(" << *item._data_ptr.valuef << "), Min("
<< item._info->Min() << "), Max("
<< item._info->Max() << ")." << endmsg;
anAlarmMsg alarm(CONFIGDAT_WRITE_ERROR);
alarm.setAlarm();
}
}
return true;
}
//
// Read
//
template <class dataType> bool ConfigElement<dataType>::Read(CDatFileReader &datfile)
{
ConfigVarList item;
float value;
for (CONFIG_VAR_LIST::iterator i = _list.begin(); i != _list.end(); ++i)
{
item = *i;
value = datfile.GetFloat(item._info->Section(), item._info->Name());
if (!item._info->Valid(value))
{
DataLog(log_level_control_alarm_detail)
<< "Value out of Range: Section(" << item._info->Section()
<< "), Name(" << item._info->Name()
<< "), Value(" << value
<< "), Min(" << item._info->Min()
<< "), Max(" << item._info->Max()
<< ")." << endmsg;
// Generate S/W A2 Alarm
anAlarmMsg alarm(CONFIGDAT_VALUE_OUT_OF_RANGE);
alarm.setAlarm();
switch (item._storage_type)
{
case ConfigVarList::INT:
*item._data_ptr.valuei = (int)item._info->Min();
break;
case ConfigVarList::FLOAT:
*item._data_ptr.valuef = item._info->Min();
break;
default:
DataLog(log_level_config_error)
<< "Wrong type found for config item " << item._info->Name()
<< "(" << item._info->DisplayType() << ")." << endmsg;
*item._data_ptr.valuef = item._info->Min();
}
}
else
{
switch (item._storage_type)
{
case ConfigVarList::INT:
*item._data_ptr.valuei = (int)value;
break;
case ConfigVarList::FLOAT:
*item._data_ptr.valuef = value;
break;
default:
DataLog(log_level_config_error)
<< "Wrong type found for config item " << item._info->Name()
<< "(" << item._info->DisplayType() << ")." << endmsg;
*item._data_ptr.valuef = item._info->Min();
}
}
}
return true;
}
template <class dataType> void ConfigElement<dataType>::SetDefault(void)
{
ConfigVarList item;
for (CONFIG_VAR_LIST::iterator i = _list.begin(); i != _list.end(); ++i)
{
item = *i;
switch (item._storage_type)
{
case ConfigVarList::INT:
*item._data_ptr.valuei = (int)item._info->Min();
break;
case ConfigVarList::FLOAT:
*item._data_ptr.valuef = item._info->Min();
break;
default:
break;
}
}
}
template <class dataType> ConfigElement<dataType>::ConfigElement()
{
}
template <class dataType> ConfigElement<dataType>::~ConfigElement()
{
}
//
// Config_CDS Class
//
CDatFileReader Config_CDS::_datfile;
DataLog_SetHandle Config_CDS::_configLogSet = DATALOG_NULL_SET_HANDLE;
Config_CDS::Config_CDS(Role role) :
MultWriteDataStore("Config_CDS", role)
{
LangUnit.Register (this, PFR_RECOVER);
Machine.Register (this, PFR_RECOVER);
Procedure.Register (this, PFR_RECOVER);
Predict.Register (this, PFR_RECOVER);
Templates.Register (this, PFR_RECOVER);
Definition.Register (this, PFR_RECOVER);
ProcedureList.numberOfProcedures.Register(this, PFR_RECOVER, 0, NUM_VISTA_PROCEDURES);
ProcedureList.Procedure.Register(this, PFR_RECOVER);
if ( _configLogSet == DATALOG_NULL_SET_HANDLE )
{
datalog_CreatePeriodicSet("ConfigData", &_configLogSet);
datalog_AddRef(_configLogSet, LangUnit.GetRef().key_lang, "ConfigLang", "language", "%d");
datalog_AddRef(_configLogSet, LangUnit.GetRef().key_height, "ConfigHeight", "height units", "%d");
datalog_AddRef(_configLogSet, LangUnit.GetRef().key_weight, "ConfigWeight", "weight units", "%d");
datalog_AddRef(_configLogSet, LangUnit.GetRef().key_decimal_delimiter, "ConfigDecimal", "decimal delimiter", "%d");
datalog_AddRef(_configLogSet, LangUnit.GetRef().key_date_format, "ConfigDateFormat", "date format", "%d");
datalog_AddRef(_configLogSet, LangUnit.GetRef().key_time_format, "ConfigTimeFormat", "time format", "%d");
datalog_AddRef(_configLogSet, Machine.GetRef().key_set_audio, "ConfigAudioLevel", "audio level", "%d");
datalog_AddRef(_configLogSet, Procedure.GetRef().key_proc_time, "ConfigProcTime", "maximum procedure time", "%d");
datalog_AddRef(_configLogSet, Procedure.GetRef().key_return_press, "ConfigReturnPressure", "return pressure", "%.0f");
datalog_AddRef(_configLogSet, Procedure.GetRef().key_draw_press, "ConfigDrawPressure", "draw pressure", "%.0f");
datalog_AddRef(_configLogSet, Procedure.GetRef().key_custom_ratio, "ConfigCustomRatio", "ratio", "%.1f");
datalog_AddRef(_configLogSet, Predict.GetRef().key_rbc_ratio, "ConfigRBCRatio", "RBC ratio", "%d");
datalog_AddRef(_configLogSet, Procedure.GetRef().key_plasma_rinseback, "ConfigRinsebackProtocol", "rinseback protocol", "%d");
datalog_AddRef(_configLogSet, Procedure.GetRef().key_audit_tracking, "ConfigAuditTracking", "audit tracking", "%d");
char keyName[32];
char keyDesc[32];
int i;
for ( i=0; i<NUM_YIELD_VOLUME; i++ )
{
sprintf(keyName, "ConfigPltYield%d", i+1);
sprintf(keyDesc, "platelet yield %d", i+1);
datalog_AddRef(_configLogSet, Templates.GetRef().key_plt_yield[i], keyName, keyDesc, "%.1f");
sprintf(keyName, "ConfigPltVolume%d", i+1);
sprintf(keyDesc, "platelet volume %d", i+1);
datalog_AddRef(_configLogSet, Templates.GetRef().key_plt_volume[i], keyName, keyDesc, "%.0f");
}
datalog_AddRef(_configLogSet, Predict.GetRef().key_ysf, "ConfigYSF", "platelet yield scaling factor", "%.2f");
for ( i=0; i<NUM_PLASMA_VOLUME; i++ )
{
sprintf(keyName, "ConfigPlasmaVolume%d", i+1);
sprintf(keyDesc, "plasma volume %d", i+1);
datalog_AddRef(_configLogSet, Templates.GetRef().key_pls_volume[i], keyName, keyDesc, "%.0f");
}
datalog_AddRef(_configLogSet, Predict.GetRef().key_pls_amap_min, "ConfigAMAPMin", "plasma AMAP minimum volume", "%d");
datalog_AddRef(_configLogSet, Predict.GetRef().key_pls_amap_max, "ConfigAMAPMax", "plasma AMAP maximum volume", "%d");
for ( i=0; i<NUM_CRIT_DOSE; i++ )
{
sprintf(keyName, "ConfigRBCCrit%d", i+1);
sprintf(keyDesc, "RBC crit %d", i+1);
datalog_AddRef(_configLogSet, Templates.GetRef().key_rbc_crit[i], keyName, keyDesc, "%.2f");
sprintf(keyName, "ConfigRBCDose%d", i+1);
sprintf(keyDesc, "RBC dose %d", i+1);
datalog_AddRef(_configLogSet, Templates.GetRef().key_rbc_dose[i], keyName, keyDesc, "%.0f");
}
datalog_AddRef(_configLogSet, Predict.GetRef().key_rsf, "ConfigRSF", "RBC yield scaling factor", "%.2f");
datalog_AddRef(_configLogSet, Procedure.GetRef().key_drbc_alert, "ConfigDRBCAlert", "DRBC alert", "%d");
datalog_AddRef(_configLogSet, Procedure.GetRef().key_ac_rate, "ConfigACRate", "AC infusion rate", "%d");
datalog_AddRef(_configLogSet, Procedure.GetRef().key_post_crit, "ConfigPostCrit", "post crit", "%.2f");
datalog_AddRef(_configLogSet, Procedure.GetRef().key_post_plat, "ConfigPostCount", "post platelet count", "%.0f");
datalog_AddRef(_configLogSet, Procedure.GetRef().key_max_draw_flow, "ConfigMaxDrawFlow", "maximum draw flow", "%d");
datalog_AddRef(_configLogSet, Predict.GetRef().key_inlet_flow_ramp, "ConfigInletFlowRamp", "inlet flow ramp", "%d");
datalog_AddRef(_configLogSet, Predict.GetRef().key_inlet_management, "ConfigInletManagement", "inlet management", "%d");
datalog_AddRef(_configLogSet, Predict.GetRef().key_return_management, "ConfigReturnManagement", "return management", "%d");
datalog_AddRef(_configLogSet, Procedure.GetRef().key_tbv_vol_setting, "ConfigTBVSetting", "TBV setting", "%d");
datalog_AddRef(_configLogSet, Procedure.GetRef().key_tbv_percent, "ConfigTBVPercent", "TBV percent", "%.1f");
datalog_AddRef(_configLogSet, Procedure.GetRef().key_weight_1_setting, "ConfigWeight1Setting", "Weight 1 setting", "%.1f");
datalog_AddRef(_configLogSet, Procedure.GetRef().key_weight_2_setting, "ConfigWeight2Setting", "Weight 2 setting", "%.1f");
datalog_AddRef(_configLogSet, Procedure.GetRef().key_weight_3_setting, "ConfigWeight3Setting", "Weight 3 setting", "%.1f");
datalog_AddRef(_configLogSet, Procedure.GetRef().key_weight_1_less_than_vol, "ConfigWeight1LessThanVol", "Weight 1 less than volume", "%.1f");
datalog_AddRef(_configLogSet, Procedure.GetRef().key_weight_2_less_than_vol, "ConfigWeight2LessThanVol", "Weight 2 less than volume", "%.1f");
datalog_AddRef(_configLogSet, Procedure.GetRef().key_weight_3_less_than_vol, "ConfigWeight3LessThanVol", "Weight 3 less than volume", "%.1f");
datalog_AddRef(_configLogSet, Procedure.GetRef().key_weight_3_greater_than_vol, "ConfigWeight3GreaterThanVol", "Weight 3 less than volume", "%.1f");
datalog_AddRef(_configLogSet, Procedure.GetRef().key_ml_per_kg, "ConfigMlPerKg", "ml/kg", "%.1f");
datalog_AddRef(_configLogSet, Predict.GetRef().key_rbc_replace_fluid, "ConfigRBCReplaceFluid", "RBC replacement fluid", "%d");
datalog_AddRef(_configLogSet, Procedure.GetRef().key_min_replacement_volume, "ConfigMinReplaceVolume", "minimum replacement volume", "%d");
datalog_AddRef(_configLogSet, Predict.GetRef().key_rbc_fluid_percent, "ConfigRBCFluidPercent", "RBC fluid percent", "%.0f");
for ( i=0; i<NUM_OFFLINE_PROCEDURES; i++ )
{
sprintf(keyName, "ConfigProcPlt%d", i+1);
sprintf(keyDesc, "procedure %d platelet product", i+1);
datalog_AddRef(_configLogSet, Definition.GetRef()[i].key_platelet, keyName, keyDesc, "%d");
sprintf(keyName, "ConfigProcPls%d", i+1);
sprintf(keyDesc, "procedure %d plasma product", i+1);
datalog_AddRef(_configLogSet, Definition.GetRef()[i].key_plasma, keyName, keyDesc, "%d");
sprintf(keyName, "ConfigProcRBC%d", i+1);
sprintf(keyDesc, "procedure %d RBC product", i+1);
datalog_AddRef(_configLogSet, Definition.GetRef()[i].key_rbc, keyName, keyDesc, "%d");
sprintf(keyName, "ConfigProcBloodType%d", i+1);
sprintf(keyDesc, "procedure %d blood type", i+1);
datalog_AddRef(_configLogSet, Definition.GetRef()[i].key_blood_type, keyName, keyDesc, "%d");
sprintf(keyName, "ConfigProcTime%d", i+1);
sprintf(keyDesc, "procedure %d time", i+1);
datalog_AddRef(_configLogSet, Definition.GetRef()[i].key_time, keyName, keyDesc, "%.0f");
}
}
}
//
// Write
//
bool Config_CDS::Write (WRITE_OPTIONS opt)
{
if (GetRole() != ROLE_RW)
{
DataLog(log_level_config_error) << "Config CDS write refused. Incorrect role." << endmsg;
return false;
}
if (!Valid())
{
DataLog(log_level_config_error) << "Config CDS write refused. Invalid datastore." << endmsg;
return false;
}
//four_way_volume_cutoff is no longer a feature
#if 0
bool four_way_volume_cutoff_config_allowed = SWOptionEnabled("four_way_volume_cutoff", LangUnit.GetRef().key_lang);
#endif
bool four_way_volume_cutoff_config_allowed = false;
if (!four_way_volume_cutoff_config_allowed)
{
*Procedure._weight_1_setting._data_ptr.valuef = *Procedure._weight_3_setting._data_ptr.valuef;
*Procedure._weight_2_setting._data_ptr.valuef = *Procedure._weight_3_setting._data_ptr.valuef;
*Procedure._weight_1_less_than_vol._data_ptr.valuef = *Procedure._weight_3_less_than_vol._data_ptr.valuef;
*Procedure._weight_2_less_than_vol._data_ptr.valuef = *Procedure._weight_3_less_than_vol._data_ptr.valuef;
}
bool successful_write = true;
// Write out the Config CDS to file.
successful_write &= LangUnit.Write(_datfile);
successful_write &= Machine.Write(_datfile);
successful_write &= Procedure.Write(_datfile);
successful_write &= Predict.Write(_datfile);
successful_write &= Templates.Write(_datfile);
successful_write &= Definition.Write(_datfile);
if (!successful_write)
{
anAlarmMsg alarm (CONFIGDAT_WRITE_ERROR);
alarm.setAlarm();
DataLog(log_level_control_alarm_detail) << "Unable to write config.dat file." << endmsg;
return false;
}
if (!_datfile.WriteCfgFile(FILE_CONFIG_DAT))
{
anAlarmMsg alarm (CONFIGDAT_WRITE_ERROR);
alarm.setAlarm();
DataLog(log_level_control_alarm_detail) << "Unable to write config.dat file." << endmsg;
return false;
}
if (opt == COPY_OFFLINE_PROCEDURE_LIST)
{
// Copy the offline procedure std::list for predict
CopyOfflineProcedureList();
}
// Send out an update message.
SendUpdateMsg();
return true;
}
Config_CDS::~Config_CDS()
{
}
//
// Read
//
bool Config_CDS::Read()
{
return ReadConfig(PNAME_CONFIGDAT);
}
bool Config_CDS::ReadConfig(const char *pathname)
{
// Only a RW Role can initialize the Config CDS.
if (GetRole() != ROLE_RW)
{
DataLog(log_level_config_error) << "Config CDS read refused. Incorrect role." << endmsg;
return false;
}
bool successful_read = true;
DFR_ERROR err;
ALARM_VALUES alarmId = NULL_ALARM;
err = _datfile.Initialize(pathname, true);
if ( err == DFR_OK )
{
// Read in the config dat file into the CDS.
successful_read &= LangUnit.Read(_datfile);
successful_read &= Machine.Read(_datfile);
successful_read &= Procedure.Read(_datfile);
successful_read &= Predict.Read(_datfile);
successful_read &= Templates.Read(_datfile);
successful_read &= Definition.Read(_datfile);
// get the error, if any ...
err = _datfile.Error();
}
switch (err)
{
case DFR_FOPEN:
alarmId = CONFIGDAT_BAD_FILE;
DataLog(log_level_control_alarm_detail)
<< "Failed to open \"" << pathname << "\": " << errnoMsg << endmsg;
break;
case DFR_PARSE:
alarmId = CONFIGDAT_PARSE_ERROR;
DataLog(log_level_control_alarm_detail)
<< "Error parsing \"" << pathname << "\": " << errnoMsg << endmsg;
break;
case DFR_VALUE:
alarmId = CONFIGDAT_VALUE_OUT_OF_RANGE;
DataLog(log_level_control_alarm_detail)
<< "Value out of range in \"" << pathname << "\": " << errnoMsg << endmsg;
break;
case DFR_NOTFOUND:
alarmId = CONFIGDAT_VALUE_NOT_FOUND;
DataLog(log_level_control_alarm_detail)
<< "Value not found in \"" << pathname << "\": " << errnoMsg << endmsg;
break;
case DFR_OK:
break;
}
if (alarmId != NULL_ALARM)
{
// Generate a Software A2 Alarm
anAlarmMsg alarm(alarmId);
alarm.setAlarm();
LangUnit.SetDefault();
Machine.SetDefault();
Procedure.SetDefault();
Predict.SetDefault();
Templates.SetDefault();
Definition.SetDefault();
successful_read = false;
}
bool four_way_volume_cutoff_config_allowed = SWOptionEnabled("four_way_volume_cutoff", LangUnit.GetRef().key_lang);
if (!four_way_volume_cutoff_config_allowed)
{
*Procedure._weight_1_setting._data_ptr.valuef = *Procedure._weight_3_setting._data_ptr.valuef;
*Procedure._weight_2_setting._data_ptr.valuef = *Procedure._weight_3_setting._data_ptr.valuef;
*Procedure._weight_1_less_than_vol._data_ptr.valuef = *Procedure._weight_3_less_than_vol._data_ptr.valuef;
*Procedure._weight_2_less_than_vol._data_ptr.valuef = *Procedure._weight_3_less_than_vol._data_ptr.valuef;
}
// If successful read, initialize the offline procedure std::list for predict
if (successful_read)
{
// Initialize the number of procedures to the number of offline ones.
ProcedureList.numberOfProcedures.Set(NUM_OFFLINE_PROCEDURES);
CopyOfflineProcedureList();
}
datalog_ForcePeriodicOutput(_configLogSet);
return successful_read;
}
//
// Valid
//
bool Config_CDS::Valid()
{
bool configuration_valid = true;
// Validate the sections.
if (!LangUnit.Valid())
{
_errorMsg = LangUnit.lastError();
return false;
}
if (!Machine.Valid())
{
_errorMsg = Machine.lastError();
return false;
}
if (!Procedure.Valid())
{
_errorMsg = Procedure.lastError();
return false;
}
if (!Predict.Valid())
{
_errorMsg = Predict.lastError();
return false;
}
if (!Templates.Valid())
{
_errorMsg = Templates.lastError();
return false;
}
if (!Definition.Valid())
{
_errorMsg = Definition.lastError();
return false;
}
DataLog (log_level_config_info) << "Config Valid" << endmsg;
_errorMsg = "";
return true;
}
//
// SendUpdateMsg
//
void Config_CDS::SendUpdateMsg()
{
ConfigChangedMsg newConfig(MessageBase::SEND_GLOBAL);
newConfig.send(1);
datalog_ForcePeriodicOutput(_configLogSet);
}
//
// Check if the specified software option is enabled, given the setting
// from sw.dat and the current language selection.
//
bool Config_CDS::SWOptionEnabled(const char * optionName)
{
return SWOptionEnabled(optionName, LangUnit.GetRef().key_lang);
}
bool Config_CDS::SWOptionEnabled(const char * optionName, int currentLanguage)
{
bool result = false;
unsigned long setting = trimaSysGetSoftwareSetting(optionName);
if ( setting & 0x01 )
{
result = true;
}
else if ( setting != 0 )
{
unsigned long mask = 1 << (currentLanguage + 1);
result = ((setting & mask) != 0);
}
return result;
}
//
// Copy over the offline procedure std::list to the predict std::list
//
void Config_CDS::CopyOfflineProcedureList()
{
const ProductDefinitionArray &offlineList = Definition.GetRef();
const ProductTemplates &templates = Templates.GetRef();
ProductListArray predictList;
for (int i = 0; i < NUM_OFFLINE_PROCEDURES; i++)
{
const int &crit_dose_index = offlineList[i].key_rbc;
const int &yield_volume_index = offlineList[i].key_platelet;
if (yield_volume_index == 0)
{
predictList[i].yield = 0.0f;
predictList[i].platelet_volume = 0.0f;
}
else
{
predictList[i].yield = templates.key_plt_yield[yield_volume_index - 1];
predictList[i].platelet_volume = templates.key_plt_volume[yield_volume_index - 1];
}
if (crit_dose_index == 0)
{
predictList[i].rbc_dose = 0.0f;
predictList[i].rbc_crit = 0.0f;
}
else
{
predictList[i].rbc_dose = templates.key_rbc_dose[crit_dose_index - 1];
predictList[i].rbc_crit = templates.key_rbc_crit[crit_dose_index - 1];
}
predictList[i].max_procedure_time = offlineList[i].key_time;
predictList[i].designator = 1; // All offline procedure default to primary
// Convert the blood type.
switch (offlineList[i].key_blood_type)
{
case CONFIG_INDEX_BLOOD_TYPE_ALL:
predictList[i].blood_type = BT_ALL;
break;
case CONFIG_INDEX_BLOOD_TYPE_OP_ON:
predictList[i].blood_type = BT_OP_ON;
break;
case CONFIG_INDEX_BLOOD_TYPE_ON:
predictList[i].blood_type = BT_ON;
break;
case CONFIG_INDEX_BLOOD_TYPE_OP_ON_AP_AN:
predictList[i].blood_type = BT_OP_ON_AP_AN;
break;
case CONFIG_INDEX_BLOOD_TYPE_OP_ON_AN:
predictList[i].blood_type = BT_OP_ON_AN;
break;
case CONFIG_INDEX_BLOOD_TYPE_ON_AN:
predictList[i].blood_type = BT_ON_AN;
break;
case CONFIG_INDEX_BLOOD_TYPE_OP_ON_BP_BN:
predictList[i].blood_type = BT_OP_ON_BP_BN;
break;
case CONFIG_INDEX_BLOOD_TYPE_OP_ON_AP_AN_BP_BN:
predictList[i].blood_type = BT_OP_ON_AP_AN_BP_BN;
break;
case CONFIG_INDEX_BLOOD_TYPE_OP_ON_AP_AN_BN:
predictList[i].blood_type = BT_OP_ON_AP_AN_BN;
break;
case CONFIG_INDEX_BLOOD_TYPE_AP_AN:
predictList[i].blood_type = BT_AP_AN;
break;
case CONFIG_INDEX_BLOOD_TYPE_AP_AN_BP_BN_ABP_ABN:
predictList[i].blood_type = BT_AP_AN_BP_BN_ABP_ABN;
break;
case CONFIG_INDEX_BLOOD_TYPE_BP_BN:
predictList[i].blood_type = BT_BP_BN;
break;
case CONFIG_INDEX_BLOOD_TYPE_ABP_ABN:
predictList[i].blood_type = BT_ABP_ABN;
break;
default:
// Generate a Software A2 Alarm
anAlarmMsg alarm(CONFIGDAT_VALUE_OUT_OF_RANGE);
alarm.setAlarm();
DataLog(log_level_control_alarm_detail)
<< "Unknown blood type ("
<< offlineList[i].key_blood_type
<< "found during Predict conversion." << endmsg;
break;
}
// Convert the plasma value
switch (offlineList[i].key_plasma)
{
case PLASMA_NONE:
predictList[i].plasma_volume = 0.0f;
break;
case PLASMA_1:
predictList[i].plasma_volume = templates.key_pls_volume[0];
break;
case PLASMA_2:
predictList[i].plasma_volume = templates.key_pls_volume[1];
break;
case PLASMA_3:
predictList[i].plasma_volume = templates.key_pls_volume[2];
break;
case PLASMA_4:
predictList[i].plasma_volume = templates.key_pls_volume[3];
break;
case PLASMA_5:
predictList[i].plasma_volume = templates.key_pls_volume[4];
break;
case PLASMA_6:
predictList[i].plasma_volume = templates.key_pls_volume[5];
break;
case PLASMA_AMAP:
predictList[i].plasma_volume = -1.0f; // AMAP flag for predict
break;
case PLASMA_MAX_CONC:
predictList[i].plasma_volume = -2.0f; // MAX Concurrent flag for predict
break;
default:
// Generate a Software A2 Alarm
anAlarmMsg alarm(CONFIGDAT_VALUE_OUT_OF_RANGE);
alarm.setAlarm();
DataLog(log_level_control_alarm_detail)
<< "Unknown plasma volume ("
<< offlineList[i].key_plasma
<< "found during Predict conversion." << endmsg;
break;
}
}
ProcedureList.Procedure.Set(predictList);
}
//
// Lang Config Element Class
//
//
// Base Constructor
//
LangConfigElement::LangConfigElement()
{
}
LangConfigElement::~LangConfigElement()
{
_list.clear();
}
//
// Register
//
bool LangConfigElement::Register (DataStore *ds, PfrType pfr)
{
// First register the element to bind it to a physical location.
bool created = ConfigElement<LangUnitCfg>::Register(ds, pfr);
// Next, fill in the std::list.
_lang._info = _Lst.pVar(KEY_LANG);
_lang._data_ptr.valuei = (int *)&((this->GetRef()).key_lang);
_lang._storage_type = ConfigVarList::INT;
_list.push_back(_lang);
_height._info = _Lst.pVar(KEY_HEIGHT);
_height._data_ptr.valuei = (int *)&((this->GetRef()).key_height);
_height._storage_type = ConfigVarList::INT;
_list.push_back(_height);
_weight._info = _Lst.pVar(KEY_WEIGHT);
_weight._data_ptr.valuei = (int *)&((this->GetRef()).key_weight);
_weight._storage_type = ConfigVarList::INT;
_list.push_back(_weight);
_date_format._info = _Lst.pVar(KEY_DATE_FORMAT);
_date_format._data_ptr.valuei = (int *)&((this->GetRef()).key_date_format);
_date_format._storage_type = ConfigVarList::INT;
_list.push_back(_date_format);
_time_format._info = _Lst.pVar(KEY_TIME_FORMAT);
_time_format._data_ptr.valuei = (int *)&((this->GetRef()).key_time_format);
_time_format._storage_type = ConfigVarList::INT;
_list.push_back(_time_format);
_decimal_delimiter._info = _Lst.pVar(KEY_DECIMAL_DELIMITER);
_decimal_delimiter._data_ptr.valuei = (int *)&((this->GetRef()).key_decimal_delimiter);
_decimal_delimiter._storage_type = ConfigVarList::INT;
_list.push_back(_decimal_delimiter);
return created;
}
//
// Assignment operator
//
LangConfigElement LangConfigElement::operator = (const LangUnitCfg &rhs)
{
this->Set(rhs);
return *this;
}
void LangConfigElement::Log()
{
}
//
// Basic Machine Config Element Class
//
//
// Base Constructor
//
BasicMachineElement::BasicMachineElement()
{
}
BasicMachineElement::~BasicMachineElement()
{
_list.clear();
}
//
// Register
//
bool BasicMachineElement::Register (DataStore *ds, PfrType pfr)
{
// First register the element to bind it to a physical location.
bool created = ConfigElement<BasicMachineCfg>::Register(ds, pfr);
// Next, fill in the std::list.
_set_time._info = _Lst.pVar(KEY_SET_TIME);
_set_time._data_ptr.valuei = (int *)&((this->GetRef()).key_set_time);
_set_time._storage_type = ConfigVarList::INT;
_list.push_back(_set_time);
_set_date._info = _Lst.pVar(KEY_SET_DATE);
_set_date._data_ptr.valuei = (int *)&((this->GetRef()).key_set_date);
_set_date._storage_type = ConfigVarList::INT;
_list.push_back(_set_date);
_set_audio._info = _Lst.pVar(KEY_SET_AUDIO);
_set_audio._data_ptr.valuei = (int *)&((this->GetRef()).key_set_audio);
_set_audio._storage_type = ConfigVarList::INT;
_list.push_back(_set_audio);
_pword._info = _Lst.pVar(KEY_PWORD);
_pword._data_ptr.valuei = (int *)&((this->GetRef()).key_pword);
_pword._storage_type = ConfigVarList::INT;
_list.push_back(_pword);
return created;
}
//
//
//
bool BasicMachineElement::Valid()
{
if (*_set_audio._data_ptr.valuei == 2)
{
std::ostringstream errorMsg;
errorMsg << "Config Elememt " << _set_audio._info->Name() << " failed valid check. "
<< "Value(" << *_set_audio._data_ptr.valuei << "), Min("
<< _set_audio._info->Min() << "), Max("
<< _set_audio._info->Max() << ")." << std::ends;
_lastError = errorMsg.str();
DataLog(log_level_control_alarm_detail) << errorMsg.str() << endmsg;
return false;
}
else
return ConfigElement<BasicMachineCfg>::Valid();
}
//
// Assignment operator
//
BasicMachineElement BasicMachineElement::operator = (const BasicMachineCfg &rhs)
{
this->Set(rhs);
return *this;
}
void BasicMachineElement::Log()
{
}
//
// Procedure Element Class
//
//
// Base Constructor
//
ProcedureElement::ProcedureElement()
{
}
ProcedureElement::~ProcedureElement()
{
_list.clear();
}
//
// Register
//
bool ProcedureElement::Register (DataStore *ds, PfrType pfr)
{
// First register the element to bind it to a physical location.
bool created = ConfigElement<ProcedureConfig>::Register(ds, pfr);
// Next, fill in the std::list.
_proc_time._info = _Lst.pVar(KEY_PROC_TIME);
_proc_time._data_ptr.valuei = (int *)&((this->GetRef()).key_proc_time);
_proc_time._storage_type = ConfigVarList::INT;
_list.push_back(_proc_time);
_return_press._info = _Lst.pVar(KEY_RETURN_PRESS);
_return_press._data_ptr.valuef = (float *)&((this->GetRef()).key_return_press);
_return_press._storage_type = ConfigVarList::FLOAT;
_list.push_back(_return_press);
_draw_press._info = _Lst.pVar(KEY_DRAW_PRESS);
_draw_press._data_ptr.valuef = (float *)&((this->GetRef()).key_draw_press);
_draw_press._storage_type = ConfigVarList::FLOAT;
_list.push_back(_draw_press);
_custom_ratio._info = _Lst.pVar(KEY_CUSTOM_RATIO);
_custom_ratio._data_ptr.valuef = (float *)&((this->GetRef()).key_custom_ratio);
_custom_ratio._storage_type = ConfigVarList::FLOAT;
_list.push_back(_custom_ratio);
_ac_rate._info = _Lst.pVar(KEY_AC_RATE);
_ac_rate._data_ptr.valuei = (int *)&((this->GetRef()).key_ac_rate);
_ac_rate._storage_type = ConfigVarList::INT;
_list.push_back(_ac_rate);
_post_crit._info = _Lst.pVar(KEY_POST_CRIT);
_post_crit._data_ptr.valuef = (float *)&((this->GetRef()).key_post_crit);
_post_crit._storage_type = ConfigVarList::FLOAT;
_list.push_back(_post_crit);
_tbv_vol_setting._info = _Lst.pVar(KEY_TBV_VOL_SETTING);
_tbv_vol_setting._data_ptr.valuei = (int *)&((this->GetRef()).key_tbv_vol_setting);
_tbv_vol_setting._storage_type = ConfigVarList::INT;
_list.push_back(_tbv_vol_setting);
_tbv_percent._info = _Lst.pVar(KEY_TBV_PERCENT);
_tbv_percent._data_ptr.valuef = (float *)&((this->GetRef()).key_tbv_percent);
_tbv_percent._storage_type = ConfigVarList::FLOAT;
_list.push_back(_tbv_percent);
_weight_1_setting._info = _Lst.pVar(KEY_WEIGHT_1_SETTING);
_weight_1_setting._data_ptr.valuef = (float *)&((this->GetRef()).key_weight_1_setting);
_weight_1_setting._storage_type = ConfigVarList::FLOAT;
_list.push_back(_weight_1_setting);
_weight_1_less_than_vol._info = _Lst.pVar(KEY_WEIGHT_1_LESS_THAN_VOL);
_weight_1_less_than_vol._data_ptr.valuef = (float *)&((this->GetRef()).key_weight_1_less_than_vol);
_weight_1_less_than_vol._storage_type = ConfigVarList::FLOAT;
_list.push_back(_weight_1_less_than_vol);
_weight_2_setting._info = _Lst.pVar(KEY_WEIGHT_2_SETTING);
_weight_2_setting._data_ptr.valuef = (float *)&((this->GetRef()).key_weight_2_setting);
_weight_2_setting._storage_type = ConfigVarList::FLOAT;
_list.push_back(_weight_2_setting);
_weight_2_less_than_vol._info = _Lst.pVar(KEY_WEIGHT_2_LESS_THAN_VOL);
_weight_2_less_than_vol._data_ptr.valuef = (float *)&((this->GetRef()).key_weight_2_less_than_vol);
_weight_2_less_than_vol._storage_type = ConfigVarList::FLOAT;
_list.push_back(_weight_2_less_than_vol);
_weight_3_setting._info = _Lst.pVar(KEY_WEIGHT_3_SETTING);
_weight_3_setting._data_ptr.valuef = (float *)&((this->GetRef()).key_weight_3_setting);
_weight_3_setting._storage_type = ConfigVarList::FLOAT;
_list.push_back(_weight_3_setting);
_weight_3_less_than_vol._info = _Lst.pVar(KEY_WEIGHT_3_LESS_THAN_VOL);
_weight_3_less_than_vol._data_ptr.valuef = (float *)&((this->GetRef()).key_weight_3_less_than_vol);
_weight_3_less_than_vol._storage_type = ConfigVarList::FLOAT;
_list.push_back(_weight_3_less_than_vol);
_weight_3_greater_than_vol._info = _Lst.pVar(KEY_WEIGHT_3_GREATER_THAN_VOL);
_weight_3_greater_than_vol._data_ptr.valuef = (float *)&((this->GetRef()).key_weight_3_greater_than_vol);
_weight_3_greater_than_vol._storage_type = ConfigVarList::FLOAT;
_list.push_back(_weight_3_greater_than_vol);
_ml_per_kg._info = _Lst.pVar(KEY_ML_PER_KG);
_ml_per_kg._data_ptr.valuef = (float *)&((this->GetRef()).key_ml_per_kg);
_ml_per_kg._storage_type = ConfigVarList::FLOAT;
_list.push_back(_ml_per_kg);
_post_plat._info = _Lst.pVar(KEY_POST_PLAT);
_post_plat._data_ptr.valuef = (float *)&((this->GetRef()).key_post_plat);
_post_plat._storage_type = ConfigVarList::FLOAT;
_list.push_back(_post_plat);
_max_draw_flow._info = _Lst.pVar(KEY_MAX_DRAW_FLOW);
_max_draw_flow._data_ptr.valuei = (int *)&((this->GetRef()).key_max_draw_flow);
_max_draw_flow._storage_type = ConfigVarList::INT;
_list.push_back(_max_draw_flow);
_min_replacement_volume._info = _Lst.pVar(KEY_MIN_REPLACEMENT_VOLUME);
_min_replacement_volume._data_ptr.valuei = (int *)&((this->GetRef()).key_min_replacement_volume);
_min_replacement_volume._storage_type = ConfigVarList::INT;
_list.push_back(_min_replacement_volume);
_drbc_alert._info = _Lst.pVar(KEY_DRBC_ALERT);
_drbc_alert._data_ptr.valuei = (int *)&((this->GetRef()).key_drbc_alert);
_drbc_alert._storage_type = ConfigVarList::INT;
_list.push_back(_drbc_alert);
_plasma_rinseback._info = _Lst.pVar(KEY_PLASMA_RINSEBACK);
_plasma_rinseback._data_ptr.valuei = (int *)&((this->GetRef()).key_plasma_rinseback);
_plasma_rinseback._storage_type = ConfigVarList::INT;
_list.push_back(_plasma_rinseback);
_audit_tracking._info = _Lst.pVar(KEY_AUDIT_TRACKING);
_audit_tracking._data_ptr.valuei = (int *)&((this->GetRef()).key_audit_tracking);
_audit_tracking._storage_type = ConfigVarList::INT;
_list.push_back(_audit_tracking);
return created;
}
//
// Assignment operator
//
ProcedureElement ProcedureElement::operator = (const ProcedureConfig &rhs)
{
this->Set(rhs);
return *this;
}
void ProcedureElement::Log()
{
}
//
// Prediction Element Class
//
//
// Base Constructor
//
PredictionElement::PredictionElement()
{
}
PredictionElement::~PredictionElement()
{
_list.clear();
}
//
// Register
//
bool PredictionElement::Register (DataStore *ds, PfrType pfr)
{
// First register the element to bind it to a physical location.
bool created = ConfigElement<PredictionConfig>::Register(ds, pfr);
// Next, fill in the std::list.
_rbc_ratio._info = _Lst.pVar(KEY_RBC_RATIO);
_rbc_ratio._data_ptr.valuei = (int *)&((this->GetRef()).key_rbc_ratio);
_rbc_ratio._storage_type = ConfigVarList::INT;
_list.push_back(_rbc_ratio);
_rbc_replace_fluid._info = _Lst.pVar(KEY_RBC_REPLACE_FLUID);
_rbc_replace_fluid._data_ptr.valuei = (int *)&((this->GetRef()).key_rbc_replace_fluid);
_rbc_replace_fluid._storage_type = ConfigVarList::INT;
_list.push_back(_rbc_replace_fluid);
_rbc_fluid_percent._info = _Lst.pVar(KEY_RBC_FLUID_PERCENT);
_rbc_fluid_percent._data_ptr.valuef = (float *)&((this->GetRef()).key_rbc_fluid_percent);
_rbc_fluid_percent._storage_type = ConfigVarList::FLOAT;
_list.push_back(_rbc_fluid_percent);
_plasma_amap_min._info = _Lst.pVar(KEY_PLASMA_AMAP_MINIMUM);
_plasma_amap_min._data_ptr.valuei = (int *)&((this->GetRef()).key_pls_amap_min);
_plasma_amap_min._storage_type = ConfigVarList::INT;
_list.push_back(_plasma_amap_min);
_plasma_amap_max._info = _Lst.pVar(KEY_PLASMA_AMAP_MAXIMUM);
_plasma_amap_max._data_ptr.valuei = (int *)&((this->GetRef()).key_pls_amap_max);
_plasma_amap_max._storage_type = ConfigVarList::INT;
_list.push_back(_plasma_amap_max);
_ysf._info = _Lst.pVar(KEY_YSF);
_ysf._data_ptr.valuef = (float *)&((this->GetRef()).key_ysf);
_ysf._storage_type = ConfigVarList::FLOAT;
_list.push_back(_ysf);
_guaranteed_yield._info = _Lst.pVar(KEY_GUARANTEED_YIELD);
_guaranteed_yield._data_ptr.valuei = (int *)&((this->GetRef()).key_guaranteed_yield);
_guaranteed_yield._storage_type = ConfigVarList::INT;
_list.push_back(_guaranteed_yield);
_confidence_level._info = _Lst.pVar(KEY_GUARANTEED_YIELD_CL);
_confidence_level._data_ptr.valuei = (int *)&((this->GetRef()).key_confidence_level);
_confidence_level._storage_type = ConfigVarList::INT;
_list.push_back(_confidence_level);
_coefficient_of_variation._info = _Lst.pVar(KEY_GUARANTEED_YIELD_CV);
_coefficient_of_variation._data_ptr.valuef = (float *)&((this->GetRef()).key_coefficient_of_variation);
_coefficient_of_variation._storage_type = ConfigVarList::FLOAT;
_list.push_back(_coefficient_of_variation);
_inlet_management._info = _Lst.pVar(KEY_INLET_MANAGEMENT);
_inlet_management._data_ptr.valuei = (int *)&((this->GetRef()).key_inlet_management);
_inlet_management._storage_type = ConfigVarList::INT;
_list.push_back(_inlet_management);
_inlet_flow_ramp._info = _Lst.pVar(KEY_INLET_FLOW_RAMP);
_inlet_flow_ramp._data_ptr.valuei = (int *)&((this->GetRef()).key_inlet_flow_ramp);
_inlet_flow_ramp._storage_type = ConfigVarList::INT;
_list.push_back(_inlet_flow_ramp);
_return_management._info = _Lst.pVar(KEY_RETURN_MANAGEMENT);
_return_management._data_ptr.valuei = (int *)&((this->GetRef()).key_return_management);
_return_management._storage_type = ConfigVarList::INT;
_list.push_back(_return_management);
_rsf._info = _Lst.pVar(KEY_RSF);
_rsf._data_ptr.valuef = (float *)&((this->GetRef()).key_rsf);
_rsf._storage_type = ConfigVarList::FLOAT;
_list.push_back(_rsf);
return created;
}
//
// Assignment operator
//
PredictionElement PredictionElement::operator = (const PredictionConfig &rhs)
{
this->Set(rhs);
return *this;
}
void PredictionElement::Log()
{
}
//
// ProductTemplates Element Class
//
//
// Base Constructor
//
ProductTemplatesElement::ProductTemplatesElement()
{
}
ProductTemplatesElement::~ProductTemplatesElement()
{
_list.clear();
}
//
// Register
//
bool ProductTemplatesElement::Register (DataStore *ds, PfrType pfr)
{
// First register the element to bind it to a physical location.
bool created = ConfigElement<ProductTemplates>::Register(ds, pfr);
// Next, fill in the std::list.
_rbc_crit_1._info = _Lst.pVar(KEY_RBC_CRIT_1);
_rbc_crit_1._data_ptr.valuef = (float *)&((this->GetRef()).key_rbc_crit[0]);
_rbc_crit_1._storage_type = ConfigVarList::FLOAT;
_list.push_back(_rbc_crit_1);
_rbc_crit_2._info = _Lst.pVar(KEY_RBC_CRIT_2);
_rbc_crit_2._data_ptr.valuef = (float *)&((this->GetRef()).key_rbc_crit[1]);
_rbc_crit_2._storage_type = ConfigVarList::FLOAT;
_list.push_back(_rbc_crit_2);
_rbc_crit_3._info = _Lst.pVar(KEY_RBC_CRIT_3);
_rbc_crit_3._data_ptr.valuef = (float *)&((this->GetRef()).key_rbc_crit[2]);
_rbc_crit_3._storage_type = ConfigVarList::FLOAT;
_list.push_back(_rbc_crit_3);
_rbc_dose_1._info = _Lst.pVar(KEY_RBC_DOSE_1);
_rbc_dose_1._data_ptr.valuef = (float *)&((this->GetRef()).key_rbc_dose[0]);
_rbc_dose_1._storage_type = ConfigVarList::FLOAT;
_list.push_back(_rbc_dose_1);
_rbc_dose_2._info = _Lst.pVar(KEY_RBC_DOSE_2);
_rbc_dose_2._data_ptr.valuef = (float *)&((this->GetRef()).key_rbc_dose[1]);
_rbc_dose_2._storage_type = ConfigVarList::FLOAT;
_list.push_back(_rbc_dose_2);
_rbc_dose_3._info = _Lst.pVar(KEY_RBC_DOSE_3);
_rbc_dose_3._data_ptr.valuef = (float *)&((this->GetRef()).key_rbc_dose[2]);
_rbc_dose_3._storage_type = ConfigVarList::FLOAT;
_list.push_back(_rbc_dose_3);
_plt_yield_1._info = _Lst.pVar(KEY_PLT_YIELD_1);
_plt_yield_1._data_ptr.valuef = (float *)&((this->GetRef()).key_plt_yield[0]);
_plt_yield_1._storage_type = ConfigVarList::FLOAT;
_list.push_back(_plt_yield_1);
_plt_yield_2._info = _Lst.pVar(KEY_PLT_YIELD_2);
_plt_yield_2._data_ptr.valuef = (float *)&((this->GetRef()).key_plt_yield[1]);
_plt_yield_2._storage_type = ConfigVarList::FLOAT;
_list.push_back(_plt_yield_2);
_plt_yield_3._info = _Lst.pVar(KEY_PLT_YIELD_3);
_plt_yield_3._data_ptr.valuef = (float *)&((this->GetRef()).key_plt_yield[2]);
_plt_yield_3._storage_type = ConfigVarList::FLOAT;
_list.push_back(_plt_yield_3);
_plt_yield_4._info = _Lst.pVar(KEY_PLT_YIELD_4);
_plt_yield_4._data_ptr.valuef = (float *)&((this->GetRef()).key_plt_yield[3]);
_plt_yield_4._storage_type = ConfigVarList::FLOAT;
_list.push_back(_plt_yield_4);
_plt_yield_5._info = _Lst.pVar(KEY_PLT_YIELD_5);
_plt_yield_5._data_ptr.valuef = (float *)&((this->GetRef()).key_plt_yield[4]);
_plt_yield_5._storage_type = ConfigVarList::FLOAT;
_list.push_back(_plt_yield_5);
_plt_yield_6._info = _Lst.pVar(KEY_PLT_YIELD_6);
_plt_yield_6._data_ptr.valuef = (float *)&((this->GetRef()).key_plt_yield[5]);
_plt_yield_6._storage_type = ConfigVarList::FLOAT;
_list.push_back(_plt_yield_6);
_plt_volume_1._info = _Lst.pVar(KEY_PLT_VOLUME_1);
_plt_volume_1._data_ptr.valuef = (float *)&((this->GetRef()).key_plt_volume[0]);
_plt_volume_1._storage_type = ConfigVarList::FLOAT;
_list.push_back(_plt_volume_1);
_plt_volume_2._info = _Lst.pVar(KEY_PLT_VOLUME_2);
_plt_volume_2._data_ptr.valuef = (float *)&((this->GetRef()).key_plt_volume[1]);
_plt_volume_2._storage_type = ConfigVarList::FLOAT;
_list.push_back(_plt_volume_2);
_plt_volume_3._info = _Lst.pVar(KEY_PLT_VOLUME_3);
_plt_volume_3._data_ptr.valuef = (float *)&((this->GetRef()).key_plt_volume[2]);
_plt_volume_3._storage_type = ConfigVarList::FLOAT;
_list.push_back(_plt_volume_3);
_plt_volume_4._info = _Lst.pVar(KEY_PLT_VOLUME_4);
_plt_volume_4._data_ptr.valuef = (float *)&((this->GetRef()).key_plt_volume[3]);
_plt_volume_4._storage_type = ConfigVarList::FLOAT;
_list.push_back(_plt_volume_4);
_plt_volume_5._info = _Lst.pVar(KEY_PLT_VOLUME_5);
_plt_volume_5._data_ptr.valuef = (float *)&((this->GetRef()).key_plt_volume[4]);
_plt_volume_5._storage_type = ConfigVarList::FLOAT;
_list.push_back(_plt_volume_5);
_plt_volume_6._info = _Lst.pVar(KEY_PLT_VOLUME_6);
_plt_volume_6._data_ptr.valuef = (float *)&((this->GetRef()).key_plt_volume[5]);
_plt_volume_6._storage_type = ConfigVarList::FLOAT;
_list.push_back(_plt_volume_6);
_pls_volume_1._info = _Lst.pVar(KEY_PLS_VOLUME_1);
_pls_volume_1._data_ptr.valuef = (float *)&((this->GetRef()).key_pls_volume[0]);
_pls_volume_1._storage_type = ConfigVarList::FLOAT;
_list.push_back(_pls_volume_1);
_pls_volume_2._info = _Lst.pVar(KEY_PLS_VOLUME_2);
_pls_volume_2._data_ptr.valuef = (float *)&((this->GetRef()).key_pls_volume[1]);
_pls_volume_2._storage_type = ConfigVarList::FLOAT;
_list.push_back(_pls_volume_2);
_pls_volume_3._info = _Lst.pVar(KEY_PLS_VOLUME_3);
_pls_volume_3._data_ptr.valuef = (float *)&((this->GetRef()).key_pls_volume[2]);
_pls_volume_3._storage_type = ConfigVarList::FLOAT;
_list.push_back(_pls_volume_3);
_pls_volume_4._info = _Lst.pVar(KEY_PLS_VOLUME_4);
_pls_volume_4._data_ptr.valuef = (float *)&((this->GetRef()).key_pls_volume[3]);
_pls_volume_4._storage_type = ConfigVarList::FLOAT;
_list.push_back(_pls_volume_4);
_pls_volume_5._info = _Lst.pVar(KEY_PLS_VOLUME_5);
_pls_volume_5._data_ptr.valuef = (float *)&((this->GetRef()).key_pls_volume[4]);
_pls_volume_5._storage_type = ConfigVarList::FLOAT;
_list.push_back(_pls_volume_5);
_pls_volume_6._info = _Lst.pVar(KEY_PLS_VOLUME_6);
_pls_volume_6._data_ptr.valuef = (float *)&((this->GetRef()).key_pls_volume[5]);
_pls_volume_6._storage_type = ConfigVarList::FLOAT;
_list.push_back(_pls_volume_6);
return created;
}
//
// Assignment operator
//
ProductTemplatesElement ProductTemplatesElement::operator = (const ProductTemplates &rhs)
{
this->Set(rhs);
return *this;
}
void ProductTemplatesElement::Log()
{
}
//
// Product Definition Element Class
//
//
// Base Constructor
//
ProductDefinitionElement::ProductDefinitionElement()
{
}
ProductDefinitionElement::~ProductDefinitionElement()
{
_list.clear();
}
//
// Register
//
bool ProductDefinitionElement::Register (DataStore *ds, PfrType pfr)
{
// First register the element to bind it to a physical location.
bool created = ConfigElement<ProductDefinitionArray>::Register(ds, pfr);
// Next, fill in the std::list.
const ProductDefinition *product = ((this)->GetRef()).as_array();
// Platelet
_platelet_a._info = _Lst.pVar(KEY_PRI_PLATELET_A);
_platelet_a._data_ptr.valuei = (int *)&product[0].key_platelet;
_platelet_a._storage_type = ConfigVarList::INT;
_list.push_back(_platelet_a);
_platelet_b._info = _Lst.pVar(KEY_PRI_PLATELET_B);
_platelet_b._data_ptr.valuei = (int *)&product[1].key_platelet;
_platelet_b._storage_type = ConfigVarList::INT;
_list.push_back(_platelet_b);
_platelet_c._info = _Lst.pVar(KEY_PRI_PLATELET_C);
_platelet_c._data_ptr.valuei = (int *)&product[2].key_platelet;
_platelet_c._storage_type = ConfigVarList::INT;
_list.push_back(_platelet_c);
_platelet_d._info = _Lst.pVar(KEY_PRI_PLATELET_D);
_platelet_d._data_ptr.valuei = (int *)&product[3].key_platelet;
_platelet_d._storage_type = ConfigVarList::INT;
_list.push_back(_platelet_d);
_platelet_e._info = _Lst.pVar(KEY_PRI_PLATELET_E);
_platelet_e._data_ptr.valuei = (int *)&product[4].key_platelet;
_platelet_e._storage_type = ConfigVarList::INT;
_list.push_back(_platelet_e);
_platelet_f._info = _Lst.pVar(KEY_PRI_PLATELET_F);
_platelet_f._data_ptr.valuei = (int *)&product[5].key_platelet;
_platelet_f._storage_type = ConfigVarList::INT;
_list.push_back(_platelet_f);
_platelet_g._info = _Lst.pVar(KEY_PRI_PLATELET_G);
_platelet_g._data_ptr.valuei = (int *)&product[6].key_platelet;
_platelet_g._storage_type = ConfigVarList::INT;
_list.push_back(_platelet_g);
_platelet_h._info = _Lst.pVar(KEY_PRI_PLATELET_H);
_platelet_h._data_ptr.valuei = (int *)&product[7].key_platelet;
_platelet_h._storage_type = ConfigVarList::INT;
_list.push_back(_platelet_h);
_platelet_i._info = _Lst.pVar(KEY_PRI_PLATELET_I);
_platelet_i._data_ptr.valuei = (int *)&product[8].key_platelet;
_platelet_i._storage_type = ConfigVarList::INT;
_list.push_back(_platelet_i);
_platelet_j._info = _Lst.pVar(KEY_PRI_PLATELET_J);
_platelet_j._data_ptr.valuei = (int *)&product[9].key_platelet;
_platelet_j._storage_type = ConfigVarList::INT;
_list.push_back(_platelet_j);
_platelet_k._info = _Lst.pVar(KEY_PRI_PLATELET_K);
_platelet_k._data_ptr.valuei = (int *)&product[10].key_platelet;
_platelet_k._storage_type = ConfigVarList::INT;
_list.push_back(_platelet_k);
_platelet_l._info = _Lst.pVar(KEY_PRI_PLATELET_L);
_platelet_l._data_ptr.valuei = (int *)&product[11].key_platelet;
_platelet_l._storage_type = ConfigVarList::INT;
_list.push_back(_platelet_l);
_platelet_m._info = _Lst.pVar(KEY_PRI_PLATELET_M);
_platelet_m._data_ptr.valuei = (int *)&product[12].key_platelet;
_platelet_m._storage_type = ConfigVarList::INT;
_list.push_back(_platelet_m);
_platelet_n._info = _Lst.pVar(KEY_PRI_PLATELET_N);
_platelet_n._data_ptr.valuei = (int *)&product[13].key_platelet;
_platelet_n._storage_type = ConfigVarList::INT;
_list.push_back(_platelet_n);
_platelet_o._info = _Lst.pVar(KEY_PRI_PLATELET_O);
_platelet_o._data_ptr.valuei = (int *)&product[14].key_platelet;
_platelet_o._storage_type = ConfigVarList::INT;
_list.push_back(_platelet_o);
// Plasma
_plasma_a._info = _Lst.pVar(KEY_PRI_PLASMA_A);
_plasma_a._data_ptr.valuei = (int *)&product[0].key_plasma;
_plasma_a._storage_type = ConfigVarList::INT;
_list.push_back(_plasma_a);
_plasma_b._info = _Lst.pVar(KEY_PRI_PLASMA_B);
_plasma_b._data_ptr.valuei = (int *)&product[1].key_plasma;
_plasma_b._storage_type = ConfigVarList::INT;
_list.push_back(_plasma_b);
_plasma_c._info = _Lst.pVar(KEY_PRI_PLASMA_C);
_plasma_c._data_ptr.valuei = (int *)&product[2].key_plasma;
_plasma_c._storage_type = ConfigVarList::INT;
_list.push_back(_plasma_c);
_plasma_d._info = _Lst.pVar(KEY_PRI_PLASMA_D);
_plasma_d._data_ptr.valuei = (int *)&product[3].key_plasma;
_plasma_d._storage_type = ConfigVarList::INT;
_list.push_back(_plasma_d);
_plasma_e._info = _Lst.pVar(KEY_PRI_PLASMA_E);
_plasma_e._data_ptr.valuei = (int *)&product[4].key_plasma;
_plasma_e._storage_type = ConfigVarList::INT;
_list.push_back(_plasma_e);
_plasma_f._info = _Lst.pVar(KEY_PRI_PLASMA_F);
_plasma_f._data_ptr.valuei = (int *)&product[5].key_plasma;
_plasma_f._storage_type = ConfigVarList::INT;
_list.push_back(_plasma_f);
_plasma_g._info = _Lst.pVar(KEY_PRI_PLASMA_G);
_plasma_g._data_ptr.valuei = (int *)&product[6].key_plasma;
_plasma_g._storage_type = ConfigVarList::INT;
_list.push_back(_plasma_g);
_plasma_h._info = _Lst.pVar(KEY_PRI_PLASMA_H);
_plasma_h._data_ptr.valuei = (int *)&product[7].key_plasma;
_plasma_h._storage_type = ConfigVarList::INT;
_list.push_back(_plasma_h);
_plasma_i._info = _Lst.pVar(KEY_PRI_PLASMA_I);
_plasma_i._data_ptr.valuei = (int *)&product[8].key_plasma;
_plasma_i._storage_type = ConfigVarList::INT;
_list.push_back(_plasma_i);
_plasma_j._info = _Lst.pVar(KEY_PRI_PLASMA_J);
_plasma_j._data_ptr.valuei = (int *)&product[9].key_plasma;
_plasma_j._storage_type = ConfigVarList::INT;
_list.push_back(_plasma_j);
_plasma_k._info = _Lst.pVar(KEY_PRI_PLASMA_K);
_plasma_k._data_ptr.valuei = (int *)&product[10].key_plasma;
_plasma_k._storage_type = ConfigVarList::INT;
_list.push_back(_plasma_k);
_plasma_l._info = _Lst.pVar(KEY_PRI_PLASMA_L);
_plasma_l._data_ptr.valuei = (int *)&product[11].key_plasma;
_plasma_l._storage_type = ConfigVarList::INT;
_list.push_back(_plasma_l);
_plasma_m._info = _Lst.pVar(KEY_PRI_PLASMA_M);
_plasma_m._data_ptr.valuei = (int *)&product[12].key_plasma;
_plasma_m._storage_type = ConfigVarList::INT;
_list.push_back(_plasma_m);
_plasma_n._info = _Lst.pVar(KEY_PRI_PLASMA_N);
_plasma_n._data_ptr.valuei = (int *)&product[13].key_plasma;
_plasma_n._storage_type = ConfigVarList::INT;
_list.push_back(_plasma_n);
_plasma_o._info = _Lst.pVar(KEY_PRI_PLASMA_O);
_plasma_o._data_ptr.valuei = (int *)&product[14].key_plasma;
_plasma_o._storage_type = ConfigVarList::INT;
_list.push_back(_plasma_o);
// RBC
_rbc_a._info = _Lst.pVar(KEY_PRI_RBC_A);
_rbc_a._data_ptr.valuei = (int *)&(product[0].key_rbc);
_rbc_a._storage_type = ConfigVarList::INT;
_list.push_back(_rbc_a);
_rbc_b._info = _Lst.pVar(KEY_PRI_RBC_B);
_rbc_b._data_ptr.valuei = (int *)&(product[1].key_rbc);
_rbc_b._storage_type = ConfigVarList::INT;
_list.push_back(_rbc_b);
_rbc_c._info = _Lst.pVar(KEY_PRI_RBC_C);
_rbc_c._data_ptr.valuei = (int *)&(product[2].key_rbc);
_rbc_c._storage_type = ConfigVarList::INT;
_list.push_back(_rbc_c);
_rbc_d._info = _Lst.pVar(KEY_PRI_RBC_D);
_rbc_d._data_ptr.valuei = (int *)&(product[3].key_rbc);
_rbc_d._storage_type = ConfigVarList::INT;
_list.push_back(_rbc_d);
_rbc_e._info = _Lst.pVar(KEY_PRI_RBC_E);
_rbc_e._data_ptr.valuei = (int *)&(product[4].key_rbc);
_rbc_e._storage_type = ConfigVarList::INT;
_list.push_back(_rbc_e);
_rbc_f._info = _Lst.pVar(KEY_PRI_RBC_F);
_rbc_f._data_ptr.valuei = (int *)&(product[5].key_rbc);
_rbc_f._storage_type = ConfigVarList::INT;
_list.push_back(_rbc_f);
_rbc_g._info = _Lst.pVar(KEY_PRI_RBC_G);
_rbc_g._data_ptr.valuei = (int *)&(product[6].key_rbc);
_rbc_g._storage_type = ConfigVarList::INT;
_list.push_back(_rbc_g);
_rbc_h._info = _Lst.pVar(KEY_PRI_RBC_H);
_rbc_h._data_ptr.valuei = (int *)&(product[7].key_rbc);
_rbc_h._storage_type = ConfigVarList::INT;
_list.push_back(_rbc_h);
_rbc_i._info = _Lst.pVar(KEY_PRI_RBC_I);
_rbc_i._data_ptr.valuei = (int *)&(product[8].key_rbc);
_rbc_i._storage_type = ConfigVarList::INT;
_list.push_back(_rbc_i);
_rbc_j._info = _Lst.pVar(KEY_PRI_RBC_J);
_rbc_j._data_ptr.valuei = (int *)&(product[9].key_rbc);
_rbc_j._storage_type = ConfigVarList::INT;
_list.push_back(_rbc_j);
_rbc_k._info = _Lst.pVar(KEY_PRI_RBC_K);
_rbc_k._data_ptr.valuei = (int *)&(product[10].key_rbc);
_rbc_k._storage_type = ConfigVarList::INT;
_list.push_back(_rbc_k);
_rbc_l._info = _Lst.pVar(KEY_PRI_RBC_L);
_rbc_l._data_ptr.valuei = (int *)&(product[11].key_rbc);
_rbc_l._storage_type = ConfigVarList::INT;
_list.push_back(_rbc_l);
_rbc_m._info = _Lst.pVar(KEY_PRI_RBC_M);
_rbc_m._data_ptr.valuei = (int *)&(product[12].key_rbc);
_rbc_m._storage_type = ConfigVarList::INT;
_list.push_back(_rbc_m);
_rbc_n._info = _Lst.pVar(KEY_PRI_RBC_N);
_rbc_n._data_ptr.valuei = (int *)&(product[13].key_rbc);
_rbc_n._storage_type = ConfigVarList::INT;
_list.push_back(_rbc_n);
_rbc_o._info = _Lst.pVar(KEY_PRI_RBC_O);
_rbc_o._data_ptr.valuei = (int *)&(product[14].key_rbc);
_rbc_o._storage_type = ConfigVarList::INT;
_list.push_back(_rbc_o);
// Blood Type
_blood_type_a._info = _Lst.pVar(KEY_PRI_BLOOD_TYPE_A);
_blood_type_a._data_ptr.valuei = (int *)&(product[0].key_blood_type);
_blood_type_a._storage_type = ConfigVarList::INT;
_list.push_back(_blood_type_a);
_blood_type_b._info = _Lst.pVar(KEY_PRI_BLOOD_TYPE_B);
_blood_type_b._data_ptr.valuei = (int *)&(product[1].key_blood_type);
_blood_type_b._storage_type = ConfigVarList::INT;
_list.push_back(_blood_type_b);
_blood_type_c._info = _Lst.pVar(KEY_PRI_BLOOD_TYPE_C);
_blood_type_c._data_ptr.valuei = (int *)&(product[2].key_blood_type);
_blood_type_c._storage_type = ConfigVarList::INT;
_list.push_back(_blood_type_c);
_blood_type_d._info = _Lst.pVar(KEY_PRI_BLOOD_TYPE_D);
_blood_type_d._data_ptr.valuei = (int *)&(product[3].key_blood_type);
_blood_type_d._storage_type = ConfigVarList::INT;
_list.push_back(_blood_type_d);
_blood_type_e._info = _Lst.pVar(KEY_PRI_BLOOD_TYPE_E);
_blood_type_e._data_ptr.valuei = (int *)&(product[4].key_blood_type);
_blood_type_e._storage_type = ConfigVarList::INT;
_list.push_back(_blood_type_e);
_blood_type_f._info = _Lst.pVar(KEY_PRI_BLOOD_TYPE_F);
_blood_type_f._data_ptr.valuei = (int *)&(product[5].key_blood_type);
_blood_type_f._storage_type = ConfigVarList::INT;
_list.push_back(_blood_type_f);
_blood_type_g._info = _Lst.pVar(KEY_PRI_BLOOD_TYPE_G);
_blood_type_g._data_ptr.valuei = (int *)&(product[6].key_blood_type);
_blood_type_g._storage_type = ConfigVarList::INT;
_list.push_back(_blood_type_g);
_blood_type_h._info = _Lst.pVar(KEY_PRI_BLOOD_TYPE_H);
_blood_type_h._data_ptr.valuei = (int *)&(product[7].key_blood_type);
_blood_type_h._storage_type = ConfigVarList::INT;
_list.push_back(_blood_type_h);
_blood_type_i._info = _Lst.pVar(KEY_PRI_BLOOD_TYPE_I);
_blood_type_i._data_ptr.valuei = (int *)&(product[8].key_blood_type);
_blood_type_i._storage_type = ConfigVarList::INT;
_list.push_back(_blood_type_i);
_blood_type_j._info = _Lst.pVar(KEY_PRI_BLOOD_TYPE_J);
_blood_type_j._data_ptr.valuei = (int *)&(product[9].key_blood_type);
_blood_type_j._storage_type = ConfigVarList::INT;
_list.push_back(_blood_type_j);
_blood_type_k._info = _Lst.pVar(KEY_PRI_BLOOD_TYPE_K);
_blood_type_k._data_ptr.valuei = (int *)&(product[10].key_blood_type);
_blood_type_k._storage_type = ConfigVarList::INT;
_list.push_back(_blood_type_k);
_blood_type_l._info = _Lst.pVar(KEY_PRI_BLOOD_TYPE_L);
_blood_type_l._data_ptr.valuei = (int *)&(product[11].key_blood_type);
_blood_type_l._storage_type = ConfigVarList::INT;
_list.push_back(_blood_type_l);
_blood_type_m._info = _Lst.pVar(KEY_PRI_BLOOD_TYPE_M);
_blood_type_m._data_ptr.valuei = (int *)&(product[12].key_blood_type);
_blood_type_m._storage_type = ConfigVarList::INT;
_list.push_back(_blood_type_m);
_blood_type_n._info = _Lst.pVar(KEY_PRI_BLOOD_TYPE_N);
_blood_type_n._data_ptr.valuei = (int *)&(product[13].key_blood_type);
_blood_type_n._storage_type = ConfigVarList::INT;
_list.push_back(_blood_type_n);
_blood_type_o._info = _Lst.pVar(KEY_PRI_BLOOD_TYPE_O);
_blood_type_o._data_ptr.valuei = (int *)&(product[14].key_blood_type);
_blood_type_o._storage_type = ConfigVarList::INT;
_list.push_back(_blood_type_o);
// Time
_time_a._info = _Lst.pVar(KEY_PRI_TIME_A);
_time_a._data_ptr.valuef = (float *)&(product[0].key_time);
_time_a._storage_type = ConfigVarList::FLOAT;
_list.push_back(_time_a);
_time_b._info = _Lst.pVar(KEY_PRI_TIME_B);
_time_b._data_ptr.valuef = (float *)&(product[1].key_time);
_time_b._storage_type = ConfigVarList::FLOAT;
_list.push_back(_time_b);
_time_c._info = _Lst.pVar(KEY_PRI_TIME_C);
_time_c._data_ptr.valuef = (float *)&(product[2].key_time);
_time_c._storage_type = ConfigVarList::FLOAT;
_list.push_back(_time_c);
_time_d._info = _Lst.pVar(KEY_PRI_TIME_D);
_time_d._data_ptr.valuef = (float *)&(product[3].key_time);
_time_d._storage_type = ConfigVarList::FLOAT;
_list.push_back(_time_d);
_time_e._info = _Lst.pVar(KEY_PRI_TIME_E);
_time_e._data_ptr.valuef = (float *)&(product[4].key_time);
_time_e._storage_type = ConfigVarList::FLOAT;
_list.push_back(_time_e);
_time_f._info = _Lst.pVar(KEY_PRI_TIME_F);
_time_f._data_ptr.valuef = (float *)&(product[5].key_time);
_time_f._storage_type = ConfigVarList::FLOAT;
_list.push_back(_time_f);
_time_g._info = _Lst.pVar(KEY_PRI_TIME_G);
_time_g._data_ptr.valuef = (float *)&(product[6].key_time);
_time_g._storage_type = ConfigVarList::FLOAT;
_list.push_back(_time_g);
_time_h._info = _Lst.pVar(KEY_PRI_TIME_H);
_time_h._data_ptr.valuef = (float *)&(product[7].key_time);
_time_h._storage_type = ConfigVarList::FLOAT;
_list.push_back(_time_h);
_time_i._info = _Lst.pVar(KEY_PRI_TIME_I);
_time_i._data_ptr.valuef = (float *)&(product[8].key_time);
_time_i._storage_type = ConfigVarList::FLOAT;
_list.push_back(_time_i);
_time_j._info = _Lst.pVar(KEY_PRI_TIME_J);
_time_j._data_ptr.valuef = (float *)&(product[9].key_time);
_time_j._storage_type = ConfigVarList::FLOAT;
_list.push_back(_time_j);
_time_k._info = _Lst.pVar(KEY_PRI_TIME_K);
_time_k._data_ptr.valuef = (float *)&(product[10].key_time);
_time_k._storage_type = ConfigVarList::FLOAT;
_list.push_back(_time_k);
_time_l._info = _Lst.pVar(KEY_PRI_TIME_L);
_time_l._data_ptr.valuef = (float *)&(product[11].key_time);
_time_l._storage_type = ConfigVarList::FLOAT;
_list.push_back(_time_l);
_time_m._info = _Lst.pVar(KEY_PRI_TIME_M);
_time_m._data_ptr.valuef = (float *)&(product[12].key_time);
_time_m._storage_type = ConfigVarList::FLOAT;
_list.push_back(_time_m);
_time_n._info = _Lst.pVar(KEY_PRI_TIME_N);
_time_n._data_ptr.valuef = (float *)&(product[13].key_time);
_time_n._storage_type = ConfigVarList::FLOAT;
_list.push_back(_time_n);
_time_o._info = _Lst.pVar(KEY_PRI_TIME_O);
_time_o._data_ptr.valuef = (float *)&(product[14].key_time);
_time_o._storage_type = ConfigVarList::FLOAT;
_list.push_back(_time_o);
return created;
}
//
// Assignment operator
//
ProductDefinitionElement ProductDefinitionElement::operator = (const ProductDefinitionArray &rhs)
{
this->Set(rhs);
return *this;
}
void ProductDefinitionElement::Log()
{
}
ProcedureListElement::ProcedureListElement()
{
}
ProcedureListElement::~ProcedureListElement()
{
}
void ProcedureListElement::Log()
{
}
//
// Executed during system initialization to read the configuration data file
//
// attempts to fix a backup file with a good file including crc
bool fixFile(CFileHelper &goodFile, const char *fname, const char *crcfname)
{
bool bSuccess = true;
char crcTxt[15];
// obtain text copy of the crc
CFileHelper fCRC;
goodFile.CRC(crcTxt);
// put it into the empty crc file
fCRC.Append (crcTxt);
fCRC.Append ("\n");
// write file to backup location and crc to backup file
bSuccess = goodFile.FastWrite (fname) &&
fCRC.FastWrite (crcfname, false);
return bSuccess;
}
// verifies that the main / backup file match
bool checkFile(void)
{
bool bMainOk = false;
bool bBackOk = false;
bool bSuccess = false;
// read in the main file and check CRC
CFileHelper fhelper;
bMainOk = fhelper.Read (PNAME_CONFIGDAT);
if (bMainOk)
{
bMainOk = fhelper.CompareCRC (PNAME_CONFIGDAT_CRC);
}
// read in the backup file and check CRC
CFileHelper fhelperBk;
bBackOk = fhelperBk.Read (PNAME_CONFIGDAT_BK);
if (bBackOk)
{
bBackOk = fhelperBk.CompareCRC (PNAME_CONFIGDAT_CRC_BK);
}
// There are four cases to deal with
int nCase = (bMainOk ? 1 : 0) + (bBackOk ? 2 : 0);
switch (nCase)
{
case 1: // Main file Ok, backup is bad.
{
// we need to update the backup file with the main one.
DataLog(log_level_config_info) << "Attempting to fix backup config file." << endmsg;
bSuccess = fixFile(fhelper,
PNAME_CONFIGDAT_BK,
PNAME_CONFIGDAT_CRC_BK);
break;
}
case 2: // Backup file is good, main file is bad.
{
// we need to update the main file with the backup one.
DataLog(log_level_config_info) << "Attempting to fix main config file." << endmsg;
bSuccess = fixFile(fhelperBk,
PNAME_CONFIGDAT,
PNAME_CONFIGDAT_CRC);
break;
}
case 3: // Both files are good, make sure they are the same.
{
if (fhelper.CRC() != fhelperBk.CRC())
{
// assume the main one is the correct one.
DataLog(log_level_config_info) << "Config files ok, but don't match." << endmsg;
bSuccess = fixFile(fhelper,
PNAME_CONFIGDAT_BK,
PNAME_CONFIGDAT_CRC_BK);
}
else
{
// both match and are fine
DataLog(log_level_config_info) << "Config.dat, backup and crc ok." << endmsg;
bSuccess = true;
break;
}
break;
}
default: // neither file is good, $%#*$#@!*
{
DataLog(log_level_config_info) << "Neither config or backup is ok." << endmsg;
bSuccess = false;
break;
}
}
return bSuccess;
}
void readConfigCDS(void)
{
//
// Initialize the message system so that alarm messages
// can be sent if config.dat can't be read correctly.
//
MessageSystem msgSystem;
msgSystem.initNonBlock();
if (!checkFile())
{
anAlarmMsg alarm(CONFIGDAT_BAD_FILE);
alarm.setAlarm("CONFIG.DAT CRC Check Failed");
}
Config_CDS * cfgreader = new Config_CDS(ROLE_RW);
cfgreader->Read();
delete cfgreader;
}
|
79df4a35ae1ff3c3036463bf8698f329141f5da7 | bd836081502105e472df1d0a99881deed61ce048 | /libapps/HeartbeatSession.cpp | 9c494ce1828b73de8d08b37db0b02b98c21fee65 | [] | no_license | mitkatch/BPE | 9f34064778c25cc8dcb8225ed9f2252a3d431fb3 | 27985cb5da5045b797e67ec8c2a93e0f50ee6c09 | refs/heads/master | 2020-03-30T22:18:51.194908 | 2018-10-05T02:48:32 | 2018-10-05T02:48:32 | 151,662,346 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,009 | cpp | HeartbeatSession.cpp | /************************************************************************
||
|| DATE: $Date: 2004/08/09 21:00:10 $
|| SOURCE: $Source: /repository/projects/Canpx/libapps/HeartbeatSession.cpp,v $
|| STATE: $State: Exp $
|| ID: $Id: HeartbeatSession.cpp,v 1.2 2004/08/09 21:00:10 mikhailt Exp $
|| REVISION: $Revision: 1.2 $
|| LOG: $Log: HeartbeatSession.cpp,v $
|| LOG: Revision 1.2 2004/08/09 21:00:10 mikhailt
|| LOG: INTERVAL added
|| LOG:
|| LOG: Revision 1.1 2004/07/30 16:14:57 mikhailt
|| LOG: Initial revision
|| LOG:
************************************************************************/
#include <sys/utsname.h>
#include "HeartbeatSession.hpp"
HeartbeatSession::HeartbeatSession(const ConfigMap &confmap):UDPSession(confmap)
{
this->setMCIP(confmap.getValue("HEARTBEAT_MULTICAST_GROUP_IP"));
this->setMCPort(confmap.getValue("HEARTBEAT_MULTICAST_GROUP_PORT"));
_interval = confmap.getValue("HEARTBEAT_INTERVAL");
_heartbeat = atoi(_interval.c_str());
struct utsname name;
uname(&name);
_p_host = name.nodename;
char pid[10];
sprintf(pid, "%d", getpid());
_pid = pid;
}
HeartbeatSession::~HeartbeatSession()
{
if (_publisher)
delete _publisher;
}
bool
HeartbeatSession::initSession()
{
bool ret = this->initUDP(UDPSession::UDP_PUBLISHER_TYPE);
if (_heartbeat > 0){
_publisher = new UDPSessionPublisher(this, udpSendFd());
addTimer(_heartbeat * 1000, TimerCallback::FOREVER, this);
ret &= true;
}
return ret;
}
void
HeartbeatSession::onTimer(TimerId id)
{
string format = string("%c");
string curtime = Scheduler::getCurrentTime(format);
long lcurtime = Scheduler::getTimeLong(curtime, format);
char buf[20];
sprintf(buf, "%d", lcurtime);
MCMsgHeartbeat * msg = new MCMsgHeartbeat(buf);
msg->addKeyValue("INTERVAL", _interval.c_str());
msg->buildSuffix(_p_name, _p_host, _pid);
_publisher->publish(msg);
}
|
15eb41e985188d1f83d16dd5a83cba995bda22af | 4a9b250172bdae6946350893c246931ef89cd8a0 | /05-ScenceManager/Brick.h | 714247ee322f763ba5f354eded412dace8feff43 | [] | no_license | krypton99/SuperMarioBros | bc687ddc4ceb51de932611554d657001fe394bb6 | ecfbd42110cbeca0c55ec90fe2fa73919484b5c5 | refs/heads/master | 2023-07-02T21:25:11.685532 | 2021-08-05T13:50:29 | 2021-08-05T13:50:29 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,842 | h | Brick.h | #pragma once
#include "GameObject.h"
#include "define.h"
// brickType
#define BRICK_BROKEN 1 // gach question/glass after broken
#define BRICK_QUESTION 2
#define BRICK_GLASS 3
#define BRICK_MUSIC 4
/* ========== STATE BRICK ========== */
#define BRICK_STATE_BOUNDING 0 // nay tung tung
#define BRICK_STATE_ACTIVE 1
#define BRICK_STATE_BROKEN 2 // broken -> gach cung
#define BRICK_STATE_HIDDEN 3 // bien mat
/* ========== ANI BRICK ========== */
#define BRICK_ANI_ACTIVE 0
#define BRICK_ANI_BROKEN 1 // va cham: question & glass
#define BRICK_ANI_HIDDEN 2 // bien thanh item
// Type Item that brick contain
#define CONTAIN_NONE 0
#define CONTAIN_ITEM_UP 1 // superleaf && red_mushroom -> Level Up for mario
#define CONTAIN_COIN 2
#define CONTAIN_PSWITCH 3
#define CONTAIN_GREEN_MUSHROOM 4
class CBrick : public CGameObject
{
public:
int brickType; // 1=normal 2=question 3=question_broken 4=bronze
int typeItem; // 0=none 1= superLeaf||red mushroom 2=coin 3=p_switch 4=green_mushroom
int count; //number of item
bool isHidden; // bien check state hidden cho music brick -> xet va cham ny > 0 -> setstate(BRICK_STATE_ACTIVE)
bool canPushUp; // cho phep push mario vao hiddenmap
bool isBroken = false; // if mario attack (glass brick) -> true
bool isFallingItem = false;
vector<LPGAMEOBJECT> listPiece; // chua gach vo
CBrick(float x, float y,int typeBrick, int typeItem, int count);
~CBrick() {};
void SetBrickType(int type) { this->brickType = type; }
int GetBrickType() { return this->brickType; }
int GetTypeItem() { return this->typeItem; }
int GetCountItem() { return this->count; }
virtual void Render();
virtual void SetState(int state);
virtual void Update(DWORD dt, vector<LPGAMEOBJECT>* coObjects);
virtual void GetBoundingBox(float& l, float& t, float& r, float& b);
}; |
f37ab22e057f1cc9690d6447e818dd8ff774c5d0 | f9231ffa7a3c42da8449f9262b27c658a0909208 | /Battle_Ship_c++/Ships/ship.h | cc045dbd4e61d147cc00a5682b1c8cfa2fe08e0e | [] | no_license | Adriel0312/Proyecto-C- | ca3f0dd2f58926d28c60a5c123bb93cbee3935da | 06d3c95881f10b4741a0f106c17d3f9d5a09ac49 | refs/heads/master | 2022-12-03T14:08:45.353062 | 2020-07-28T18:40:08 | 2020-07-28T18:40:08 | 283,295,053 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,463 | h | ship.h | class ship{
private:
bool shield;
bool destroyed;
int regeneration;
int regenCounter;
int resistance;
int shipLength;
char oriented;
char type;
int color;
shipNode * coordinates;
ship * next;
public:
ship(char type,int regen,int resistance,int size,char oriented, string coor, int pcolor){
this->shield = true;
this->destroyed = false;
this->regeneration = regen;
this->regenCounter = regen;
this->resistance = resistance;
this->shipLength = size;
this->oriented = oriented;
this->type = type;
this->color = pcolor;
this->next = NULL;
genShip(coor);
}
void genShip(string coor)
{
shipNode * newNode = new shipNode(coor[0],coor[1] -'0',type);
this-> coordinates = newNode;
char i;
int j;
int counter = 1;
shipNode *current = newNode;
while(counter<shipLength)
{
if (oriented == 'V')
{
i = current->getI();
j = current->getJ()+1;
}
else if(oriented == 'H')
{
i = current->getI()+1;
j = current->getJ();
}
shipNode * newNode = new shipNode(i,j,type);
current->setNextNode(newNode);
current = current->getNextNode();
counter++;
}
}
void swapActive(){
this->shield=false;
}
void regenerate(){
this->regenCounter--;
if (regenCounter == 0)
{
this->shield=true;
regenCounter = regeneration;
}
}
void delayRegeneration(int delay)
{
this->regenCounter += delay;
}
bool decreaseResistance(){
if (resistance==0)
{
this->destroyed = true;
return false;
}
else
{
this->resistance--;
return true;
}
}
void resetRegeneration(int type){
if (type==1)
this->regeneration=1;
else if (type==2)
this->regeneration=2;
else if (type==3)
this->regeneration=4;
else if (type==4)
this->regeneration=4;
else if (type==5)
this->regeneration=5;
}
bool isDestroyed()
{
return destroyed;
}
shipNode * getShipNode()
{
return coordinates;
}
void setNextShip(ship * nextShip)
{
this->next = nextShip;
}
ship * getNextShip()
{
return next;
}
int getShipColor()
{
return color;
}
char getType()
{
return type;
}
bool getShield()
{
return shield;
}
}; |
81974e5c99a721b37b08edcbbb8832995af41154 | 3f57a298d25a0f81902db4a0a342bf08bd39e8ed | /QuantumWorld/Temp/StagingArea/Data/il2cppOutput/AssemblyU2DCSharp_OverlayScript4230540291.h | efc396be80798bb89d7d4372b306367de8d1d9df | [] | no_license | superduperpacman42/QuantumWorld | a7a58b08011caf728d29eb01e2bf87f0ac6153d6 | 76709e8ec2d3edc2f1af8274ba0b99baa48c57a5 | refs/heads/master | 2021-01-20T00:45:37.955563 | 2017-04-24T01:33:50 | 2017-04-24T01:33:50 | 89,181,937 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,163 | h | AssemblyU2DCSharp_OverlayScript4230540291.h | #pragma once
#include "il2cpp-config.h"
#ifndef _MSC_VER
# include <alloca.h>
#else
# include <malloc.h>
#endif
#include <stdint.h>
// UnityEngine.GameObject
struct GameObject_t1756533147;
#include "UnityEngine_UnityEngine_MonoBehaviour1158329972.h"
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// OverlayScript
struct OverlayScript_t4230540291 : public MonoBehaviour_t1158329972
{
public:
// System.Single OverlayScript::delay
float ___delay_2;
// System.Single OverlayScript::t
float ___t_3;
// System.Boolean OverlayScript::moved
bool ___moved_4;
// UnityEngine.GameObject OverlayScript::next
GameObject_t1756533147 * ___next_5;
public:
inline static int32_t get_offset_of_delay_2() { return static_cast<int32_t>(offsetof(OverlayScript_t4230540291, ___delay_2)); }
inline float get_delay_2() const { return ___delay_2; }
inline float* get_address_of_delay_2() { return &___delay_2; }
inline void set_delay_2(float value)
{
___delay_2 = value;
}
inline static int32_t get_offset_of_t_3() { return static_cast<int32_t>(offsetof(OverlayScript_t4230540291, ___t_3)); }
inline float get_t_3() const { return ___t_3; }
inline float* get_address_of_t_3() { return &___t_3; }
inline void set_t_3(float value)
{
___t_3 = value;
}
inline static int32_t get_offset_of_moved_4() { return static_cast<int32_t>(offsetof(OverlayScript_t4230540291, ___moved_4)); }
inline bool get_moved_4() const { return ___moved_4; }
inline bool* get_address_of_moved_4() { return &___moved_4; }
inline void set_moved_4(bool value)
{
___moved_4 = value;
}
inline static int32_t get_offset_of_next_5() { return static_cast<int32_t>(offsetof(OverlayScript_t4230540291, ___next_5)); }
inline GameObject_t1756533147 * get_next_5() const { return ___next_5; }
inline GameObject_t1756533147 ** get_address_of_next_5() { return &___next_5; }
inline void set_next_5(GameObject_t1756533147 * value)
{
___next_5 = value;
Il2CppCodeGenWriteBarrier(&___next_5, value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
|
1970b0843829cb346014fa76c2b88926927f7e7f | f55b576671e0efe9be6119cd5534a86306822a9a | /mytutorial/softserial/softserial.ino | fe21c3670218165b3a5b0066ed24e416e7de9fa8 | [] | no_license | gbox3d/myarduinoprj | 5a94a0b6bbc3984fc6bc25ca173079a50a6c8cb3 | ac00c70b8e5a3adf703c6a6a5b3c25f9d94eb319 | refs/heads/master | 2021-01-10T11:16:50.694940 | 2016-04-03T13:41:58 | 2016-04-03T13:41:58 | 51,231,116 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 444 | ino | softserial.ino | #include <SoftwareSerial.h>
#include <EEPROM.h>
#include <ArduinoJson.h>
#include <SimpleTimer.h>
SoftwareSerial mySerial(2, 3); // RX,TX
void setup() {
// put your setup code here, to run once:
mySerial.begin(9600);
delay(500);
mySerial.println("start~");
}
void loop() {
// put your main code here, to run repeatedly:
while(mySerial.available() > 0)
{
char c = mySerial.read();
mySerial.println(c);
}
}
|
73506966ad8a4773c0bdeb8a57dad3fdea3056fd | 56b2363983136e66e8feeb45309e0caaabd0a01a | /UndertaleSFML/UndertaleSFML/kult.hpp | da9d5e51c1d296b5e996a895606cd2618761cdda | [] | no_license | WarlockD/Cocos2dx-Undertale-Engine | 4433c7517820ecc59dad9323e09b6a98167f062b | e51ae5439ca9d1ee1212dc1cd5f55bf3e1a4b0b3 | refs/heads/master | 2020-04-06T05:11:31.096808 | 2017-02-14T01:06:02 | 2017-02-14T01:06:02 | 50,688,255 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 19,982 | hpp | kult.hpp | // Kult - A lightweight entity/component/system library written in C++11
// rlyeh, 2013..2015. ZLIB/libPNG licensed.
// api #1 { add<component_t>(id); get<component_t>(id); has<component_t>(id); del<component_t>(id); dump(id); }
// api #2 { entity += component; entity[component]; entity.has(component); entity -= component; id.dump(); }
// @todo: [ entity, component, system( position, velocity ), engine ].diff(), patch(), save(), load(), versioning?
#pragma once
#define KULT_VERSION "1.0.0" /* (2015/11/24) Allow external serializer; new entity methods; extra join/exclude sugars; improve dump info
#define KULT_VERSION "0.0.0" // (2014/05/04) Initial commit */
#include <algorithm>
#include <iostream> // registerme
#include <map>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <sstream>
#include <functional>
#include <type_traits>
#ifdef KULT_SERIALIZER_INC
#include KULT_SERIALIZER_INC
#endif
#ifndef KULT_SERIALIZER_FN
#define KULT_SERIALIZER_FN(v) (v)
#endif
#ifdef _OPENMP
#include <omp.h>
#endif
#if defined(_NDEBUG) || defined(NDEBUG)
#define KULT_DEBUG(...)
#define KULT_RELEASE(...) __VA_ARGS__
#else
#include <cassert>
#define KULT_DEBUG(...) __VA_ARGS__
#define KULT_RELEASE(...)
#endif
// Detect if we have a stream
namespace kult {
template<typename V> using set = std::unordered_set<V>; // std::set<V>; // unordered_set
template<typename K, typename V> using map = std::unordered_map<K, V>; //std::map<K, V>; // unordered_map
using type = unsigned;
using t_event = unsigned;
// kult::helpers
struct _has_default_constructor {};
struct _can_copy : public _has_default_constructor {};
template<class B>
typename std::enable_if<std::is_default_constructible<B>::value>::type
inline _assign(B& l, B&, _has_default_constructor) {
l = B();
}
template<class B>
typename std::enable_if<std::is_copy_assignable<B>::value>::type
inline _assign(B& l, B& r, _can_copy) {
l = r;
}
template<typename T>
T zero() {
return std::pair<T, T>().first;
}
template<typename T>
T zero(const T &t) {
return zero<T>();
}
template<typename T>
T one() {
return !zero<T>();
}
template<typename T>
T one(const T &t) {
return one<T>();
}
template<typename T>
bool is_true(const T &t) {
return t != zero<T>();
}
template<typename T>
bool is_false(const T &t) {
return !is_true<T>(t);
}
template<typename T>
void reset(T &t) {
t = zero<T>();
}
template<typename T>
T &invalid() {
static T t;
return reset(t), t;
}
template<typename T>
T &invalid(const T &t) {
return invalid<T>();
}
// kult::id
template<typename T = type>
T none() {
return invalid<T>();
}
template<typename T = type>
T &id() {
static T _id = none();
return ++_id;
}
// kult::entity
// forward declarations {
struct entity;
inline type purge(const type &);
inline std::string dump(const type &);
template<typename T> inline decltype(T::value_type) &get(const type &id);
template<typename T> inline decltype(T::value_type) &add(const type &id);
template<typename T> inline bool has(const type &id);
template<typename T> inline bool del(const type &id);
//template<typename T, typename ... Args> inline decltype(T::value_type) &assign(const type &id, Args && ... args);
//template<typename T, typename Args> inline decltype(T::value_type) &assign(const type &id, Args && args);
struct entity {
const type id;
static set<entity*> &all() { // all live instances are reflected here
static set<entity*> statics;
return statics;
}
entity(const type &id_ = kult::id()) : id(id_) {
KULT_DEBUG(
assert(all().insert(this).second);
)
KULT_RELEASE(
all().insert(this);
)
}
~entity() {
all().erase(this);
}
operator type const () const {
return id;
}
template<typename T>
inline decltype(T::value_type) &add() {
return kult::add<T>(id);
}
template<typename component>
decltype(component::value_type) &operator [](const component &t) const {
return kult::add<component>(id), kult::get<component>(id);
}
template<typename component>
const entity &operator +=(const component &t) const {
return kult::add<component>(id), *this;
}
template<typename component>
const entity &operator -=(const component &t) const {
return kult::del<component>(id), *this;
}
template<typename component>
bool has(const component &t) const {
return kult::has<component>(id);
}
std::string dump() const {
return kult::dump(id);
}
void purge() {
kult::purge(id);
*const_cast<type*>(&id) = none<type>();
}
template<typename CC,typename C>
typename std::enable_if<std::is_same<decltype(CC::value_type),C>::value, decltype(CC::value_type)&>::type
assign(C&& value) const;
template<typename component>
decltype(component::value_type) &get() const {
return kult::get<component>(id);
}
template<typename component>
bool has() const {
return kult::has<component>(id);
}
};
inline set<entity*> entities() {
return entity::all();
}
// kult::component
enum GROUPBY_MODE {
JOIN = 0, MERGE = 1, EXCLUDE = 2
};
template<typename T>
inline kult::set<entity> &any() {
static kult::set<entity> entities;
return entities;
}
template<int MODE>
inline kult::set<entity> group_by(const kult::set<entity> &A, const kult::set<entity> &B) {
const kult::set<entity> *tiny, *large;
if (A.size() < B.size()) tiny = &A, large = &B;
else tiny = &B, large = &A;
kult::set<entity> newset; // union first, then difference, then intersection
/**/ if (MODE == MERGE) { newset = *large; for (auto &id : *tiny) newset.insert(id); }
else if (MODE == EXCLUDE) { newset = *large; for (auto &id : *tiny) newset.erase(id); }
else { for (auto &id : *tiny) if (large->find(id) != large->end()) newset.insert(id); }
return newset;
}
// sugars {
template<class T> kult::set< entity > join() { return any<T>(); }
template<class T, class U> kult::set< entity > join() { return group_by<JOIN>(any<T>(), any<U>()); }
template<class T, class U, class V> kult::set< entity > join() { return group_by<JOIN>(any<T>(), join<U, V>()); }
template<class T, class U, class V, class W> kult::set< entity > join() { return group_by<JOIN>(any<T>(), join<U, V, W>()); }
template<class T> kult::set< entity > join(const T &t) { return any<T>(); }
template<class T, class U> kult::set< entity > join(const T &t, const U &u) { return join<T, U>(); }
template<class T, class U, class V> kult::set< entity > join(const T &t, const U &u, const V &v) { return join<T, U, V>(); }
template<class T, class U, class V, class W> kult::set< entity > join(const T &t, const U &u, const V &v, const W &w) { return join<T, U, V, W>(); }
template<class T> kult::set<entity> exclude(const kult::set<entity> &B) { return group_by<EXCLUDE>(any<T>(), B); }
template<class T> kult::set<entity> exclude(const kult::set<entity> &A, const T &t) { return group_by<EXCLUDE>(A, any<T>()); }
// }
template<typename... T>
using system = std::function<void(T...)>;
// parallelize
# ifdef _MSC_VER
# define OMP_PARA_INTERNAL __pragma(omp parallel for)
# else
# define OMP_PARA_INTERNAL _Pragma("omp parallel for") // C99
# endif
# define parallelize(id, sys) while(1) { \
const std::vector<type> vsys( sys.begin(), sys.end() ); \
const int end = vsys.size(); int it; \
OMP_PARA_INTERNAL for( it = 0; it < end; ++it ) { \
auto &id = vsys[it];
// [...]
# define pend \
} break; }
template<typename T>
kult::map< type, T > &components() {
static kult::map< type, T > objects;
return objects;
}
template<typename T>
inline bool has(const type &id) {
return components<T>().find(id) != components<T>().end();
}
template<typename T>
inline decltype(T::value_type) &get(const type &id) {
// KULT_DEBUG(
// safe
// static decltype(T::value_type) invalid, reset;
//return has<T>(id) ? components<T>()[id].value_type : invalid = decltype(T::value_type)();// reset;
// )
// KULT_RELEASE(
// fast
return components<T>()[id].value_type;
//)
}
template<typename T>
inline decltype(T::value_type) &add(const type &id) {
any<T>().insert(id);
return components<T>()[id].value_type;
}
template<typename CC, typename C>
typename std::enable_if<std::is_same<decltype(CC::value_type), C>::value, decltype(CC::value_type)&>::type
assign(const type &id, C&& value) {
any<T>().emplace(value);
return components<T>()[id].value_type;
}
template<typename CC, typename C>
typename std::enable_if<std::is_same<decltype(CC::value_type), C>::value, decltype(CC::value_type)&>::type
entity::assign(C&& value) const{
any<CC>().emplace(value);
return components<CC>()[id].value_type;
}
template<typename T>
inline bool del(const type &id) {
add<T>(id);
components<T>().erase(id);
any<T>().erase(id);
return !has<T>(id);
}
struct interface {
virtual ~interface() {}
virtual void purge(const type &) const = 0;
virtual void swap(const type &, const type &) const = 0;
virtual void merge(const type &, const type &) const = 0;
virtual void copy(const type &, const type &) const = 0;
virtual void dump(std::ostream &, const type &) const = 0;
virtual std::string name() const = 0;
static std::vector<const interface*> ®istered() {
static std::vector<const interface*> vector;
return vector;
}
};
template<type NAME, typename T>
struct component : interface {
public:
typedef typename T type;
T value_type;
component(bool reentrant = 0) {
if (!reentrant) {
static struct registerme {
registerme() {
interface::registered().push_back(new component(1));
}
} st;
}
}
component(const T& v) : value_type(v) {}
component(T&& v) : value_type(std::move(v)) {}
~component() {
auto &list = interface::registered();
for (auto &it : list) {
if (it == this) {
std::swap(it, list.back());
list.pop_back();
}
}
}
// sugars {
const component &operator+=(const type &id) const {
return add<component>(id), *this;
}
T &operator[](const type &id) const {
KULT_DEBUG(
return operator+=(id), get<component>(id);
)
KULT_RELEASE(
return get<component>(id);
)
}
// }
virtual std::string name() const {
return std::string{ (NAME >> 24) & 0xff, (NAME >> 16) & 0xff, (NAME >> 8) & 0xff, NAME & 0xff };
}
virtual void purge(const type &id) const {
del<component>(id);
}
virtual void swap(const type &dst, const type &src) const {
KULT_DEBUG(
// safe
if (kult::has<component>(dst) && kult::has<component>(src)) {
std::swap(get<component>(dst), get<component>(src));
}
)
KULT_RELEASE(
// fast
std::swap(get<component>(dst), get<component>(src));
)
}
virtual void merge(const type &dst, const type &src) const {
static_assert(std::is_copy_assignable<T>::value, "Type canot be copied");
add<component>(dst) = get<component>(src);
//_assign(add<component>(dst), get<component>(src),_can_move());
}
virtual void copy(const type &dst, const type &src) const {
if (kult::has<component>(src)) {
merge(dst, src);
}
else {
purge(dst);
}
}
//http://stackoverflow.com/questions/5839357/detect-operator-support-with-decltype-sfinae
// template class to check if we can dump an object
template<typename S, typename T>
class is_streamable
{
template<typename SS, typename TT>
static auto test(int)-> decltype(std::declval<SS&>() << std::declval<TT>(), std::true_type());
template<typename, typename>
static auto test(...)->std::false_type;
public:
static const bool value = decltype(test<S, T>(0))::value;
};
// check to see if we have a stream operater, if not just print its name and id
private:
struct t_generic_dump {};
struct t_has_stream_operator : t_generic_dump {};
template<class Q = T>
typename std::enable_if<is_streamable<std::ostream, Q>::value>::type
generic_dump(std::ostream &os, const type &id, t_generic_dump) const {
if (has<component>(id)) {
os << "\t" << name() << ": " << KULT_SERIALIZER_FN(get<component>(id)) << ",\n";
}
}
template<class Q = T>
void generic_dump(std::ostream &os, const type &id, t_has_stream_operator) const {
if (has<component>(id)) {
os << "\t" << name() << ": " << id << ",\n";
}
}
public:
//virtual void dump(std::ostream &os, const type &id) const {
// if (has<component>(id)) generic_dump(os, id, t_has_stream_operator());
//}
inline T &operator()(const type &id) {
return get<component>(id);
}
inline const T &operator()(const type &id) const {
return get<component>(id);
}
};
inline std::string dump(const type &id) {
std::stringstream ss; ss << '{';
for (auto &it : interface::registered()) {
it->dump(ss, id);
}
return ss << '}', ss.str();
}
inline type purge(const type &id) { // clear
for (auto &it : interface::registered()) {
it->purge(id);
}
return id;
}
inline type swap(const type &dst, const type &src) {
for (auto &it : interface::registered()) {
it->swap(dst, src);
}
return dst;
}
inline type merge(const type &dst, const type &src) {
for (auto &it : interface::registered()) {
it->merge(dst, src);
}
return dst;
}
inline type copy(const type &dst, const type &src) {
for (auto &it : interface::registered()) {
it->copy(dst, src);
}
return dst;
}
inline type spawn(const type &src) {
return copy(id(), src);
}
/*
inline type restart( const type &id ) {
return copy( id, type(id) );
}
inline type respawn( const type &id ) {
return copy( id, type(id) );
}
*/
inline type reset(const type &id) {
return copy(id, none());
}
// kill(id);
// save() -> diff( zero(), *this )
// load() -> patch( zero(), diff );
// undo()
// redo()
}
namespace std {
template<> struct hash<kult::entity> {
typedef kult::entity argument_type;
typedef std::size_t result_type;
result_type operator()(argument_type const& s) const
{
static std::hash<kult::type> hasher;
return hasher(s.id);
}
};
};
#ifdef KULT_BUILD_TESTS
// unittest suite {
#include <errno.h>
#include <string.h>
#include <stdlib.h>
#define suite(...) if(printf("------ " __VA_ARGS__),puts(""),true)
#define test(...) (errno=0,++tst,err+=!(ok=!!(__VA_ARGS__))),printf("[%s] %d %s (%s)\n",ok?" OK ":"FAIL",__LINE__,#__VA_ARGS__,strerror(errno))
unsigned tst = 0, err = 0, ok = atexit([] { suite("summary") { printf("[%s] %d tests = %d passed + %d errors\n", err ? "FAIL" : " OK ", tst, tst - err, err); }});
// }
using namespace kult;
// gamedev types and constants
template<typename T>
struct vec2 {
T x, y;
bool operator==(const vec2 &other) const {
return x == other.x && y == other.y;
}
template<class ostream>
friend inline ostream& operator <<(ostream &os, const vec2 &self) {
return os << "(x=" << self.x << ",y=" << self.y << ")", os;
}
};
using vec2f = vec2<float>;
using vec2i = vec2<int>;
const vec2f zero2f = { 0.f, 0.f }, one2f = { 1.f, 1.f };
// component aliases
using friendly = kult::component< 'team', bool >;
using health = kult::component< 'heal', int >;
using mana = kult::component< 'mana', int >;
using coins = kult::component< 'coin', int >;
using name = kult::component< 'name', std::string >;
using position = kult::component< 'pos2', vec2f >;
int main() {
suite("helper tests") {
test(zero<bool>() == false);
test(zero<int>() == 0);
test(zero<float>() == 0.f);
int t;
test(one(t) == 1);
float f;
test(one(f) == 1.f);
test(is_true(3));
test(is_false(0));
test(is_true(true));
test(is_false(false));
test(is_true(-1.0));
test(is_false(0.0));
}
suite("id tests") {
test(none() == none());
auto id0 = id();
test(id0 < id());
test(none() < id());
test((id() = none()) == none());
}
suite("add<component_t>(id) syntax") {
// entities
int none = 0, player = 1, enemy = 2;
// components
test(!has<name>(player));
test(!has<position>(player));
test(!has<coins>(enemy));
test(!has<health>(enemy));
add<name>(player) = "Hero";
add<position>(player) = zero2f;
add<health>(player) = 100;
add<coins>(player) = 200;
add<mana>(player) = 4000;
add<friendly>(player) = true;
add<name>(enemy) = "Orc";
add<position>(enemy) = one2f;
add<health>(enemy) = 200;
add<coins>(enemy) = 50;
add<mana>(enemy) = 10;
test(get<health>(player) == 100); // :>
test(has<name>(player));
test(!has<vec2i>(player));
test(has<position>(player));
test(has<health>(player));
test(get<mana>(enemy) == 10);
test(get<position>(player) == zero2f);
test(get<health>(player) == 100);
// systems; here we intersect a system of all elements with <name> and <position>.
test((join<name, position>().size() == 2));
// systems; simulate movement
for (auto &id : join<name, position>()) {
vec2f &pos = get<position>(id);
pos.x += 10;
pos.y++;
}
// systems; simulate a spell bomb in entities of any type
for (auto &id : join<mana>()) {
get<mana>(id) -= 50;
}
// systems; simulate a powerup (+$100) for all players
for (auto &id : join<name, coins, friendly>()) {
get<coins>(id) += 100;
}
// systems; simulate a poison (-50%HP) to all entities that are not friendly (so enemies)
for (auto &id : exclude<friendly>(join<name, health>())) {
get<health>(id) *= 0.5;
}
test(get<health>(player) == 100 + 0);
test(get<health>(enemy) == 200 / 2);
test(get<coins>(player) == 200 + 100);
test(get<coins>(enemy) == 50 + 0);
test(get<mana>(player) == 4000 - 50);
test(get<mana>(enemy) == 10 - 50);
test(del<position>(player));
test(!has<position>(player));
test(del<name>(player));
test(!has<name>(player));
test((join<name, position>().size() == 1));
}
suite("entity[component] (or component[entity]) syntax") {
// entities
kult::entity player, enemy;
component<'name', std::string> name;
component<'heal', size_t> heal;
component<'coin', size_t> coin;
component<'mana', size_t> mana;
component<'team', bool> team;
component<'pos2', vec2f> pos2;
// components
player[name] = "Hero";
player[pos2] = zero2f;
player[heal] = 100;
player[coin] = 200;
player[mana] = 4000;
player[team] = true;
enemy[name] = "Orc";
enemy[pos2] = one2f;
enemy[heal] = 200;
enemy[coin] = 50;
enemy[mana] = 10;
test(player[heal] == 100); // :>
test(player.has(name));
test(player.has(pos2));
test(player.has(heal));
test(enemy[mana] == 10);
test(player[pos2] == zero2f);
test(player[heal] == 100);
// systems; here we intersect a system of all elements with <name> and <pos2>.
test(join(name, pos2).size() == 2);
// systems; simulate movement
for (auto &id : join(name, pos2)) {
vec2f &pos = pos2[id];
pos.x += 10;
pos.y++;
}
// systems; simulate a spell bomb in entities of any type
for (auto &id : join(mana)) {
mana[id] -= 50;
}
// systems; simulate a powerup (+$100) for all players
for (auto &id : join(name, coin, team)) {
coin[id] += 100;
}
// systems; simulate a poison (-50%HP) to all entities that are not in team (so enemies)
for (auto &id : exclude(join(name, heal), team)) {
heal[id] *= 0.5;
}
test(player[heal] == 100 + 0);
test(player[heal] == 100 + 0);
test(enemy[heal] == 200 / 2);
test(player[coin] == 200 + 100);
test(enemy[coin] == 50 + 0);
test(player[mana] == 4000 - 50);
test(enemy[mana] == 10 - 50);
player -= pos2;
player -= name;
test(!player.has(pos2));
test(!player.has(name));
test(join(name, pos2).size() == 1);
test(player.dump() != "{}");
player.purge();
test(player.dump() == "{}");
test(entities().size() == 2);
}
test(entities().size() == 0);
}
#endif |
63d6131308857b7ad40d97d71a47ef42112c398c | 3f3095dbf94522e37fe897381d9c76ceb67c8e4f | /Current/Cheat_GiveBeerBuff_Row.hpp | 0429c5fa07f5d2303fb92160d934a72f7fa7d6e4 | [] | no_license | DRG-Modding/Header-Dumps | 763c7195b9fb24a108d7d933193838d736f9f494 | 84932dc1491811e9872b1de4f92759616f9fa565 | refs/heads/main | 2023-06-25T11:11:10.298500 | 2023-06-20T13:52:18 | 2023-06-20T13:52:18 | 399,652,576 | 8 | 7 | null | null | null | null | UTF-8 | C++ | false | false | 908 | hpp | Cheat_GiveBeerBuff_Row.hpp | #ifndef UE4SS_SDK_Cheat_GiveBeerBuff_Row_HPP
#define UE4SS_SDK_Cheat_GiveBeerBuff_Row_HPP
class UCheat_GiveBeerBuff_Row_C : public UUserWidget
{
FPointerToUberGraphFrame UberGraphFrame;
class UCheckBox* CheckBox_0;
class UTextBlock* TextBlock_BeerName;
class UTemporaryBuff* myBeerBuff;
FCheat_GiveBeerBuff_Row_COn BeerbuffRow checked On BeerbuffRow checked;
void On BeerbuffRow checked(class UCheat_GiveBeerBuff_Row_C* Buff row to skip);
bool alreadyActive;
void Set BeerBuff(class UTemporaryBuff* berr buff in);
void BndEvt__CheckBox_0_K2Node_ComponentBoundEvent_64_OnCheckBoxComponentStateChanged__DelegateSignature(bool bIsChecked);
void Check if owned buff is the active buff();
void ExecuteUbergraph_Cheat_GiveBeerBuff_Row(int32 EntryPoint);
void On BeerbuffRow checked__DelegateSignature(class UCheat_GiveBeerBuff_Row_C* Buff row to skip);
};
#endif
|
16a3745dacb708f36766a4bc10b93a1bdec1cc9e | 6b40e9dccf2edc767c44df3acd9b626fcd586b4d | /NT/admin/admt/arext/addtogrp/grpupdt.h | 595b26f4cb84d2ec6583df7e7ed5379763115f15 | [] | no_license | jjzhang166/WinNT5_src_20201004 | 712894fcf94fb82c49e5cd09d719da00740e0436 | b2db264153b80fbb91ef5fc9f57b387e223dbfc2 | refs/heads/Win2K3 | 2023-08-12T01:31:59.670176 | 2021-10-14T15:14:37 | 2021-10-14T15:14:37 | 586,134,273 | 1 | 0 | null | 2023-01-07T03:47:45 | 2023-01-07T03:47:44 | null | UTF-8 | C++ | false | false | 2,533 | h | grpupdt.h | //---------------------------------------------------------------------------
// GrpUpdt.h
//
// Comment: This is a COM object extension for the MCS DCTAccountReplicator.
// This object implements the IExtendAccountMigration interface.
// The Process method adds the migrated account to the specified
// group on source and target domain. The Undo function removes these
// from the specified group.
//
// (c) Copyright 1995-1998, Mission Critical Software, Inc., All Rights Reserved
//
// Proprietary and confidential to Mission Critical Software, Inc.
//---------------------------------------------------------------------------
#ifndef __GROUPUPDATE_H_
#define __GROUPUPDATE_H_
#include "resource.h" // main symbols
#include "ExtSeq.h"
/////////////////////////////////////////////////////////////////////////////
// CGroupUpdate
class ATL_NO_VTABLE CGroupUpdate :
public CComObjectRootEx<CComMultiThreadModel>,
public CComCoClass<CGroupUpdate, &CLSID_GroupUpdate>,
public IDispatchImpl<IExtendAccountMigration, &IID_IExtendAccountMigration, &LIBID_ADDTOGROUPLib>
{
public:
CGroupUpdate()
{
m_sName = L"";
m_sDesc = L"";
m_Sequence = AREXT_DEFAULT_SEQUENCE_NUMBER;
}
DECLARE_REGISTRY_RESOURCEID(IDR_GROUPUPDATE)
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(CGroupUpdate)
COM_INTERFACE_ENTRY(IExtendAccountMigration)
COM_INTERFACE_ENTRY(IDispatch)
END_COM_MAP()
// IExtendAccountMigration
public:
STDMETHOD(ProcessUndo)(/*[in]*/ IUnknown * pSource, /*[in]*/ IUnknown * pTarget, /*[in]*/ IUnknown * pMainSettings, /*[in, out]*/ IUnknown ** pPropToSet, /*[in,out]*/ EAMAccountStats* pStats);
STDMETHOD(PreProcessObject)(/*[in]*/ IUnknown * pSource, /*[in]*/ IUnknown * pTarget, /*[in]*/ IUnknown * pMainSettings, /*[in,out]*/ IUnknown ** ppPropsToSet, /*[in,out]*/ EAMAccountStats* pStats);
STDMETHOD(ProcessObject)(/*[in]*/ IUnknown * pSource, /*[in]*/ IUnknown * pTarget, /*[in]*/ IUnknown * pMainSettings, /*[in,out]*/ IUnknown ** ppPropsToSet, /*[in,out]*/ EAMAccountStats* pStats);
STDMETHOD(get_sDesc)(/*[out, retval]*/ BSTR *pVal);
STDMETHOD(put_sDesc)(/*[in]*/ BSTR newVal);
STDMETHOD(get_sName)(/*[out, retval]*/ BSTR *pVal);
STDMETHOD(put_sName)(/*[in]*/ BSTR newVal);
STDMETHOD(get_SequenceNumber)(/*[out, retval]*/ LONG * value) { (*value) = m_Sequence; return S_OK; }
private:
_bstr_t m_sDesc;
_bstr_t m_sName;
long m_Sequence;
};
#endif //__GROUPUPDATE_H_
|
e9f9d306ccfc71c2ca69fcde6439cf179280f659 | 9e34e84c20760a9a37512c675074974ac7e56275 | /more-source/2011-2012/2011-2012_feb_camp_sdu/cdf/a.cpp | 97037e09a486e90342e82989c995fcc5d120ba0d | [] | no_license | Slava/competitiveProgramming | 2b7f26bf24143b459c6e2625ef1ea343a926bb76 | b68391720b9f9efc4162a66ca07d9448cffc1453 | refs/heads/master | 2021-01-21T12:40:40.053352 | 2020-01-06T19:21:45 | 2020-01-06T19:21:45 | 9,552,080 | 8 | 6 | null | null | null | null | UTF-8 | C++ | false | false | 431 | cpp | a.cpp | #include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
const int N = 100100;
string s, t;
int main() {
cin >> t >> s;
int n = (int)s.size(), m = (int)t.size(), ans = 1<<30;
for (int i = -max(m,n); i <= max(n,m); i++) {
int cnt = 0;
for (int j = 0; j < n; j++)
if (i+j < 0 || i+j >= m || s[j] != t[i+j])
cnt++;
ans = min(ans, cnt);
}
cout << ans << endl;
return 0;
}
|
e1eca3b10e73840ac1b30e4fb470796bc0ddafb3 | e3e3bf2a8cb16c8e87139237a7f03aa6807f7f2c | /cell_based/test/population/TestCellBasedPdeHandler.hpp | 059c253357f9eb81f3912bc60ff676054d3d4ac7 | [
"BSD-3-Clause"
] | permissive | uofs-simlab/ChasteOS | f67b67f246befbc38edc3dc93b5e55a7bbf1fcfc | 04d98998e2ebad3f29086b8eaa1d89c08c6fccf6 | refs/heads/master | 2021-05-07T04:10:38.591384 | 2017-11-20T15:48:06 | 2017-11-20T15:48:06 | 111,127,403 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 50,775 | hpp | TestCellBasedPdeHandler.hpp | /*
Copyright (c) 2005-2016, University of Oxford.
All rights reserved.
University of Oxford means the Chancellor, Masters and Scholars of the
University of Oxford, having an administrative office at Wellington
Square, Oxford OX1 2JD, UK.
This file is part of Chaste.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the University of Oxford nor the names of its
contributors may be used to endorse or promote products derived from this
software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef TESTCELLBASEDPDEHANDLER_HPP_
#define TESTCELLBASEDPDEHANDLER_HPP_
#include <cxxtest/TestSuite.h>
#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
#include "CheckpointArchiveTypes.hpp"
#include "CellBasedPdeHandler.hpp"
#include "CellBasedPdeHandlerOnCuboid.hpp"
#include "HoneycombMeshGenerator.hpp"
#include "CellsGenerator.hpp"
#include "FixedDurationGenerationBasedCellCycleModel.hpp"
#include "MeshBasedCellPopulation.hpp"
#include "NodeBasedCellPopulation.hpp"
#include "CellwiseSourcePde.hpp"
#include "SimpleUniformSourcePde.hpp"
#include "ConstBoundaryCondition.hpp"
#include "PetscSetupAndFinalize.hpp"
#include "ReplicatableVector.hpp"
#include "WildTypeCellMutationState.hpp"
#include "AveragedSourcePde.hpp"
#include "FileComparison.hpp"
#include "NumericFileComparison.hpp"
#include "FunctionalBoundaryCondition.hpp"
#include "ArchiveOpener.hpp"
#include "SmartPointers.hpp"
#include "AbstractCellBasedWithTimingsTestSuite.hpp"
class SimplePdeForTesting : public AbstractLinearEllipticPde<2,2>
{
public:
double ComputeConstantInUSourceTerm(const ChastePoint<2>&, Element<2,2>* pElement)
{
return -1.0;
}
double ComputeLinearInUCoeffInSourceTerm(const ChastePoint<2>&, Element<2,2>*)
{
return 0.0;
}
c_matrix<double,2,2> ComputeDiffusionTerm(const ChastePoint<2>& )
{
return identity_matrix<double>(2);
}
};
class TestCellBasedPdeHandler : public AbstractCellBasedWithTimingsTestSuite
{
public:
void TestConstructor() throw(Exception)
{
EXIT_IF_PARALLEL;
// Create a cell population
HoneycombMeshGenerator generator(2, 2, 0);
MutableMesh<2,2>* p_generating_mesh = generator.GetMesh();
NodesOnlyMesh<2> mesh;
mesh.ConstructNodesWithoutMesh(*p_generating_mesh, 1.5);
std::vector<CellPtr> cells;
CellsGenerator<FixedDurationGenerationBasedCellCycleModel, 2> cells_generator;
cells_generator.GenerateBasic(cells, mesh.GetNumNodes());
NodeBasedCellPopulation<2> cell_population(mesh, cells);
// Create a PDE handler object using this cell population
CellBasedPdeHandler<2> pde_handler(&cell_population);
// Test that member variables are initialised correctly
TS_ASSERT_EQUALS(pde_handler.GetCellPopulation(), &cell_population);
TS_ASSERT_EQUALS(pde_handler.GetWriteAverageRadialPdeSolution(), false);
TS_ASSERT_EQUALS(pde_handler.GetWriteDailyAverageRadialPdeSolution(), false);
TS_ASSERT_EQUALS(pde_handler.GetImposeBcsOnCoarseBoundary(), true);
TS_ASSERT_EQUALS(pde_handler.GetNumRadialIntervals(), UNSIGNED_UNSET);
TS_ASSERT(pde_handler.GetCoarsePdeMesh() == NULL);
}
void TestSetMethods() throw(Exception)
{
EXIT_IF_PARALLEL;
// Create a cell population
HoneycombMeshGenerator generator(2, 2, 0);
MutableMesh<2,2>* p_generating_mesh = generator.GetMesh();
NodesOnlyMesh<2> mesh;
mesh.ConstructNodesWithoutMesh(*p_generating_mesh, 1.5);
std::vector<CellPtr> cells;
CellsGenerator<FixedDurationGenerationBasedCellCycleModel, 2> cells_generator;
cells_generator.GenerateBasic(cells, mesh.GetNumNodes());
NodeBasedCellPopulation<2> cell_population(mesh, cells);
// Create a PDE handler object using this cell population
CellBasedPdeHandler<2> pde_handler(&cell_population);
// Test set and get methods
pde_handler.SetWriteAverageRadialPdeSolution("averaged quantity");
TS_ASSERT_EQUALS(pde_handler.GetWriteAverageRadialPdeSolution(), true);
TS_ASSERT_EQUALS(pde_handler.GetWriteDailyAverageRadialPdeSolution(), false);
TS_ASSERT_EQUALS(pde_handler.GetNumRadialIntervals(), 10u);
pde_handler.SetWriteAverageRadialPdeSolution("averaged quantity", 5, true);
TS_ASSERT_EQUALS(pde_handler.GetWriteAverageRadialPdeSolution(), true);
TS_ASSERT_EQUALS(pde_handler.GetWriteDailyAverageRadialPdeSolution(), true);
TS_ASSERT_EQUALS(pde_handler.GetNumRadialIntervals(), 5u);
pde_handler.SetImposeBcsOnCoarseBoundary(false);
TS_ASSERT_EQUALS(pde_handler.GetImposeBcsOnCoarseBoundary(), false);
// Test AddPdeAndBc()
SimpleUniformSourcePde<2> pde(-0.1);
ConstBoundaryCondition<2> bc(1.0);
PdeAndBoundaryConditions<2> pde_and_bc(&pde, &bc, false);
pde_and_bc.SetDependentVariableName("averaged quantity");
unsigned num_nodes = mesh.GetNumNodes();
std::vector<double> data(num_nodes);
for (unsigned i=0; i<num_nodes; i++)
{
data[i] = i + 0.45;
}
Vec vector = PetscTools::CreateVec(data);
pde_and_bc.SetSolution(vector);
pde_handler.AddPdeAndBc(&pde_and_bc);
TS_ASSERT_EQUALS(pde_handler.mPdeAndBcCollection[0]->IsNeumannBoundaryCondition(), false);
TS_ASSERT_EQUALS(pde_handler.mPdeAndBcCollection[0]->HasAveragedSourcePde(), false);
ReplicatableVector solution(pde_handler.GetPdeSolution());
TS_ASSERT_EQUALS(solution.GetSize(), num_nodes);
for (unsigned i=0; i<num_nodes; i++)
{
TS_ASSERT_DELTA(solution[i], i + 0.45, 1e-4);
}
}
void TestCellBasedPdeHandlerOutputParameters() throw(Exception)
{
EXIT_IF_PARALLEL;
std::string output_directory = "TestCellBasedPdeHandlerOutputParameters";
OutputFileHandler output_file_handler(output_directory, false);
// Create a cell population
HoneycombMeshGenerator generator(2, 2, 0);
MutableMesh<2,2>* p_generating_mesh = generator.GetMesh();
NodesOnlyMesh<2> mesh;
mesh.ConstructNodesWithoutMesh(*p_generating_mesh, 1.5);
std::vector<CellPtr> cells;
CellsGenerator<FixedDurationGenerationBasedCellCycleModel, 2> cells_generator;
cells_generator.GenerateBasic(cells, mesh.GetNumNodes());
NodeBasedCellPopulation<2> cell_population(mesh, cells);
// Create a PDE handler object using this cell population
CellBasedPdeHandler<2> pde_handler(&cell_population);
// Test output methods
TS_ASSERT_EQUALS(pde_handler.GetIdentifier(), "CellBasedPdeHandler-2");
out_stream pde_handler_parameter_file = output_file_handler.OpenOutputFile("CellBasedPdeHandler.parameters");
pde_handler.OutputParameters(pde_handler_parameter_file);
pde_handler_parameter_file->close();
{
// Compare the generated file in test output with a reference copy in the source code.
FileFinder generated = output_file_handler.FindFile("CellBasedPdeHandler.parameters");
FileFinder reference("cell_based/test/data/TestCellBasedPdeHandler/CellBasedPdeHandler.parameters",
RelativeTo::ChasteSourceRoot);
FileComparison comparer(generated, reference);
TS_ASSERT(comparer.CompareFiles());
}
}
void TestArchiving() throw(Exception)
{
EXIT_IF_PARALLEL;
FileFinder archive_dir("archive", RelativeTo::ChasteTestOutput);
std::string archive_file = "CellBasedPdeHandler.arch";
ArchiveLocationInfo::SetMeshFilename("pde_handler_mesh");
{
// Create a cell population
HoneycombMeshGenerator generator(2, 2, 0);
MutableMesh<2,2>* p_generating_mesh = generator.GetMesh();
NodesOnlyMesh<2> mesh;
mesh.ConstructNodesWithoutMesh(*p_generating_mesh, 1.5);
std::vector<CellPtr> cells;
CellsGenerator<FixedDurationGenerationBasedCellCycleModel, 2> cells_generator;
cells_generator.GenerateBasic(cells, mesh.GetNumNodes());
NodeBasedCellPopulation<2> cell_population(mesh, cells);
// Create a PDE handler object using this cell population
CellBasedPdeHandler<2>* const p_pde_handler = new CellBasedPdeHandler<2>(&cell_population);
// Set member variables for testing
p_pde_handler->SetWriteAverageRadialPdeSolution("averaged quantity", 5, true);
p_pde_handler->SetImposeBcsOnCoarseBoundary(false);
// Set up PDE and pass to handler
AveragedSourcePde<2> pde(cell_population, -0.1);
ConstBoundaryCondition<2> bc(1.0);
PdeAndBoundaryConditions<2> pde_and_bc(&pde, &bc, false);
pde_and_bc.SetDependentVariableName("averaged quantity");
p_pde_handler->AddPdeAndBc(&pde_and_bc);
// Test UseCoarsePdeMesh() again
ChastePoint<2> lower(0.0, 0.0);
ChastePoint<2> upper(9.0, 9.0);
ChasteCuboid<2> cuboid(lower, upper);
p_pde_handler->UseCoarsePdeMesh(3.0, cuboid, true);
// Create an output archive
ArchiveOpener<boost::archive::text_oarchive, std::ofstream> arch_opener(archive_dir, archive_file);
boost::archive::text_oarchive* p_arch = arch_opener.GetCommonArchive();
// Archive object
SimulationTime* p_simulation_time = SimulationTime::Instance();
p_simulation_time->SetEndTimeAndNumberOfTimeSteps(1.0, 11);
(*p_arch) << static_cast<const SimulationTime&>(*p_simulation_time);
(*p_arch) << p_pde_handler;
// Tidy up
SimulationTime::Destroy();
delete p_pde_handler;
}
{
CellBasedPdeHandler<2>* p_pde_handler;
// Create an input archive
ArchiveOpener<boost::archive::text_iarchive, std::ifstream> arch_opener(archive_dir, archive_file);
boost::archive::text_iarchive* p_arch = arch_opener.GetCommonArchive();
// Restore object from the archive
SimulationTime* p_simulation_time = SimulationTime::Instance();
(*p_arch) >> *p_simulation_time;
(*p_arch) >> p_pde_handler;
// Test that the member variables were archived correctly
TS_ASSERT_EQUALS(p_pde_handler->mpCellPopulation->GetNumRealCells(), 4u);
TS_ASSERT_EQUALS(p_pde_handler->GetWriteAverageRadialPdeSolution(), true);
TS_ASSERT_EQUALS(p_pde_handler->GetWriteDailyAverageRadialPdeSolution(), true);
TS_ASSERT_EQUALS(p_pde_handler->GetImposeBcsOnCoarseBoundary(), false);
TS_ASSERT_EQUALS(p_pde_handler->GetNumRadialIntervals(), 5u);
TS_ASSERT_EQUALS(p_pde_handler->mAverageRadialSolutionVariableName, "averaged quantity");
///\todo we currently do not archive mpCoarsePdeMesh - consider doing this (#1891)
TS_ASSERT(p_pde_handler->GetCoarsePdeMesh() == NULL);
TS_ASSERT_EQUALS(p_pde_handler->mPdeAndBcCollection.size(), 1u);
TS_ASSERT_EQUALS(p_pde_handler->mPdeAndBcCollection[0]->IsNeumannBoundaryCondition(), false);
// Tidy up
delete p_pde_handler->mpCellPopulation;
delete p_pde_handler;
}
}
void TestArchivingOfPdeHandlerOnCuboid() throw(Exception)
{
EXIT_IF_PARALLEL;
FileFinder archive_dir("archive", RelativeTo::ChasteTestOutput);
std::string archive_file = "CellBasedPdeHandlerOnCuboid.arch";
ArchiveLocationInfo::SetMeshFilename("pde_handler_mesh");
{
// Create a cell population
HoneycombMeshGenerator generator(2, 2, 0);
MutableMesh<2,2>* p_generating_mesh = generator.GetMesh();
NodesOnlyMesh<2> mesh;
mesh.ConstructNodesWithoutMesh(*p_generating_mesh, 1.5);
std::vector<CellPtr> cells;
CellsGenerator<FixedDurationGenerationBasedCellCycleModel, 2> cells_generator;
cells_generator.GenerateBasic(cells, mesh.GetNumNodes());
NodeBasedCellPopulation<2> cell_population(mesh, cells);
// Create a PDE handler object using this cell population
CellBasedPdeHandlerOnCuboid<2>* const p_pde_handler = new CellBasedPdeHandlerOnCuboid<2>(&cell_population);
// Set member variables for testing
p_pde_handler->SetWriteAverageRadialPdeSolution("averaged quantity", 5, true);
p_pde_handler->SetImposeBcsOnCoarseBoundary(false);
// Set up PDE and pass to handler
AveragedSourcePde<2> pde(cell_population, -0.1);
ConstBoundaryCondition<2> bc(1.0);
PdeAndBoundaryConditions<2> pde_and_bc(&pde, &bc, false);
pde_and_bc.SetDependentVariableName("averaged quantity");
p_pde_handler->AddPdeAndBc(&pde_and_bc);
// Test UseCoarsePdeMesh() again
ChastePoint<2> lower(0.0, 0.0);
ChastePoint<2> upper(9.0, 9.0);
ChasteCuboid<2> cuboid(lower, upper);
p_pde_handler->UseCoarsePdeMesh(3.0, cuboid, true);
// Create an output archive
ArchiveOpener<boost::archive::text_oarchive, std::ofstream> arch_opener(archive_dir, archive_file);
boost::archive::text_oarchive* p_arch = arch_opener.GetCommonArchive();
// Archive object
SimulationTime* p_simulation_time = SimulationTime::Instance();
p_simulation_time->SetEndTimeAndNumberOfTimeSteps(1.0, 11);
(*p_arch) << static_cast<const SimulationTime&>(*p_simulation_time);
(*p_arch) << p_pde_handler;
// Tidy up
SimulationTime::Destroy();
delete p_pde_handler;
}
{
CellBasedPdeHandlerOnCuboid<2>* p_pde_handler;
// Create an input archive
ArchiveOpener<boost::archive::text_iarchive, std::ifstream> arch_opener(archive_dir, archive_file);
boost::archive::text_iarchive* p_arch = arch_opener.GetCommonArchive();
// Restore object from the archive
SimulationTime* p_simulation_time = SimulationTime::Instance();
(*p_arch) >> *p_simulation_time;
(*p_arch) >> p_pde_handler;
// Test that the member variables were archived correctly
TS_ASSERT_EQUALS(p_pde_handler->mpCellPopulation->GetNumRealCells(), 4u);
TS_ASSERT_EQUALS(p_pde_handler->GetWriteAverageRadialPdeSolution(), true);
TS_ASSERT_EQUALS(p_pde_handler->GetWriteDailyAverageRadialPdeSolution(), true);
TS_ASSERT_EQUALS(p_pde_handler->GetImposeBcsOnCoarseBoundary(), false);
TS_ASSERT_EQUALS(p_pde_handler->GetNumRadialIntervals(), 5u);
TS_ASSERT_EQUALS(p_pde_handler->mAverageRadialSolutionVariableName, "averaged quantity");
///\todo we currently do not archive mpCoarsePdeMesh - consider doing this (#1891)
TS_ASSERT(p_pde_handler->GetCoarsePdeMesh() == NULL);
TS_ASSERT_EQUALS(p_pde_handler->mPdeAndBcCollection.size(), 1u);
TS_ASSERT_EQUALS(p_pde_handler->mPdeAndBcCollection[0]->IsNeumannBoundaryCondition(), false);
// Tidy up
delete p_pde_handler->mpCellPopulation;
delete p_pde_handler;
}
}
void TestUseCoarsePdeMesh() throw(Exception)
{
EXIT_IF_PARALLEL;
// Create a cell population
HoneycombMeshGenerator generator(4, 4, 0);
MutableMesh<2,2>* p_generating_mesh = generator.GetMesh();
NodesOnlyMesh<2> mesh;
mesh.ConstructNodesWithoutMesh(*p_generating_mesh, 1.5);
std::vector<CellPtr> cells;
CellsGenerator<FixedDurationGenerationBasedCellCycleModel, 2> cells_generator;
cells_generator.GenerateBasic(cells, mesh.GetNumNodes());
NodeBasedCellPopulation<2> cell_population(mesh, cells);
// Create a PDE handler object using this cell population
CellBasedPdeHandler<2> pde_handler(&cell_population);
// Test that UseCoarsePdeMesh() throws an exception if no PDEs are specified
ChastePoint<2> lower(0.0, 0.0);
ChastePoint<2> upper(9.0, 9.0);
ChasteCuboid<2> cuboid(lower, upper);
TS_ASSERT_THROWS_THIS(pde_handler.UseCoarsePdeMesh(3.0, cuboid, true),
"mPdeAndBcCollection should be populated prior to calling UseCoarsePdeMesh().");
// Set up PDE and pass to handler
AveragedSourcePde<2> pde(cell_population, -0.1);
ConstBoundaryCondition<2> bc(1.0);
PdeAndBoundaryConditions<2> pde_and_bc(&pde, &bc, false);
pde_handler.AddPdeAndBc(&pde_and_bc);
// Test UseCoarsePdeMesh() again
pde_handler.UseCoarsePdeMesh(3.0, cuboid, true);
// Test that the coarse mesh has the correct number of nodes and elements
TetrahedralMesh<2,2>* p_coarse_mesh = pde_handler.GetCoarsePdeMesh();
TS_ASSERT_EQUALS(p_coarse_mesh->GetNumNodes(), 16u);
TS_ASSERT_EQUALS(p_coarse_mesh->GetNumElements(), 18u);
// Find centre of cell population
c_vector<double,2> centre_of_cell_population = cell_population.GetCentroidOfCellPopulation();
// Find centre of coarse PDE mesh
c_vector<double,2> centre_of_coarse_pde_mesh = zero_vector<double>(2);
for (unsigned i=0; i<p_coarse_mesh->GetNumNodes(); i++)
{
centre_of_coarse_pde_mesh += p_coarse_mesh->GetNode(i)->rGetLocation();
}
centre_of_coarse_pde_mesh /= p_coarse_mesh->GetNumNodes();
// Test that the two centres match
c_vector<double,2> centre_difference = centre_of_cell_population - centre_of_coarse_pde_mesh;
TS_ASSERT_DELTA(norm_2(centre_difference), 0.0, 1e-4);
// Test that UseCoarsePdeMesh() throws an exception if the wrong type of PDE is specified
SimpleUniformSourcePde<2> pde2(-0.1);
ConstBoundaryCondition<2> bc2(1.0);
PdeAndBoundaryConditions<2> pde_and_bc2(&pde2, &bc2, false);
pde_and_bc2.SetDependentVariableName("second variable");
pde_handler.AddPdeAndBc(&pde_and_bc2);
TS_ASSERT_THROWS_THIS(pde_handler.UseCoarsePdeMesh(3.0, cuboid, true),
"UseCoarsePdeMesh() should only be called if averaged-source PDEs are specified.");
// Now test the 1D case
std::vector<Node<1>*> nodes_1d;
nodes_1d.push_back(new Node<1>(0, true, 0.0));
NodesOnlyMesh<1> mesh_1d;
mesh_1d.ConstructNodesWithoutMesh(nodes_1d, 1.5);
std::vector<CellPtr> cells_1d;
CellsGenerator<FixedDurationGenerationBasedCellCycleModel, 1> cells_generator_1d;
cells_generator_1d.GenerateBasic(cells_1d, mesh_1d.GetNumNodes());
NodeBasedCellPopulation<1> cell_population_1d(mesh_1d, cells_1d);
CellBasedPdeHandler<1> pde_handler_1d(&cell_population_1d);
AveragedSourcePde<1> pde_1d(cell_population_1d, -0.1);
ConstBoundaryCondition<1> bc_1d(1.0);
PdeAndBoundaryConditions<1> pde_and_bc_1d(&pde_1d, &bc_1d, false);
pde_handler_1d.AddPdeAndBc(&pde_and_bc_1d);
ChastePoint<1> lower1(0.0);
ChastePoint<1> upper1(9.0);
ChasteCuboid<1> cuboid1(lower1, upper1);
pde_handler_1d.UseCoarsePdeMesh(3.0, cuboid1, true);
// Test that the coarse mesh has the correct number of nodes and elements
TetrahedralMesh<1,1>* p_coarse_mesh_1d = pde_handler_1d.GetCoarsePdeMesh();
TS_ASSERT_EQUALS(p_coarse_mesh_1d->GetNumNodes(), 4u);
TS_ASSERT_EQUALS(p_coarse_mesh_1d->GetNumElements(), 3u);
// Now test the 3D case
std::vector<Node<3>*> nodes_3d;
nodes_3d.push_back(new Node<3>(0, true, 0.0));
NodesOnlyMesh<3> mesh_3d;
mesh_3d.ConstructNodesWithoutMesh(nodes_3d, 1.5);
std::vector<CellPtr> cells_3d;
CellsGenerator<FixedDurationGenerationBasedCellCycleModel, 3> cells_generator_3d;
cells_generator_3d.GenerateBasic(cells_3d, mesh_3d.GetNumNodes());
NodeBasedCellPopulation<3> cell_population_3d(mesh_3d, cells_3d);
CellBasedPdeHandler<3> pde_handler_3d(&cell_population_3d);
AveragedSourcePde<3> pde_3d(cell_population_3d, -0.1);
ConstBoundaryCondition<3> bc_3d(1.0);
PdeAndBoundaryConditions<3> pde_and_bc_3d(&pde_3d, &bc_3d, false);
pde_handler_3d.AddPdeAndBc(&pde_and_bc_3d);
ChastePoint<3> lower3(0.0, 0.0, 0.0);
ChastePoint<3> upper3(9.0, 9.0, 9.0);
ChasteCuboid<3> cuboid3(lower3, upper3);
pde_handler_3d.UseCoarsePdeMesh(3.0, cuboid3, true);
// Test that the coarse mesh has the correct number of nodes and elements
TetrahedralMesh<3,3>* p_coarse_mesh_3d = pde_handler_3d.GetCoarsePdeMesh();
TS_ASSERT_EQUALS(p_coarse_mesh_3d->GetNumNodes(), 64u);
TS_ASSERT_EQUALS(p_coarse_mesh_3d->GetNumElements(), 162u);
// Avoid memory leak
for (unsigned i=0; i<nodes_1d.size(); i++)
{
delete nodes_1d[i];
delete nodes_3d[i];
}
}
void TestUseCoarsePdeMeshNotCentredOnPopulation() throw(Exception)
{
EXIT_IF_PARALLEL;
// Create a cell population
HoneycombMeshGenerator generator(4, 4, 0);
MutableMesh<2,2>* p_generating_mesh = generator.GetMesh();
NodesOnlyMesh<2> mesh;
mesh.ConstructNodesWithoutMesh(*p_generating_mesh, 1.5);
std::vector<CellPtr> cells;
CellsGenerator<FixedDurationGenerationBasedCellCycleModel, 2> cells_generator;
cells_generator.GenerateBasic(cells, mesh.GetNumNodes());
NodeBasedCellPopulation<2> cell_population(mesh, cells);
// Create a PDE handler object using this cell population
CellBasedPdeHandler<2> pde_handler(&cell_population);
// Test that UseCoarsePdeMesh() throws an exception if no PDEs are specified
ChastePoint<2> lower(0.0, 0.0);
ChastePoint<2> upper(9.0, 9.0);
ChasteCuboid<2> cuboid(lower, upper);
// Set up PDE and pass to handler
AveragedSourcePde<2> pde(cell_population, -0.1);
ConstBoundaryCondition<2> bc(1.0);
PdeAndBoundaryConditions<2> pde_and_bc(&pde, &bc, false);
pde_handler.AddPdeAndBc(&pde_and_bc);
// Test UseCoarsePdeMesh() again
pde_handler.UseCoarsePdeMesh(3.0, cuboid);
// Check that the centre of the mesh co-incides with centre of the cuboid.
c_vector<double,2> centre_of_coarse_mesh = zero_vector<double>(2);
for (unsigned i=0; i<pde_handler.GetCoarsePdeMesh()->GetNumNodes(); i++)
{
centre_of_coarse_mesh += pde_handler.GetCoarsePdeMesh()->GetNode(i)->rGetLocation();
}
centre_of_coarse_mesh /= pde_handler.GetCoarsePdeMesh()->GetNumNodes();
c_vector<double,2> centre_of_cuboid = 0.5*(lower.rGetLocation() + upper.rGetLocation());
TS_ASSERT_DELTA(norm_2(centre_of_cuboid - centre_of_coarse_mesh), 0.0, 1e-4);
}
void TestInitialiseCellPdeElementMapAndFindCoarseElementContainingCell() throw(Exception)
{
EXIT_IF_PARALLEL;
// Create a cell population
HoneycombMeshGenerator generator(4, 4, 0);
MutableMesh<2,2>* p_generating_mesh = generator.GetMesh();
NodesOnlyMesh<2> mesh;
mesh.ConstructNodesWithoutMesh(*p_generating_mesh, 1.5);
std::vector<CellPtr> cells;
CellsGenerator<FixedDurationGenerationBasedCellCycleModel, 2> cells_generator;
cells_generator.GenerateBasic(cells, mesh.GetNumNodes());
NodeBasedCellPopulation<2> cell_population(mesh, cells);
// Create a PDE handler object using this cell population
CellBasedPdeHandler<2> pde_handler(&cell_population);
TS_ASSERT_EQUALS(pde_handler.mCellPdeElementMap.size(), 0u);
// Test that InitialiseCellPdeElementMap() throws an exception if mpCoarsePdeMesh is not set up
TS_ASSERT_THROWS_THIS(pde_handler.InitialiseCellPdeElementMap(),
"InitialiseCellPdeElementMap() should only be called if mpCoarsePdeMesh is set up.");
// Set up PDE and pass to handler
AveragedSourcePde<2> pde(cell_population, -0.1);
ConstBoundaryCondition<2> bc(1.0);
PdeAndBoundaryConditions<2> pde_and_bc(&pde, &bc, false);
pde_handler.AddPdeAndBc(&pde_and_bc);
// Use a coarse PDE mesh
ChastePoint<2> lower(0.0, 0.0);
ChastePoint<2> upper(9.0, 9.0);
ChasteCuboid<2> cuboid(lower, upper);
pde_handler.UseCoarsePdeMesh(3.0, cuboid, true);
// Test that mCellPdeElementMap is initialised correctly
pde_handler.InitialiseCellPdeElementMap();
TS_ASSERT_EQUALS(pde_handler.mCellPdeElementMap.size(), cell_population.GetNumRealCells());
for (AbstractCellPopulation<2>::Iterator cell_iter = cell_population.Begin();
cell_iter != cell_population.End();
++cell_iter)
{
unsigned containing_element_index = pde_handler.mCellPdeElementMap[*cell_iter];
TS_ASSERT_LESS_THAN(containing_element_index, pde_handler.GetCoarsePdeMesh()->GetNumElements());
TS_ASSERT_EQUALS(containing_element_index, pde_handler.FindCoarseElementContainingCell(*cell_iter));
}
}
void TestWritingToFile() throw(Exception)
{
EXIT_IF_PARALLEL;
std::string output_directory = "TestCellBasedPdeHandlerWritingToFile";
// Create a cell population
HoneycombMeshGenerator generator(4, 4, 0);
MutableMesh<2,2>* p_generating_mesh = generator.GetMesh();
NodesOnlyMesh<2> mesh;
mesh.ConstructNodesWithoutMesh(*p_generating_mesh, 1.5);
std::vector<CellPtr> cells;
CellsGenerator<FixedDurationGenerationBasedCellCycleModel, 2> cells_generator;
cells_generator.GenerateBasic(cells, mesh.GetNumNodes());
TS_ASSERT_EQUALS(cells.size(), mesh.GetNumNodes());
NodeBasedCellPopulation<2> cell_population(mesh, cells);
cell_population.SetDataOnAllCells("variable", 1.0);
// Create a PDE handler object using this cell population
CellBasedPdeHandler<2> pde_handler(&cell_population);
TS_ASSERT_THROWS_THIS(pde_handler.OpenResultsFiles(output_directory),
"Trying to solve a PDE on a cell population that doesn't have a mesh. Try calling UseCoarsePdeMesh().");
// Use a coarse PDE mesh since we are using a node-based cell population
AveragedSourcePde<2> pde(cell_population, -0.1);
ConstBoundaryCondition<2> bc(1.0);
PdeAndBoundaryConditions<2> pde_and_bc(&pde, &bc, false);
pde_and_bc.SetDependentVariableName("variable");
pde_handler.AddPdeAndBc(&pde_and_bc);
ChastePoint<2> lower(0.0, 0.0);
ChastePoint<2> upper(9.0, 9.0);
ChasteCuboid<2> cuboid(lower, upper);
pde_handler.UseCoarsePdeMesh(3.0, cuboid, true);
// For coverage, call SetWriteAverageRadialPdeSolution() prior to output
pde_handler.SetWriteAverageRadialPdeSolution("variable", 5, true);
// Test that output files are opened correctly
pde_handler.OpenResultsFiles(output_directory);
FileFinder file_finder(output_directory + "/results.vizcoarsepdesolution", RelativeTo::ChasteTestOutput);
TS_ASSERT(file_finder.Exists());
TS_ASSERT(file_finder.IsFile());
FileFinder file_finder2(output_directory + "/radial_dist.dat", RelativeTo::ChasteTestOutput);
TS_ASSERT(file_finder2.Exists());
TS_ASSERT(file_finder2.IsFile());
TS_ASSERT_THROWS_NOTHING(pde_handler.CloseResultsFiles());
// For coverage, also test that output files are opened correctly when not using a coarse PDE mesh
HoneycombMeshGenerator generator2(5, 5, 0);
MutableMesh<2,2>* p_mesh2 = generator2.GetMesh();
std::vector<CellPtr> cells2;
CellsGenerator<FixedDurationGenerationBasedCellCycleModel, 2> cells_generator2;
cells_generator2.GenerateBasic(cells2, p_mesh2->GetNumNodes());
MeshBasedCellPopulation<2> cell_population2(*p_mesh2, cells2);
cell_population2.SetDataOnAllCells("another variable", 1.0);
CellBasedPdeHandler<2> pde_handler2(&cell_population2);
pde_handler2.OpenResultsFiles(output_directory);
FileFinder file_finder3(output_directory + "/results.vizpdesolution", RelativeTo::ChasteTestOutput);
TS_ASSERT(file_finder3.Exists());
TS_ASSERT(file_finder3.IsFile());
pde_handler2.CloseResultsFiles();
}
void TestWriteAverageRadialPdeSolution() throw(Exception)
{
EXIT_IF_PARALLEL;
// Create a cell population using a circular mesh
HoneycombMeshGenerator generator(5, 5, 0);
MutableMesh<2,2>* p_mesh = generator.GetMesh();
std::vector<CellPtr> cells;
CellsGenerator<FixedDurationGenerationBasedCellCycleModel, 2> cells_generator;
cells_generator.GenerateBasic(cells, p_mesh->GetNumNodes());
MeshBasedCellPopulation<2> cell_population(*p_mesh, cells);
// Put random data on the cells
for (AbstractCellPopulation<2>::Iterator cell_iter = cell_population.Begin();
cell_iter != cell_population.End();
++cell_iter)
{
cell_iter->GetCellData()->SetItem("averaged quantity", RandomNumberGenerator::Instance()->ranf());
}
// Create a PDE handler object using this cell population
CellBasedPdeHandler<2> pde_handler(&cell_population);
pde_handler.SetWriteAverageRadialPdeSolution("averaged quantity", 2);
// Open result file ourselves
OutputFileHandler output_file_handler("TestWriteAverageRadialPdeSolution", false);
pde_handler.mpAverageRadialPdeSolutionResultsFile = output_file_handler.OpenOutputFile("radial_dist.dat");
// Write average radial PDE solution to file
pde_handler.WriteAverageRadialPdeSolution(SimulationTime::Instance()->GetTime());
// Test that this is correct by comparing with an existing results file
std::string results_dir = output_file_handler.GetOutputDirectoryFullPath();
NumericFileComparison comparison(results_dir + "/radial_dist.dat", "cell_based/test/data/TestCellBasedPdeHandler/radial_dist.dat");
TS_ASSERT(comparison.CompareFiles());
// Close result file ourselves
pde_handler.mpAverageRadialPdeSolutionResultsFile->close();
}
void TestSolvePdeAndWriteResultsToFileAndGetPDESolutionAtPointWithoutCoarsePdeMeshDirichlet() throw(Exception)
{
EXIT_IF_PARALLEL;
// Set up SimulationTime
SimulationTime::Instance()->SetEndTimeAndNumberOfTimeSteps(0.5, 6);
// Set up mesh
MutableMesh<2,2> mesh;
TrianglesMeshReader<2,2> mesh_reader("mesh/test/data/disk_522_elements");
mesh.ConstructFromMeshReader(mesh_reader);
// Set up cells
std::vector<CellPtr> cells;
CellsGenerator<FixedDurationGenerationBasedCellCycleModel, 2> cells_generator;
cells_generator.GenerateBasic(cells, mesh.GetNumNodes());
// Set up cell population
MeshBasedCellPopulation<2> cell_population(mesh, cells);
// Create a PDE handler object using this cell population
CellBasedPdeHandler<2> pde_handler(&cell_population);
// Create a single PDE and pass to the handler
SimplePdeForTesting pde;
ConstBoundaryCondition<2> bc(1.0);
PdeAndBoundaryConditions<2> pde_and_bc(&pde, &bc, false);
pde_and_bc.SetDependentVariableName("variable");
// For coverage, provide an initial guess for the solution
std::vector<double> data(mesh.GetNumNodes());
for (unsigned i=0; i<mesh.GetNumNodes(); i++)
{
data[i] = 1.0;
}
Vec vector = PetscTools::CreateVec(data);
pde_and_bc.SetSolution(vector);
pde_handler.AddPdeAndBc(&pde_and_bc);
// Open result file ourselves
OutputFileHandler output_file_handler("TestWritePdeSolution", false);
pde_handler.mpVizPdeSolutionResultsFile = output_file_handler.OpenOutputFile("results.vizpdesolution");
// Solve PDE (set sampling timestep multiple to be large doesn't do anything as always output on 1st timestep)
pde_handler.SolvePdeAndWriteResultsToFile(10);
// Close result file ourselves
pde_handler.mpVizPdeSolutionResultsFile->close();
// Test that this is correct by comparing with an existing results file
std::string results_dir = output_file_handler.GetOutputDirectoryFullPath();
NumericFileComparison comparison(results_dir + "results.vizpdesolution", "cell_based/test/data/TestCellBasedPdeHandler/results.vizpdesolution");
TS_ASSERT(comparison.CompareFiles());
// Check the correct solution was obtained
for (AbstractCellPopulation<2>::Iterator cell_iter = cell_population.Begin();
cell_iter != cell_population.End();
++cell_iter)
{
double radius = norm_2(cell_population.GetLocationOfCellCentre(*cell_iter));
double analytic_solution = 1.0 - 0.25*(1 - pow(radius,2.0));
// Test that PDE solver is working correctly
TS_ASSERT_DELTA(cell_iter->GetCellData()->GetItem("variable"), analytic_solution, 0.02);
}
// Now check the GetPdeSolutionAtPoint method
// First loop over nodes and check it works
// Check the correct solution was obtained
for (AbstractCellPopulation<2>::Iterator cell_iter = cell_population.Begin();
cell_iter != cell_population.End();
++cell_iter)
{
double cell_data_solution(cell_iter->GetCellData()->GetItem("variable"));
c_vector<double,2> cell_location = cell_population.GetLocationOfCellCentre(*cell_iter);
TS_ASSERT_DELTA(pde_handler.GetPdeSolutionAtPoint(cell_location,"variable"), cell_data_solution, 1e-6);
}
// Now choose some other points
// Centre
c_vector<double,2> point;
point(0) = 0.0;
point(1) = 0.0;
TS_ASSERT_DELTA(pde_handler.GetPdeSolutionAtPoint(point,"variable"), 0.75, 0.01);
// Cover exception
TS_ASSERT_THROWS_CONTAINS(pde_handler.GetPdeSolutionAtPoint(point, "not_a_var"),
"There is no PDE with that variable.");
// Random point
point(0) = 0.5;
point(1) = 0.5;
TS_ASSERT_DELTA(pde_handler.GetPdeSolutionAtPoint(point,"variable"), 1.0 - (1.0-2.0*0.5*0.5)/4.0, 0.01);
// Point on the boundary
point(0) = 1.0;
point(1) = 0.0;
TS_ASSERT_DELTA(pde_handler.GetPdeSolutionAtPoint(point,"variable"), 1.0, 1e-6);
}
void TestSolvePdeAndWriteResultsToFileWithoutCoarsePdeMeshNeumann() throw(Exception)
{
EXIT_IF_PARALLEL;
// Set up SimulationTime
SimulationTime::Instance()->SetEndTimeAndNumberOfTimeSteps(0.5, 6);
// Set up mesh
MutableMesh<2,2> mesh;
TrianglesMeshReader<2,2> mesh_reader("mesh/test/data/disk_522_elements");
mesh.ConstructFromMeshReader(mesh_reader);
// Set up cells
std::vector<CellPtr> cells;
CellsGenerator<FixedDurationGenerationBasedCellCycleModel, 2> cells_generator;
cells_generator.GenerateBasic(cells, mesh.GetNumNodes());
// Set up cell population
MeshBasedCellPopulation<2> cell_population(mesh, cells);
// Create a PDE handler object using this cell population
CellBasedPdeHandler<2> pde_handler(&cell_population);
// Create a single PDE and pass to the handler
// Note SimplePdeForTesting wouldnt work as theres no solution with Neuman conditions.
// Also note that when using Neuman conditions the only solution that works is u=0
CellwiseSourcePde<2> pde(cell_population, 0.0);
ConstBoundaryCondition<2> bc(0.0);
PdeAndBoundaryConditions<2> pde_and_bc(&pde, &bc, true);
pde_and_bc.SetDependentVariableName("variable");
// For coverage, provide an initial guess for the solution
std::vector<double> data(mesh.GetNumNodes()+1);
for (unsigned i=0; i<mesh.GetNumNodes(); i++)
{
data[i] = 1.0;
}
Vec vector = PetscTools::CreateVec(data);
pde_and_bc.SetSolution(vector);
pde_handler.AddPdeAndBc(&pde_and_bc);
// Open result file ourselves
OutputFileHandler output_file_handler("TestWritePdeSolution", false);
pde_handler.mpVizPdeSolutionResultsFile = output_file_handler.OpenOutputFile("results.vizpdesolution");
// Solve PDE (set sampling timestep multiple to be large doesn't do anything as always output on 1st timestep)
pde_handler.SolvePdeAndWriteResultsToFile(10);
// Close result file ourselves
pde_handler.mpVizPdeSolutionResultsFile->close();
// Check the correct solution was obtained
for (AbstractCellPopulation<2>::Iterator cell_iter = cell_population.Begin();
cell_iter != cell_population.End();
++cell_iter)
{
// Test that PDE solver is working correctly
TS_ASSERT_DELTA(cell_iter->GetCellData()->GetItem("variable"), 0.0, 0.02);
}
}
void TestSolvePdeAndWriteResultsToFileCoarsePdeMeshDirichlet() throw(Exception)
{
EXIT_IF_PARALLEL;
// Set up SimulationTime
SimulationTime::Instance()->SetEndTimeAndNumberOfTimeSteps(0.05, 6);
// Create a cigar-shaped mesh
TrianglesMeshReader<2,2> mesh_reader("mesh/test/data/disk_522_elements");
MutableMesh<2,2> mesh;
mesh.ConstructFromMeshReader(mesh_reader);
mesh.Scale(5.0, 1.0);
// Create a cell population
std::vector<CellPtr> cells;
CellsGenerator<FixedDurationGenerationBasedCellCycleModel, 2> cells_generator;
cells_generator.GenerateBasic(cells, mesh.GetNumNodes());
MeshBasedCellPopulation<2> cell_population(mesh, cells);
// Create a PDE handler object using this cell population
CellBasedPdeHandler<2> pde_handler(&cell_population);
// Set up PDE and pass to handler
AveragedSourcePde<2> pde(cell_population, -0.01);
ConstBoundaryCondition<2> bc(1.0);
PdeAndBoundaryConditions<2> pde_and_bc(&pde, &bc, false);
pde_and_bc.SetDependentVariableName("variable");
pde_handler.AddPdeAndBc(&pde_and_bc);
// Solve PDEs on a coarse mesh
ChastePoint<2> lower(0.0, 0.0);
ChastePoint<2> upper(50.0, 50.0);
ChasteCuboid<2> cuboid(lower, upper);
pde_handler.UseCoarsePdeMesh(10.0, cuboid, true);
pde_handler.SetImposeBcsOnCoarseBoundary(false);
// For coverage, provide an initial guess for the solution
std::vector<double> data(pde_handler.mpCoarsePdeMesh->GetNumNodes());
for (unsigned i=0; i<pde_handler.mpCoarsePdeMesh->GetNumNodes(); i++)
{
data[i] = 1.0;
}
Vec vector = PetscTools::CreateVec(data);
pde_and_bc.SetSolution(vector);
// Open result file ourselves
OutputFileHandler output_file_handler("TestWritePdeSolution", false);
pde_handler.mpVizPdeSolutionResultsFile = output_file_handler.OpenOutputFile("results.vizpdesolution");
// Solve PDE (set sampling timestep multiple to be large doesn't do anything as always output on 1st timestep)
pde_handler.SolvePdeAndWriteResultsToFile(10);
// Close result file ourselves
pde_handler.mpVizPdeSolutionResultsFile->close();
// Test that boundary cells experience the right boundary condition
for (AbstractCellPopulation<2>::Iterator cell_iter = cell_population.Begin();
cell_iter != cell_population.End();
++cell_iter)
{
if (cell_population.GetNodeCorrespondingToCell(*cell_iter)->IsBoundaryNode())
{
TS_ASSERT_DELTA(cell_iter->GetCellData()->GetItem("variable"), 1.0, 1e-1);
}
}
}
void TestSolvePdeAndWriteResultsToFileCoarsePdeMeshNeumann() throw(Exception)
{
EXIT_IF_PARALLEL;
// Set up SimulationTime
SimulationTime::Instance()->SetEndTimeAndNumberOfTimeSteps(0.05, 6);
// Create a cigar-shaped mesh
TrianglesMeshReader<2,2> mesh_reader("mesh/test/data/disk_522_elements");
MutableMesh<2,2> mesh;
mesh.ConstructFromMeshReader(mesh_reader);
mesh.Scale(5.0, 1.0);
// Create a cell population
std::vector<CellPtr> cells;
CellsGenerator<FixedDurationGenerationBasedCellCycleModel, 2> cells_generator;
cells_generator.GenerateBasic(cells, mesh.GetNumNodes());
MeshBasedCellPopulation<2> cell_population(mesh, cells);
// Create a PDE handler object using this cell population
CellBasedPdeHandler<2> pde_handler(&cell_population);
// Set up PDE and pass to handler
AveragedSourcePde<2> pde(cell_population, -0.01);
ConstBoundaryCondition<2> bc(0.0);
PdeAndBoundaryConditions<2> pde_and_bc(&pde, &bc, true); // Last boolean specifies Neuman conditions
pde_and_bc.SetDependentVariableName("variable");
pde_handler.AddPdeAndBc(&pde_and_bc);
// Solve PDEs on a coarse mesh
ChastePoint<2> lower(0.0, 0.0);
ChastePoint<2> upper(50.0, 50.0);
ChasteCuboid<2> cuboid(lower, upper);
pde_handler.UseCoarsePdeMesh(10.0, cuboid, true);
pde_handler.SetImposeBcsOnCoarseBoundary(false);
// For coverage, provide an initial guess for the solution
std::vector<double> data(pde_handler.mpCoarsePdeMesh->GetNumNodes());
for (unsigned i=0; i<pde_handler.mpCoarsePdeMesh->GetNumNodes(); i++)
{
data[i] = 1.0;
}
Vec vector = PetscTools::CreateVec(data);
pde_and_bc.SetSolution(vector);
// Open result file ourselves
OutputFileHandler output_file_handler("TestWritePdeSolution", false);
pde_handler.mpVizPdeSolutionResultsFile = output_file_handler.OpenOutputFile("results.vizpdesolution");
// Solve PDE (set sampling timestep multiple to be large doesn't do anything as always output on 1st timestep)
pde_handler.SolvePdeAndWriteResultsToFile(10);
// Close result file ourselves
pde_handler.mpVizPdeSolutionResultsFile->close();
// Test that boundary cells experience the right boundary condition
for (AbstractCellPopulation<2>::Iterator cell_iter = cell_population.Begin();
cell_iter != cell_population.End();
++cell_iter)
{
if (cell_population.GetNodeCorrespondingToCell(*cell_iter)->IsBoundaryNode())
{
TS_ASSERT_DELTA(cell_iter->GetCellData()->GetItem("variable"), 0.0, 1e-1);
}
}
}
void TestSolvePdeAndWriteResultsToFileWithCoarsePdeMesh() throw(Exception)
{
EXIT_IF_PARALLEL;
// Set up SimulationTime
SimulationTime::Instance()->SetEndTimeAndNumberOfTimeSteps(0.05, 6);
// Create a cell population
HoneycombMeshGenerator generator(5, 5, 0);
MutableMesh<2,2>* p_mesh = generator.GetMesh();
std::vector<CellPtr> cells;
CellsGenerator<FixedDurationGenerationBasedCellCycleModel, 2> cells_generator;
cells_generator.GenerateBasic(cells, p_mesh->GetNumNodes());
MeshBasedCellPopulation<2> cell_population(*p_mesh, cells);
// Create a PDE handler object using this cell population
CellBasedPdeHandler<2> pde_handler(&cell_population);
// Set up PDE and pass to handler
AveragedSourcePde<2> pde(cell_population, -0.1);
ConstBoundaryCondition<2> bc(1.0);
PdeAndBoundaryConditions<2> pde_and_bc(&pde, &bc, false);
pde_and_bc.SetDependentVariableName("quantity 1");
pde_handler.AddPdeAndBc(&pde_and_bc);
// Set up second PDE and pass to handler
AveragedSourcePde<2> pde2(cell_population, -0.5);
PdeAndBoundaryConditions<2> pde_and_bc2(&pde2, &bc, false);
TS_ASSERT_THROWS_THIS(pde_handler.AddPdeAndBc(&pde_and_bc2), "When adding more than one PDE to CellBasedPdeHandler set the dependent variable name using SetDependentVariableName(name).");
pde_and_bc2.SetDependentVariableName("quantity 1");
TS_ASSERT_THROWS_THIS(pde_handler.AddPdeAndBc(&pde_and_bc2), "The name quantity 1 has already been used in the PDE collection");
pde_and_bc2.SetDependentVariableName("quantity 2");
pde_handler.AddPdeAndBc(&pde_and_bc2);
// Solve PDEs on a coarse mesh
ChastePoint<2> lower(0.0, 0.0);
ChastePoint<2> upper(50.0, 50.0);
ChasteCuboid<2> cuboid(lower, upper);
pde_handler.UseCoarsePdeMesh(10.0, cuboid, true);
pde_handler.SetImposeBcsOnCoarseBoundary(false);
// Open result file ourselves
OutputFileHandler output_file_handler("TestSolvePdeAndWriteResultsToFileWithCoarsePdeMesh", false);
pde_handler.mpVizPdeSolutionResultsFile = output_file_handler.OpenOutputFile("results.vizpdesolution");
// Solve PDEs and (for coverage) write results to file
pde_handler.SolvePdeAndWriteResultsToFile(1);
// Close result file ourselves
pde_handler.mpVizPdeSolutionResultsFile->close();
TetrahedralMesh<2,2>* p_coarse_mesh = pde_handler.GetCoarsePdeMesh();
TS_ASSERT(p_coarse_mesh != NULL);
TS_ASSERT_THROWS_THIS(pde_handler.GetPdeSolution("quantity 3"), "The PDE collection does not contain a PDE named quantity 3");
ReplicatableVector pde_solution0(pde_handler.GetPdeSolution("quantity 1"));
ReplicatableVector pde_solution1(pde_handler.GetPdeSolution("quantity 2"));
TS_ASSERT_EQUALS(pde_solution0.GetSize(), pde_solution1.GetSize());
// Test that the solution is 1.0 at each coarse mesh node far from the cells
for (unsigned i=0; i<pde_solution0.GetSize(); i++)
{
c_vector<double,2> centre;
centre(0) = 2.5; // assuming 5x5 honeycomb mesh
centre(1) = 2.5;
c_vector<double,2> position = p_coarse_mesh->GetNode(i)->rGetLocation();
double dist = norm_2(centre - position);
double u0 = pde_solution0[i];
double u1 = pde_solution1[i];
if (dist > 4.0)
{
TS_ASSERT_DELTA(u0, 1.0, 1e-5);
TS_ASSERT_DELTA(u1, 1.0, 1e-5);
}
}
/*
* Loop over cells, find the coarse mesh element containing it, then
* check the interpolated PDE solution is between the min and max of
* the PDE solution on the nodes of that element.
*/
for (AbstractCellPopulation<2>::Iterator cell_iter = cell_population.Begin();
cell_iter != cell_population.End();
++cell_iter)
{
c_vector<double,2> cell_location = cell_population.GetLocationOfCellCentre(*cell_iter);
unsigned elem_index = p_coarse_mesh->GetContainingElementIndex(cell_location);
Element<2,2>* p_element = p_coarse_mesh->GetElement(elem_index);
unsigned node_0_index = p_element->GetNodeGlobalIndex(0);
unsigned node_1_index = p_element->GetNodeGlobalIndex(1);
unsigned node_2_index = p_element->GetNodeGlobalIndex(2);
double max0 = std::max(pde_solution0[node_0_index], pde_solution0[node_1_index]);
max0 = std::max(max0, pde_solution0[node_2_index]);
double max1 = std::max(pde_solution1[node_0_index], pde_solution1[node_1_index]);
max1 = std::max(max1, pde_solution1[node_2_index]);
double min0 = std::min(pde_solution0[node_0_index], pde_solution0[node_1_index]);
min0 = std::min(min0, pde_solution0[node_2_index]);
double min1 = std::min(pde_solution1[node_0_index], pde_solution1[node_1_index]);
min1 = std::min(min1, pde_solution1[node_2_index]);
double value0_at_cell = cell_iter->GetCellData()->GetItem("quantity 1");
double value1_at_cell = cell_iter->GetCellData()->GetItem("quantity 2");
TS_ASSERT_LESS_THAN_EQUALS(value1_at_cell, value0_at_cell);
TS_ASSERT_LESS_THAN_EQUALS(min0, value0_at_cell + DBL_EPSILON);
TS_ASSERT_LESS_THAN_EQUALS(value0_at_cell, max0 + DBL_EPSILON);
TS_ASSERT_LESS_THAN_EQUALS(min1, value1_at_cell + DBL_EPSILON);
TS_ASSERT_LESS_THAN_EQUALS(value1_at_cell, max1 + DBL_EPSILON);
// Now check the GetPdeSolutionAtPoint method matches
TS_ASSERT_DELTA(pde_handler.GetPdeSolutionAtPoint(cell_location, "quantity 1"), value0_at_cell, 1e-6);
TS_ASSERT_DELTA(pde_handler.GetPdeSolutionAtPoint(cell_location, "quantity 2"), value1_at_cell, 1e-6);
}
}
};
#endif /*TESTCELLBASEDPDEHANDLER_HPP_*/
|
8b9f5088ca29bb3fc79f4a28784064f1f06e52ed | 6b2a8dd202fdce77c971c412717e305e1caaac51 | /solutions_5753053697277952_0/C++/ppetter1025/pA.cpp | 44ca2f167228f5de9971b130458fc361b39f3f80 | [] | no_license | alexandraback/datacollection | 0bc67a9ace00abbc843f4912562f3a064992e0e9 | 076a7bc7693f3abf07bfdbdac838cb4ef65ccfcf | refs/heads/master | 2021-01-24T18:27:24.417992 | 2017-05-23T09:23:38 | 2017-05-23T09:23:38 | 84,313,442 | 2 | 4 | null | null | null | null | UTF-8 | C++ | false | false | 1,435 | cpp | pA.cpp | #include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()
#ifdef _DEBUG_
#define debug(...) printf(__VA_ARGS__)
#else
#define debug(...) (void)0
#endif
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
const int MAXN = 30;
int p[MAXN];
bool check(int n) {
int mx = -1, cnt = 0;
for(int i=0; i<n; i++) {
if(p[i] > mx) {
mx = p[i];
cnt = 1;
}
else if(p[i] == mx) cnt++;
}
return cnt == 2;
}
int main() {
int t;
scanf("%d", &t);
for(int kase=1; kase<=t; kase++) {
int n;
scanf("%d", &n);
for(int i=0; i<n; i++) scanf("%d", p+i);
printf("Case #%d: ", kase);
int mx = p[0], id;
while(!check(n)) {
mx = -1, id = -1;
for(int i=0; i<n; i++) {
if(p[i] > mx) {
mx = p[i];
id = i;
}
}
putchar('A'+id);
putchar(' ');
p[id]--;
}
mx = -1;
for(int i=0; i<n; i++) mx = max(mx, p[i]);
while(1) {
bool flag = false;
for(int i=0; i<n; i++) {
if(p[i] && p[i] != mx) {
flag = true;
putchar('A'+i);
putchar(' ');
p[i]--;
}
}
if(!flag) break;
}
while(1) {
bool flag = false;
for(int i=0; i<n; i++) {
if(p[i]) {
p[i]--;
putchar('A'+i);
if(!p[i]) flag = true;
}
}
if(flag) break;
putchar(' ');
}
putchar('\n');
}
return 0;
}
|
a991801298e789d9123f673123e59c2b9c874dbc | f26e3cbaadf2e2eec62f9c2378f4983b7fbf3630 | /Hole.h | af6bbbea5806c29b6a1f6e5b1d598340ad7debde | [] | no_license | Andre1999Lopes/Picaria | 77ebde2495e8e7fb9a753b5f779a047d5066b998 | e17f60639b13397b98580e3ce9b1fdae4b3872c1 | refs/heads/master | 2023-06-28T11:28:17.596868 | 2021-07-30T16:01:29 | 2021-07-30T16:01:29 | 391,116,320 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 989 | h | Hole.h | #ifndef HOLE_H
#define HOLE_H
#include <QObject>
#include <QPushButton>
#include <Picaria.h>
class Hole : public QPushButton {
Q_OBJECT
Q_PROPERTY(State state READ state WRITE setState NOTIFY stateChanged)
public:
enum State {
EmptyState,
RedState,
BlueState,
SelectableState
};
Q_ENUM(State)
explicit Hole(QWidget *parent = nullptr);
virtual ~Hole();
State state() const { return m_state; }
void setState(State State);
void setNeighbors(int i, Picaria::Mode mode);
std::vector<int> getNeighbors() const { return this->neighbors; }
int getIndex() const { return this->index; }
void setIndex(int index) { this->index = index; }
public slots:
void reset();
signals:
void stateChanged(State State);
private:
int index;
State m_state;
std::vector<int> neighbors;
static QPixmap stateToPixmap(State state);
private slots:
void updateHole(State state);
};
#endif // HOLE_H
|
f853ad1856defc9cfa792ff47af1d4e01e8bd01a | f5b3a57b61d01a0672bb7150201ba177c5a92922 | /src/include/BPlusTree.h | c837f879a412200c88ec5b7f7053032ae2b96870 | [] | no_license | walotta/TicketSystem-2021 | 18117e7660dd3dc796dc43fc403d38b1cc04629f | 31278124e3a85854fd27bfffc4e533115d7d129a | refs/heads/main | 2023-06-03T03:03:38.568936 | 2021-06-14T05:16:02 | 2021-06-14T05:16:02 | 357,042,690 | 1 | 0 | null | 2021-06-06T16:43:00 | 2021-04-12T03:14:50 | C++ | UTF-8 | C++ | false | false | 24,920 | h | BPlusTree.h | //
// Created by wzj on 2021/1/15.
//
#ifndef BOOKSTORE_BPLUSTREE_H
#define BOOKSTORE_BPLUSTREE_H
#define No_Block_Merge_off
#define Debug_Mode_off
#include "STL.h"
#include <cstring>
#include "StoragePool.h"
#include "ErrorMessage.h"
template<int Size,int SizeOfCache>
class BPlusTree
{
private:
const string name;
int root=-1;
int head=-1;
class assistStore
{
public:
bool used=false;
int rootStorage;
int headStorage;
};
class BStore
{
public:
bool IfLeaves=-1;
int NextLeaf=-1;
int FrontLeaf=-1;
int storeNumber=-1;
int storeId[Size]={0};
std::pair<unsigned long long,long long> storeKey[Size];
};
BStore rootBlock;
StoragePool<BStore,assistStore,SizeOfCache>* storage;
unsigned long long hash(const string& hash_in) const
{
unsigned long long res=0;
for(auto it:hash_in)res=(res<<16)+res+(unsigned int)it;
return res;
}
//返回是否需要裂块,需要返回裂块后的新id值
int dp_insert(int now,std::pair<unsigned long long,long long> key, const int &id){
BStore nowBlock=storage->get(now);
if(nowBlock.IfLeaves)
{
//叶节点
//检查重复插入
int check_i=0;
for(check_i=0;check_i<nowBlock.storeNumber;check_i++)
{
if(key<nowBlock.storeKey[check_i])break;
}
if(check_i!=0&&nowBlock.storeKey[check_i-1]==key)
{
for(int j=check_i-1;j>=0;j--)
{
if(nowBlock.storeKey[j]!=key)break;
if(nowBlock.storeId[j]==id)throw error("BptInsertRepeat");
}
if(nowBlock.storeKey[0]==key&&nowBlock.FrontLeaf!=-1)
{
BStore check=storage->get(nowBlock.FrontLeaf);
bool finish=false;
while(true)
{
for(int j=check.storeNumber-1;j>=0;j--)
{
if(check.storeKey[j]!=key)
{
finish=true;
break;
}
if(check.storeId[j]==id)throw error("BptInsertRepeat");
}
if(check.FrontLeaf==-1||finish)break;
check=storage->get(check.FrontLeaf);
}
}
}
if(nowBlock.storeNumber<Size)
{
int i=0;
for(i=0;i<nowBlock.storeNumber;i++)
{
if(key<nowBlock.storeKey[i])break;
}
for(int j=nowBlock.storeNumber;j>i;j--)
{
nowBlock.storeKey[j]=nowBlock.storeKey[j-1];
nowBlock.storeId[j]=nowBlock.storeId[j-1];
}
nowBlock.storeKey[i]=key;
nowBlock.storeId[i]=id;
nowBlock.storeNumber++;
storage->update(now,nowBlock);
if(now==root)rootBlock=nowBlock;
return -1;
}else
{
int numberOfNew=Size/2;
BStore new_Store;
new_Store.IfLeaves=true;
new_Store.storeNumber=numberOfNew;
for(int i=0;i<numberOfNew;i++)
{
new_Store.storeKey[i]=nowBlock.storeKey[i];
new_Store.storeId[i]=nowBlock.storeId[i];
}
for(int i=numberOfNew;i<nowBlock.storeNumber;i++)
{
nowBlock.storeId[i-numberOfNew]=nowBlock.storeId[i];
nowBlock.storeKey[i-numberOfNew]=nowBlock.storeKey[i];
}
nowBlock.storeNumber=nowBlock.storeNumber-numberOfNew;
for(int i=0;i<Size;i++)
{
if(i<numberOfNew)
{
if(key<new_Store.storeKey[i])
{
for(int j=numberOfNew;j>i;j--)
{
new_Store.storeKey[j]=new_Store.storeKey[j-1];
new_Store.storeId[j]=new_Store.storeId[j-1];
}
new_Store.storeKey[i]=key;
new_Store.storeId[i]=id;
new_Store.storeNumber++;
break;
}
}else
{
if(key<nowBlock.storeKey[i-numberOfNew])
{
for(int j=nowBlock.storeNumber;j>i-numberOfNew;j--)
{
nowBlock.storeId[j]=nowBlock.storeId[j-1];
nowBlock.storeKey[j]=nowBlock.storeKey[j-1];
}
nowBlock.storeKey[i-numberOfNew]=key;
nowBlock.storeId[i-numberOfNew]=id;
nowBlock.storeNumber++;
break;
}
if(i==Size-1)
{
nowBlock.storeKey[i-numberOfNew+1]=key;
nowBlock.storeId[i-numberOfNew+1]=id;
nowBlock.storeNumber++;
}
}
}
new_Store.FrontLeaf=nowBlock.FrontLeaf;
new_Store.NextLeaf=now;
int newId=storage->add(new_Store);
nowBlock.FrontLeaf=newId;
storage->update(now,nowBlock);
if(now==root)rootBlock=nowBlock;
int front=new_Store.FrontLeaf;
if(front==-1)
{
head=newId;
}else
{
new_Store=storage->get(front);
new_Store.NextLeaf=newId;
storage->update(front,new_Store);
if(front==root)rootBlock=new_Store;
}
return newId;
}
}else
{
//非叶节点
int i=0;
for(i=0;i<nowBlock.storeNumber-1;i++)
{
if(key<nowBlock.storeKey[i+1])break;
}
int newId=dp_insert(nowBlock.storeId[i],key,id);
if(newId==-1)
{
return -1;
}else
{
//处理裂块
BStore temm=storage->get(nowBlock.storeId[i]);
std::pair<unsigned long long,long long> newKey=temm.storeKey[0];
if(nowBlock.storeNumber<Size)
{
for(int j=nowBlock.storeNumber;j>i;j--)
{
nowBlock.storeId[j]=nowBlock.storeId[j-1];
nowBlock.storeKey[j]=nowBlock.storeKey[j-1];
}
nowBlock.storeNumber++;
nowBlock.storeId[i]=newId;
nowBlock.storeKey[i+1]=newKey;
storage->update(now,nowBlock);
if(now==root)rootBlock=nowBlock;
return -1;
}else
{
int numberOfNew=Size/2;
//nowBlock.storeId[i]=newId;
BStore new_Store;
new_Store.IfLeaves=false;
new_Store.storeNumber=numberOfNew;
for(int j=0;j<numberOfNew;j++)
{
new_Store.storeKey[j]=nowBlock.storeKey[j];
new_Store.storeId[j]=nowBlock.storeId[j];
}
for(int j=numberOfNew;j<nowBlock.storeNumber;j++)
{
nowBlock.storeId[j-numberOfNew]=nowBlock.storeId[j];
nowBlock.storeKey[j-numberOfNew]=nowBlock.storeKey[j];
}
nowBlock.storeNumber=nowBlock.storeNumber-numberOfNew;
if(i<numberOfNew)
{
for(int j=numberOfNew;j>i;j--)
{
new_Store.storeId[j]=new_Store.storeId[j-1];
new_Store.storeKey[j]=new_Store.storeKey[j-1];
}
new_Store.storeKey[i+1]=newKey;
new_Store.storeId[i]=newId;
new_Store.storeNumber++;
}else
{
for(int j=nowBlock.storeNumber;j>i-numberOfNew;j--)
{
nowBlock.storeId[j]=nowBlock.storeId[j-1];
nowBlock.storeKey[j]=nowBlock.storeKey[j-1];
}
nowBlock.storeKey[i+1-numberOfNew]=newKey;
nowBlock.storeId[i-numberOfNew]=newId;
nowBlock.storeNumber++;
}
storage->update(now,nowBlock);
if(now==root)rootBlock=nowBlock;
int ans=storage->add(new_Store);
return ans;
}
}
}
}
//搜索删除,在返回后由父节点判断是否需要合并
void dp_remove(int now,const std::pair<unsigned long long,long long> &key, const int &id)
{
BStore nowBlock=storage->get(now);
if(nowBlock.IfLeaves)
{
//叶子节点
int i=0;
for(i=0;i<nowBlock.storeNumber;i++)
{
if(key<nowBlock.storeKey[i])break;
}
i--;
if(i==-1)
{
throw error("BPT remove not found");
}
bool finish=false;
if(nowBlock.storeKey[i]==key)
{
int j;
for(j=i;j>=0;j--)
{
if(nowBlock.storeId[j]==id&&nowBlock.storeKey[j]==key)
{
finish=true;
break;
}
}
if(finish)
{
//删除点在当前块
for(int k=j;k<nowBlock.storeNumber-1;k++)
{
nowBlock.storeId[k]=nowBlock.storeId[k+1];
nowBlock.storeKey[k]=nowBlock.storeKey[k+1];
}
nowBlock.storeNumber--;
storage->update(now,nowBlock);
if(now==root)rootBlock=nowBlock;
}else
{
//删除点在前面块
BStore f=storage->get(nowBlock.FrontLeaf);
int f_point=nowBlock.FrontLeaf;
while(true)
{
for(int k=f.storeNumber-1;k>=0;k--)
{
if(f.storeKey[k]!=key)throw error("BPT remove not found");
else
{
if(f.storeId[k]==id)
{
for(int ii=k;ii<f.storeNumber-1;ii++)
{
f.storeId[ii]=f.storeId[ii+1];
f.storeKey[ii]=f.storeKey[ii+1];
}
f.storeNumber--;
storage->update(f_point,f);
if(f_point==root)rootBlock=f;
finish=true;
break;
}
}
}
if(finish)
{
break;
}else if(f.FrontLeaf==-1)
{
throw error("BPT remove not found");
}else
{
f_point=f.FrontLeaf;
f=storage->get(f_point);
}
}
}
}else
{
throw error("BPT remove not found");
}
}else
{
//不是叶子节点
int i=0;
for(i=0;i<nowBlock.storeNumber-1;i++)
{
if(key<nowBlock.storeKey[i+1])break;
}
dp_remove(nowBlock.storeId[i],key,id);
BStore son=storage->get(nowBlock.storeId[i]);
nowBlock.storeKey[i]=son.storeKey[0];
const int _min=Size/2;
#ifdef No_Block_Merge
bptStorage->update(now,nowBlock);
if(now==root)rootBlock=nowBlock;
return;
#endif
if(son.storeNumber<_min && nowBlock.storeNumber>1)
{
//需要扩容
int direction=1;
if(i==nowBlock.storeNumber-1)direction=-1;
BStore neigh=storage->get(nowBlock.storeId[i+direction]);
if(neigh.storeNumber<_min)
{
//合并
BStore new_block;
if(son.IfLeaves)
{
//子节点是叶子节点,维护链表
new_block.IfLeaves=true;
if(direction==1)
{
//取右邻居
new_block.NextLeaf=neigh.NextLeaf;
new_block.FrontLeaf=son.FrontLeaf;
}else
{
//取左邻居
new_block.NextLeaf=son.NextLeaf;
new_block.FrontLeaf=neigh.FrontLeaf;
}
}else
{
new_block.IfLeaves=false;
}
//执行合并操作
new_block.storeNumber=son.storeNumber+neigh.storeNumber;
if(direction==1)
{
for(int j=0;j<new_block.storeNumber;j++)
{
if(j<son.storeNumber)
{
new_block.storeId[j]=son.storeId[j];
new_block.storeKey[j]=son.storeKey[j];
}else
{
new_block.storeId[j]=neigh.storeId[j-son.storeNumber];
new_block.storeKey[j]=neigh.storeKey[j-son.storeNumber];
}
}
}else
{
for(int j=0;j<new_block.storeNumber;j++)
{
if(j<neigh.storeNumber)
{
new_block.storeId[j]=neigh.storeId[j];
new_block.storeKey[j]=neigh.storeKey[j];
}else
{
new_block.storeId[j]=son.storeId[j-neigh.storeNumber];
new_block.storeKey[j]=son.storeKey[j-neigh.storeNumber];
}
}
}
storage->remove(nowBlock.storeId[i]);
storage->remove(nowBlock.storeId[i+direction]);
int newId=storage->add(new_block);
if(direction==1)
{
for(int j=i+2;j<nowBlock.storeNumber;j++)
{
nowBlock.storeKey[j-1]=nowBlock.storeKey[j];
nowBlock.storeId[j-1]=nowBlock.storeId[j];
}
nowBlock.storeKey[i]=new_block.storeKey[0];
nowBlock.storeId[i]=newId;
nowBlock.storeNumber--;
}else
{
nowBlock.storeKey[i-1]=new_block.storeKey[0];
nowBlock.storeId[i-1]=newId;
nowBlock.storeNumber--;
}
//修改相邻元素的链表结构
if(new_block.IfLeaves)
{
if(new_block.FrontLeaf==-1)
{
head=newId;
}else
{
BStore tem=storage->get(new_block.FrontLeaf);
tem.NextLeaf=newId;
storage->update(new_block.FrontLeaf,tem);
if(new_block.FrontLeaf==root)rootBlock=tem;
}
if(new_block.NextLeaf!=-1)
{
BStore tem=storage->get(new_block.NextLeaf);
tem.FrontLeaf=newId;
storage->update(new_block.NextLeaf,tem);
if(new_block.NextLeaf==root)rootBlock=tem;
}
}
}else
{
//领养
if(direction==1)
{
son.storeId[son.storeNumber]=neigh.storeId[0];
son.storeKey[son.storeNumber]=neigh.storeKey[0];
son.storeNumber++;
for(int j=1;j<neigh.storeNumber;j++)
{
neigh.storeKey[j-1]=neigh.storeKey[j];
neigh.storeId[j-1]=neigh.storeId[j];
}
neigh.storeNumber--;
nowBlock.storeKey[i+direction]=neigh.storeKey[0];
}else
{
for(int j=son.storeNumber;j>0;j--)
{
son.storeKey[j]=son.storeKey[j-1];
son.storeId[j]=son.storeId[j-1];
}
son.storeNumber++;
son.storeKey[0]=neigh.storeKey[neigh.storeNumber-1];
son.storeId[0]=neigh.storeId[neigh.storeNumber-1];
neigh.storeNumber--;
nowBlock.storeKey[i]=son.storeKey[0];
}
storage->update(nowBlock.storeId[i],son);
storage->update(nowBlock.storeId[i+direction],neigh);
}
}
storage->update(now,nowBlock);
if(now==root)rootBlock=nowBlock;
}
}
void dp_find(int now,const unsigned long long &key,vector<std::pair<int,long long>>& res)const
{
BStore nowBlock=storage->get(now);
if(nowBlock.IfLeaves)
{
int i=0;
for(i=0;i<nowBlock.storeNumber;i++)
{
if(key<nowBlock.storeKey[i].first)break;
}
i--;
if(i==-1)
{
res.clear();
return;
}
if(nowBlock.storeKey[i].first==key)
{
res.push_back(std::make_pair(nowBlock.storeId[i],nowBlock.storeKey[i].second));
for(int j=i-1;j>=0;j--)
{
if(nowBlock.storeKey[j].first==key)res.push_back(std::make_pair(nowBlock.storeId[j],nowBlock.storeKey[j].second));
else return;
}
BStore find=storage->get(nowBlock.FrontLeaf);
while(true)
{
for(int j=find.storeNumber-1;j>=0;j--)
{
if(find.storeKey[j].first==key)res.push_back(std::make_pair(find.storeId[j],find.storeKey[j].second));
else return;
}
if(find.FrontLeaf==-1)return;
else find=storage->get(find.FrontLeaf);
}
}else
{
res.clear();
return;
}
}else
{
int i=0;
for(i=0;i<nowBlock.storeNumber-1;i++)
{
if(key<nowBlock.storeKey[i+1].first)break;
}
return dp_find(nowBlock.storeId[i],key,res);
}
}
public:
BPlusTree()=delete;
explicit BPlusTree(const string& _name):name(_name)
{
string headString="BptOf_";
storage=new StoragePool<BStore,assistStore,SizeOfCache>(headString+name);
assistStore ass;
ass=storage->readExtraBlock();
if(!ass.used)
{
root=-1;
head=-1;
ass.rootStorage=root;
ass.headStorage=head;
ass.used=true;
storage->writeExtraBlock(ass);
}else
{
root=ass.rootStorage;
head=ass.headStorage;
rootBlock=storage->get(root);
}
}
~BPlusTree()
{
assistStore ass;
ass.headStorage=head;
ass.rootStorage=root;
ass.used=true;
storage->writeExtraBlock(ass);
delete storage;
}
void insert(const std::pair<string,long long > &_key, const int &id)
{
std::pair<unsigned long long,long long> key(hash(_key.first),_key.second);
if(root==-1)
{
//当前无数据
BStore tem;
tem.FrontLeaf=-1;
tem.NextLeaf=-1;
tem.IfLeaves=true;
tem.storeNumber=1;
tem.storeId[0]=id;
tem.storeKey[0]=key;
root=storage->add(tem);
head=root;
rootBlock=tem;
}else
{
//当前有数据
int newId=dp_insert(root,key,id);
if(newId==-1)return;
else
{
BStore new_head;
BStore temm=storage->get(newId);
new_head.IfLeaves=false;
new_head.storeNumber=2;
new_head.storeKey[0]=temm.storeKey[0];
new_head.storeId[0]=newId;
new_head.storeKey[1]=rootBlock.storeKey[0];
new_head.storeId[1]=root;
root=storage->add(new_head);
rootBlock=new_head;
}
}
}
void remove(const std::pair<string,long long> &_key, const int &id)
{
std::pair<unsigned long long,long long> key(hash(_key.first),_key.second);
if(rootBlock.IfLeaves)
{
//根节点是叶子节点
for(int i=0;i<rootBlock.storeNumber;i++)
{
if(rootBlock.storeId[i]==id&&rootBlock.storeKey[i]==key)
{
for(int j=i+1;j<rootBlock.storeNumber;j++)
{
rootBlock.storeKey[j-1]=rootBlock.storeKey[j];
rootBlock.storeId[j-1]=rootBlock.storeId[j];
}
rootBlock.storeNumber--;
storage->update(root,rootBlock);
return;
}
}
throw error("BPT remove not found");
}else
{
//树高度高于1
dp_remove(root, key, id);
if(rootBlock.storeNumber==1)
{
int new_root=rootBlock.storeId[0];
storage->remove(root);
root=new_root;
rootBlock=storage->get(root);
}
}
}
void find(const string &_key,vector<std::pair<int,long long>>& res)const
{
unsigned long long key=hash(_key);
if(root==-1)
{
res.clear();
return;
}else
{
dp_find(root,key,res);
return;
}
}
void clean()
{
storage->clearAll();
root=-1;
head=-1;
assistStore ass;
ass.rootStorage=root;
ass.headStorage=head;
ass.used=true;
storage->writeExtraBlock(ass);
}
};
#endif //BOOKSTORE_BPLUSTREE_H
|
8e440cf5aa2f42b663048c52cf0d1166356cc054 | 38d78ee89e1a97becbaf8c5430e685f2db0bce02 | /server/main.cpp | 60fef0280cd49b5a40d46a583d682c42ba1be606 | [] | no_license | serg3vik/mp_simplehttp | 325a321c1cb744e5e0d93894cea368dd9db4b04d | de2b91fe2856b54204bea1a6f8e8a2b097dbb419 | refs/heads/master | 2020-05-18T05:35:50.857983 | 2019-06-04T10:56:14 | 2019-06-04T10:56:14 | 184,211,002 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,425 | cpp | main.cpp | #include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <fcntl.h>
#include <netinet/ip.h>
#include <netdb.h>
#include <signal.h>
#include <errno.h>
#include <wait.h>
#include "fd_pass.h"
#include "manager.h"
#include "error_handler.h"
//==============================================================================
static const uint16_t DEFAULT_SERVER_PORT = 8888;
//==============================================================================
const char *RootPath = nullptr;
//==============================================================================
//
//==============================================================================
void signalHandler(int sig) {
if (sig == SIGTERM) {
fprintf_mp(stdout, "Kill \'em ALL!\r\n");
Manager::instance()->killAll();
deinitLog();
exit(1);
} else {
// waitpid() might overwrite errno, so we save and restore it:
int saved_errno = errno;
while(waitpid(-1, NULL, WNOHANG) > 0);
errno = saved_errno;
}
}
//==============================================================================
//
//==============================================================================
struct globalArgs_t {
const char *ipaddr;
const char *port;
const char *root_dir;
} globalArgs;
static const char *optString = "h:p:d:";
//==============================================================================
// Launch options: -h <ip> -p <port> -d <directory>
//==============================================================================
int main(int argc, char *argv[]) {
#if defined DAEMON_APP
/* DAEMONIZE */
pid_t pid, sid;
/* Fork off the parent process */
pid = fork();
if (pid < 0) {
perror("daemonize fork");
exit(EXIT_FAILURE);
}
/* If we got a good PID, then
we can exit the parent process. */
if (pid > 0) {
exit(EXIT_SUCCESS);
}
/* Change the file mode mask */
umask(0);
/* Open any logs here */
if (initLog() < 0) {
perror("Init LOG");
exit(EXIT_FAILURE);
}
/* Create a new SID for the child process */
sid = setsid();
if (sid < 0) {
/* Log any failure here */
perror("setsid");
exit(EXIT_FAILURE);
}
/* Change the current working directory */
if ((chdir("/")) < 0) {
/* Log any failure here */
perror("chdir");
exit(EXIT_FAILURE);
}
fprintf_mp(stdout, "Helloworld epta!\r\n");
/* Close out the standard file descriptors */
close(STDIN_FILENO);
close(STDOUT_FILENO);
close(STDERR_FILENO);
/* end of daemonize */
#else
initLog();
#endif
memset (&globalArgs, 0, sizeof(globalArgs_t));
int opt;
while((opt = getopt(argc, argv, optString)) != -1) {
switch (opt) {
case 'h': {
globalArgs.ipaddr = optarg;
}break;
case 'p': {
globalArgs.port = optarg;
}break;
case 'd': {
globalArgs.root_dir = optarg;
}
}
}
if (!(globalArgs.ipaddr && globalArgs.port && globalArgs.root_dir)) return -1;
RootPath = globalArgs.root_dir;
uint16_t ServerPort;
sscanf(globalArgs.port, "%d", &ServerPort);
struct sigaction sa;
int rv = -1;
int opt_enable = 1;
Manager *manager = Manager::instance();
if (!manager) {
return -1;
fprintf_mp(stderr, "Can\'t create the manager!\r\n");
}
sa.sa_handler = signalHandler; // reap all dead processes
sigemptyset(&sa.sa_mask);
sa.sa_flags = SA_RESTART;
if (sigaction(SIGCHLD, &sa, NULL) == -1) {
fprintf_mp(stderr, "sigaction SIGCHLD\r\n");
return -1;
}
if (sigaction(SIGTERM, &sa, NULL) == -1) {
fprintf_mp(stderr, "sigaction SIGTERM\r\n");
return -1;
}
int MasterSocket = socket(AF_INET, SOCK_STREAM, 0);
if (MasterSocket < 0) {
fprintf_mp(stderr, "Socket creation failed! %s\r\n", strerror(errno));
return EXIT_FAILURE;
}
if (setsockopt(MasterSocket, SOL_SOCKET, SO_REUSEADDR, &opt_enable, sizeof(int)) == -1) {
fprintf_mp(stderr, "setsockopt %s\r\n", strerror(errno));
return -1;
}
struct sockaddr_in serv_addr;
serv_addr.sin_addr.s_addr = INADDR_ANY;
serv_addr.sin_family = AF_INET;
serv_addr.sin_port = htons(ServerPort);
if (bind(MasterSocket, (struct sockaddr*)&serv_addr, sizeof(serv_addr)) < 0) {
fprintf_mp(stderr, "server: bind %s\r\n", strerror(errno));
return -1;
}
manager->init();
if (listen(MasterSocket, SOMAXCONN) < 0) {
fprintf_mp(stderr, "server: listen (%s)\r\n", strerror(errno));
return -1;
}
/* Main server loop */
while (1) {
int SlaveSocket = accept(MasterSocket, NULL, NULL);
if (SlaveSocket < 0) {
fprintf_mp(stderr, "server: accept (%s)\r\n", strerror(errno));
return -1;
}
if (manager->do_work(SlaveSocket) == -1) {
fprintf_mp(stderr, "do_work\r\n");
return -1;
}
// /* Close the socket */
// if (shutdown(SlaveSocket, SHUT_RDWR) < 0) {
// fprintf_mp(stderr, "main shutdown\r\n");
// return -1;
// }
if (close(SlaveSocket) < 0) {
fprintf_mp(stderr, "main close\r\n");
return -1;
}
}
/* THE PARENT PROCESS MUST STILL ALIVE UNTIL AT LEAST ONE CHILD IS ALIVE! */
deinitLog();
return 0;
}
|
e0047fefa0221136f9b57bef064b2595271fff2a | 69784e105ddc2aca3699b6b07dbcb1834d7c242c | /Classes/Native/AssemblyU2DCSharp_Reference_1_gen2181976982.h | bbaa1c3a0562624954af66e8ee764dfb80cb4b9b | [] | no_license | ryanmcgrail95/CRHC-iOS | 7e72139100b2140143deb424d21fdc69b2959ed1 | 1b00260e6c59f552d9a8b94e42fcae5e657a6c46 | refs/heads/master | 2021-06-12T11:21:33.461817 | 2017-03-04T01:08:34 | 2017-03-04T01:08:34 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,588 | h | AssemblyU2DCSharp_Reference_1_gen2181976982.h | #pragma once
#include "il2cpp-config.h"
#ifndef _MSC_VER
# include <alloca.h>
#else
# include <malloc.h>
#endif
#include <stdint.h>
// System.String
struct String_t;
// System.Object
struct Il2CppObject;
// System.Byte[]
struct ByteU5BU5D_t3397334013;
// UnityEngine.WWW
struct WWW_t2919945039;
// Reference`1/LoadEventDelegate<System.Object>
struct LoadEventDelegate_t2479697798;
#include "AssemblyU2DCSharp_Reference3342691873.h"
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// Reference`1<System.Object>
struct Reference_1_t2181976982 : public Reference_t3342691873
{
public:
// System.String Reference`1::path
String_t* ___path_1;
// T Reference`1::data
Il2CppObject * ___data_2;
// System.Boolean Reference`1::_isLoaded
bool ____isLoaded_3;
// System.Byte[] Reference`1::byteData
ByteU5BU5D_t3397334013* ___byteData_4;
// UnityEngine.WWW Reference`1::www
WWW_t2919945039 * ___www_5;
// Reference`1/LoadEventDelegate<T> Reference`1::onLoad
LoadEventDelegate_t2479697798 * ___onLoad_6;
public:
inline static int32_t get_offset_of_path_1() { return static_cast<int32_t>(offsetof(Reference_1_t2181976982, ___path_1)); }
inline String_t* get_path_1() const { return ___path_1; }
inline String_t** get_address_of_path_1() { return &___path_1; }
inline void set_path_1(String_t* value)
{
___path_1 = value;
Il2CppCodeGenWriteBarrier(&___path_1, value);
}
inline static int32_t get_offset_of_data_2() { return static_cast<int32_t>(offsetof(Reference_1_t2181976982, ___data_2)); }
inline Il2CppObject * get_data_2() const { return ___data_2; }
inline Il2CppObject ** get_address_of_data_2() { return &___data_2; }
inline void set_data_2(Il2CppObject * value)
{
___data_2 = value;
Il2CppCodeGenWriteBarrier(&___data_2, value);
}
inline static int32_t get_offset_of__isLoaded_3() { return static_cast<int32_t>(offsetof(Reference_1_t2181976982, ____isLoaded_3)); }
inline bool get__isLoaded_3() const { return ____isLoaded_3; }
inline bool* get_address_of__isLoaded_3() { return &____isLoaded_3; }
inline void set__isLoaded_3(bool value)
{
____isLoaded_3 = value;
}
inline static int32_t get_offset_of_byteData_4() { return static_cast<int32_t>(offsetof(Reference_1_t2181976982, ___byteData_4)); }
inline ByteU5BU5D_t3397334013* get_byteData_4() const { return ___byteData_4; }
inline ByteU5BU5D_t3397334013** get_address_of_byteData_4() { return &___byteData_4; }
inline void set_byteData_4(ByteU5BU5D_t3397334013* value)
{
___byteData_4 = value;
Il2CppCodeGenWriteBarrier(&___byteData_4, value);
}
inline static int32_t get_offset_of_www_5() { return static_cast<int32_t>(offsetof(Reference_1_t2181976982, ___www_5)); }
inline WWW_t2919945039 * get_www_5() const { return ___www_5; }
inline WWW_t2919945039 ** get_address_of_www_5() { return &___www_5; }
inline void set_www_5(WWW_t2919945039 * value)
{
___www_5 = value;
Il2CppCodeGenWriteBarrier(&___www_5, value);
}
inline static int32_t get_offset_of_onLoad_6() { return static_cast<int32_t>(offsetof(Reference_1_t2181976982, ___onLoad_6)); }
inline LoadEventDelegate_t2479697798 * get_onLoad_6() const { return ___onLoad_6; }
inline LoadEventDelegate_t2479697798 ** get_address_of_onLoad_6() { return &___onLoad_6; }
inline void set_onLoad_6(LoadEventDelegate_t2479697798 * value)
{
___onLoad_6 = value;
Il2CppCodeGenWriteBarrier(&___onLoad_6, value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
|
67692075097329f697a1b224d70e2b2738bb05cb | bbc071ef4349defe5ac99e65a9d77ab739433250 | /a.cpp | 470227ec6a2773a98f27db0463f64e1edec06a2f | [] | no_license | kamaljeetsingh1322/WEBD | 306eb13477eb118b3fda31cd46491a18cf8aec76 | 7bf6853cafaadfa7e3ac5fb434a9b07313185d81 | refs/heads/main | 2023-03-16T07:40:17.167622 | 2021-03-17T09:33:31 | 2021-03-17T09:33:31 | 309,016,803 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 7,356 | cpp | a.cpp | #include<iostream>
#include<fstream>
#include<cctype>
#include<iomanip>
using namespace std;
class account
{
int no;
char name[50];
int deposit;
char type;
public:
void createAcc()
{
system("CLS");
cout<<"\n\t\t\tEnter the Account No. : ";
cin>>no;
cout<<"\n\n\t\t\tEnter the Name of the Account holder : ";
cin.ignore();
cin.getline(name,50);
cout<<"\n\t\t\tEnter Type of the Account (C/S) : ";
cin>>type;
type=toupper(type);
cout<<"\n\t\t\tEnter The Initial amount : ";
cin>>deposit;
cout<<"\n\n\t\t\tAccount Created..";
}
void show_account() const
{
cout<<"\n\t\t\tAccount No. : "<<no;
cout<<"\n\t\t\tAccount Holder Name : ";
cout<<name;
cout<<"\n\t\t\tType of Account : "<<type;
cout<<"\n\t\t\tBalance amount : "<<deposit;
}
void modify()
{
cout<<"\n\t\t\tAccount No. : "<<no;
cout<<"\n\t\t\tModify Account Holder Name : ";
cin.ignore();
cin.getline(name,50);
cout<<"\n\t\t\tModify Type of Account : ";
cin>>type;
type=toupper(type);
cout<<"\n\t\t\tModify Balance amount : ";
cin>>deposit;
}
void dep(int x)
{
deposit+=x;
}
void draw(int x)
{
deposit-=x;
}
void all() const
{
cout<<no<<setw(10)<<" "<<name<<setw(10)<<" "<<type<<setw(6)<<deposit<<endl;
}
int ret_no() const
{
return no;
}
int retdeposit() const
{
return deposit;
}
char rettype() const
{
return type;
}
};
void newAcc()
{
account obj;
ofstream writeF;
writeF.open("account.txt",ios::binary|ios::app);
obj.createAcc();
writeF.write(reinterpret_cast<char *> (&obj), sizeof(account));
writeF.close();
}
void display_one(int n) //BALANCE ENQUIRY
{
account obj;
bool i=false;
ifstream readF;
readF.open("account.txt",ios::binary);
if(!readF)
{
cout<<"File could not be open !! Press any Key...";
return;
}
cout<<"\n\t\t\tBALANCE DETAILS\n";
while(readF.read(reinterpret_cast<char *> (&obj), sizeof(account)))
{
if(obj.ret_no()==n)
{
obj.show_account();
i=true;
}
}
readF.close();
if(i==false)
cout<<"\n\n\t\t\tAccount number does not exist";
}
void modify_acc(int n)
{
bool found=false;
account ac;
fstream File;
File.open("account.txt",ios::binary|ios::in|ios::out);
if(!File)
{
cout<<"File could not be open !! Press any Key...";
return;
}
while(!File.eof() && found==false)
{
File.read(reinterpret_cast<char *> (&ac), sizeof(account));
if(ac.ret_no()==n)
{
ac.show_account();
cout<<"\n\n\t\t\tEnter The New Details of account"<<endl;
ac.modify();
int pos=(-1)*static_cast<int>(sizeof(account));
File.seekp(pos,ios::cur);
File.write(reinterpret_cast<char *> (&ac), sizeof(account));
cout<<"\n\n\t\t\tRecord Updated";
found=true;
}
}
File.close();
if(found==false)
cout<<"\n\n\t\t\tRecord Not Found ";
}
void delete_acc(int n)
{
account obj;
ifstream inFile;
ofstream outFile;
inFile.open("account.txt",ios::binary);
if(!inFile)
{
cout<<"File could not be open !! Press any Key...";
return;
}
outFile.open("Temp.txt",ios::binary);
inFile.seekg(0,ios::beg);
while(inFile.read(reinterpret_cast<char *> (&obj), sizeof(account)))
{
if(obj.ret_no()!=n)
outFile.write(reinterpret_cast<char *> (&obj), sizeof(account));
}
inFile.close();
outFile.close();
remove("account.txt");
rename("Temp.txt","account.txt");
cout<<"\n\nRecord Deleted ..";
}
void display_all()
{
system("CLS");
account obj;
ifstream readF;
readF.open("account.txt",ios::binary);
if(!readF)
{
cout<<"File could not be open !! Press any Key...";
return;
}
cout<<"\n\n\t\tACCOUNT HOLDER LIST\n\n";
cout<<"====================================================\n";
cout<<"A/c no. NAME Type Balance\n";
cout<<"====================================================\n";
while(readF.read(reinterpret_cast<char *> (&obj), sizeof(account)))
obj.all();
readF.close();
}
void balance(int n, int option)
{
int amt;
bool i=false;
account obj;
fstream File;
File.open("account.txt", ios::binary|ios::in|ios::out);
if(!File)
{
cout<<"File could not be open !! Press any Key...";
return;
}
while(!File.eof() && i==false)
{
File.read(reinterpret_cast<char *> (&obj), sizeof(account));
if(obj.ret_no()==n)
{
obj.show_account();
if(option==1)
{
cout<<"\n\n\t\t\tTO DEPOSITSS AMOUNT";
cout<<"\n\n\t\t\tEnter The amount to be deposited: ";
cin>>amt;
obj.dep(amt);
}
if(option==2)
{
cout<<"\n\n\t\t\tTO WITHDRAW AMOUNT";
cout<<"\n\n\t\t\tEnter The amount to be withdraw: ";
cin>>amt;
int bal=obj.retdeposit()-amt;
if(bal<0)
cout<<"Insufficient balance"<<endl;
else
obj.draw(amt);
}
int pos=(-1)*static_cast<int>(sizeof(obj));
File.seekp(pos,ios::cur);
File.write(reinterpret_cast<char *> (&obj), sizeof(account));
cout<<"\n\n\t\t\tRecord Updated";
i=true;
}
}
File.close();
if(i==false)
cout<<"\n\n\t\t\tRecord Not Found ";
}
int main()
{
char choice;
int acc;
do
{
system("CLS");
cout<<"\n\n\t\t\t\t======================\n";
cout<<"\t\t\t\tBANK MANAGEMENT SYSTEM";
cout<<"\n\t\t\t\t======================\n";
cout<<"\t\t\t\t ::MAIN MENU::\n";
cout<<"\n\t\t\t\t1. NEW ACCOUNT";
cout<<"\n\t\t\t\t2. DEPOSIT AMOUNT";
cout<<"\n\t\t\t\t3. WITHDRAW AMOUNT";
cout<<"\n\t\t\t\t4. BALANCE ENQUIRY";
cout<<"\n\t\t\t\t5. ALL ACCOUNT HOLDER LIST";
cout<<"\n\t\t\t\t6. CLOSE AN ACCOUNT";
cout<<"\n\t\t\t\t7. MODIFY AN ACCOUNT";
cout<<"\n\t\t\t\t8. EXIT";
cout<<"\n\n\t\t\t\tSelect Your Option (1-8): ";
cin>>choice;
switch(choice)
{
case '1':
newAcc();
break;
case '2':
system("CLS");
cout<<"\n\n\t\t\tEnter The account No. : "; cin>>acc;
balance(acc, 1);
break;
case '3':
system("CLS");
cout<<"\n\n\t\t\tEnter The account No. : "; cin>>acc;
balance(acc, 2);
break;
case '4':
system("CLS");
cout<<"\n\n\t\t\tEnter The account No. : "; cin>>acc;
display_one(acc);
break;
case '5':
display_all();
break;
case '6':
system("CLS");
cout<<"\n\n\t\t\tEnter The account No. : "; cin>>acc;
delete_acc(acc);
break;
case '7':
system("CLS");
cout<<"\n\n\t\t\tEnter The account No. : "; cin>>acc;
modify_acc(acc);
break;
case '8':
system("CLS");
cout<<"\n\n\t\t\tthxs...";
break;
default :cout<<"\a";
}
cin.ignore();
cin.get();
}while(choice!='8');
return 0;
}
|
60f7a7633a8d2c746476171ac94c145a4a7b43d5 | 3efc50ba20499cc9948473ee9ed2ccfce257d79a | /data/code-jam/files/639102_cz.vx.bc_760487_0_extracted_b.cc | 43fb1fdca0c798ed44ecac29ad59cacecba6507c | [] | no_license | arthurherbout/crypto_code_detection | 7e10ed03238278690d2d9acaa90fab73e52bab86 | 3c9ff8a4b2e4d341a069956a6259bf9f731adfc0 | refs/heads/master | 2020-07-29T15:34:31.380731 | 2019-12-20T13:52:39 | 2019-12-20T13:52:39 | 209,857,592 | 9 | 4 | null | 2019-12-20T13:52:42 | 2019-09-20T18:35:35 | C | UTF-8 | C++ | false | false | 849 | cc | 639102_cz.vx.bc_760487_0_extracted_b.cc | #include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
const ll llinf = 1LL<<50;
ll B[120];
ll D[1001000];
int nb;
int main() {
int nt, C = 1;
ll tot;
cin >> nt;
while (nt-- && cin >> tot >> nb) {
for (int i = 0; i < nb; ++i)
cin >> B[i];
sort(B, B+nb);
ll m = 0; // m < 1000000
for (int i = 0; i+1 < nb; ++i)
m += B[i]*(B[i+1]-1);
for (int i = 0; i <= m; ++i)
D[i] = llinf;
D[0] = 0;
for (int i = 0; i < nb-1; ++i) {
for (int j = 0; j <= m; ++j)
D[j+B[i]] = min(D[j+B[i]], D[j]+1);
}
ll ans = llinf;
for (int i = 0; i <= m; ++i) {
if (!((tot - i)%B[nb-1]))
ans = min(ans, D[i] + (tot-i)/B[nb-1]);
}
cout << "Case #" << C++ << ": ";
if (ans < llinf) cout << ans << endl;
else cout << "IMPOSSIBLE" << endl;
}
}
|
23c17a417ed95b3738a4de280b63c97697993b0b | 4b2741a424993dd2fdc4169995e64c9981246c77 | /C++/337_HouseRobberIII.cpp | 6a7a84434c250fc2a5c0a58a1beac4098e0929c6 | [] | no_license | UrMagicIsMine/LeetCode-Sol | 6828507e733e1267369ba1b484dc4ef1b4c193ce | b5fe858adfd22d0084975a74a7b4f39c4e5b7d3d | refs/heads/master | 2021-04-30T14:14:26.361993 | 2020-09-20T23:47:44 | 2020-09-20T23:47:44 | 121,192,645 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,633 | cpp | 337_HouseRobberIII.cpp | /*The thief has found himself a new place for his thievery again. There is only
* one entrance to this area, called the "root." Besides the root, each house has
* one and only one parent house. After a tour, the smart thief realized that
* "all houses in this place forms a binary tree". It will automatically contact
* the police if two directly-linked houses were broken into on the same night.
*
* Determine the maximum amount of money the thief can rob tonight without
* alerting the police.
*
* Example 1:
* 3
* / \
* 2 3
* \ \
* 3 1
* Maximum amount of money the thief can rob = 3 + 3 + 1 = 7.
* Example 2:
* 3
* / \
* 4 5
* / \ \
* 1 3 1
* Maximum amount of money the thief can rob = 4 + 5 = 9.
*/
#include <vector>
#include <algorithm>
#include <cassert>
using namespace std;
/*
* Definition for a binary tree node.
*/
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x) : val(x), left(NULL), right(NULL) {}
};
pair<int, int> _rob(TreeNode* pNode) {
pair<int, int> resl(0, 0);
if (pNode) {
pair<int, int> pl = _rob(pNode->left);
pair<int, int> pr = _rob(pNode->right);
pNode->val = max(pNode->val + pl.second + pr.second, pl.first + pr.first);
resl.first = pNode->val;
resl.second = pl.first + pr.first;
}
return resl;
}
int rob(TreeNode* root) {
pair<int, int> money = _rob(root);
return max(money.first, money.second);
}
int main()
{
vector<TreeNode> nums = { 4,1,2,3 };
nums[0].left = &nums[1];
nums[1].left = &nums[2];
nums[2].left = &nums[3];
int ans = 7;
int ret = rob(&nums[0]);
assert(ret == ans);
return 0;
}
|
150d67eb4e931a7193eb7040201d07232181252f | 73692ba82885354766751b7bca0a74ecc895f138 | /include/SceneManagerAwareMixin.h | 8a57ade7f78cf816ee56b34cf3eb01d03c21f243 | [] | no_license | lenchis001/T10 | 0f8ae27204f946e7d6157b1d66fb486b5a52c44b | f5918d19971a47559542bd9d66a4deb793ee1137 | refs/heads/master | 2023-09-01T15:52:13.130753 | 2023-06-04T23:59:54 | 2023-06-04T23:59:54 | 62,447,620 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 598 | h | SceneManagerAwareMixin.h | #ifndef __SCENE_MANAGER_AWARE__
#define __SCENE_MANAGER_AWARE__
#include "boost/smart_ptr.hpp"
namespace irr::scene {
class ISceneManager;
template<class S = ISceneManager> class SceneManagerAwareMixin
{
public:
SceneManagerAwareMixin(boost::shared_ptr<S> sceneManager) {
_sceneManager = sceneManager;
}
virtual boost::shared_ptr<S> getSceneManager() {
return _sceneManager.lock();
}
virtual void setSceneManager(boost::shared_ptr<S> sceneManager) {
_sceneManager = sceneManager;
}
private:
boost::weak_ptr<S> _sceneManager;
};
}
#endif |
89080f1fda1cea66202e447210f110268314075a | e7e497b20442a4220296dea1550091a457df5a38 | /main_project/OceCxxAdapter/src/DoingSearchNewContainerAdapter.cpp | de86080ed2c5b27dc4fba64567bd5888eb1a19eb | [] | no_license | gunner14/old_rr_code | cf17a2dedf8dfcdcf441d49139adaadc770c0eea | bb047dc88fa7243ded61d840af0f8bad22d68dee | refs/heads/master | 2021-01-17T18:23:28.154228 | 2013-12-02T23:45:33 | 2013-12-02T23:45:33 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,216 | cpp | DoingSearchNewContainerAdapter.cpp | #include "DoingSearchNewContainerAdapter.h"
#include <iostream>
#include <Ice/Ice.h>
using namespace xce::doingsearch;
using namespace std;
using namespace MyUtil;
//---------------------------------------------------------------------------
DoingSearchNewContainerAdapter::DoingSearchNewContainerAdapter(){
}
DoingSearchContainerPrx DoingSearchNewContainerAdapter::getDoingSearchContainer() {
return locate<DoingSearchContainerPrx>(name(), endpoints(), TWO_WAY, 300);
}
DoingSearchContainerPrx DoingSearchNewContainerAdapter::getDoingSearchContainerOneway() {
return locate<DoingSearchContainerPrx>(name(), endpoints(), ONE_WAY, 300);
}
void DoingSearchNewContainerAdapter::addDoing(DoingItem item){
MCE_DEBUG("DoingSearchNewContainerAdapter::addDoing");
try{
getDoingSearchContainerOneway()->addDoing(item);
}catch(Ice::Exception& e){
MCE_WARN("DoingSearchNewContainerAdapter::addDoing "<< e);
}catch(...){
MCE_WARN("DoingSearchNewContainerAdapter::addDoing exception");
}
}
string DoingSearchNewContainerAdapter::name(){
return "M";
}
string DoingSearchNewContainerAdapter::endpoints(){
return "@DoingSearchNewContainer";
}
size_t DoingSearchNewContainerAdapter::cluster() {
return 0;
}
|
666c29e3018255a31a5837cf9765874b56373824 | 9516974386dc57016025ade6030c8e0f6fd9f8f9 | /net/inspect/ProcessInspector.h | 40300070402ba5fc0b5d16d9e12b0a4327e949b6 | [] | no_license | sky1737/kimgbo | 4141411c11162fcf8ba75146c310c580b6519d10 | 37282369601e622634d7d8b96e94e44f1118f991 | refs/heads/master | 2021-01-19T20:30:51.225127 | 2016-11-21T06:15:23 | 2016-11-21T06:15:23 | 88,513,409 | 1 | 0 | null | 2017-04-17T13:59:43 | 2017-04-17T13:59:43 | null | UTF-8 | C++ | false | false | 620 | h | ProcessInspector.h | #ifndef INSPECT_PROCESSINSPECTOR_H
#define INSPECT_PROCESSINSPECTOR_H
#include <string>
#include "Inspector.h"
//#include "Types.h"
namespace kimgbo
{
namespace net
{
class ProcessInspector
{
public:
void registerCommands(Inspector* ins);
private:
static std::string pid(HttpRequest::Method, const Inspector::ArgList&);
static std::string procStatus(HttpRequest::Method, const Inspector::ArgList&);
static std::string openedFiles(HttpRequest::Method, const Inspector::ArgList&);
static std::string threads(HttpRequest::Method, const Inspector::ArgList&);
};
}
}
#endif // INSPECT_PROCESSINSPECTOR_H
|
5c7ab11536282f3c268d4a2bc792c82cadb653bd | 394fd2a44126ae5607c30a58fe5593db1c6e5a02 | /src/QCamMovieAvi_avifile.hpp | 10d0d29d2640c634711c032668505cccd53d5d4e | [] | no_license | thx8411/qastrocam-g2 | 653b98463609737ab328f63929690f27d7f100eb | c1453cc8bc2e7719db21bae5bffe3340c66b42e0 | refs/heads/master | 2021-01-17T11:35:54.403879 | 2016-04-01T20:33:07 | 2016-04-01T20:33:07 | 40,839,897 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,644 | hpp | QCamMovieAvi_avifile.hpp | /******************************************************************
Qastrocam
Copyright (C) 2003-2009 Franck Sicard
Qastrocam-g2
Copyright (C) 2009-2013 Blaise-Florentin Collin
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License v2
as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA.
*******************************************************************/
#ifndef _QCamMoviAvi_avifile_hpp_
#define _QCamMoviAvi_avifile_hpp_
// only available if have libavifile
#if HAVE_AVIFILE_H
#include "QCamMovie.hpp"
#include <avifile.h>
// raw avi recording class
class QCamMovieAvi : public QCamMovie {
public:
QCamMovieAvi();
~QCamMovieAvi();
QWidget* buildGUI(QWidget* father);
// open the stream
bool openImpl(const string & seqName, const QCam & cam);
// close the stream
void closeImpl();
// add a frame
bool addImpl(const QCamFrame & newFrame, const QCam & cam);
private:
bool registaxCompatibility;
// file
mutable avm::IWriteFile* aviFile_;
// stream
mutable avm::IWriteStream* aviStream_;
// frame buffer
mutable unsigned char* deinterlaceBuf_;
};
#endif /* HAVE_AVIFILE_H */
#endif
|
dba2d3acda795380498d19e9a00f11884ee1909e | 3eab3ae9e4326f4543c184531351f9e9d2b29362 | /schedule.cpp | 2026ba8a27ef75a419aa6d66c25907ce3c589b77 | [] | no_license | hemangbhatt/CMSC202-Project1 | c48ed113d34a228cc6af6b004b1eafe0908f093c | 7a3368778c5e12a0a27ac62361789632bb7e680d | refs/heads/master | 2021-01-19T01:07:20.104496 | 2016-05-31T19:01:43 | 2016-05-31T19:01:43 | 60,111,640 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,857 | cpp | schedule.cpp | /*****************************************
** File: schedule.cpp
** Project: CMSC 202 Project 1, Spring 2016
** Author: Hemang Bhatt
** Date: 02/20/15
** Section: 12
** E-mail: hb6@umbc.edu
**
** This file contains the main driver program for Project 1.
** This program includes the header file for specified activity data, and
** schedules maximum possible activities using greedy algorithm and displays
** the results in the format (hh:mm).
**
***********************************************/
// Activity Scheduling
#include <iostream>
#include <iomanip>
#include <string>
#include "sched.hpp"
using namespace std;
// sort() - sorts an array of floats returning sorted indices
// On return, indx[] is an array of indices such that data[indx[0]],
// data[indx[1]], ..., data[indx[len-1]] is data[] in ascending order.
//
// Parameters
// data[] - float array of data to be ordered
// indx[] - int array, same length as data[], to hold indices
// len - int specifying the length of data[] and indx[]
void sort(float data[], int indx[], int len);
// sched() - schedules events given start and end times, and indx[] from sort
// Returns number of events scheduled; on return, scheduled[] contains
// indices of scheduled events (e.g. startTime[scheduled[0]] is the start
// time of the first schedled event).
//
// Parameters
// startTime[] - float array of event start times
// endTime[] - float array of event end times
// indx[] - array of indices that orders the end times
// scheduled[] - int array to hold indices of scheduled events
// len - int specifying the length of the arrays
// Returns
// int value specifying number of events scheduled
int sched(float startTime[], float endTime[], int indx[], int scheduled[], int len);
// printEvent() - prints an event to the console
// Converts float start and end times to hh:mm format and prints times
// along with description. E.g. Study Session from 12.5 to 13.25 should
// print as "12:30 - 13:15 Study Session"
//
// Parameters
// startTime - float event start time
// endTime - float event end time
// description - string event description
void printEvent(float startTime, float endTime, string description);
// MAIN PROGRAM
int main() {
int indx[NUM_EVENTS];
int scheduledEvents[NUM_EVENTS];
int numSched;
// Sort by event ending times
sort(endTime, indx, NUM_EVENTS);
// Call greedy scheduling algorithm
numSched = sched(startTime, endTime, indx, scheduledEvents, NUM_EVENTS);
// Display scheduled events
for (int i = 0; i < numSched; i++)
printEvent(startTime[scheduledEvents[i]], endTime[scheduledEvents[i]],
description[scheduledEvents[i]]);
return 0;
}
//
// FUNCTION IMPLEMENTATIONS
//
void sort(float data[], int indx[], int len) {
// create index array
for (int i = 0; i < len; i++)
indx[i] = i;
// sort indices of the indx array using bubble sort
for (int x = 0; x < len; x++) {
for (int y = 0; y < (len - 1); y++) {
// if higher value than swape
if (data[indx[y]] > data[indx[y + 1]]) {
int temp = indx[y];
indx[y] = indx[y + 1];
indx[y + 1] = temp;
}
}
}
}
// This function schedules the event using greedy algorithm giving first preference to the event who ends first.
int sched(float startTime[], float endTime[], int indx[], int scheduled[], int \
len) {
// register the first event
int counter = 0;
scheduled[counter] = indx[counter];
for (int eventNum = 1; eventNum < len; eventNum++) {
// Register the event if start time of event is after than end time of
// previous event
if (startTime[indx[eventNum]] >= endTime[scheduled[counter]]) {
scheduled[(counter + 1)] = indx[eventNum];
counter++;
}
}
return ++counter; // increase by 1 one for the first event
}
// This function prints time using hh:mm format with discription
void printEvent(float startTime, float endTime, string description) {
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
// set floting point precision 2
cout.precision(2);
// fill 0 if one digit
// Find minutes using (time - int(time)) * 60
// set width of hours using setw()
cout << std::setw(2) << std::setfill('0') << int(startTime) << ":"
<< std::setw(2) << std::setfill('0') << int((((startTime) - int(startTime)) * 60)) << " - "
<< std::setw(2) << std::setfill('0') << int(endTime) << ":"
<< std::setw(2) << std::setfill('0') << int((((endTime) - int(endTime)) * 60 ))
<< " " << description << endl;
}
|
3c015dc2ea36dcb6df1f5b0cf63f1f3f06452a1d | a03c2402207183d8df03c06b0c2a78162b2c712d | /factorial class.cpp | 28d69f4c558f69cf1a8f920d077177af8a396eaf | [] | no_license | PrateekJain999/cpp-Codes | 9a1921952a4c261f4fa715485e14c7291d345dd1 | 39d2eff00563cf5b3ef7ead2748369a4efb70b6c | refs/heads/main | 2023-02-27T20:03:00.216144 | 2021-02-01T07:35:22 | 2021-02-01T07:35:22 | 334,866,859 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 290 | cpp | factorial class.cpp | #include<iostream>
using namespace std;
class Ac
{
public:
int i,n,fact;
void gn()
{
cout<<"Enter the number";
cin>>n;
}
void fact()
{
fact=1;
for(i=1;i<=n;i++)
{
fact=fact*i;
}
cout<<"factorial is "<<fact;
}
};
main()
{
Ac o;
o.gn();
o.fact();
}
|
1b3c58213b54a2d133acc2d92ba377673895b9b7 | bcf138c82fcba9acc7d7ce4d3a92618b06ebe7c7 | /gta5/0xEE47635F352DA367.cpp | f4ac5cf679077d8ed42da540d12bfe7abe4700e0 | [] | no_license | DeepWolf413/additional-native-data | aded47e042f0feb30057e753910e0884c44121a0 | e015b2500b52065252ffbe3c53865fe3cdd3e06c | refs/heads/main | 2023-07-10T00:19:54.416083 | 2021-08-12T16:00:12 | 2021-08-12T16:00:12 | 395,340,507 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 358 | cpp | 0xEE47635F352DA367.cpp | // achievement_controller.ysc @ L12676
int func_90(int iParam0, int* iParam1)
{
int iVar0;
int iVar1;
iVar1 = FILES::GET_NUM_DLC_WEAPONS();
iVar0 = 0;
while (iVar0 < iVar1)
{
if (FILES::GET_DLC_WEAPON_DATA(iVar0, iParam1))
{
if (iParam1->f_1 == iParam0)
{
return iVar0;
}
}
iVar0++;
}
return -1;
} |
9c892ede941e982885f75d6598b79d006be61364 | 0b44172bacc2c7060a5caed6b8be71a78a249883 | /Client/SDL_project/HSL.h | e9a5bf2df39275d489dac3c79c4147e91704e69e | [] | no_license | Alli1223/River-Fishing | 25c2d81b662d8f2ab125ee2fb4b2680c46f70709 | 80306544eea7b130e1ebaa1fb6363d68b34ff3c8 | refs/heads/master | 2020-03-22T06:17:19.035476 | 2018-07-06T00:53:01 | 2018-07-06T00:53:01 | 139,623,115 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 356 | h | HSL.h | #pragma once
//https://en.wikipedia.org/wiki/HSL_and_HSV#Converting_to_RGB
class HSL
{
public:
double Hue;
double Saturation;
double Luminance;
HSL();
HSL(int H, int S, int L);
SDL_Color TurnToRGB();
HSL TurnToHSL(const SDL_Color& C);
const double D_EPSILON = 0.00000000000001;
private:
double HueToRGB(double arg1, double arg2, double H);
};
|
0479bfd140ba9df5d7b3cd55f98f7ad255975280 | a18fae4a953799f26411c08bd6e95f3d248ac2b9 | /src/elems/arrow.cpp | b70e6a67e7a0990c9ce4fae7b4f15955b98a8288 | [] | no_license | vch9/GaCre-GaPla | e3551a0c74199b2deb41a914b5ebf1db538db868 | 6ec47b35354605c1cb86276f949966569abc3afd | refs/heads/master | 2022-04-06T11:04:45.740293 | 2020-01-09T22:43:20 | 2020-01-27T22:41:23 | 219,955,945 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 599 | cpp | arrow.cpp | #include "arrow.hpp"
/* Constructors */
Arrow::Arrow(Game* g, int i, int j, Direction d):
Elem("~", g, i, j),
Move(),
direction(d),
active(true){
}
/* Methods */
void Arrow::takeAction(){
/* Follow it's journey */
move(Arrow::game, this, Arrow::direction, 1);
}
void Arrow::onCollision(Elem* e){
if(e->getSymb()=="s"){
((Monster*)e)->reduceHealth(50);
}
if(e->getSymb()=="J"){
((Player*)e)->reduceHealth(50);
}
Elem::switchActive();
Elem::game->getCurrentBoard()->getCell(Elem::pos_i, Elem::pos_j)->setElem(nullptr);
}
bool Arrow::blockable(){
return false;
}
|
465e089b59bb3c0d064232f721d5680f0fbb9562 | abc1f2f52fc20106bf3bc90dea904bebabf1c1ab | /DEFINITIVO/DEFINITIVO.ino | 777b77818fbea18a185d86c1e0971050bccbee7e | [] | no_license | omarmyrm/Canned-Universe-CanSat | a16031d460abe1b2ff84fbfb87888adcf222818f | f0ff98c5ecd3b4d2b2e7af602982301a76339985 | refs/heads/main | 2023-05-30T04:54:49.114159 | 2021-06-07T19:54:51 | 2021-06-07T19:54:51 | 313,020,808 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,892 | ino | DEFINITIVO.ino | /*
CANSAT 2021
Equipo Canned Universe
IES Andres de Vandelvira e IES Ramon y Cajal(Albacete)
DATE:25-01-2020
*/
#include "libPressTemp.h"
#include "libGPS.h"
#include "libOLED.h"
#include "libSDcard.h"
unsigned double packetsSend = 1;// change data type from long to double, to avoid errors in a later division
unsigned long double a;// to store millis() as a double, to avoid losing information in a later division
bool SDcardWorking = false;// this is then set to true when the SDcard starts working, we assume it doesn't stop working during the program.
void setup(){
Serial.begin(9600);
initGPS();// starts the GPS from its .h file
initPressTemp();// starts the BMP180 from its .h file
initOLED();// starts the display from the .h file
SDcardWorking = initSD();// start the SD and check if it's working or not
while(packetsSend<100){// ONLY SENDS 100 PACKETS, controls the execution of the program. CHANGE THIS to a GOOD condition to stop the program
a = millis();// number of ms since the start of the program
if( packetsSend > a /1000 )// *trick* for ONLY sending the data once every second
{
}else{
String dataPressTemp = getDataPressTemp();// get the data as a string to write it to the SD card and print it on the serial monitor
float tempOLED = tempForOLED();// get the temp from the sensors to print it in the OLED display
float pressOLED = pressForOLED();//get the pressure from the sensors to print it in the OLED display
int metersHigh = gps.altitude.meters();// get the altitude from the GPS to print in the OLED display
Serial.print(dataPressTemp);// send the information via radio
displayGPS();// send the GPS information via radio (*SHOULD CHANGE THE NAME OF THIS*)
Serial.println("$");//final character of the sequence of information via radio
logToSD(dataPressTemp,metersHigh,SDcardWorking);// store in the SD card only the temp,press and altitude data.
//display the data in the OLED display
displayTemperatura(tempOLED);
displayPressure(pressOLED);
displayAltitude(metersHigh);
//
//delay(100);// we are using a "smart delay" with the ms thing instead of delay
++packetsSend;// we have send one packet of information, so we increment the number by 1,
}
}
myFile.close();// everything is inside the setup because it is easier to write to the file when you only close it once.
//that is why there is that shitty loop, REMEMBER TO CLOSE the file so it saves it to the SD
}
void loop() {
}
|
cfd1aadeac3c7ddba53c00b00c082a4bb6ab6486 | 8bfbccc253fde3850d96959fc747c38e698c8736 | /src/sequencemanager.h | 300d31140bd02826a6bc0ca08b88317da02adf3e | [] | no_license | sidneydijkstra/PADEngine | b61cd89056e4b4ad19a94660419d1eccf34fda2c | 4499c64d4c14bf42f597e6f06c19da733de84255 | refs/heads/master | 2023-05-10T15:23:41.044506 | 2021-05-18T13:38:42 | 2021-05-18T13:38:42 | 297,615,673 | 0 | 1 | null | 2021-01-18T14:35:39 | 2020-09-22T10:33:50 | C | UTF-8 | C++ | false | false | 2,905 | h | sequencemanager.h | /// @file sequencemanager.h
/// @brief Standalone header providing SequenceManager functionality.
/// @author Sidney Dijkstra
/// @version 1.0.0
/// @date 02/01/2021
#ifndef SEQUENCEMANAGER_CLASS
#define SEQUENCEMANAGER_CLASS
#include "renderer.h"
#include "scene.h"
#include "input.h"
#include <cstdint>
#include <vector>
namespace pad {
/// @brief Class describing a SequenceManager, which handles the flow of the engine.
///
/// The SequenceManager is an important component inside the engine.
/// Within Vulkan it is possible to prepare the next frame through the command buffer with rendering information.
/// To be able to prepaire these next frames for rendering it will be necessary to create multiple frames and buffers.
/// This is where the SequenceManager comes in handy. It contains two lists with <a href="https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VkSemaphore.html">VkSemaphore</a> objects and two <a href="https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VkFence.html">VkFence</a> objects.
/// These lists are then used to keep track of which frames are done rendering and which need to be rendered.
/// These Vulkan objects give a signal when a frame is done rendering to prevent problems in rendering order.
/// Lastly the SequenceManager contains the current frame that is used during the updating of buffers.
class SequenceManager {
public:
/// @brief The constructor for the SequenceManager class.
SequenceManager();
/// @brief The deconstructor for the SequenceManager class.
~SequenceManager();
/// @brief The draw function of SequenceManager.
/// @param _scene The Scene to draw.
void draw(Scene* _scene);
/// @brief Get the Renderer.
/// @return Pointer to Renderer.
Renderer* getRenderer();
/// @brief Set resize value to true, this means the window is resized.
void setFramebufferResized();
private:
Renderer* _renderer; ///< @brief Renderer pointer of SequenceManager.
/// @brief Get the image index.
/// @return Current image index.
uint32_t getImageIndex();
/// @brief Recreate the SequenceManager.
void recreate();
/// @brief Setup sync objects.
void setupSyncObjects();
/// @brief Setup a scene.
/// @param _scene Pointer to the Scene.
/// @param _imageIndex Current image index.
void updateScene(Scene* _scene, int _imageIndex);
/// @brief Update the sequence.
/// @param _commandBuffer VkCommandBuffer to use.
/// @param _imageIndex Current image index.
void updateSequence(const VkCommandBuffer _commandBuffer, const uint32_t _imageIndex);
std::vector<VkSemaphore> _imageAvailableSemaphores;
std::vector<VkSemaphore> _renderFinishedSemaphores;
std::vector<VkFence> _inFlightFences;
std::vector<VkFence> _imagesInFlight;
size_t _currentFrame = 0;
bool _framebufferResized = false;
const int MAX_FRAMES_IN_FLIGHT = 2;
};
}
#endif |
59dce6749f2332921a823502dde571467b855ca6 | 1dc05c3cb3a57aea5f64052f329eaf458f73c832 | /topic/SwordforOffer/28isSymmetric.cpp | 1ebc620f0919cbbb40ab435c5574c132a2d95d75 | [] | no_license | ITShadow/practiceCode | 0b1fcbb6b150a1ee91283e8ac7a8d928b4751eda | 4b407ad98e3abc0be5eadc97ff32165f9f367104 | refs/heads/master | 2023-04-08T05:53:21.734166 | 2021-04-26T03:45:46 | 2021-04-26T03:45:46 | 295,429,631 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,634 | cpp | 28isSymmetric.cpp | /* 请实现一个函数,用来判断一棵二叉树是不是对称的。如果一棵二叉树和它的镜像一样,那么它是对称的。
例如,二叉树 [1,2,2,3,4,4,3] 是对称的。
1
/ \
2 2
/ \ / \
3 4 4 3
但是下面这个 [1,2,2,null,3,null,3] 则不是镜像对称的:
1
/ \
2 2
\ \
3 3
示例 1:
输入:root = [1,2,2,3,4,4,3]
输出:true
示例 2:
输入:root = [1,2,2,null,3,null,3]
输出:false
限制:
0 <= 节点个数 <= 1000
来源:力扣(LeetCode)
链接:https://leetcode-cn.com/problems/dui-cheng-de-er-cha-shu-lcof
著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。 */
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
/* class Solution {
public:
bool isSymmetric(TreeNode* root) {
if(root==NULL) return true;
queue<TreeNode*> q;
q.push(root->left);
q.push(root->right);
while(!q.empty())
{
TreeNode *A=q.front();
q.pop();
TreeNode *B=q.front();
q.pop();
if(A==NULL&&B==NULL) continue;
if(A==NULL||B==NULL) return false;
if(A->val!=B->val) return false;
q.push(A->left);
q.push(B->right);
q.push(A->right);
q.push(B->left);
}
return true;
}
}; */
/* 层序遍历,每次比较,循环往复 */ |
8692a547dffb6a94771343d552776b9aebefee5c | 0eff74b05b60098333ad66cf801bdd93becc9ea4 | /second/download/rsync/gumtree/rsync_repos_function_14_last_repos.cpp | 0e65cff79fe480ebe5ab29f3ca9faccdaa288a45 | [] | no_license | niuxu18/logTracker-old | 97543445ea7e414ed40bdc681239365d33418975 | f2b060f13a0295387fe02187543db124916eb446 | refs/heads/master | 2021-09-13T21:39:37.686481 | 2017-12-11T03:36:34 | 2017-12-11T03:36:34 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 234 | cpp | rsync_repos_function_14_last_repos.cpp | void match_report(void)
{
if (!DEBUG_GTE(DELTASUM, 1))
return;
rprintf(FINFO,
"total: matches=%d hash_hits=%d false_alarms=%d data=%s\n",
total_matches, total_hash_hits, total_false_alarms,
big_num(stats.literal_data));
} |
6bbf4b3bcbb9c5b29062da95457c3a18214bfec1 | 3ee850d3df62fcf79719c03d1f467c147a361e0d | /source/ProbabilisticDistanceMetric.h | 2089a2ca7518f5a34cdf2f3dfe4beb117f25ddab | [
"Apache-2.0"
] | permissive | nagyist/Visceral.EvaluateSegmentation | 5ccc015dbd4c44e9397627c65afea7cb6d58b413 | 4cff08d1b5e23e2ecb95043fb62589058f80b690 | refs/heads/master | 2022-12-22T02:20:54.236978 | 2021-12-25T18:29:53 | 2021-12-25T18:29:53 | 85,386,947 | 0 | 0 | Apache-2.0 | 2022-12-17T07:53:37 | 2017-03-18T08:30:50 | C++ | UTF-8 | C++ | false | false | 2,096 | h | ProbabilisticDistanceMetric.h | /*
// ProbabilisticDistanceMetric.h
// VISERAL Project http://www.viceral.eu
// VISCERAL received funding from EU FP7, contract 318068
// Created by Abdel Aziz Taha (taha@ifs.tuwien.ac.at)
// on 22.04.2013
// Copyright 2013 Vienna University of Technology
// Institute of Software Technology and Interactive Systems
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Description:
//
// This algorithm calculates the Probabilistic Distance between two volumes.
//
//
//
*/
#include "itkImage.h"
class ProbabilisticDistanceMetric
{
typedef itk::ImageRegionConstIterator<ImageType> FixedIteratorType;
typedef itk::ImageRegionConstIterator<ImageType> MovingIteratorType;
private:
VoxelPreprocessor *voxelprocesser;
bool fuzzy;
double threshold;
public:
~ProbabilisticDistanceMetric(){
}
ProbabilisticDistanceMetric(VoxelPreprocessor *voxelprocesser, bool fuzzy, double threshold){
this->voxelprocesser= voxelprocesser;
this->fuzzy = fuzzy;
this->threshold = threshold;
}
double CalcJProbabilisticDistance(){ //[{00121}]
double mean_f = voxelprocesser->mean_f;
double mean_m = voxelprocesser->mean_m;
int numberElements = std::min(voxelprocesser->numberElements_f, voxelprocesser->numberElements_m);
double probability_joint = 0;
double probability_diff = 0;
for (int i = 0; i < numberElements; i++)
{
double f =values_f[i];
double m =values_m[i];
probability_diff += abs(f - m);
probability_joint += f * m;
}
double pd= -1;
if(probability_joint != 0)
pd = probability_diff/(2*probability_joint);
return pd;
}
};
|
f0063b82106c74cf262f81574a2199d8d669a119 | 2b1b459706bbac83dad951426927b5798e1786fc | /zircon/kernel/phys/efi/protocol.cc | b392c79b4be79b4fbbf58dcafb733301c4e45655 | [
"BSD-2-Clause",
"MIT",
"BSD-3-Clause"
] | permissive | gnoliyil/fuchsia | bc205e4b77417acd4513fd35d7f83abd3f43eb8d | bc81409a0527580432923c30fbbb44aba677b57d | refs/heads/main | 2022-12-12T11:53:01.714113 | 2022-01-08T17:01:14 | 2022-12-08T01:29:53 | 445,866,010 | 4 | 3 | BSD-2-Clause | 2022-10-11T05:44:30 | 2022-01-08T16:09:33 | C++ | UTF-8 | C++ | false | false | 1,445 | cc | protocol.cc | // Copyright 2022 The Fuchsia Authors
//
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file or at
// https://opensource.org/licenses/MIT
#include <stdio.h>
#include <zircon/assert.h>
#include <phys/efi/main.h>
#include <phys/efi/protocol.h>
fit::result<efi_status, efi_handle> EfiOpenProtocol(efi_handle handle, const efi_guid& guid) {
void* ptr = nullptr;
efi_status status = gEfiSystemTable->BootServices->OpenProtocol(
handle, &guid, &ptr, gEfiImageHandle, nullptr, EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL);
if (status != EFI_SUCCESS) {
return fit::error{status};
}
return fit::ok(ptr);
}
void EfiCloseProtocol(const efi_guid& guid, efi_handle protocol) {
efi_status status =
gEfiSystemTable->BootServices->CloseProtocol(protocol, &guid, gEfiImageHandle, nullptr);
// TODO(mcgrathr): Getting EFI_INVALID_PARAMETER here, can't tell why.
// For now, just leaking the references seems harmless enough.
status = EFI_SUCCESS;
ZX_ASSERT_MSG(status == EFI_SUCCESS, "CloseProtocol(%p, <guid> %p, %p, NULL) -> %#zx\n", protocol,
&guid, gEfiImageHandle, status);
}
bool EfiHasProtocol(efi_handle handle, const efi_guid& guid) {
return gEfiSystemTable->BootServices->OpenProtocol(handle, &guid, nullptr, gEfiImageHandle,
nullptr, EFI_OPEN_PROTOCOL_TEST_PROTOCOL) ==
EFI_SUCCESS;
}
|
07ecf8118004c881511fd7369ed0171cf6ee05f9 | a6b3e3e818bc5c1efef9bf992bfc583de87d2595 | /d01/ex05/Human.hpp | 20e6bcf8a43599b126feb477415b026945ed21b1 | [] | no_license | gloomikon/Piscine_CPP | 4d66d65b5d75a4a4fc47a0778719d50d124fbb4d | b67071af3c7a4cb8ffb1a1567d010d2c574f6e1f | refs/heads/master | 2020-09-14T05:17:13.442632 | 2019-12-26T18:59:11 | 2019-12-26T18:59:11 | 223,030,006 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,098 | hpp | Human.hpp | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Human.hpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mzhurba <mzhurba@student.unit.ua> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/12/04 22:40:24 by mzhurba #+# #+# */
/* Updated: 2019/12/04 22:44:08 by mzhurba ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef HUMAN_HPP
#define HUMAN_HPP
#include "Brain.hpp"
class Human
{
public:
Human();
~Human();
std::string identify() const;
Brain const & getBrain() const;
private:
const Brain brain;
};
#endif |
3e14c881eb713b85cc60a33bb67b4343604563cf | 0ff7fc50fb88b843e45e3a67e0d6fd239ea64b82 | /qubus/src/global_id.cpp | 929de67619c46d80446ddf7bf90395cb0c88cdca | [
"BSL-1.0"
] | permissive | qubusproject/Qubus | 0d86385bf8aafbb1df65525a2e484c4b9062f78e | 0feb8d6df00459c5af402545dbe7c82ee3ec4b7c | refs/heads/master | 2021-07-09T06:19:09.382941 | 2020-02-02T21:28:20 | 2020-02-02T21:28:20 | 237,774,567 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 738 | cpp | global_id.cpp | #include <qubus/global_id.hpp>
#include <utility>
using server_type = hpx::components::component<qubus::global_id_server>;
HPX_REGISTER_COMPONENT(server_type, qubus_global_id_server);
namespace qubus
{
global_id::global_id(hpx::id_type id) : base_type(std::move(id))
{
}
global_id::global_id(hpx::future<hpx::id_type>&& id) : base_type(std::move(id))
{
}
global_id generate_global_id()
{
return hpx::local_new<global_id>();
}
bool operator==(const global_id& lhs, const global_id& rhs)
{
return lhs.get_id() == rhs.get_id();
}
bool operator!=(const global_id& lhs, const global_id& rhs)
{
return !(lhs == rhs);
}
bool operator<(const global_id& lhs, const global_id& rhs)
{
return lhs.get_id() < rhs.get_id();
}
} |
ed65b24a0554fed531bc2963ca4c0ac679c42cbd | bc0a9cc3ed843f038d41e6e41d24672878d8da21 | /ussenterprise/SegmentScreen.h | b956c3ebf0542d04f059e31bfa463c1d2880d0f1 | [] | no_license | Embedded-Software-kurssi/USSENTERPRISE | f589c3bf96e4386acbd5bada4934dda08c273dbe | 159e72853eb1f10d3f6416f49a64c5f150f199b9 | refs/heads/master | 2021-01-11T16:35:21.718999 | 2017-02-09T12:10:23 | 2017-02-09T12:10:23 | 80,115,929 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,186 | h | SegmentScreen.h | /*
* SegmentScreen.h
*
* Created: 13.10.2016 12.51.48
* Author: Teemu Pusa Jarmo Pesonen
*/
#ifndef SEGMENTSCREEN_H_
#define SEGMENTSCREEN_H_
#include "Arduino.h"
class SegmentScreen
{
private:
char *cathodePins;
int anodePin = 0;
void bitAction(char b, char pin);
public:
SegmentScreen(char cathodePins[7], char anodePin);
~SegmentScreen();
void clear();
void show(char c);
void turnOn();
void turnOff();
void init();
};
class SegmentLayout
{
private:
SegmentScreen **segmentScreens;
String text;
int count;
char currentSegementScreen = 0;
int slideDelay;
int currentSlideIndex = 0;
char minRefreshDelay = 0;
long lastRefresh = 0;
public:
SegmentLayout(SegmentScreen *segmentScreens[], int count);
~SegmentLayout();
void setText(String text);
void refresh();
void init();
void setMinRefreshDuration(int duration);
};
class SegmentCounter
{
private:
int delay = 1000;
long lastSwitch = 0;
SegmentLayout *layout;
String *stringSeq;
int length = 0;
int index = 0;
public:
SegmentCounter(SegmentLayout *layout);
~SegmentCounter();
void refresh();
void setText(String *stringSeq, int length);
};
#endif /* SEGMENTSCREEN_H_ */ |
233ae45bf1256d0e014fa314aa966276715f371c | 6cee25417e81dfc615a1baf227c9a8e745d21bbe | /common/core/BulletCommand.hpp | 67a388796712c6d8d945e648e46cbbe5d04bdda1 | [] | no_license | Koukan/Grab | e8c31f688ccbfdee55327151d65c9b1c0dbac43d | 263c774adaae7fb5baccef22186b37afcb2d285c | refs/heads/master | 2018-12-28T20:19:50.985625 | 2013-12-02T19:33:29 | 2013-12-02T19:33:29 | 13,930,582 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,180 | hpp | BulletCommand.hpp | #pragma once
#include <set>
#include <random>
#include "Net.hpp"
#include "bulletmlrunner.h"
#include "Sprite.hpp"
#include "PhysicObject.hpp"
#include "Bullet.hpp"
#include "GameState.hpp"
CORE_BEGIN_NAMESPACE
class CORE_DLLREQ BulletCommand : public Bullet, public BulletMLRunner
{
public:
BulletCommand(std::string const &parser, GameState &gstate,
double x = 0, double y = 0, double vx = 0, double vy = 0, bool paused = false);
BulletCommand(BulletMLParser &parser, GameState &gstate,
double x = 0, double y = 0, double vx = 0, double vy = 0, bool paused = false);
BulletCommand(BulletMLState &state, GameState &gstate, bool paused,
double x = 0, double y = 0, double vx = 0, double vy = 0);
BulletCommand(BulletMLState &state, GameState &gstate, HitBox &box, bool paused,
double vx = 0, double vy = 0, double xHitboxOffset = 0, double yHitboxOffset = 0);
virtual ~BulletCommand();
// BulletMLRunner overloaded
virtual double getBulletDirection();
virtual double getAimDirection();
virtual double getBulletSpeed();
virtual double getDefaultSpeed();
virtual double getRank();
virtual double getRand();
virtual void createSimpleBullet(double direction, double speed);
virtual void createBullet(BulletMLState* state, double direction, double speed);
virtual int getTurn();
virtual void doVanish();
virtual void doChangeDirection(double direction);
virtual void doChangeSpeed(double speed);
virtual void doAccelX(double speedx);
virtual void doAccelY(double speedy);
virtual double getBulletSpeedX();
virtual double getBulletSpeedY();
void removeChild(uint32_t id);
double getAimDirection(double defaultValue);
void isCommanded(bool commanded);
bool isCommanded() const;
void addFocus(std::string const &name);
void removeFocus(std::string const &name);
void setRank(double rank);
virtual void move(double time);
void setSeed(uint32_t seed);
uint32_t getSeed() const;
Bullet *getChild(uint32_t id) const;
std::string const &getBulletScript() const;
void start();
void stop();
bool isStarted() const;
virtual void erase();
protected:
typedef std::map<uint32_t, Bullet*> BulletMap;
enum Shape
{
Circle,
Rectangle,
UNKNOWN
};
void setSpeedDirection();
void insertChild(Bullet &bullet);
virtual BulletCommand *instantiateBullet(BulletMLState* state, double direction, double speed);
double _direction;
double _speed;
double _turn;
bool _end;
GameState &_state;
Shape _shape;
uint32_t _width;
uint32_t _height;
double _rank;
uint32_t _nextId;
uint32_t _simpleLife;
double _lifeRank;
uint32_t _simpleDamage;
std::set<std::string> _focus;
BulletMap _childs;
std::string _simpleSprite;
std::string _simpleGroup;
double _simpleXHitbox;
double _simpleYHitbox;
std::string _grabBullet;
std::string _deathBullet;
std::mt19937 _rand;
uint32_t _seed;
bool _paused;
bool _isCommanded;
bool _stop;
public:
unsigned int const score;
private:
void managePaused(GameState &);
};
CORE_END_NAMESPACE
|
af9375ba4ff0b3100dc62517fc1c703aced8faf9 | d73da2cb206091403e7f5d4707ec73418ee7a2b8 | /Transform/main.cpp | ec4f3c1a4c9391488c689e772a48563dad356d5b | [] | no_license | Yuli-yx/OpenCV-Tuturial-1 | 99e49d2d59a90aa3a5651661257107d58bd2070d | 804b4e41d6bfbf81fa3db49441c816533e50d888 | refs/heads/main | 2022-12-25T17:18:44.952854 | 2020-10-07T09:47:21 | 2020-10-07T09:47:21 | 301,982,528 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,314 | cpp | main.cpp | #include <iostream>
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
using namespace std;
using namespace cv;
int main() {
Mat src, dst;
src = imread("/home/will-zhu/Documents/OpenCVTuturials/first week/license plate.jpg");
imshow("initial image", src);
Point2f srcPts[4];
srcPts[0] = Point2f(597,331);
srcPts[1] = Point2f(603,390);
srcPts[2] = Point2f(764,332);
srcPts[3] = Point2f(772,388);
int MinX = std::min(srcPts[0].x, srcPts[1].x);
int MaxX = std::max(srcPts[2].x, srcPts[3].x);
int MinY = std::min(srcPts[0].y, srcPts[2].y);
int MaxY = std::max(srcPts[1].y, srcPts[3].y);
Point2f dstPts[4];
dstPts[0] = cv::Point2f(MinX, MinY);
dstPts[1] = cv::Point2f(MinX, MaxY);
dstPts[2] = cv::Point2f(MaxX, MinY);
dstPts[3] = cv::Point2f(MaxX, MaxY);
Mat perspectiveMat = getPerspectiveTransform(srcPts, dstPts);
warpPerspective(src, dst, perspectiveMat, src.size());
Mat plate;
Point2f center = Point2f((int)((MinX+MaxX)/2),(int)((MinY+MaxY)/2));
getRectSubPix(dst,Size(MaxX-MinX,MaxY-MinY),center,plate);
cvtColor(plate,plate,COLOR_BGR2GRAY);
threshold(plate,plate,130,255,THRESH_BINARY);
imshow("transformed", dst);
imshow("plate",plate);
waitKey(0);
return 0;
}
|
53f17769b20e4fe994d484078659684b415ba809 | 13794000c71a63a86e755d95caf1996775dbcfbf | /Headers/Graph.h | 7e66278a585e3e450a61c4f7d9d8499a42e4eedb | [] | no_license | moh4med/Algorithm | a509fe0d512136ea6a843e8ed4a72c10f66089b2 | a55df94440bd2eb1d6b90a7a9a43f3709b4bd178 | refs/heads/master | 2021-01-17T17:36:54.558198 | 2017-01-06T07:31:56 | 2017-01-06T07:31:56 | 61,139,154 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 573 | h | Graph.h | /*
* Graph.h
*
* Created on: Jun 14, 2016
* Author: Mohamed
*/
#ifndef GRAPH_H_
#define GRAPH_H_
#include <vector>
#pragma once
class GList{
private:
std::vector< std::vector<int> > a;
public:
GList(int n);
void addedge(int from,int to);
std::vector<int> adjacents(int from);
bool IsAdjacent(int from ,int to);
};
class GMatrix{
std::vector< std::vector<bool> > a;
public:
GMatrix(int n);
void addedge(int from,int to);
std::vector<int> adjacents(int from);
bool IsAdjacent(int from ,int to);
};
#endif /* GRAPH_H_ */
|
509f53653e60e32d89ecc6a1c54e1e1b47b0590c | 857c96d1606e1e6d86f9aad524eb8764e5d18f52 | /achilles/MyPipe.cpp | 342876cef4075e32bb5225ed0ff38bac229fed52 | [] | no_license | zausiu/Achilles | bac8ae08693ffe8e00ceb877ee12903ed2ef8175 | d414ebc87e1f738e67a23ee790764ca7c20e8932 | refs/heads/master | 2021-01-19T00:10:30.611311 | 2016-11-07T07:59:23 | 2016-11-07T07:59:23 | 72,943,145 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,224 | cpp | MyPipe.cpp | /*********************************************
* MyPipe.cpp
* Author: kamuszhou@tencent.com kamuszhou@qq.com
* website: blog.ykyi.net
* Created on: Nov 6, 2016
* Praise Be to the Lord. BUG-FREE CODE !
********************************************/
#include <stdio.h>
#include <stdexcept>
#include <boost/shared_ptr.hpp>
#include "MyPipe.h"
MyPipe::MyPipe(const std::string cmd, int start_line, int line_count)
{
cmd_ = cmd;
start_line_ = start_line;
line_count_ = line_count;
lines_.reserve(line_count);
Plenish();
}
MyPipe::~MyPipe()
{
}
const std::vector<std::string>& MyPipe::GetResultLines()const
{
return lines_;
}
void MyPipe::Plenish()
{
// replace the cmd string to any external command u wish
// static const std::string cmd("cat /etc/passwd");
char line[4096*100];
boost::shared_ptr<FILE> pipe(popen(cmd_.c_str(), "r"), pclose);
if (!pipe)
{
throw std::runtime_error("popen() failed!");
}
int end_line = start_line_ + line_count_;
for (int i = 0; i < end_line && !feof(pipe.get()); i++)
{
if (fgets(line, sizeof(line), pipe.get()) != NULL)
{
if ( i < start_line_ )
continue;
lines_.push_back(line);
}
}
}
|
5311f6bb72e14364c543bdef0bf784c1117855ea | ef4762e3e36510b579e9af42c21d2cbe78fb563d | /queue.h | 297bd2e5d988385b1e7bbba03ed13d4c7e3468cb | [] | no_license | rrigato/elementary_structures | 2a6a330e445e2da4d491a664eed388a60cf358cd | 94d72c862227ebd6fce28fcfb15af5b50cc6881c | refs/heads/master | 2020-12-24T15:06:01.528614 | 2015-06-23T18:03:30 | 2015-06-23T18:03:30 | 34,225,819 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,257 | h | queue.h | #ifndef MYQUEUE_H
#define MYQUEUE_H
#include <string>
#include <iostream>
using namespace std;
template <class P>
class Queue
{
private:
struct Node
{
P data;
Node * next;
};
Node * Front;
Node * Rear;
int num_nodes;
public:
Queue()
{
Front = NULL;
Rear = NULL;
num_nodes = 0;
// small_menu();
}
void operator= (const Queue &obj)
{
if (&obj == this)
{
return ;
}
if (obj.Front ==NULL)
{
return ;
}
while(Front)
{
Deque();
}
Node * helper = obj.Front;
while (helper)
{
Enque(helper->data);
helper = helper->next;
}
num_nodes = obj.num_nodes;
}
Queue( const Queue &obj)
{
*this = obj;
// small_menu();
}
void Enque (P );
P Deque ();
void menu( char) const;
void small_menu() const;
bool isFull() const
{
return false;
}
bool isEmpty() const
{
if (!Front)
{
return true;
}
return false;
}
int get_num() const
{
return num_nodes;
}
};
template <class P>
P Queue<P>::Deque()
{
if (!Front)
{
throw "The queue is empty";
return -1;
}
else
{
P value;
Node * helper1 = Front;
Front = Front->next;
value = helper1->data;
delete helper1;
num_nodes--;
if(num_nodes == 0)
{
Rear = NULL;
}
return value;
}
}
template <class P>
void Queue<P>::Enque(P value)
{
Node * NewNode;
NewNode = new Node;
NewNode->data = value;
if (!Front)
{
Front = NewNode;
Rear = NewNode;
}
else
{
Rear->next = NewNode;
Rear = NewNode;
}
NewNode->next = NULL;
num_nodes++;
}
#endif
|
410d353f55ffc5c6f4ce79f84bdeef7bfb8aaed3 | ddf4dacfaf3d2d72eeb1383fbf22dbbeaef627ae | /AbstractFactory/types.h | 5f1ecde78997897eb9ca7103420d0f3887081755 | [] | no_license | andrewgolman/Metaprog | 7c9233d6a239afcbc153d4a3d7d68e2db4997a8a | f2ef8717930a79bf5331977660761f6a5d99662f | refs/heads/master | 2020-09-14T22:53:39.892389 | 2019-12-17T15:09:20 | 2019-12-17T15:09:20 | 223,284,232 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,338 | h | types.h | #include "root.h"
struct Chair : public Root {
Chair() {
std::cout << "Chair" << std::endl;
}
};
struct Table : public Root {
Table() {
std::cout << "Table" << std::endl;
}
};
struct Sofa : public Root {
Sofa() {
std::cout << "Sofa" << std::endl;
}
};
struct WoodenChair : public Chair {
WoodenChair() {
std::cout << "WoodenChair" << std::endl;
}
};
struct WoodenTable : public Table {
WoodenTable() {
std::cout << "WoodenTable" << std::endl;
}
};
struct WoodenSofa : public Sofa {
WoodenSofa() {
std::cout << "WoodenSofa" << std::endl;
}
};
struct MetalChair : public Chair {
MetalChair() {
std::cout << "MetalChair" << std::endl;
}
};
struct MetalTable : public Table {
MetalTable() {
std::cout << "MetalTable" << std::endl;
}
};
struct MetalSofa : public Sofa {
MetalSofa() {
std::cout << "MetalSofa" << std::endl;
}
};
struct MetalRichChair : public Chair {
MetalRichChair() {
std::cout << "MetalRichChair" << std::endl;
}
};
struct MetalRichTable : public Table {
MetalRichTable() {
std::cout << "MetalRichTable" << std::endl;
}
};
struct MetalRichSofa : public Sofa {
MetalRichSofa() {
std::cout << "MetalRichSofa" << std::endl;
}
};
|
1bf1bc17886c616196ab8ddc3d20c65fd82c9d3b | ef58f7cd07eb02b1f71265cb150cc53239890cdd | /include/osv/boot.hh | b8fb1944620e9b46fde65314560850eec15c749e | [
"BSD-3-Clause"
] | permissive | SpirentOrion/osv | 4a636e5802551c15db8c27edd71709bae8bff914 | 32348562e2ba0b2275b2d8d64a78af97bedcdc88 | refs/heads/master | 2020-04-05T04:24:05.007536 | 2020-02-19T23:56:55 | 2020-02-19T23:56:55 | 40,269,211 | 2 | 3 | NOASSERTION | 2020-02-19T23:56:56 | 2015-08-05T21:15:32 | C | UTF-8 | C++ | false | false | 827 | hh | boot.hh | #ifndef BOOT_HH
#define BOOT_HH
#include "arch-setup.hh"
class time_element {
public:
const char *str;
u64 stamp;
};
class boot_time_chart {
public:
void event(const char *str);
void event(int event_idx, const char *str);
void event(int event_idx, const char *str, u64 stamp);
void print_chart();
private:
// Can we keep it at 0 and let the initial two users increment it? No, we
// cannot. The reason is that the code that *parses* those fields run
// relatively late (the code that takes the measure is so early it cannot
// call this one directly. Therefore, the measurements would appear in the
// middle of the list, and we want to preserve order.
int _event = 4;
time_element arrays[16];
void print_one_time(int index);
double to_msec(u64 time);
};
#endif
|
eb96cf1944eea89acabf1448d4c9fd9ec5661b21 | 670f828aea8b44507fd64ba84cf2b765baadf95d | /AR_cylReactor/processor13/constant/polyMesh/faces | f0b3b4589bc0ccaf9f78a914a05df5c72b7a606b | [] | no_license | rashwin1989/sharedOFCases | c6d224ac11669ca7b8e69e292e6aa8aa82961803 | df459380195835b2967393bfe05f89910b7ae3a5 | refs/heads/master | 2020-03-16T19:57:37.472882 | 2018-08-13T21:41:43 | 2018-08-13T21:41:43 | 132,940,021 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 142,287 | faces | /*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.3.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class faceList;
location "constant/polyMesh";
object faces;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
6525
(
3(1 3385 1693)
4(0 1 1693 1692)
3(2 3386 1694)
4(1 2 1694 1693)
3(3 3387 1695)
4(2 3 1695 1694)
3(4 3388 1696)
4(3 4 1696 1695)
3(5 3389 1697)
4(4 5 1697 1696)
3(6 3390 1698)
4(5 6 1698 1697)
3(7 3391 1699)
4(6 7 1699 1698)
3(8 3392 1700)
4(7 8 1700 1699)
3(9 3393 1701)
4(8 9 1701 1700)
3(10 3394 1702)
4(9 10 1702 1701)
3(11 3395 1703)
4(10 11 1703 1702)
3(12 3396 1704)
4(11 12 1704 1703)
3(13 3397 1705)
4(12 13 1705 1704)
3(14 3398 1706)
4(13 14 1706 1705)
3(15 3399 1707)
4(14 15 1707 1706)
3(16 3400 1708)
4(15 16 1708 1707)
3(17 3401 1709)
4(16 17 1709 1708)
3(18 3402 1710)
4(17 18 1710 1709)
3(19 3403 1711)
4(18 19 1711 1710)
4(19 20 1712 1711)
4(22 1 1693 1714)
4(21 22 1714 1713)
4(23 2 1694 1715)
4(22 23 1715 1714)
4(24 3 1695 1716)
4(23 24 1716 1715)
4(25 4 1696 1717)
4(24 25 1717 1716)
4(26 5 1697 1718)
4(25 26 1718 1717)
4(27 6 1698 1719)
4(26 27 1719 1718)
4(28 7 1699 1720)
4(27 28 1720 1719)
4(29 8 1700 1721)
4(28 29 1721 1720)
4(30 9 1701 1722)
4(29 30 1722 1721)
4(31 10 1702 1723)
4(30 31 1723 1722)
4(32 11 1703 1724)
4(31 32 1724 1723)
4(33 12 1704 1725)
4(32 33 1725 1724)
4(34 13 1705 1726)
4(33 34 1726 1725)
4(35 14 1706 1727)
4(34 35 1727 1726)
4(36 15 1707 1728)
4(35 36 1728 1727)
4(37 16 1708 1729)
4(36 37 1729 1728)
4(38 17 1709 1730)
4(37 38 1730 1729)
4(39 18 1710 1731)
4(38 39 1731 1730)
4(40 19 1711 1732)
4(39 40 1732 1731)
4(40 41 1733 1732)
4(43 22 1714 1735)
4(42 43 1735 1734)
4(44 23 1715 1736)
4(43 44 1736 1735)
4(45 24 1716 1737)
4(44 45 1737 1736)
4(46 25 1717 1738)
4(45 46 1738 1737)
4(47 26 1718 1739)
4(46 47 1739 1738)
4(48 27 1719 1740)
4(47 48 1740 1739)
4(49 28 1720 1741)
4(48 49 1741 1740)
4(50 29 1721 1742)
4(49 50 1742 1741)
4(51 30 1722 1743)
4(50 51 1743 1742)
4(52 31 1723 1744)
4(51 52 1744 1743)
4(53 32 1724 1745)
4(52 53 1745 1744)
4(54 33 1725 1746)
4(53 54 1746 1745)
4(55 34 1726 1747)
4(54 55 1747 1746)
4(56 35 1727 1748)
4(55 56 1748 1747)
4(57 36 1728 1749)
4(56 57 1749 1748)
4(58 37 1729 1750)
4(57 58 1750 1749)
4(59 38 1730 1751)
4(58 59 1751 1750)
4(60 39 1731 1752)
4(59 60 1752 1751)
4(61 40 1732 1753)
4(60 61 1753 1752)
4(61 62 1754 1753)
4(64 43 1735 1756)
4(63 64 1756 1755)
4(65 44 1736 1757)
4(64 65 1757 1756)
4(66 45 1737 1758)
4(65 66 1758 1757)
4(67 46 1738 1759)
4(66 67 1759 1758)
4(68 47 1739 1760)
4(67 68 1760 1759)
4(69 48 1740 1761)
4(68 69 1761 1760)
4(70 49 1741 1762)
4(69 70 1762 1761)
4(71 50 1742 1763)
4(70 71 1763 1762)
4(72 51 1743 1764)
4(71 72 1764 1763)
4(73 52 1744 1765)
4(72 73 1765 1764)
4(74 53 1745 1766)
4(73 74 1766 1765)
4(75 54 1746 1767)
4(74 75 1767 1766)
4(76 55 1747 1768)
4(75 76 1768 1767)
4(77 56 1748 1769)
4(76 77 1769 1768)
4(78 57 1749 1770)
4(77 78 1770 1769)
4(79 58 1750 1771)
4(78 79 1771 1770)
4(80 59 1751 1772)
4(79 80 1772 1771)
4(81 60 1752 1773)
4(80 81 1773 1772)
4(82 61 1753 1774)
4(81 82 1774 1773)
4(82 83 1775 1774)
4(85 64 1756 1777)
4(84 85 1777 1776)
4(86 65 1757 1778)
4(85 86 1778 1777)
4(87 66 1758 1779)
4(86 87 1779 1778)
4(88 67 1759 1780)
4(87 88 1780 1779)
4(89 68 1760 1781)
4(88 89 1781 1780)
4(90 69 1761 1782)
4(89 90 1782 1781)
4(91 70 1762 1783)
4(90 91 1783 1782)
4(92 71 1763 1784)
4(91 92 1784 1783)
4(93 72 1764 1785)
4(92 93 1785 1784)
4(94 73 1765 1786)
4(93 94 1786 1785)
4(95 74 1766 1787)
4(94 95 1787 1786)
4(96 75 1767 1788)
4(95 96 1788 1787)
4(97 76 1768 1789)
4(96 97 1789 1788)
4(98 77 1769 1790)
4(97 98 1790 1789)
4(99 78 1770 1791)
4(98 99 1791 1790)
4(100 79 1771 1792)
4(99 100 1792 1791)
4(101 80 1772 1793)
4(100 101 1793 1792)
4(102 81 1773 1794)
4(101 102 1794 1793)
4(103 82 1774 1795)
4(102 103 1795 1794)
4(103 104 1796 1795)
4(106 85 1777 1798)
4(105 106 1798 1797)
4(107 86 1778 1799)
4(106 107 1799 1798)
4(108 87 1779 1800)
4(107 108 1800 1799)
4(109 88 1780 1801)
4(108 109 1801 1800)
4(110 89 1781 1802)
4(109 110 1802 1801)
4(111 90 1782 1803)
4(110 111 1803 1802)
4(112 91 1783 1804)
4(111 112 1804 1803)
4(113 92 1784 1805)
4(112 113 1805 1804)
4(114 93 1785 1806)
4(113 114 1806 1805)
4(115 94 1786 1807)
4(114 115 1807 1806)
4(116 95 1787 1808)
4(115 116 1808 1807)
4(117 96 1788 1809)
4(116 117 1809 1808)
4(118 97 1789 1810)
4(117 118 1810 1809)
4(119 98 1790 1811)
4(118 119 1811 1810)
4(120 99 1791 1812)
4(119 120 1812 1811)
4(121 100 1792 1813)
4(120 121 1813 1812)
4(122 101 1793 1814)
4(121 122 1814 1813)
4(123 102 1794 1815)
4(122 123 1815 1814)
4(124 103 1795 1816)
4(123 124 1816 1815)
4(124 125 1817 1816)
4(127 106 1798 1819)
4(126 127 1819 1818)
4(128 107 1799 1820)
4(127 128 1820 1819)
4(129 108 1800 1821)
4(128 129 1821 1820)
4(130 109 1801 1822)
4(129 130 1822 1821)
4(131 110 1802 1823)
4(130 131 1823 1822)
4(132 111 1803 1824)
4(131 132 1824 1823)
4(133 112 1804 1825)
4(132 133 1825 1824)
4(134 113 1805 1826)
4(133 134 1826 1825)
4(135 114 1806 1827)
4(134 135 1827 1826)
4(136 115 1807 1828)
4(135 136 1828 1827)
4(137 116 1808 1829)
4(136 137 1829 1828)
4(138 117 1809 1830)
4(137 138 1830 1829)
4(139 118 1810 1831)
4(138 139 1831 1830)
4(140 119 1811 1832)
4(139 140 1832 1831)
4(141 120 1812 1833)
4(140 141 1833 1832)
4(142 121 1813 1834)
4(141 142 1834 1833)
4(143 122 1814 1835)
4(142 143 1835 1834)
4(144 123 1815 1836)
4(143 144 1836 1835)
4(145 124 1816 1837)
4(144 145 1837 1836)
4(145 146 1838 1837)
4(148 127 1819 1840)
4(147 148 1840 1839)
4(149 128 1820 1841)
4(148 149 1841 1840)
4(150 129 1821 1842)
4(149 150 1842 1841)
4(151 130 1822 1843)
4(150 151 1843 1842)
4(152 131 1823 1844)
4(151 152 1844 1843)
4(153 132 1824 1845)
4(152 153 1845 1844)
4(154 133 1825 1846)
4(153 154 1846 1845)
4(155 134 1826 1847)
4(154 155 1847 1846)
4(156 135 1827 1848)
4(155 156 1848 1847)
4(157 136 1828 1849)
4(156 157 1849 1848)
4(158 137 1829 1850)
4(157 158 1850 1849)
4(159 138 1830 1851)
4(158 159 1851 1850)
4(160 139 1831 1852)
4(159 160 1852 1851)
4(161 140 1832 1853)
4(160 161 1853 1852)
4(162 141 1833 1854)
4(161 162 1854 1853)
4(163 142 1834 1855)
4(162 163 1855 1854)
4(164 143 1835 1856)
4(163 164 1856 1855)
4(165 144 1836 1857)
4(164 165 1857 1856)
4(166 145 1837 1858)
4(165 166 1858 1857)
4(166 167 1859 1858)
4(169 148 1840 1861)
4(168 169 1861 1860)
4(170 149 1841 1862)
4(169 170 1862 1861)
4(171 150 1842 1863)
4(170 171 1863 1862)
4(172 151 1843 1864)
4(171 172 1864 1863)
4(173 152 1844 1865)
4(172 173 1865 1864)
4(174 153 1845 1866)
4(173 174 1866 1865)
4(175 154 1846 1867)
4(174 175 1867 1866)
4(176 155 1847 1868)
4(175 176 1868 1867)
4(177 156 1848 1869)
4(176 177 1869 1868)
4(178 157 1849 1870)
4(177 178 1870 1869)
4(179 158 1850 1871)
4(178 179 1871 1870)
4(180 159 1851 1872)
4(179 180 1872 1871)
4(181 160 1852 1873)
4(180 181 1873 1872)
4(182 161 1853 1874)
4(181 182 1874 1873)
4(183 162 1854 1875)
4(182 183 1875 1874)
4(184 163 1855 1876)
4(183 184 1876 1875)
4(185 164 1856 1877)
4(184 185 1877 1876)
4(186 165 1857 1878)
4(185 186 1878 1877)
4(187 166 1858 1879)
4(186 187 1879 1878)
4(187 188 1880 1879)
4(190 169 1861 1882)
4(189 190 1882 1881)
4(191 170 1862 1883)
4(190 191 1883 1882)
4(192 171 1863 1884)
4(191 192 1884 1883)
4(193 172 1864 1885)
4(192 193 1885 1884)
4(194 173 1865 1886)
4(193 194 1886 1885)
4(195 174 1866 1887)
4(194 195 1887 1886)
4(196 175 1867 1888)
4(195 196 1888 1887)
4(197 176 1868 1889)
4(196 197 1889 1888)
4(198 177 1869 1890)
4(197 198 1890 1889)
4(199 178 1870 1891)
4(198 199 1891 1890)
4(200 179 1871 1892)
4(199 200 1892 1891)
4(201 180 1872 1893)
4(200 201 1893 1892)
4(202 181 1873 1894)
4(201 202 1894 1893)
4(203 182 1874 1895)
4(202 203 1895 1894)
4(204 183 1875 1896)
4(203 204 1896 1895)
4(205 184 1876 1897)
4(204 205 1897 1896)
4(206 185 1877 1898)
4(205 206 1898 1897)
4(207 186 1878 1899)
4(206 207 1899 1898)
4(208 187 1879 1900)
4(207 208 1900 1899)
4(208 209 1901 1900)
4(211 190 1882 1903)
4(210 211 1903 1902)
4(212 191 1883 1904)
4(211 212 1904 1903)
4(213 192 1884 1905)
4(212 213 1905 1904)
4(214 193 1885 1906)
4(213 214 1906 1905)
4(215 194 1886 1907)
4(214 215 1907 1906)
4(216 195 1887 1908)
4(215 216 1908 1907)
4(217 196 1888 1909)
4(216 217 1909 1908)
4(218 197 1889 1910)
4(217 218 1910 1909)
4(219 198 1890 1911)
4(218 219 1911 1910)
4(220 199 1891 1912)
4(219 220 1912 1911)
4(221 200 1892 1913)
4(220 221 1913 1912)
4(222 201 1893 1914)
4(221 222 1914 1913)
4(223 202 1894 1915)
4(222 223 1915 1914)
4(224 203 1895 1916)
4(223 224 1916 1915)
4(225 204 1896 1917)
4(224 225 1917 1916)
4(226 205 1897 1918)
4(225 226 1918 1917)
4(227 206 1898 1919)
4(226 227 1919 1918)
4(228 207 1899 1920)
4(227 228 1920 1919)
4(229 208 1900 1921)
4(228 229 1921 1920)
4(229 230 1922 1921)
4(232 211 1903 1924)
4(231 232 1924 1923)
4(233 212 1904 1925)
4(232 233 1925 1924)
4(234 213 1905 1926)
4(233 234 1926 1925)
4(235 214 1906 1927)
4(234 235 1927 1926)
4(236 215 1907 1928)
4(235 236 1928 1927)
4(237 216 1908 1929)
4(236 237 1929 1928)
4(238 217 1909 1930)
4(237 238 1930 1929)
4(239 218 1910 1931)
4(238 239 1931 1930)
4(240 219 1911 1932)
4(239 240 1932 1931)
4(241 220 1912 1933)
4(240 241 1933 1932)
4(242 221 1913 1934)
4(241 242 1934 1933)
4(243 222 1914 1935)
4(242 243 1935 1934)
4(244 223 1915 1936)
4(243 244 1936 1935)
4(245 224 1916 1937)
4(244 245 1937 1936)
4(246 225 1917 1938)
4(245 246 1938 1937)
4(247 226 1918 1939)
4(246 247 1939 1938)
4(248 227 1919 1940)
4(247 248 1940 1939)
4(249 228 1920 1941)
4(248 249 1941 1940)
4(250 229 1921 1942)
4(249 250 1942 1941)
4(250 251 1943 1942)
4(253 232 1924 1945)
4(252 253 1945 1944)
4(254 233 1925 1946)
4(253 254 1946 1945)
4(255 234 1926 1947)
4(254 255 1947 1946)
4(256 235 1927 1948)
4(255 256 1948 1947)
4(257 236 1928 1949)
4(256 257 1949 1948)
4(258 237 1929 1950)
4(257 258 1950 1949)
4(259 238 1930 1951)
4(258 259 1951 1950)
4(260 239 1931 1952)
4(259 260 1952 1951)
4(261 240 1932 1953)
4(260 261 1953 1952)
4(262 241 1933 1954)
4(261 262 1954 1953)
4(263 242 1934 1955)
4(262 263 1955 1954)
4(264 243 1935 1956)
4(263 264 1956 1955)
4(265 244 1936 1957)
4(264 265 1957 1956)
4(266 245 1937 1958)
4(265 266 1958 1957)
4(267 246 1938 1959)
4(266 267 1959 1958)
4(268 247 1939 1960)
4(267 268 1960 1959)
4(269 248 1940 1961)
4(268 269 1961 1960)
4(270 249 1941 1962)
4(269 270 1962 1961)
4(271 250 1942 1963)
4(270 271 1963 1962)
4(271 272 1964 1963)
4(274 253 1945 1966)
4(273 274 1966 1965)
4(275 254 1946 1967)
4(274 275 1967 1966)
4(276 255 1947 1968)
4(275 276 1968 1967)
4(277 256 1948 1969)
4(276 277 1969 1968)
4(278 257 1949 1970)
4(277 278 1970 1969)
4(279 258 1950 1971)
4(278 279 1971 1970)
4(280 259 1951 1972)
4(279 280 1972 1971)
4(281 260 1952 1973)
4(280 281 1973 1972)
4(282 261 1953 1974)
4(281 282 1974 1973)
4(283 262 1954 1975)
4(282 283 1975 1974)
4(284 263 1955 1976)
4(283 284 1976 1975)
4(285 264 1956 1977)
4(284 285 1977 1976)
4(286 265 1957 1978)
4(285 286 1978 1977)
4(287 266 1958 1979)
4(286 287 1979 1978)
4(288 267 1959 1980)
4(287 288 1980 1979)
4(289 268 1960 1981)
4(288 289 1981 1980)
4(290 269 1961 1982)
4(289 290 1982 1981)
4(291 270 1962 1983)
4(290 291 1983 1982)
4(292 271 1963 1984)
4(291 292 1984 1983)
4(292 293 1985 1984)
4(296 274 1966 1988)
4(295 296 1988 1987)
4(297 275 1967 1989)
4(296 297 1989 1988)
4(298 276 1968 1990)
4(297 298 1990 1989)
4(299 277 1969 1991)
4(298 299 1991 1990)
4(300 278 1970 1992)
4(299 300 1992 1991)
4(301 279 1971 1993)
4(300 301 1993 1992)
4(302 280 1972 1994)
4(301 302 1994 1993)
4(303 281 1973 1995)
4(302 303 1995 1994)
4(304 282 1974 1996)
4(303 304 1996 1995)
4(305 283 1975 1997)
4(304 305 1997 1996)
4(306 284 1976 1998)
4(305 306 1998 1997)
4(307 285 1977 1999)
4(306 307 1999 1998)
4(308 286 1978 2000)
4(307 308 2000 1999)
4(309 287 1979 2001)
4(308 309 2001 2000)
4(310 288 1980 2002)
4(309 310 2002 2001)
4(311 289 1981 2003)
4(310 311 2003 2002)
4(312 290 1982 2004)
4(311 312 2004 2003)
4(313 291 1983 2005)
4(312 313 2005 2004)
4(314 292 1984 2006)
4(313 314 2006 2005)
4(314 315 2007 2006)
4(317 295 1987 2009)
4(316 317 2009 2008)
4(318 296 1988 2010)
4(317 318 2010 2009)
4(319 297 1989 2011)
4(318 319 2011 2010)
4(320 298 1990 2012)
4(319 320 2012 2011)
4(321 299 1991 2013)
4(320 321 2013 2012)
4(322 300 1992 2014)
4(321 322 2014 2013)
4(323 301 1993 2015)
4(322 323 2015 2014)
4(324 302 1994 2016)
4(323 324 2016 2015)
4(325 303 1995 2017)
4(324 325 2017 2016)
4(326 304 1996 2018)
4(325 326 2018 2017)
4(327 305 1997 2019)
4(326 327 2019 2018)
4(328 306 1998 2020)
4(327 328 2020 2019)
4(329 307 1999 2021)
4(328 329 2021 2020)
4(330 308 2000 2022)
4(329 330 2022 2021)
4(331 309 2001 2023)
4(330 331 2023 2022)
4(332 310 2002 2024)
4(331 332 2024 2023)
4(333 311 2003 2025)
4(332 333 2025 2024)
4(334 312 2004 2026)
4(333 334 2026 2025)
4(335 313 2005 2027)
4(334 335 2027 2026)
4(336 314 2006 2028)
4(335 336 2028 2027)
4(336 337 2029 2028)
4(339 317 2009 2031)
4(338 339 2031 2030)
4(340 318 2010 2032)
4(339 340 2032 2031)
4(341 319 2011 2033)
4(340 341 2033 2032)
4(342 320 2012 2034)
4(341 342 2034 2033)
4(343 321 2013 2035)
4(342 343 2035 2034)
4(344 322 2014 2036)
4(343 344 2036 2035)
4(345 323 2015 2037)
4(344 345 2037 2036)
4(346 324 2016 2038)
4(345 346 2038 2037)
4(347 325 2017 2039)
4(346 347 2039 2038)
4(348 326 2018 2040)
4(347 348 2040 2039)
4(349 327 2019 2041)
4(348 349 2041 2040)
4(350 328 2020 2042)
4(349 350 2042 2041)
4(351 329 2021 2043)
4(350 351 2043 2042)
4(352 330 2022 2044)
4(351 352 2044 2043)
4(353 331 2023 2045)
4(352 353 2045 2044)
4(354 332 2024 2046)
4(353 354 2046 2045)
4(355 333 2025 2047)
4(354 355 2047 2046)
4(356 334 2026 2048)
4(355 356 2048 2047)
4(357 335 2027 2049)
4(356 357 2049 2048)
4(358 336 2028 2050)
4(357 358 2050 2049)
4(358 359 2051 2050)
4(361 339 2031 2053)
4(360 361 2053 2052)
4(362 340 2032 2054)
4(361 362 2054 2053)
4(363 341 2033 2055)
4(362 363 2055 2054)
4(364 342 2034 2056)
4(363 364 2056 2055)
4(365 343 2035 2057)
4(364 365 2057 2056)
4(366 344 2036 2058)
4(365 366 2058 2057)
4(367 345 2037 2059)
4(366 367 2059 2058)
4(368 346 2038 2060)
4(367 368 2060 2059)
4(369 347 2039 2061)
4(368 369 2061 2060)
4(370 348 2040 2062)
4(369 370 2062 2061)
4(371 349 2041 2063)
4(370 371 2063 2062)
4(372 350 2042 2064)
4(371 372 2064 2063)
4(373 351 2043 2065)
4(372 373 2065 2064)
4(374 352 2044 2066)
4(373 374 2066 2065)
4(375 353 2045 2067)
4(374 375 2067 2066)
4(376 354 2046 2068)
4(375 376 2068 2067)
4(377 355 2047 2069)
4(376 377 2069 2068)
4(378 356 2048 2070)
4(377 378 2070 2069)
4(379 357 2049 2071)
4(378 379 2071 2070)
4(380 358 2050 2072)
4(379 380 2072 2071)
4(380 381 2073 2072)
4(383 361 2053 2075)
4(382 383 2075 2074)
4(384 362 2054 2076)
4(383 384 2076 2075)
4(385 363 2055 2077)
4(384 385 2077 2076)
4(386 364 2056 2078)
4(385 386 2078 2077)
4(387 365 2057 2079)
4(386 387 2079 2078)
4(388 366 2058 2080)
4(387 388 2080 2079)
4(389 367 2059 2081)
4(388 389 2081 2080)
4(390 368 2060 2082)
4(389 390 2082 2081)
4(391 369 2061 2083)
4(390 391 2083 2082)
4(392 370 2062 2084)
4(391 392 2084 2083)
4(393 371 2063 2085)
4(392 393 2085 2084)
4(394 372 2064 2086)
4(393 394 2086 2085)
4(395 373 2065 2087)
4(394 395 2087 2086)
4(396 374 2066 2088)
4(395 396 2088 2087)
4(397 375 2067 2089)
4(396 397 2089 2088)
4(398 376 2068 2090)
4(397 398 2090 2089)
4(399 377 2069 2091)
4(398 399 2091 2090)
4(400 378 2070 2092)
4(399 400 2092 2091)
4(401 379 2071 2093)
4(400 401 2093 2092)
4(402 380 2072 2094)
4(401 402 2094 2093)
4(402 403 2095 2094)
4(405 383 2075 2097)
4(404 405 2097 2096)
4(406 384 2076 2098)
4(405 406 2098 2097)
4(407 385 2077 2099)
4(406 407 2099 2098)
4(408 386 2078 2100)
4(407 408 2100 2099)
4(409 387 2079 2101)
4(408 409 2101 2100)
4(410 388 2080 2102)
4(409 410 2102 2101)
4(411 389 2081 2103)
4(410 411 2103 2102)
4(412 390 2082 2104)
4(411 412 2104 2103)
4(413 391 2083 2105)
4(412 413 2105 2104)
4(414 392 2084 2106)
4(413 414 2106 2105)
4(415 393 2085 2107)
4(414 415 2107 2106)
4(416 394 2086 2108)
4(415 416 2108 2107)
4(417 395 2087 2109)
4(416 417 2109 2108)
4(418 396 2088 2110)
4(417 418 2110 2109)
4(419 397 2089 2111)
4(418 419 2111 2110)
4(420 398 2090 2112)
4(419 420 2112 2111)
4(421 399 2091 2113)
4(420 421 2113 2112)
4(422 400 2092 2114)
4(421 422 2114 2113)
4(423 401 2093 2115)
4(422 423 2115 2114)
4(424 402 2094 2116)
4(423 424 2116 2115)
4(424 425 2117 2116)
4(427 405 2097 2119)
4(426 427 2119 2118)
4(428 406 2098 2120)
4(427 428 2120 2119)
4(429 407 2099 2121)
4(428 429 2121 2120)
4(430 408 2100 2122)
4(429 430 2122 2121)
4(431 409 2101 2123)
4(430 431 2123 2122)
4(432 410 2102 2124)
4(431 432 2124 2123)
4(433 411 2103 2125)
4(432 433 2125 2124)
4(434 412 2104 2126)
4(433 434 2126 2125)
4(435 413 2105 2127)
4(434 435 2127 2126)
4(436 414 2106 2128)
4(435 436 2128 2127)
4(437 415 2107 2129)
4(436 437 2129 2128)
4(438 416 2108 2130)
4(437 438 2130 2129)
4(439 417 2109 2131)
4(438 439 2131 2130)
4(440 418 2110 2132)
4(439 440 2132 2131)
4(441 419 2111 2133)
4(440 441 2133 2132)
4(442 420 2112 2134)
4(441 442 2134 2133)
4(443 421 2113 2135)
4(442 443 2135 2134)
4(444 422 2114 2136)
4(443 444 2136 2135)
4(445 423 2115 2137)
4(444 445 2137 2136)
4(446 424 2116 2138)
4(445 446 2138 2137)
4(446 447 2139 2138)
4(449 427 2119 2141)
4(448 449 2141 2140)
4(450 428 2120 2142)
4(449 450 2142 2141)
4(451 429 2121 2143)
4(450 451 2143 2142)
4(452 430 2122 2144)
4(451 452 2144 2143)
4(453 431 2123 2145)
4(452 453 2145 2144)
4(454 432 2124 2146)
4(453 454 2146 2145)
4(455 433 2125 2147)
4(454 455 2147 2146)
4(456 434 2126 2148)
4(455 456 2148 2147)
4(457 435 2127 2149)
4(456 457 2149 2148)
4(458 436 2128 2150)
4(457 458 2150 2149)
4(459 437 2129 2151)
4(458 459 2151 2150)
4(460 438 2130 2152)
4(459 460 2152 2151)
4(461 439 2131 2153)
4(460 461 2153 2152)
4(462 440 2132 2154)
4(461 462 2154 2153)
4(463 441 2133 2155)
4(462 463 2155 2154)
4(464 442 2134 2156)
4(463 464 2156 2155)
4(465 443 2135 2157)
4(464 465 2157 2156)
4(466 444 2136 2158)
4(465 466 2158 2157)
4(467 445 2137 2159)
4(466 467 2159 2158)
4(468 446 2138 2160)
4(467 468 2160 2159)
4(468 469 2161 2160)
4(471 449 2141 2163)
4(470 471 2163 2162)
4(472 450 2142 2164)
4(471 472 2164 2163)
4(473 451 2143 2165)
4(472 473 2165 2164)
4(474 452 2144 2166)
4(473 474 2166 2165)
4(475 453 2145 2167)
4(474 475 2167 2166)
4(476 454 2146 2168)
4(475 476 2168 2167)
4(477 455 2147 2169)
4(476 477 2169 2168)
4(478 456 2148 2170)
4(477 478 2170 2169)
4(479 457 2149 2171)
4(478 479 2171 2170)
4(480 458 2150 2172)
4(479 480 2172 2171)
4(481 459 2151 2173)
4(480 481 2173 2172)
4(482 460 2152 2174)
4(481 482 2174 2173)
4(483 461 2153 2175)
4(482 483 2175 2174)
4(484 462 2154 2176)
4(483 484 2176 2175)
4(485 463 2155 2177)
4(484 485 2177 2176)
4(486 464 2156 2178)
4(485 486 2178 2177)
4(487 465 2157 2179)
4(486 487 2179 2178)
4(488 466 2158 2180)
4(487 488 2180 2179)
4(489 467 2159 2181)
4(488 489 2181 2180)
4(490 468 2160 2182)
4(489 490 2182 2181)
4(490 491 2183 2182)
4(493 471 2163 2185)
4(492 493 2185 2184)
4(494 472 2164 2186)
4(493 494 2186 2185)
4(495 473 2165 2187)
4(494 495 2187 2186)
4(496 474 2166 2188)
4(495 496 2188 2187)
4(497 475 2167 2189)
4(496 497 2189 2188)
4(498 476 2168 2190)
4(497 498 2190 2189)
4(499 477 2169 2191)
4(498 499 2191 2190)
4(500 478 2170 2192)
4(499 500 2192 2191)
4(501 479 2171 2193)
4(500 501 2193 2192)
4(502 480 2172 2194)
4(501 502 2194 2193)
4(503 481 2173 2195)
4(502 503 2195 2194)
4(504 482 2174 2196)
4(503 504 2196 2195)
4(505 483 2175 2197)
4(504 505 2197 2196)
4(506 484 2176 2198)
4(505 506 2198 2197)
4(507 485 2177 2199)
4(506 507 2199 2198)
4(508 486 2178 2200)
4(507 508 2200 2199)
4(509 487 2179 2201)
4(508 509 2201 2200)
4(510 488 2180 2202)
4(509 510 2202 2201)
4(511 489 2181 2203)
4(510 511 2203 2202)
4(512 490 2182 2204)
4(511 512 2204 2203)
4(512 513 2205 2204)
4(515 493 2185 2207)
4(514 515 2207 2206)
4(516 494 2186 2208)
4(515 516 2208 2207)
4(517 495 2187 2209)
4(516 517 2209 2208)
4(518 496 2188 2210)
4(517 518 2210 2209)
4(519 497 2189 2211)
4(518 519 2211 2210)
4(520 498 2190 2212)
4(519 520 2212 2211)
4(521 499 2191 2213)
4(520 521 2213 2212)
4(522 500 2192 2214)
4(521 522 2214 2213)
4(523 501 2193 2215)
4(522 523 2215 2214)
4(524 502 2194 2216)
4(523 524 2216 2215)
4(525 503 2195 2217)
4(524 525 2217 2216)
4(526 504 2196 2218)
4(525 526 2218 2217)
4(527 505 2197 2219)
4(526 527 2219 2218)
4(528 506 2198 2220)
4(527 528 2220 2219)
4(529 507 2199 2221)
4(528 529 2221 2220)
4(530 508 2200 2222)
4(529 530 2222 2221)
4(531 509 2201 2223)
4(530 531 2223 2222)
4(532 510 2202 2224)
4(531 532 2224 2223)
4(533 511 2203 2225)
4(532 533 2225 2224)
4(534 512 2204 2226)
4(533 534 2226 2225)
4(534 535 2227 2226)
4(537 515 2207 2229)
4(536 537 2229 2228)
4(538 516 2208 2230)
4(537 538 2230 2229)
4(539 517 2209 2231)
4(538 539 2231 2230)
4(540 518 2210 2232)
4(539 540 2232 2231)
4(541 519 2211 2233)
4(540 541 2233 2232)
4(542 520 2212 2234)
4(541 542 2234 2233)
4(543 521 2213 2235)
4(542 543 2235 2234)
4(544 522 2214 2236)
4(543 544 2236 2235)
4(545 523 2215 2237)
4(544 545 2237 2236)
4(546 524 2216 2238)
4(545 546 2238 2237)
4(547 525 2217 2239)
4(546 547 2239 2238)
4(548 526 2218 2240)
4(547 548 2240 2239)
4(549 527 2219 2241)
4(548 549 2241 2240)
4(550 528 2220 2242)
4(549 550 2242 2241)
4(551 529 2221 2243)
4(550 551 2243 2242)
4(552 530 2222 2244)
4(551 552 2244 2243)
4(553 531 2223 2245)
4(552 553 2245 2244)
4(554 532 2224 2246)
4(553 554 2246 2245)
4(555 533 2225 2247)
4(554 555 2247 2246)
4(556 534 2226 2248)
4(555 556 2248 2247)
4(559 537 2229 2251)
4(558 559 2251 2250)
4(560 538 2230 2252)
4(559 560 2252 2251)
4(561 539 2231 2253)
4(560 561 2253 2252)
4(562 540 2232 2254)
4(561 562 2254 2253)
4(563 541 2233 2255)
4(562 563 2255 2254)
4(564 542 2234 2256)
4(563 564 2256 2255)
4(565 543 2235 2257)
4(564 565 2257 2256)
4(566 544 2236 2258)
4(565 566 2258 2257)
4(567 545 2237 2259)
4(566 567 2259 2258)
4(568 546 2238 2260)
4(567 568 2260 2259)
4(569 547 2239 2261)
4(568 569 2261 2260)
4(570 548 2240 2262)
4(569 570 2262 2261)
4(571 549 2241 2263)
4(570 571 2263 2262)
4(572 550 2242 2264)
4(571 572 2264 2263)
4(573 551 2243 2265)
4(572 573 2265 2264)
4(574 552 2244 2266)
4(573 574 2266 2265)
4(575 553 2245 2267)
4(574 575 2267 2266)
4(576 554 2246 2268)
4(575 576 2268 2267)
4(577 555 2247 2269)
4(576 577 2269 2268)
4(577 578 2270 2269)
4(580 559 2251 2272)
4(579 580 2272 2271)
4(581 560 2252 2273)
4(580 581 2273 2272)
4(582 561 2253 2274)
4(581 582 2274 2273)
4(583 562 2254 2275)
4(582 583 2275 2274)
4(584 563 2255 2276)
4(583 584 2276 2275)
4(585 564 2256 2277)
4(584 585 2277 2276)
4(586 565 2257 2278)
4(585 586 2278 2277)
4(587 566 2258 2279)
4(586 587 2279 2278)
4(588 567 2259 2280)
4(587 588 2280 2279)
4(589 568 2260 2281)
4(588 589 2281 2280)
4(590 569 2261 2282)
4(589 590 2282 2281)
4(591 570 2262 2283)
4(590 591 2283 2282)
4(592 571 2263 2284)
4(591 592 2284 2283)
4(593 572 2264 2285)
4(592 593 2285 2284)
4(594 573 2265 2286)
4(593 594 2286 2285)
4(595 574 2266 2287)
4(594 595 2287 2286)
4(596 575 2267 2288)
4(595 596 2288 2287)
4(597 576 2268 2289)
4(596 597 2289 2288)
4(598 577 2269 2290)
4(597 598 2290 2289)
4(598 599 2291 2290)
4(601 580 2272 2293)
4(600 601 2293 2292)
4(602 581 2273 2294)
4(601 602 2294 2293)
4(603 582 2274 2295)
4(602 603 2295 2294)
4(604 583 2275 2296)
4(603 604 2296 2295)
4(605 584 2276 2297)
4(604 605 2297 2296)
4(606 585 2277 2298)
4(605 606 2298 2297)
4(607 586 2278 2299)
4(606 607 2299 2298)
4(608 587 2279 2300)
4(607 608 2300 2299)
4(609 588 2280 2301)
4(608 609 2301 2300)
4(610 589 2281 2302)
4(609 610 2302 2301)
4(611 590 2282 2303)
4(610 611 2303 2302)
4(612 591 2283 2304)
4(611 612 2304 2303)
4(613 592 2284 2305)
4(612 613 2305 2304)
4(614 593 2285 2306)
4(613 614 2306 2305)
4(615 594 2286 2307)
4(614 615 2307 2306)
4(616 595 2287 2308)
4(615 616 2308 2307)
4(617 596 2288 2309)
4(616 617 2309 2308)
4(618 597 2289 2310)
4(617 618 2310 2309)
4(619 598 2290 2311)
4(618 619 2311 2310)
4(619 620 2312 2311)
4(622 601 2293 2314)
4(621 622 2314 2313)
4(623 602 2294 2315)
4(622 623 2315 2314)
4(624 603 2295 2316)
4(623 624 2316 2315)
4(625 604 2296 2317)
4(624 625 2317 2316)
4(626 605 2297 2318)
4(625 626 2318 2317)
4(627 606 2298 2319)
4(626 627 2319 2318)
4(628 607 2299 2320)
4(627 628 2320 2319)
4(629 608 2300 2321)
4(628 629 2321 2320)
4(630 609 2301 2322)
4(629 630 2322 2321)
4(631 610 2302 2323)
4(630 631 2323 2322)
4(632 611 2303 2324)
4(631 632 2324 2323)
4(633 612 2304 2325)
4(632 633 2325 2324)
4(634 613 2305 2326)
4(633 634 2326 2325)
4(635 614 2306 2327)
4(634 635 2327 2326)
4(636 615 2307 2328)
4(635 636 2328 2327)
4(637 616 2308 2329)
4(636 637 2329 2328)
4(638 617 2309 2330)
4(637 638 2330 2329)
4(639 618 2310 2331)
4(638 639 2331 2330)
4(640 619 2311 2332)
4(639 640 2332 2331)
4(640 641 2333 2332)
4(643 622 2314 2335)
4(642 643 2335 2334)
4(644 623 2315 2336)
4(643 644 2336 2335)
4(645 624 2316 2337)
4(644 645 2337 2336)
4(646 625 2317 2338)
4(645 646 2338 2337)
4(647 626 2318 2339)
4(646 647 2339 2338)
4(648 627 2319 2340)
4(647 648 2340 2339)
4(649 628 2320 2341)
4(648 649 2341 2340)
4(650 629 2321 2342)
4(649 650 2342 2341)
4(651 630 2322 2343)
4(650 651 2343 2342)
4(652 631 2323 2344)
4(651 652 2344 2343)
4(653 632 2324 2345)
4(652 653 2345 2344)
4(654 633 2325 2346)
4(653 654 2346 2345)
4(655 634 2326 2347)
4(654 655 2347 2346)
4(656 635 2327 2348)
4(655 656 2348 2347)
4(657 636 2328 2349)
4(656 657 2349 2348)
4(658 637 2329 2350)
4(657 658 2350 2349)
4(659 638 2330 2351)
4(658 659 2351 2350)
4(660 639 2331 2352)
4(659 660 2352 2351)
4(661 640 2332 2353)
4(660 661 2353 2352)
4(661 662 2354 2353)
4(664 643 2335 2356)
4(663 664 2356 2355)
4(665 644 2336 2357)
4(664 665 2357 2356)
4(666 645 2337 2358)
4(665 666 2358 2357)
4(667 646 2338 2359)
4(666 667 2359 2358)
4(668 647 2339 2360)
4(667 668 2360 2359)
4(669 648 2340 2361)
4(668 669 2361 2360)
4(670 649 2341 2362)
4(669 670 2362 2361)
4(671 650 2342 2363)
4(670 671 2363 2362)
4(672 651 2343 2364)
4(671 672 2364 2363)
4(673 652 2344 2365)
4(672 673 2365 2364)
4(674 653 2345 2366)
4(673 674 2366 2365)
4(675 654 2346 2367)
4(674 675 2367 2366)
4(676 655 2347 2368)
4(675 676 2368 2367)
4(677 656 2348 2369)
4(676 677 2369 2368)
4(678 657 2349 2370)
4(677 678 2370 2369)
4(679 658 2350 2371)
4(678 679 2371 2370)
4(680 659 2351 2372)
4(679 680 2372 2371)
4(681 660 2352 2373)
4(680 681 2373 2372)
4(682 661 2353 2374)
4(681 682 2374 2373)
4(682 683 2375 2374)
4(685 664 2356 2377)
4(684 685 2377 2376)
4(686 665 2357 2378)
4(685 686 2378 2377)
4(687 666 2358 2379)
4(686 687 2379 2378)
4(688 667 2359 2380)
4(687 688 2380 2379)
4(689 668 2360 2381)
4(688 689 2381 2380)
4(690 669 2361 2382)
4(689 690 2382 2381)
4(691 670 2362 2383)
4(690 691 2383 2382)
4(692 671 2363 2384)
4(691 692 2384 2383)
4(693 672 2364 2385)
4(692 693 2385 2384)
4(694 673 2365 2386)
4(693 694 2386 2385)
4(695 674 2366 2387)
4(694 695 2387 2386)
4(696 675 2367 2388)
4(695 696 2388 2387)
4(697 676 2368 2389)
4(696 697 2389 2388)
4(698 677 2369 2390)
4(697 698 2390 2389)
4(699 678 2370 2391)
4(698 699 2391 2390)
4(700 679 2371 2392)
4(699 700 2392 2391)
4(701 680 2372 2393)
4(700 701 2393 2392)
4(702 681 2373 2394)
4(701 702 2394 2393)
4(703 682 2374 2395)
4(702 703 2395 2394)
4(703 704 2396 2395)
4(706 685 2377 2398)
4(705 706 2398 2397)
4(707 686 2378 2399)
4(706 707 2399 2398)
4(708 687 2379 2400)
4(707 708 2400 2399)
4(709 688 2380 2401)
4(708 709 2401 2400)
4(710 689 2381 2402)
4(709 710 2402 2401)
4(711 690 2382 2403)
4(710 711 2403 2402)
4(712 691 2383 2404)
4(711 712 2404 2403)
4(713 692 2384 2405)
4(712 713 2405 2404)
4(714 693 2385 2406)
4(713 714 2406 2405)
4(715 694 2386 2407)
4(714 715 2407 2406)
4(716 695 2387 2408)
4(715 716 2408 2407)
4(717 696 2388 2409)
4(716 717 2409 2408)
4(718 697 2389 2410)
4(717 718 2410 2409)
4(719 698 2390 2411)
4(718 719 2411 2410)
4(720 699 2391 2412)
4(719 720 2412 2411)
4(721 700 2392 2413)
4(720 721 2413 2412)
4(722 701 2393 2414)
4(721 722 2414 2413)
4(723 702 2394 2415)
4(722 723 2415 2414)
4(724 703 2395 2416)
4(723 724 2416 2415)
4(724 725 2417 2416)
4(727 706 2398 2419)
4(726 727 2419 2418)
4(728 707 2399 2420)
4(727 728 2420 2419)
4(729 708 2400 2421)
4(728 729 2421 2420)
4(730 709 2401 2422)
4(729 730 2422 2421)
4(731 710 2402 2423)
4(730 731 2423 2422)
4(732 711 2403 2424)
4(731 732 2424 2423)
4(733 712 2404 2425)
4(732 733 2425 2424)
4(734 713 2405 2426)
4(733 734 2426 2425)
4(735 714 2406 2427)
4(734 735 2427 2426)
4(736 715 2407 2428)
4(735 736 2428 2427)
4(737 716 2408 2429)
4(736 737 2429 2428)
4(738 717 2409 2430)
4(737 738 2430 2429)
4(739 718 2410 2431)
4(738 739 2431 2430)
4(740 719 2411 2432)
4(739 740 2432 2431)
4(741 720 2412 2433)
4(740 741 2433 2432)
4(742 721 2413 2434)
4(741 742 2434 2433)
4(743 722 2414 2435)
4(742 743 2435 2434)
4(744 723 2415 2436)
4(743 744 2436 2435)
4(745 724 2416 2437)
4(744 745 2437 2436)
4(745 746 2438 2437)
4(748 727 2419 2440)
4(747 748 2440 2439)
4(749 728 2420 2441)
4(748 749 2441 2440)
4(750 729 2421 2442)
4(749 750 2442 2441)
4(751 730 2422 2443)
4(750 751 2443 2442)
4(752 731 2423 2444)
4(751 752 2444 2443)
4(753 732 2424 2445)
4(752 753 2445 2444)
4(754 733 2425 2446)
4(753 754 2446 2445)
4(755 734 2426 2447)
4(754 755 2447 2446)
4(756 735 2427 2448)
4(755 756 2448 2447)
4(757 736 2428 2449)
4(756 757 2449 2448)
4(758 737 2429 2450)
4(757 758 2450 2449)
4(759 738 2430 2451)
4(758 759 2451 2450)
4(760 739 2431 2452)
4(759 760 2452 2451)
4(761 740 2432 2453)
4(760 761 2453 2452)
4(762 741 2433 2454)
4(761 762 2454 2453)
4(763 742 2434 2455)
4(762 763 2455 2454)
4(764 743 2435 2456)
4(763 764 2456 2455)
4(765 744 2436 2457)
4(764 765 2457 2456)
4(766 745 2437 2458)
4(765 766 2458 2457)
4(766 767 2459 2458)
4(769 748 2440 2461)
4(768 769 2461 2460)
4(770 749 2441 2462)
4(769 770 2462 2461)
4(771 750 2442 2463)
4(770 771 2463 2462)
4(772 751 2443 2464)
4(771 772 2464 2463)
4(773 752 2444 2465)
4(772 773 2465 2464)
4(774 753 2445 2466)
4(773 774 2466 2465)
4(775 754 2446 2467)
4(774 775 2467 2466)
4(776 755 2447 2468)
4(775 776 2468 2467)
4(777 756 2448 2469)
4(776 777 2469 2468)
4(778 757 2449 2470)
4(777 778 2470 2469)
4(779 758 2450 2471)
4(778 779 2471 2470)
4(780 759 2451 2472)
4(779 780 2472 2471)
4(781 760 2452 2473)
4(780 781 2473 2472)
4(782 761 2453 2474)
4(781 782 2474 2473)
4(783 762 2454 2475)
4(782 783 2475 2474)
4(784 763 2455 2476)
4(783 784 2476 2475)
4(785 764 2456 2477)
4(784 785 2477 2476)
4(786 765 2457 2478)
4(785 786 2478 2477)
4(787 766 2458 2479)
4(786 787 2479 2478)
4(787 788 2480 2479)
4(790 769 2461 2482)
4(789 790 2482 2481)
4(791 770 2462 2483)
4(790 791 2483 2482)
4(792 771 2463 2484)
4(791 792 2484 2483)
4(793 772 2464 2485)
4(792 793 2485 2484)
4(794 773 2465 2486)
4(793 794 2486 2485)
4(795 774 2466 2487)
4(794 795 2487 2486)
4(796 775 2467 2488)
4(795 796 2488 2487)
4(797 776 2468 2489)
4(796 797 2489 2488)
4(798 777 2469 2490)
4(797 798 2490 2489)
4(799 778 2470 2491)
4(798 799 2491 2490)
4(800 779 2471 2492)
4(799 800 2492 2491)
4(801 780 2472 2493)
4(800 801 2493 2492)
4(802 781 2473 2494)
4(801 802 2494 2493)
4(803 782 2474 2495)
4(802 803 2495 2494)
4(804 783 2475 2496)
4(803 804 2496 2495)
4(805 784 2476 2497)
4(804 805 2497 2496)
4(806 785 2477 2498)
4(805 806 2498 2497)
4(807 786 2478 2499)
4(806 807 2499 2498)
4(808 787 2479 2500)
4(807 808 2500 2499)
4(808 809 2501 2500)
4(811 790 2482 2503)
4(810 811 2503 2502)
4(812 791 2483 2504)
4(811 812 2504 2503)
4(813 792 2484 2505)
4(812 813 2505 2504)
4(814 793 2485 2506)
4(813 814 2506 2505)
4(815 794 2486 2507)
4(814 815 2507 2506)
4(816 795 2487 2508)
4(815 816 2508 2507)
4(817 796 2488 2509)
4(816 817 2509 2508)
4(818 797 2489 2510)
4(817 818 2510 2509)
4(819 798 2490 2511)
4(818 819 2511 2510)
4(820 799 2491 2512)
4(819 820 2512 2511)
4(821 800 2492 2513)
4(820 821 2513 2512)
4(822 801 2493 2514)
4(821 822 2514 2513)
4(823 802 2494 2515)
4(822 823 2515 2514)
4(824 803 2495 2516)
4(823 824 2516 2515)
4(825 804 2496 2517)
4(824 825 2517 2516)
4(826 805 2497 2518)
4(825 826 2518 2517)
4(827 806 2498 2519)
4(826 827 2519 2518)
4(828 807 2499 2520)
4(827 828 2520 2519)
4(829 808 2500 2521)
4(828 829 2521 2520)
4(829 830 2522 2521)
4(832 811 2503 2524)
4(831 832 2524 2523)
4(833 812 2504 2525)
4(832 833 2525 2524)
4(834 813 2505 2526)
4(833 834 2526 2525)
4(835 814 2506 2527)
4(834 835 2527 2526)
4(836 815 2507 2528)
4(835 836 2528 2527)
4(837 816 2508 2529)
4(836 837 2529 2528)
4(838 817 2509 2530)
4(837 838 2530 2529)
4(839 818 2510 2531)
4(838 839 2531 2530)
4(840 819 2511 2532)
4(839 840 2532 2531)
4(841 820 2512 2533)
4(840 841 2533 2532)
4(842 821 2513 2534)
4(841 842 2534 2533)
4(843 822 2514 2535)
4(842 843 2535 2534)
4(844 823 2515 2536)
4(843 844 2536 2535)
4(845 824 2516 2537)
4(844 845 2537 2536)
4(846 825 2517 2538)
4(845 846 2538 2537)
4(847 826 2518 2539)
4(846 847 2539 2538)
4(848 827 2519 2540)
4(847 848 2540 2539)
4(849 828 2520 2541)
4(848 849 2541 2540)
4(850 829 2521 2542)
4(849 850 2542 2541)
4(850 851 2543 2542)
4(853 832 2524 2545)
4(852 853 2545 2544)
4(854 833 2525 2546)
4(853 854 2546 2545)
4(855 834 2526 2547)
4(854 855 2547 2546)
4(856 835 2527 2548)
4(855 856 2548 2547)
4(857 836 2528 2549)
4(856 857 2549 2548)
4(858 837 2529 2550)
4(857 858 2550 2549)
4(859 838 2530 2551)
4(858 859 2551 2550)
4(860 839 2531 2552)
4(859 860 2552 2551)
4(861 840 2532 2553)
4(860 861 2553 2552)
4(862 841 2533 2554)
4(861 862 2554 2553)
4(863 842 2534 2555)
4(862 863 2555 2554)
4(864 843 2535 2556)
4(863 864 2556 2555)
4(865 844 2536 2557)
4(864 865 2557 2556)
4(866 845 2537 2558)
4(865 866 2558 2557)
4(867 846 2538 2559)
4(866 867 2559 2558)
4(868 847 2539 2560)
4(867 868 2560 2559)
4(869 848 2540 2561)
4(868 869 2561 2560)
4(870 849 2541 2562)
4(869 870 2562 2561)
4(871 850 2542 2563)
4(870 871 2563 2562)
4(871 872 2564 2563)
4(874 853 2545 2566)
4(873 874 2566 2565)
4(875 854 2546 2567)
4(874 875 2567 2566)
4(876 855 2547 2568)
4(875 876 2568 2567)
4(877 856 2548 2569)
4(876 877 2569 2568)
4(878 857 2549 2570)
4(877 878 2570 2569)
4(879 858 2550 2571)
4(878 879 2571 2570)
4(880 859 2551 2572)
4(879 880 2572 2571)
4(881 860 2552 2573)
4(880 881 2573 2572)
4(882 861 2553 2574)
4(881 882 2574 2573)
4(883 862 2554 2575)
4(882 883 2575 2574)
4(884 863 2555 2576)
4(883 884 2576 2575)
4(885 864 2556 2577)
4(884 885 2577 2576)
4(886 865 2557 2578)
4(885 886 2578 2577)
4(887 866 2558 2579)
4(886 887 2579 2578)
4(888 867 2559 2580)
4(887 888 2580 2579)
4(889 868 2560 2581)
4(888 889 2581 2580)
4(890 869 2561 2582)
4(889 890 2582 2581)
4(891 870 2562 2583)
4(890 891 2583 2582)
4(892 871 2563 2584)
4(891 892 2584 2583)
4(892 893 2585 2584)
4(895 874 2566 2587)
4(894 895 2587 2586)
4(896 875 2567 2588)
4(895 896 2588 2587)
4(897 876 2568 2589)
4(896 897 2589 2588)
4(898 877 2569 2590)
4(897 898 2590 2589)
4(899 878 2570 2591)
4(898 899 2591 2590)
4(900 879 2571 2592)
4(899 900 2592 2591)
4(901 880 2572 2593)
4(900 901 2593 2592)
4(902 881 2573 2594)
4(901 902 2594 2593)
4(903 882 2574 2595)
4(902 903 2595 2594)
4(904 883 2575 2596)
4(903 904 2596 2595)
4(905 884 2576 2597)
4(904 905 2597 2596)
4(906 885 2577 2598)
4(905 906 2598 2597)
4(907 886 2578 2599)
4(906 907 2599 2598)
4(908 887 2579 2600)
4(907 908 2600 2599)
4(909 888 2580 2601)
4(908 909 2601 2600)
4(910 889 2581 2602)
4(909 910 2602 2601)
4(911 890 2582 2603)
4(910 911 2603 2602)
4(912 891 2583 2604)
4(911 912 2604 2603)
4(913 892 2584 2605)
4(912 913 2605 2604)
4(913 914 2606 2605)
4(916 895 2587 2608)
4(915 916 2608 2607)
4(917 896 2588 2609)
4(916 917 2609 2608)
4(918 897 2589 2610)
4(917 918 2610 2609)
4(919 898 2590 2611)
4(918 919 2611 2610)
4(920 899 2591 2612)
4(919 920 2612 2611)
4(921 900 2592 2613)
4(920 921 2613 2612)
4(922 901 2593 2614)
4(921 922 2614 2613)
4(923 902 2594 2615)
4(922 923 2615 2614)
4(924 903 2595 2616)
4(923 924 2616 2615)
4(925 904 2596 2617)
4(924 925 2617 2616)
4(926 905 2597 2618)
4(925 926 2618 2617)
4(927 906 2598 2619)
4(926 927 2619 2618)
4(928 907 2599 2620)
4(927 928 2620 2619)
4(929 908 2600 2621)
4(928 929 2621 2620)
4(930 909 2601 2622)
4(929 930 2622 2621)
4(931 910 2602 2623)
4(930 931 2623 2622)
4(932 911 2603 2624)
4(931 932 2624 2623)
4(933 912 2604 2625)
4(932 933 2625 2624)
4(934 913 2605 2626)
4(933 934 2626 2625)
4(934 935 2627 2626)
4(937 916 2608 2629)
4(936 937 2629 2628)
4(938 917 2609 2630)
4(937 938 2630 2629)
4(939 918 2610 2631)
4(938 939 2631 2630)
4(940 919 2611 2632)
4(939 940 2632 2631)
4(941 920 2612 2633)
4(940 941 2633 2632)
4(942 921 2613 2634)
4(941 942 2634 2633)
4(943 922 2614 2635)
4(942 943 2635 2634)
4(944 923 2615 2636)
4(943 944 2636 2635)
4(945 924 2616 2637)
4(944 945 2637 2636)
4(946 925 2617 2638)
4(945 946 2638 2637)
4(947 926 2618 2639)
4(946 947 2639 2638)
4(948 927 2619 2640)
4(947 948 2640 2639)
4(949 928 2620 2641)
4(948 949 2641 2640)
4(950 929 2621 2642)
4(949 950 2642 2641)
4(951 930 2622 2643)
4(950 951 2643 2642)
4(952 931 2623 2644)
4(951 952 2644 2643)
4(953 932 2624 2645)
4(952 953 2645 2644)
4(954 933 2625 2646)
4(953 954 2646 2645)
4(955 934 2626 2647)
4(954 955 2647 2646)
4(955 956 2648 2647)
4(958 937 2629 2650)
4(957 958 2650 2649)
4(959 938 2630 2651)
4(958 959 2651 2650)
4(960 939 2631 2652)
4(959 960 2652 2651)
4(961 940 2632 2653)
4(960 961 2653 2652)
4(962 941 2633 2654)
4(961 962 2654 2653)
4(963 942 2634 2655)
4(962 963 2655 2654)
4(964 943 2635 2656)
4(963 964 2656 2655)
4(965 944 2636 2657)
4(964 965 2657 2656)
4(966 945 2637 2658)
4(965 966 2658 2657)
4(967 946 2638 2659)
4(966 967 2659 2658)
4(968 947 2639 2660)
4(967 968 2660 2659)
4(969 948 2640 2661)
4(968 969 2661 2660)
4(970 949 2641 2662)
4(969 970 2662 2661)
4(971 950 2642 2663)
4(970 971 2663 2662)
4(972 951 2643 2664)
4(971 972 2664 2663)
4(973 952 2644 2665)
4(972 973 2665 2664)
4(974 953 2645 2666)
4(973 974 2666 2665)
4(975 954 2646 2667)
4(974 975 2667 2666)
4(976 955 2647 2668)
4(975 976 2668 2667)
4(976 977 2669 2668)
4(979 958 2650 2671)
4(978 979 2671 2670)
4(980 959 2651 2672)
4(979 980 2672 2671)
4(981 960 2652 2673)
4(980 981 2673 2672)
4(982 961 2653 2674)
4(981 982 2674 2673)
4(983 962 2654 2675)
4(982 983 2675 2674)
4(984 963 2655 2676)
4(983 984 2676 2675)
4(985 964 2656 2677)
4(984 985 2677 2676)
4(986 965 2657 2678)
4(985 986 2678 2677)
4(987 966 2658 2679)
4(986 987 2679 2678)
4(988 967 2659 2680)
4(987 988 2680 2679)
4(989 968 2660 2681)
4(988 989 2681 2680)
4(990 969 2661 2682)
4(989 990 2682 2681)
4(991 970 2662 2683)
4(990 991 2683 2682)
4(992 971 2663 2684)
4(991 992 2684 2683)
4(993 972 2664 2685)
4(992 993 2685 2684)
4(994 973 2665 2686)
4(993 994 2686 2685)
4(995 974 2666 2687)
4(994 995 2687 2686)
4(996 975 2667 2688)
4(995 996 2688 2687)
4(997 976 2668 2689)
4(996 997 2689 2688)
4(997 998 2690 2689)
4(1000 979 2671 2692)
4(999 1000 2692 2691)
4(1001 980 2672 2693)
4(1000 1001 2693 2692)
4(1002 981 2673 2694)
4(1001 1002 2694 2693)
4(1003 982 2674 2695)
4(1002 1003 2695 2694)
4(1004 983 2675 2696)
4(1003 1004 2696 2695)
4(1005 984 2676 2697)
4(1004 1005 2697 2696)
4(1006 985 2677 2698)
4(1005 1006 2698 2697)
4(1007 986 2678 2699)
4(1006 1007 2699 2698)
4(1008 987 2679 2700)
4(1007 1008 2700 2699)
4(1009 988 2680 2701)
4(1008 1009 2701 2700)
4(1010 989 2681 2702)
4(1009 1010 2702 2701)
4(1011 990 2682 2703)
4(1010 1011 2703 2702)
4(1012 991 2683 2704)
4(1011 1012 2704 2703)
4(1013 992 2684 2705)
4(1012 1013 2705 2704)
4(1014 993 2685 2706)
4(1013 1014 2706 2705)
4(1015 994 2686 2707)
4(1014 1015 2707 2706)
4(1016 995 2687 2708)
4(1015 1016 2708 2707)
4(1017 996 2688 2709)
4(1016 1017 2709 2708)
4(1018 997 2689 2710)
4(1017 1018 2710 2709)
4(1018 1019 2711 2710)
4(1021 1000 2692 2713)
4(1020 1021 2713 2712)
4(1022 1001 2693 2714)
4(1021 1022 2714 2713)
4(1023 1002 2694 2715)
4(1022 1023 2715 2714)
4(1024 1003 2695 2716)
4(1023 1024 2716 2715)
4(1025 1004 2696 2717)
4(1024 1025 2717 2716)
4(1026 1005 2697 2718)
4(1025 1026 2718 2717)
4(1027 1006 2698 2719)
4(1026 1027 2719 2718)
4(1028 1007 2699 2720)
4(1027 1028 2720 2719)
4(1029 1008 2700 2721)
4(1028 1029 2721 2720)
4(1030 1009 2701 2722)
4(1029 1030 2722 2721)
4(1031 1010 2702 2723)
4(1030 1031 2723 2722)
4(1032 1011 2703 2724)
4(1031 1032 2724 2723)
4(1033 1012 2704 2725)
4(1032 1033 2725 2724)
4(1034 1013 2705 2726)
4(1033 1034 2726 2725)
4(1035 1014 2706 2727)
4(1034 1035 2727 2726)
4(1036 1015 2707 2728)
4(1035 1036 2728 2727)
4(1037 1016 2708 2729)
4(1036 1037 2729 2728)
4(1038 1017 2709 2730)
4(1037 1038 2730 2729)
4(1039 1018 2710 2731)
4(1038 1039 2731 2730)
4(1039 1040 2732 2731)
4(1042 1021 2713 2734)
4(1041 1042 2734 2733)
4(1043 1022 2714 2735)
4(1042 1043 2735 2734)
4(1044 1023 2715 2736)
4(1043 1044 2736 2735)
4(1045 1024 2716 2737)
4(1044 1045 2737 2736)
4(1046 1025 2717 2738)
4(1045 1046 2738 2737)
4(1047 1026 2718 2739)
4(1046 1047 2739 2738)
4(1048 1027 2719 2740)
4(1047 1048 2740 2739)
4(1049 1028 2720 2741)
4(1048 1049 2741 2740)
4(1050 1029 2721 2742)
4(1049 1050 2742 2741)
4(1051 1030 2722 2743)
4(1050 1051 2743 2742)
4(1052 1031 2723 2744)
4(1051 1052 2744 2743)
4(1053 1032 2724 2745)
4(1052 1053 2745 2744)
4(1054 1033 2725 2746)
4(1053 1054 2746 2745)
4(1055 1034 2726 2747)
4(1054 1055 2747 2746)
4(1056 1035 2727 2748)
4(1055 1056 2748 2747)
4(1057 1036 2728 2749)
4(1056 1057 2749 2748)
4(1058 1037 2729 2750)
4(1057 1058 2750 2749)
4(1059 1038 2730 2751)
4(1058 1059 2751 2750)
4(1060 1039 2731 2752)
4(1059 1060 2752 2751)
4(1060 1061 2753 2752)
4(1063 1042 2734 2755)
4(1062 1063 2755 2754)
4(1064 1043 2735 2756)
4(1063 1064 2756 2755)
4(1065 1044 2736 2757)
4(1064 1065 2757 2756)
4(1066 1045 2737 2758)
4(1065 1066 2758 2757)
4(1067 1046 2738 2759)
4(1066 1067 2759 2758)
4(1068 1047 2739 2760)
4(1067 1068 2760 2759)
4(1069 1048 2740 2761)
4(1068 1069 2761 2760)
4(1070 1049 2741 2762)
4(1069 1070 2762 2761)
4(1071 1050 2742 2763)
4(1070 1071 2763 2762)
4(1072 1051 2743 2764)
4(1071 1072 2764 2763)
4(1073 1052 2744 2765)
4(1072 1073 2765 2764)
4(1074 1053 2745 2766)
4(1073 1074 2766 2765)
4(1075 1054 2746 2767)
4(1074 1075 2767 2766)
4(1076 1055 2747 2768)
4(1075 1076 2768 2767)
4(1077 1056 2748 2769)
4(1076 1077 2769 2768)
4(1078 1057 2749 2770)
4(1077 1078 2770 2769)
4(1079 1058 2750 2771)
4(1078 1079 2771 2770)
4(1080 1059 2751 2772)
4(1079 1080 2772 2771)
4(1081 1060 2752 2773)
4(1080 1081 2773 2772)
4(1081 1082 2774 2773)
4(1084 1063 2755 2776)
4(1083 1084 2776 2775)
4(1085 1064 2756 2777)
4(1084 1085 2777 2776)
4(1086 1065 2757 2778)
4(1085 1086 2778 2777)
4(1087 1066 2758 2779)
4(1086 1087 2779 2778)
4(1088 1067 2759 2780)
4(1087 1088 2780 2779)
4(1089 1068 2760 2781)
4(1088 1089 2781 2780)
4(1090 1069 2761 2782)
4(1089 1090 2782 2781)
4(1091 1070 2762 2783)
4(1090 1091 2783 2782)
4(1092 1071 2763 2784)
4(1091 1092 2784 2783)
4(1093 1072 2764 2785)
4(1092 1093 2785 2784)
4(1094 1073 2765 2786)
4(1093 1094 2786 2785)
4(1095 1074 2766 2787)
4(1094 1095 2787 2786)
4(1096 1075 2767 2788)
4(1095 1096 2788 2787)
4(1097 1076 2768 2789)
4(1096 1097 2789 2788)
4(1098 1077 2769 2790)
4(1097 1098 2790 2789)
4(1099 1078 2770 2791)
4(1098 1099 2791 2790)
4(1100 1079 2771 2792)
4(1099 1100 2792 2791)
4(1101 1080 2772 2793)
4(1100 1101 2793 2792)
4(1102 1081 2773 2794)
4(1101 1102 2794 2793)
4(1102 1103 2795 2794)
4(1105 1084 2776 2797)
4(1104 1105 2797 2796)
4(1106 1085 2777 2798)
4(1105 1106 2798 2797)
4(1107 1086 2778 2799)
4(1106 1107 2799 2798)
4(1108 1087 2779 2800)
4(1107 1108 2800 2799)
4(1109 1088 2780 2801)
4(1108 1109 2801 2800)
4(1110 1089 2781 2802)
4(1109 1110 2802 2801)
4(1111 1090 2782 2803)
4(1110 1111 2803 2802)
4(1112 1091 2783 2804)
4(1111 1112 2804 2803)
4(1113 1092 2784 2805)
4(1112 1113 2805 2804)
4(1114 1093 2785 2806)
4(1113 1114 2806 2805)
4(1115 1094 2786 2807)
4(1114 1115 2807 2806)
4(1116 1095 2787 2808)
4(1115 1116 2808 2807)
4(1117 1096 2788 2809)
4(1116 1117 2809 2808)
4(1118 1097 2789 2810)
4(1117 1118 2810 2809)
4(1119 1098 2790 2811)
4(1118 1119 2811 2810)
4(1120 1099 2791 2812)
4(1119 1120 2812 2811)
4(1121 1100 2792 2813)
4(1120 1121 2813 2812)
4(1122 1101 2793 2814)
4(1121 1122 2814 2813)
4(1123 1102 2794 2815)
4(1122 1123 2815 2814)
4(1123 1124 2816 2815)
4(1126 1105 2797 2818)
4(1125 1126 2818 2817)
4(1127 1106 2798 2819)
4(1126 1127 2819 2818)
4(1128 1107 2799 2820)
4(1127 1128 2820 2819)
4(1129 1108 2800 2821)
4(1128 1129 2821 2820)
4(1130 1109 2801 2822)
4(1129 1130 2822 2821)
4(1131 1110 2802 2823)
4(1130 1131 2823 2822)
4(1132 1111 2803 2824)
4(1131 1132 2824 2823)
4(1133 1112 2804 2825)
4(1132 1133 2825 2824)
4(1134 1113 2805 2826)
4(1133 1134 2826 2825)
4(1135 1114 2806 2827)
4(1134 1135 2827 2826)
4(1136 1115 2807 2828)
4(1135 1136 2828 2827)
4(1137 1116 2808 2829)
4(1136 1137 2829 2828)
4(1138 1117 2809 2830)
4(1137 1138 2830 2829)
4(1139 1118 2810 2831)
4(1138 1139 2831 2830)
4(1140 1119 2811 2832)
4(1139 1140 2832 2831)
4(1141 1120 2812 2833)
4(1140 1141 2833 2832)
4(1142 1121 2813 2834)
4(1141 1142 2834 2833)
4(1143 1122 2814 2835)
4(1142 1143 2835 2834)
4(1144 1123 2815 2836)
4(1143 1144 2836 2835)
4(1144 1145 2837 2836)
4(1147 1126 2818 2839)
4(1146 1147 2839 2838)
4(1148 1127 2819 2840)
4(1147 1148 2840 2839)
4(1149 1128 2820 2841)
4(1148 1149 2841 2840)
4(1150 1129 2821 2842)
4(1149 1150 2842 2841)
4(1151 1130 2822 2843)
4(1150 1151 2843 2842)
4(1152 1131 2823 2844)
4(1151 1152 2844 2843)
4(1153 1132 2824 2845)
4(1152 1153 2845 2844)
4(1154 1133 2825 2846)
4(1153 1154 2846 2845)
4(1155 1134 2826 2847)
4(1154 1155 2847 2846)
4(1156 1135 2827 2848)
4(1155 1156 2848 2847)
4(1157 1136 2828 2849)
4(1156 1157 2849 2848)
4(1158 1137 2829 2850)
4(1157 1158 2850 2849)
4(1159 1138 2830 2851)
4(1158 1159 2851 2850)
4(1160 1139 2831 2852)
4(1159 1160 2852 2851)
4(1161 1140 2832 2853)
4(1160 1161 2853 2852)
4(1162 1141 2833 2854)
4(1161 1162 2854 2853)
4(1163 1142 2834 2855)
4(1162 1163 2855 2854)
4(1164 1143 2835 2856)
4(1163 1164 2856 2855)
4(1165 1144 2836 2857)
4(1164 1165 2857 2856)
4(1165 1166 2858 2857)
4(1168 1147 2839 2860)
4(1167 1168 2860 2859)
4(1169 1148 2840 2861)
4(1168 1169 2861 2860)
4(1170 1149 2841 2862)
4(1169 1170 2862 2861)
4(1171 1150 2842 2863)
4(1170 1171 2863 2862)
4(1172 1151 2843 2864)
4(1171 1172 2864 2863)
4(1173 1152 2844 2865)
4(1172 1173 2865 2864)
4(1174 1153 2845 2866)
4(1173 1174 2866 2865)
4(1175 1154 2846 2867)
4(1174 1175 2867 2866)
4(1176 1155 2847 2868)
4(1175 1176 2868 2867)
4(1177 1156 2848 2869)
4(1176 1177 2869 2868)
4(1178 1157 2849 2870)
4(1177 1178 2870 2869)
4(1179 1158 2850 2871)
4(1178 1179 2871 2870)
4(1180 1159 2851 2872)
4(1179 1180 2872 2871)
4(1181 1160 2852 2873)
4(1180 1181 2873 2872)
4(1182 1161 2853 2874)
4(1181 1182 2874 2873)
4(1183 1162 2854 2875)
4(1182 1183 2875 2874)
4(1184 1163 2855 2876)
4(1183 1184 2876 2875)
4(1185 1164 2856 2877)
4(1184 1185 2877 2876)
4(1186 1165 2857 2878)
4(1185 1186 2878 2877)
4(1186 1187 2879 2878)
4(1189 1168 2860 2881)
4(1188 1189 2881 2880)
4(1190 1169 2861 2882)
4(1189 1190 2882 2881)
4(1191 1170 2862 2883)
4(1190 1191 2883 2882)
4(1192 1171 2863 2884)
4(1191 1192 2884 2883)
4(1193 1172 2864 2885)
4(1192 1193 2885 2884)
4(1194 1173 2865 2886)
4(1193 1194 2886 2885)
4(1195 1174 2866 2887)
4(1194 1195 2887 2886)
4(1196 1175 2867 2888)
4(1195 1196 2888 2887)
4(1197 1176 2868 2889)
4(1196 1197 2889 2888)
4(1198 1177 2869 2890)
4(1197 1198 2890 2889)
4(1199 1178 2870 2891)
4(1198 1199 2891 2890)
4(1200 1179 2871 2892)
4(1199 1200 2892 2891)
4(1201 1180 2872 2893)
4(1200 1201 2893 2892)
4(1202 1181 2873 2894)
4(1201 1202 2894 2893)
4(1203 1182 2874 2895)
4(1202 1203 2895 2894)
4(1204 1183 2875 2896)
4(1203 1204 2896 2895)
4(1205 1184 2876 2897)
4(1204 1205 2897 2896)
4(1206 1185 2877 2898)
4(1205 1206 2898 2897)
4(1207 1186 2878 2899)
4(1206 1207 2899 2898)
4(1207 1208 2900 2899)
4(1210 1189 2881 2902)
4(1209 1210 2902 2901)
4(1211 1190 2882 2903)
4(1210 1211 2903 2902)
4(1212 1191 2883 2904)
4(1211 1212 2904 2903)
4(1213 1192 2884 2905)
4(1212 1213 2905 2904)
4(1214 1193 2885 2906)
4(1213 1214 2906 2905)
4(1215 1194 2886 2907)
4(1214 1215 2907 2906)
4(1216 1195 2887 2908)
4(1215 1216 2908 2907)
4(1217 1196 2888 2909)
4(1216 1217 2909 2908)
4(1218 1197 2889 2910)
4(1217 1218 2910 2909)
4(1219 1198 2890 2911)
4(1218 1219 2911 2910)
4(1220 1199 2891 2912)
4(1219 1220 2912 2911)
4(1221 1200 2892 2913)
4(1220 1221 2913 2912)
4(1222 1201 2893 2914)
4(1221 1222 2914 2913)
4(1223 1202 2894 2915)
4(1222 1223 2915 2914)
4(1224 1203 2895 2916)
4(1223 1224 2916 2915)
4(1225 1204 2896 2917)
4(1224 1225 2917 2916)
4(1226 1205 2897 2918)
4(1225 1226 2918 2917)
4(1227 1206 2898 2919)
4(1226 1227 2919 2918)
4(1228 1207 2899 2920)
4(1227 1228 2920 2919)
4(1228 1229 2921 2920)
4(1231 1210 2902 2923)
4(1230 1231 2923 2922)
4(1232 1211 2903 2924)
4(1231 1232 2924 2923)
4(1233 1212 2904 2925)
4(1232 1233 2925 2924)
4(1234 1213 2905 2926)
4(1233 1234 2926 2925)
4(1235 1214 2906 2927)
4(1234 1235 2927 2926)
4(1236 1215 2907 2928)
4(1235 1236 2928 2927)
4(1237 1216 2908 2929)
4(1236 1237 2929 2928)
4(1238 1217 2909 2930)
4(1237 1238 2930 2929)
4(1239 1218 2910 2931)
4(1238 1239 2931 2930)
4(1240 1219 2911 2932)
4(1239 1240 2932 2931)
4(1241 1220 2912 2933)
4(1240 1241 2933 2932)
4(1242 1221 2913 2934)
4(1241 1242 2934 2933)
4(1243 1222 2914 2935)
4(1242 1243 2935 2934)
4(1244 1223 2915 2936)
4(1243 1244 2936 2935)
4(1245 1224 2916 2937)
4(1244 1245 2937 2936)
4(1246 1225 2917 2938)
4(1245 1246 2938 2937)
4(1247 1226 2918 2939)
4(1246 1247 2939 2938)
4(1248 1227 2919 2940)
4(1247 1248 2940 2939)
4(1249 1228 2920 2941)
4(1248 1249 2941 2940)
4(1249 1250 2942 2941)
4(1252 1231 2923 2944)
4(1251 1252 2944 2943)
4(1253 1232 2924 2945)
4(1252 1253 2945 2944)
4(1254 1233 2925 2946)
4(1253 1254 2946 2945)
4(1255 1234 2926 2947)
4(1254 1255 2947 2946)
4(1256 1235 2927 2948)
4(1255 1256 2948 2947)
4(1257 1236 2928 2949)
4(1256 1257 2949 2948)
4(1258 1237 2929 2950)
4(1257 1258 2950 2949)
4(1259 1238 2930 2951)
4(1258 1259 2951 2950)
4(1260 1239 2931 2952)
4(1259 1260 2952 2951)
4(1261 1240 2932 2953)
4(1260 1261 2953 2952)
4(1262 1241 2933 2954)
4(1261 1262 2954 2953)
4(1263 1242 2934 2955)
4(1262 1263 2955 2954)
4(1264 1243 2935 2956)
4(1263 1264 2956 2955)
4(1265 1244 2936 2957)
4(1264 1265 2957 2956)
4(1266 1245 2937 2958)
4(1265 1266 2958 2957)
4(1267 1246 2938 2959)
4(1266 1267 2959 2958)
4(1268 1247 2939 2960)
4(1267 1268 2960 2959)
4(1269 1248 2940 2961)
4(1268 1269 2961 2960)
4(1270 1249 2941 2962)
4(1269 1270 2962 2961)
4(1270 1271 2963 2962)
4(1273 1252 2944 2965)
4(1272 1273 2965 2964)
4(1274 1253 2945 2966)
4(1273 1274 2966 2965)
4(1275 1254 2946 2967)
4(1274 1275 2967 2966)
4(1276 1255 2947 2968)
4(1275 1276 2968 2967)
4(1277 1256 2948 2969)
4(1276 1277 2969 2968)
4(1278 1257 2949 2970)
4(1277 1278 2970 2969)
4(1279 1258 2950 2971)
4(1278 1279 2971 2970)
4(1280 1259 2951 2972)
4(1279 1280 2972 2971)
4(1281 1260 2952 2973)
4(1280 1281 2973 2972)
4(1282 1261 2953 2974)
4(1281 1282 2974 2973)
4(1283 1262 2954 2975)
4(1282 1283 2975 2974)
4(1284 1263 2955 2976)
4(1283 1284 2976 2975)
4(1285 1264 2956 2977)
4(1284 1285 2977 2976)
4(1286 1265 2957 2978)
4(1285 1286 2978 2977)
4(1287 1266 2958 2979)
4(1286 1287 2979 2978)
4(1288 1267 2959 2980)
4(1287 1288 2980 2979)
4(1289 1268 2960 2981)
4(1288 1289 2981 2980)
4(1290 1269 2961 2982)
4(1289 1290 2982 2981)
4(1291 1270 2962 2983)
4(1290 1291 2983 2982)
4(1291 1292 2984 2983)
4(1294 1273 2965 2986)
4(1293 1294 2986 2985)
4(1295 1274 2966 2987)
4(1294 1295 2987 2986)
4(1296 1275 2967 2988)
4(1295 1296 2988 2987)
4(1297 1276 2968 2989)
4(1296 1297 2989 2988)
4(1298 1277 2969 2990)
4(1297 1298 2990 2989)
4(1299 1278 2970 2991)
4(1298 1299 2991 2990)
4(1300 1279 2971 2992)
4(1299 1300 2992 2991)
4(1301 1280 2972 2993)
4(1300 1301 2993 2992)
4(1302 1281 2973 2994)
4(1301 1302 2994 2993)
4(1303 1282 2974 2995)
4(1302 1303 2995 2994)
4(1304 1283 2975 2996)
4(1303 1304 2996 2995)
4(1305 1284 2976 2997)
4(1304 1305 2997 2996)
4(1306 1285 2977 2998)
4(1305 1306 2998 2997)
4(1307 1286 2978 2999)
4(1306 1307 2999 2998)
4(1308 1287 2979 3000)
4(1307 1308 3000 2999)
4(1309 1288 2980 3001)
4(1308 1309 3001 3000)
4(1310 1289 2981 3002)
4(1309 1310 3002 3001)
4(1311 1290 2982 3003)
4(1310 1311 3003 3002)
4(1312 1291 2983 3004)
4(1311 1312 3004 3003)
4(1312 1313 3005 3004)
4(1315 1294 2986 3007)
4(1314 1315 3007 3006)
4(1316 1295 2987 3008)
4(1315 1316 3008 3007)
4(1317 1296 2988 3009)
4(1316 1317 3009 3008)
4(1318 1297 2989 3010)
4(1317 1318 3010 3009)
4(1319 1298 2990 3011)
4(1318 1319 3011 3010)
4(1320 1299 2991 3012)
4(1319 1320 3012 3011)
4(1321 1300 2992 3013)
4(1320 1321 3013 3012)
4(1322 1301 2993 3014)
4(1321 1322 3014 3013)
4(1323 1302 2994 3015)
4(1322 1323 3015 3014)
4(1324 1303 2995 3016)
4(1323 1324 3016 3015)
4(1325 1304 2996 3017)
4(1324 1325 3017 3016)
4(1326 1305 2997 3018)
4(1325 1326 3018 3017)
4(1327 1306 2998 3019)
4(1326 1327 3019 3018)
4(1328 1307 2999 3020)
4(1327 1328 3020 3019)
4(1329 1308 3000 3021)
4(1328 1329 3021 3020)
4(1330 1309 3001 3022)
4(1329 1330 3022 3021)
4(1331 1310 3002 3023)
4(1330 1331 3023 3022)
4(1332 1311 3003 3024)
4(1331 1332 3024 3023)
4(1333 1312 3004 3025)
4(1332 1333 3025 3024)
4(1333 1334 3026 3025)
4(1336 1315 3007 3028)
4(1335 1336 3028 3027)
4(1337 1316 3008 3029)
4(1336 1337 3029 3028)
4(1338 1317 3009 3030)
4(1337 1338 3030 3029)
4(1339 1318 3010 3031)
4(1338 1339 3031 3030)
4(1340 1319 3011 3032)
4(1339 1340 3032 3031)
4(1341 1320 3012 3033)
4(1340 1341 3033 3032)
4(1342 1321 3013 3034)
4(1341 1342 3034 3033)
4(1343 1322 3014 3035)
4(1342 1343 3035 3034)
4(1344 1323 3015 3036)
4(1343 1344 3036 3035)
4(1345 1324 3016 3037)
4(1344 1345 3037 3036)
4(1346 1325 3017 3038)
4(1345 1346 3038 3037)
4(1347 1326 3018 3039)
4(1346 1347 3039 3038)
4(1348 1327 3019 3040)
4(1347 1348 3040 3039)
4(1349 1328 3020 3041)
4(1348 1349 3041 3040)
4(1350 1329 3021 3042)
4(1349 1350 3042 3041)
4(1351 1330 3022 3043)
4(1350 1351 3043 3042)
4(1352 1331 3023 3044)
4(1351 1352 3044 3043)
4(1353 1332 3024 3045)
4(1352 1353 3045 3044)
4(1354 1333 3025 3046)
4(1353 1354 3046 3045)
4(1354 1355 3047 3046)
4(1357 1336 3028 3049)
4(1356 1357 3049 3048)
4(1358 1337 3029 3050)
4(1357 1358 3050 3049)
4(1359 1338 3030 3051)
4(1358 1359 3051 3050)
4(1360 1339 3031 3052)
4(1359 1360 3052 3051)
4(1361 1340 3032 3053)
4(1360 1361 3053 3052)
4(1362 1341 3033 3054)
4(1361 1362 3054 3053)
4(1363 1342 3034 3055)
4(1362 1363 3055 3054)
4(1364 1343 3035 3056)
4(1363 1364 3056 3055)
4(1365 1344 3036 3057)
4(1364 1365 3057 3056)
4(1366 1345 3037 3058)
4(1365 1366 3058 3057)
4(1367 1346 3038 3059)
4(1366 1367 3059 3058)
4(1368 1347 3039 3060)
4(1367 1368 3060 3059)
4(1369 1348 3040 3061)
4(1368 1369 3061 3060)
4(1370 1349 3041 3062)
4(1369 1370 3062 3061)
4(1371 1350 3042 3063)
4(1370 1371 3063 3062)
4(1372 1351 3043 3064)
4(1371 1372 3064 3063)
4(1373 1352 3044 3065)
4(1372 1373 3065 3064)
4(1374 1353 3045 3066)
4(1373 1374 3066 3065)
4(1375 1354 3046 3067)
4(1374 1375 3067 3066)
4(1375 1376 3068 3067)
4(1378 1357 3049 3070)
4(1377 1378 3070 3069)
4(1379 1358 3050 3071)
4(1378 1379 3071 3070)
4(1380 1359 3051 3072)
4(1379 1380 3072 3071)
4(1381 1360 3052 3073)
4(1380 1381 3073 3072)
4(1382 1361 3053 3074)
4(1381 1382 3074 3073)
4(1383 1362 3054 3075)
4(1382 1383 3075 3074)
4(1384 1363 3055 3076)
4(1383 1384 3076 3075)
4(1385 1364 3056 3077)
4(1384 1385 3077 3076)
4(1386 1365 3057 3078)
4(1385 1386 3078 3077)
4(1387 1366 3058 3079)
4(1386 1387 3079 3078)
4(1388 1367 3059 3080)
4(1387 1388 3080 3079)
4(1389 1368 3060 3081)
4(1388 1389 3081 3080)
4(1390 1369 3061 3082)
4(1389 1390 3082 3081)
4(1391 1370 3062 3083)
4(1390 1391 3083 3082)
4(1392 1371 3063 3084)
4(1391 1392 3084 3083)
4(1393 1372 3064 3085)
4(1392 1393 3085 3084)
4(1394 1373 3065 3086)
4(1393 1394 3086 3085)
4(1395 1374 3066 3087)
4(1394 1395 3087 3086)
4(1396 1375 3067 3088)
4(1395 1396 3088 3087)
4(1396 1397 3089 3088)
4(1399 1378 3070 3091)
4(1398 1399 3091 3090)
4(1400 1379 3071 3092)
4(1399 1400 3092 3091)
4(1401 1380 3072 3093)
4(1400 1401 3093 3092)
4(1402 1381 3073 3094)
4(1401 1402 3094 3093)
4(1403 1382 3074 3095)
4(1402 1403 3095 3094)
4(1404 1383 3075 3096)
4(1403 1404 3096 3095)
4(1405 1384 3076 3097)
4(1404 1405 3097 3096)
4(1406 1385 3077 3098)
4(1405 1406 3098 3097)
4(1407 1386 3078 3099)
4(1406 1407 3099 3098)
4(1408 1387 3079 3100)
4(1407 1408 3100 3099)
4(1409 1388 3080 3101)
4(1408 1409 3101 3100)
4(1410 1389 3081 3102)
4(1409 1410 3102 3101)
4(1411 1390 3082 3103)
4(1410 1411 3103 3102)
4(1412 1391 3083 3104)
4(1411 1412 3104 3103)
4(1413 1392 3084 3105)
4(1412 1413 3105 3104)
4(1414 1393 3085 3106)
4(1413 1414 3106 3105)
4(1415 1394 3086 3107)
4(1414 1415 3107 3106)
4(1416 1395 3087 3108)
4(1415 1416 3108 3107)
4(1417 1396 3088 3109)
4(1416 1417 3109 3108)
4(1417 1418 3110 3109)
4(1420 1399 3091 3112)
4(1419 1420 3112 3111)
4(1421 1400 3092 3113)
4(1420 1421 3113 3112)
4(1422 1401 3093 3114)
4(1421 1422 3114 3113)
4(1423 1402 3094 3115)
4(1422 1423 3115 3114)
4(1424 1403 3095 3116)
4(1423 1424 3116 3115)
4(1425 1404 3096 3117)
4(1424 1425 3117 3116)
4(1426 1405 3097 3118)
4(1425 1426 3118 3117)
4(1427 1406 3098 3119)
4(1426 1427 3119 3118)
4(1428 1407 3099 3120)
4(1427 1428 3120 3119)
4(1429 1408 3100 3121)
4(1428 1429 3121 3120)
4(1430 1409 3101 3122)
4(1429 1430 3122 3121)
4(1431 1410 3102 3123)
4(1430 1431 3123 3122)
4(1432 1411 3103 3124)
4(1431 1432 3124 3123)
4(1433 1412 3104 3125)
4(1432 1433 3125 3124)
4(1434 1413 3105 3126)
4(1433 1434 3126 3125)
4(1435 1414 3106 3127)
4(1434 1435 3127 3126)
4(1436 1415 3107 3128)
4(1435 1436 3128 3127)
4(1437 1416 3108 3129)
4(1436 1437 3129 3128)
4(1438 1417 3109 3130)
4(1437 1438 3130 3129)
4(1438 1439 3131 3130)
4(1441 1420 3112 3133)
4(1440 1441 3133 3132)
4(1442 1421 3113 3134)
4(1441 1442 3134 3133)
4(1443 1422 3114 3135)
4(1442 1443 3135 3134)
4(1444 1423 3115 3136)
4(1443 1444 3136 3135)
4(1445 1424 3116 3137)
4(1444 1445 3137 3136)
4(1446 1425 3117 3138)
4(1445 1446 3138 3137)
4(1447 1426 3118 3139)
4(1446 1447 3139 3138)
4(1448 1427 3119 3140)
4(1447 1448 3140 3139)
4(1449 1428 3120 3141)
4(1448 1449 3141 3140)
4(1450 1429 3121 3142)
4(1449 1450 3142 3141)
4(1451 1430 3122 3143)
4(1450 1451 3143 3142)
4(1452 1431 3123 3144)
4(1451 1452 3144 3143)
4(1453 1432 3124 3145)
4(1452 1453 3145 3144)
4(1454 1433 3125 3146)
4(1453 1454 3146 3145)
4(1455 1434 3126 3147)
4(1454 1455 3147 3146)
4(1456 1435 3127 3148)
4(1455 1456 3148 3147)
4(1457 1436 3128 3149)
4(1456 1457 3149 3148)
4(1458 1437 3129 3150)
4(1457 1458 3150 3149)
4(1459 1438 3130 3151)
4(1458 1459 3151 3150)
4(1459 1460 3152 3151)
4(1462 1441 3133 3154)
4(1461 1462 3154 3153)
4(1463 1442 3134 3155)
4(1462 1463 3155 3154)
4(1464 1443 3135 3156)
4(1463 1464 3156 3155)
4(1465 1444 3136 3157)
4(1464 1465 3157 3156)
4(1466 1445 3137 3158)
4(1465 1466 3158 3157)
4(1467 1446 3138 3159)
4(1466 1467 3159 3158)
4(1468 1447 3139 3160)
4(1467 1468 3160 3159)
4(1469 1448 3140 3161)
4(1468 1469 3161 3160)
4(1470 1449 3141 3162)
4(1469 1470 3162 3161)
4(1471 1450 3142 3163)
4(1470 1471 3163 3162)
4(1472 1451 3143 3164)
4(1471 1472 3164 3163)
4(1473 1452 3144 3165)
4(1472 1473 3165 3164)
4(1474 1453 3145 3166)
4(1473 1474 3166 3165)
4(1475 1454 3146 3167)
4(1474 1475 3167 3166)
4(1476 1455 3147 3168)
4(1475 1476 3168 3167)
4(1477 1456 3148 3169)
4(1476 1477 3169 3168)
4(1478 1457 3149 3170)
4(1477 1478 3170 3169)
4(1479 1458 3150 3171)
4(1478 1479 3171 3170)
4(1480 1459 3151 3172)
4(1479 1480 3172 3171)
4(1480 1481 3173 3172)
4(1483 1462 3154 3175)
4(1482 1483 3175 3174)
4(1484 1463 3155 3176)
4(1483 1484 3176 3175)
4(1485 1464 3156 3177)
4(1484 1485 3177 3176)
4(1486 1465 3157 3178)
4(1485 1486 3178 3177)
4(1487 1466 3158 3179)
4(1486 1487 3179 3178)
4(1488 1467 3159 3180)
4(1487 1488 3180 3179)
4(1489 1468 3160 3181)
4(1488 1489 3181 3180)
4(1490 1469 3161 3182)
4(1489 1490 3182 3181)
4(1491 1470 3162 3183)
4(1490 1491 3183 3182)
4(1492 1471 3163 3184)
4(1491 1492 3184 3183)
4(1493 1472 3164 3185)
4(1492 1493 3185 3184)
4(1494 1473 3165 3186)
4(1493 1494 3186 3185)
4(1495 1474 3166 3187)
4(1494 1495 3187 3186)
4(1496 1475 3167 3188)
4(1495 1496 3188 3187)
4(1497 1476 3168 3189)
4(1496 1497 3189 3188)
4(1498 1477 3169 3190)
4(1497 1498 3190 3189)
4(1499 1478 3170 3191)
4(1498 1499 3191 3190)
4(1500 1479 3171 3192)
4(1499 1500 3192 3191)
4(1501 1480 3172 3193)
4(1500 1501 3193 3192)
4(1501 1502 3194 3193)
4(1504 1483 3175 3196)
4(1503 1504 3196 3195)
4(1505 1484 3176 3197)
4(1504 1505 3197 3196)
4(1506 1485 3177 3198)
4(1505 1506 3198 3197)
4(1507 1486 3178 3199)
4(1506 1507 3199 3198)
4(1508 1487 3179 3200)
4(1507 1508 3200 3199)
4(1509 1488 3180 3201)
4(1508 1509 3201 3200)
4(1510 1489 3181 3202)
4(1509 1510 3202 3201)
4(1511 1490 3182 3203)
4(1510 1511 3203 3202)
4(1512 1491 3183 3204)
4(1511 1512 3204 3203)
4(1513 1492 3184 3205)
4(1512 1513 3205 3204)
4(1514 1493 3185 3206)
4(1513 1514 3206 3205)
4(1515 1494 3186 3207)
4(1514 1515 3207 3206)
4(1516 1495 3187 3208)
4(1515 1516 3208 3207)
4(1517 1496 3188 3209)
4(1516 1517 3209 3208)
4(1518 1497 3189 3210)
4(1517 1518 3210 3209)
4(1519 1498 3190 3211)
4(1518 1519 3211 3210)
4(1520 1499 3191 3212)
4(1519 1520 3212 3211)
4(1521 1500 3192 3213)
4(1520 1521 3213 3212)
4(1522 1501 3193 3214)
4(1521 1522 3214 3213)
4(1522 1523 3215 3214)
4(1525 1504 3196 3217)
4(1524 1525 3217 3216)
4(1526 1505 3197 3218)
4(1525 1526 3218 3217)
4(1527 1506 3198 3219)
4(1526 1527 3219 3218)
4(1528 1507 3199 3220)
4(1527 1528 3220 3219)
4(1529 1508 3200 3221)
4(1528 1529 3221 3220)
4(1530 1509 3201 3222)
4(1529 1530 3222 3221)
4(1531 1510 3202 3223)
4(1530 1531 3223 3222)
4(1532 1511 3203 3224)
4(1531 1532 3224 3223)
4(1533 1512 3204 3225)
4(1532 1533 3225 3224)
4(1534 1513 3205 3226)
4(1533 1534 3226 3225)
4(1535 1514 3206 3227)
4(1534 1535 3227 3226)
4(1536 1515 3207 3228)
4(1535 1536 3228 3227)
4(1537 1516 3208 3229)
4(1536 1537 3229 3228)
4(1538 1517 3209 3230)
4(1537 1538 3230 3229)
4(1539 1518 3210 3231)
4(1538 1539 3231 3230)
4(1540 1519 3211 3232)
4(1539 1540 3232 3231)
4(1541 1520 3212 3233)
4(1540 1541 3233 3232)
4(1542 1521 3213 3234)
4(1541 1542 3234 3233)
4(1543 1522 3214 3235)
4(1542 1543 3235 3234)
4(1543 1544 3236 3235)
4(1546 1525 3217 3238)
4(1545 1546 3238 3237)
4(1547 1526 3218 3239)
4(1546 1547 3239 3238)
4(1548 1527 3219 3240)
4(1547 1548 3240 3239)
4(1549 1528 3220 3241)
4(1548 1549 3241 3240)
4(1550 1529 3221 3242)
4(1549 1550 3242 3241)
4(1551 1530 3222 3243)
4(1550 1551 3243 3242)
4(1552 1531 3223 3244)
4(1551 1552 3244 3243)
4(1553 1532 3224 3245)
4(1552 1553 3245 3244)
4(1554 1533 3225 3246)
4(1553 1554 3246 3245)
4(1555 1534 3226 3247)
4(1554 1555 3247 3246)
4(1556 1535 3227 3248)
4(1555 1556 3248 3247)
4(1557 1536 3228 3249)
4(1556 1557 3249 3248)
4(1558 1537 3229 3250)
4(1557 1558 3250 3249)
4(1559 1538 3230 3251)
4(1558 1559 3251 3250)
4(1560 1539 3231 3252)
4(1559 1560 3252 3251)
4(1561 1540 3232 3253)
4(1560 1561 3253 3252)
4(1562 1541 3233 3254)
4(1561 1562 3254 3253)
4(1563 1542 3234 3255)
4(1562 1563 3255 3254)
4(1564 1543 3235 3256)
4(1563 1564 3256 3255)
4(1564 1565 3257 3256)
4(1567 1546 3238 3259)
4(1566 1567 3259 3258)
4(1568 1547 3239 3260)
4(1567 1568 3260 3259)
4(1569 1548 3240 3261)
4(1568 1569 3261 3260)
4(1570 1549 3241 3262)
4(1569 1570 3262 3261)
4(1571 1550 3242 3263)
4(1570 1571 3263 3262)
4(1572 1551 3243 3264)
4(1571 1572 3264 3263)
4(1573 1552 3244 3265)
4(1572 1573 3265 3264)
4(1574 1553 3245 3266)
4(1573 1574 3266 3265)
4(1575 1554 3246 3267)
4(1574 1575 3267 3266)
4(1576 1555 3247 3268)
4(1575 1576 3268 3267)
4(1577 1556 3248 3269)
4(1576 1577 3269 3268)
4(1578 1557 3249 3270)
4(1577 1578 3270 3269)
4(1579 1558 3250 3271)
4(1578 1579 3271 3270)
4(1580 1559 3251 3272)
4(1579 1580 3272 3271)
4(1581 1560 3252 3273)
4(1580 1581 3273 3272)
4(1582 1561 3253 3274)
4(1581 1582 3274 3273)
4(1583 1562 3254 3275)
4(1582 1583 3275 3274)
4(1584 1563 3255 3276)
4(1583 1584 3276 3275)
4(1585 1564 3256 3277)
4(1584 1585 3277 3276)
4(1585 1586 3278 3277)
4(1588 1567 3259 3280)
4(1587 1588 3280 3279)
4(1589 1568 3260 3281)
4(1588 1589 3281 3280)
4(1590 1569 3261 3282)
4(1589 1590 3282 3281)
4(1591 1570 3262 3283)
4(1590 1591 3283 3282)
4(1592 1571 3263 3284)
4(1591 1592 3284 3283)
4(1593 1572 3264 3285)
4(1592 1593 3285 3284)
4(1594 1573 3265 3286)
4(1593 1594 3286 3285)
4(1595 1574 3266 3287)
4(1594 1595 3287 3286)
4(1596 1575 3267 3288)
4(1595 1596 3288 3287)
4(1597 1576 3268 3289)
4(1596 1597 3289 3288)
4(1598 1577 3269 3290)
4(1597 1598 3290 3289)
4(1599 1578 3270 3291)
4(1598 1599 3291 3290)
4(1600 1579 3271 3292)
4(1599 1600 3292 3291)
4(1601 1580 3272 3293)
4(1600 1601 3293 3292)
4(1602 1581 3273 3294)
4(1601 1602 3294 3293)
4(1603 1582 3274 3295)
4(1602 1603 3295 3294)
4(1604 1583 3275 3296)
4(1603 1604 3296 3295)
4(1605 1584 3276 3297)
4(1604 1605 3297 3296)
4(1606 1585 3277 3298)
4(1605 1606 3298 3297)
4(1606 1607 3299 3298)
4(1609 1588 3280 3301)
4(1608 1609 3301 3300)
4(1610 1589 3281 3302)
4(1609 1610 3302 3301)
4(1611 1590 3282 3303)
4(1610 1611 3303 3302)
4(1612 1591 3283 3304)
4(1611 1612 3304 3303)
4(1613 1592 3284 3305)
4(1612 1613 3305 3304)
4(1614 1593 3285 3306)
4(1613 1614 3306 3305)
4(1615 1594 3286 3307)
4(1614 1615 3307 3306)
4(1616 1595 3287 3308)
4(1615 1616 3308 3307)
4(1617 1596 3288 3309)
4(1616 1617 3309 3308)
4(1618 1597 3289 3310)
4(1617 1618 3310 3309)
4(1619 1598 3290 3311)
4(1618 1619 3311 3310)
4(1620 1599 3291 3312)
4(1619 1620 3312 3311)
4(1621 1600 3292 3313)
4(1620 1621 3313 3312)
4(1622 1601 3293 3314)
4(1621 1622 3314 3313)
4(1623 1602 3294 3315)
4(1622 1623 3315 3314)
4(1624 1603 3295 3316)
4(1623 1624 3316 3315)
4(1625 1604 3296 3317)
4(1624 1625 3317 3316)
4(1626 1605 3297 3318)
4(1625 1626 3318 3317)
4(1627 1606 3298 3319)
4(1626 1627 3319 3318)
4(1627 1628 3320 3319)
4(1630 1609 3301 3322)
4(1629 1630 3322 3321)
4(1631 1610 3302 3323)
4(1630 1631 3323 3322)
4(1632 1611 3303 3324)
4(1631 1632 3324 3323)
4(1633 1612 3304 3325)
4(1632 1633 3325 3324)
4(1634 1613 3305 3326)
4(1633 1634 3326 3325)
4(1635 1614 3306 3327)
4(1634 1635 3327 3326)
4(1636 1615 3307 3328)
4(1635 1636 3328 3327)
4(1637 1616 3308 3329)
4(1636 1637 3329 3328)
4(1638 1617 3309 3330)
4(1637 1638 3330 3329)
4(1639 1618 3310 3331)
4(1638 1639 3331 3330)
4(1640 1619 3311 3332)
4(1639 1640 3332 3331)
4(1641 1620 3312 3333)
4(1640 1641 3333 3332)
4(1642 1621 3313 3334)
4(1641 1642 3334 3333)
4(1643 1622 3314 3335)
4(1642 1643 3335 3334)
4(1644 1623 3315 3336)
4(1643 1644 3336 3335)
4(1645 1624 3316 3337)
4(1644 1645 3337 3336)
4(1646 1625 3317 3338)
4(1645 1646 3338 3337)
4(1647 1626 3318 3339)
4(1646 1647 3339 3338)
4(1648 1627 3319 3340)
4(1647 1648 3340 3339)
4(1648 1649 3341 3340)
4(1651 1630 3322 3343)
4(1650 1651 3343 3342)
4(1652 1631 3323 3344)
4(1651 1652 3344 3343)
4(1653 1632 3324 3345)
4(1652 1653 3345 3344)
4(1654 1633 3325 3346)
4(1653 1654 3346 3345)
4(1655 1634 3326 3347)
4(1654 1655 3347 3346)
4(1656 1635 3327 3348)
4(1655 1656 3348 3347)
4(1657 1636 3328 3349)
4(1656 1657 3349 3348)
4(1658 1637 3329 3350)
4(1657 1658 3350 3349)
4(1659 1638 3330 3351)
4(1658 1659 3351 3350)
4(1660 1639 3331 3352)
4(1659 1660 3352 3351)
4(1661 1640 3332 3353)
4(1660 1661 3353 3352)
4(1662 1641 3333 3354)
4(1661 1662 3354 3353)
4(1663 1642 3334 3355)
4(1662 1663 3355 3354)
4(1664 1643 3335 3356)
4(1663 1664 3356 3355)
4(1665 1644 3336 3357)
4(1664 1665 3357 3356)
4(1666 1645 3337 3358)
4(1665 1666 3358 3357)
4(1667 1646 3338 3359)
4(1666 1667 3359 3358)
4(1668 1647 3339 3360)
4(1667 1668 3360 3359)
4(1669 1648 3340 3361)
4(1668 1669 3361 3360)
4(1669 1670 3362 3361)
4(1672 1651 3343 3364)
4(1673 1652 3344 3365)
4(1674 1653 3345 3366)
4(1675 1654 3346 3367)
4(1676 1655 3347 3368)
4(1677 1656 3348 3369)
4(1678 1657 3349 3370)
4(1679 1658 3350 3371)
4(1680 1659 3351 3372)
4(1681 1660 3352 3373)
4(1682 1661 3353 3374)
4(1683 1662 3354 3375)
4(1684 1663 3355 3376)
4(1685 1664 3356 3377)
4(1686 1665 3357 3378)
4(1687 1666 3358 3379)
4(1688 1667 3359 3380)
4(1689 1668 3360 3381)
4(1690 1669 3361 3382)
4(3384 1692 1693 3385)
4(3385 1693 1694 3386)
4(3386 1694 1695 3387)
4(3387 1695 1696 3388)
4(3388 1696 1697 3389)
4(3389 1697 1698 3390)
4(3390 1698 1699 3391)
4(3391 1699 1700 3392)
4(3392 1700 1701 3393)
4(3393 1701 1702 3394)
4(3394 1702 1703 3395)
4(3395 1703 1704 3396)
4(3396 1704 1705 3397)
4(3397 1705 1706 3398)
4(3398 1706 1707 3399)
4(3399 1707 1708 3400)
4(3400 1708 1709 3401)
4(3401 1709 1710 3402)
4(3402 1710 1711 3403)
4(3403 1711 1712 3404)
4(1692 1713 1714 1693)
4(1693 1714 1715 1694)
4(1694 1715 1716 1695)
4(1695 1716 1717 1696)
4(1696 1717 1718 1697)
4(1697 1718 1719 1698)
4(1698 1719 1720 1699)
4(1699 1720 1721 1700)
4(1700 1721 1722 1701)
4(1701 1722 1723 1702)
4(1702 1723 1724 1703)
4(1703 1724 1725 1704)
4(1704 1725 1726 1705)
4(1705 1726 1727 1706)
4(1706 1727 1728 1707)
4(1707 1728 1729 1708)
4(1708 1729 1730 1709)
4(1709 1730 1731 1710)
4(1710 1731 1732 1711)
4(1711 1732 1733 1712)
4(1713 1734 1735 1714)
4(1714 1735 1736 1715)
4(1715 1736 1737 1716)
4(1716 1737 1738 1717)
4(1717 1738 1739 1718)
4(1718 1739 1740 1719)
4(1719 1740 1741 1720)
4(1720 1741 1742 1721)
4(1721 1742 1743 1722)
4(1722 1743 1744 1723)
4(1723 1744 1745 1724)
4(1724 1745 1746 1725)
4(1725 1746 1747 1726)
4(1726 1747 1748 1727)
4(1727 1748 1749 1728)
4(1728 1749 1750 1729)
4(1729 1750 1751 1730)
4(1730 1751 1752 1731)
4(1731 1752 1753 1732)
4(1732 1753 1754 1733)
4(1734 1755 1756 1735)
4(1735 1756 1757 1736)
4(1736 1757 1758 1737)
4(1737 1758 1759 1738)
4(1738 1759 1760 1739)
4(1739 1760 1761 1740)
4(1740 1761 1762 1741)
4(1741 1762 1763 1742)
4(1742 1763 1764 1743)
4(1743 1764 1765 1744)
4(1744 1765 1766 1745)
4(1745 1766 1767 1746)
4(1746 1767 1768 1747)
4(1747 1768 1769 1748)
4(1748 1769 1770 1749)
4(1749 1770 1771 1750)
4(1750 1771 1772 1751)
4(1751 1772 1773 1752)
4(1752 1773 1774 1753)
4(1753 1774 1775 1754)
4(1755 1776 1777 1756)
4(1756 1777 1778 1757)
4(1757 1778 1779 1758)
4(1758 1779 1780 1759)
4(1759 1780 1781 1760)
4(1760 1781 1782 1761)
4(1761 1782 1783 1762)
4(1762 1783 1784 1763)
4(1763 1784 1785 1764)
4(1764 1785 1786 1765)
4(1765 1786 1787 1766)
4(1766 1787 1788 1767)
4(1767 1788 1789 1768)
4(1768 1789 1790 1769)
4(1769 1790 1791 1770)
4(1770 1791 1792 1771)
4(1771 1792 1793 1772)
4(1772 1793 1794 1773)
4(1773 1794 1795 1774)
4(1774 1795 1796 1775)
4(1776 1797 1798 1777)
4(1777 1798 1799 1778)
4(1778 1799 1800 1779)
4(1779 1800 1801 1780)
4(1780 1801 1802 1781)
4(1781 1802 1803 1782)
4(1782 1803 1804 1783)
4(1783 1804 1805 1784)
4(1784 1805 1806 1785)
4(1785 1806 1807 1786)
4(1786 1807 1808 1787)
4(1787 1808 1809 1788)
4(1788 1809 1810 1789)
4(1789 1810 1811 1790)
4(1790 1811 1812 1791)
4(1791 1812 1813 1792)
4(1792 1813 1814 1793)
4(1793 1814 1815 1794)
4(1794 1815 1816 1795)
4(1795 1816 1817 1796)
4(1797 1818 1819 1798)
4(1798 1819 1820 1799)
4(1799 1820 1821 1800)
4(1800 1821 1822 1801)
4(1801 1822 1823 1802)
4(1802 1823 1824 1803)
4(1803 1824 1825 1804)
4(1804 1825 1826 1805)
4(1805 1826 1827 1806)
4(1806 1827 1828 1807)
4(1807 1828 1829 1808)
4(1808 1829 1830 1809)
4(1809 1830 1831 1810)
4(1810 1831 1832 1811)
4(1811 1832 1833 1812)
4(1812 1833 1834 1813)
4(1813 1834 1835 1814)
4(1814 1835 1836 1815)
4(1815 1836 1837 1816)
4(1816 1837 1838 1817)
4(1818 1839 1840 1819)
4(1819 1840 1841 1820)
4(1820 1841 1842 1821)
4(1821 1842 1843 1822)
4(1822 1843 1844 1823)
4(1823 1844 1845 1824)
4(1824 1845 1846 1825)
4(1825 1846 1847 1826)
4(1826 1847 1848 1827)
4(1827 1848 1849 1828)
4(1828 1849 1850 1829)
4(1829 1850 1851 1830)
4(1830 1851 1852 1831)
4(1831 1852 1853 1832)
4(1832 1853 1854 1833)
4(1833 1854 1855 1834)
4(1834 1855 1856 1835)
4(1835 1856 1857 1836)
4(1836 1857 1858 1837)
4(1837 1858 1859 1838)
4(1839 1860 1861 1840)
4(1840 1861 1862 1841)
4(1841 1862 1863 1842)
4(1842 1863 1864 1843)
4(1843 1864 1865 1844)
4(1844 1865 1866 1845)
4(1845 1866 1867 1846)
4(1846 1867 1868 1847)
4(1847 1868 1869 1848)
4(1848 1869 1870 1849)
4(1849 1870 1871 1850)
4(1850 1871 1872 1851)
4(1851 1872 1873 1852)
4(1852 1873 1874 1853)
4(1853 1874 1875 1854)
4(1854 1875 1876 1855)
4(1855 1876 1877 1856)
4(1856 1877 1878 1857)
4(1857 1878 1879 1858)
4(1858 1879 1880 1859)
4(1860 1881 1882 1861)
4(1861 1882 1883 1862)
4(1862 1883 1884 1863)
4(1863 1884 1885 1864)
4(1864 1885 1886 1865)
4(1865 1886 1887 1866)
4(1866 1887 1888 1867)
4(1867 1888 1889 1868)
4(1868 1889 1890 1869)
4(1869 1890 1891 1870)
4(1870 1891 1892 1871)
4(1871 1892 1893 1872)
4(1872 1893 1894 1873)
4(1873 1894 1895 1874)
4(1874 1895 1896 1875)
4(1875 1896 1897 1876)
4(1876 1897 1898 1877)
4(1877 1898 1899 1878)
4(1878 1899 1900 1879)
4(1879 1900 1901 1880)
4(1881 1902 1903 1882)
4(1882 1903 1904 1883)
4(1883 1904 1905 1884)
4(1884 1905 1906 1885)
4(1885 1906 1907 1886)
4(1886 1907 1908 1887)
4(1887 1908 1909 1888)
4(1888 1909 1910 1889)
4(1889 1910 1911 1890)
4(1890 1911 1912 1891)
4(1891 1912 1913 1892)
4(1892 1913 1914 1893)
4(1893 1914 1915 1894)
4(1894 1915 1916 1895)
4(1895 1916 1917 1896)
4(1896 1917 1918 1897)
4(1897 1918 1919 1898)
4(1898 1919 1920 1899)
4(1899 1920 1921 1900)
4(1900 1921 1922 1901)
4(1902 1923 1924 1903)
4(1903 1924 1925 1904)
4(1904 1925 1926 1905)
4(1905 1926 1927 1906)
4(1906 1927 1928 1907)
4(1907 1928 1929 1908)
4(1908 1929 1930 1909)
4(1909 1930 1931 1910)
4(1910 1931 1932 1911)
4(1911 1932 1933 1912)
4(1912 1933 1934 1913)
4(1913 1934 1935 1914)
4(1914 1935 1936 1915)
4(1915 1936 1937 1916)
4(1916 1937 1938 1917)
4(1917 1938 1939 1918)
4(1918 1939 1940 1919)
4(1919 1940 1941 1920)
4(1920 1941 1942 1921)
4(1921 1942 1943 1922)
4(1923 1944 1945 1924)
4(1924 1945 1946 1925)
4(1925 1946 1947 1926)
4(1926 1947 1948 1927)
4(1927 1948 1949 1928)
4(1928 1949 1950 1929)
4(1929 1950 1951 1930)
4(1930 1951 1952 1931)
4(1931 1952 1953 1932)
4(1932 1953 1954 1933)
4(1933 1954 1955 1934)
4(1934 1955 1956 1935)
4(1935 1956 1957 1936)
4(1936 1957 1958 1937)
4(1937 1958 1959 1938)
4(1938 1959 1960 1939)
4(1939 1960 1961 1940)
4(1940 1961 1962 1941)
4(1941 1962 1963 1942)
4(1942 1963 1964 1943)
4(1944 1965 1966 1945)
4(1945 1966 1967 1946)
4(1946 1967 1968 1947)
4(1947 1968 1969 1948)
4(1948 1969 1970 1949)
4(1949 1970 1971 1950)
4(1950 1971 1972 1951)
4(1951 1972 1973 1952)
4(1952 1973 1974 1953)
4(1953 1974 1975 1954)
4(1954 1975 1976 1955)
4(1955 1976 1977 1956)
4(1956 1977 1978 1957)
4(1957 1978 1979 1958)
4(1958 1979 1980 1959)
4(1959 1980 1981 1960)
4(1960 1981 1982 1961)
4(1961 1982 1983 1962)
4(1962 1983 1984 1963)
4(1963 1984 1985 1964)
4(1965 1987 1988 1966)
4(1966 1988 1989 1967)
4(1967 1989 1990 1968)
4(1968 1990 1991 1969)
4(1969 1991 1992 1970)
4(1970 1992 1993 1971)
4(1971 1993 1994 1972)
4(1972 1994 1995 1973)
4(1973 1995 1996 1974)
4(1974 1996 1997 1975)
4(1975 1997 1998 1976)
4(1976 1998 1999 1977)
4(1977 1999 2000 1978)
4(1978 2000 2001 1979)
4(1979 2001 2002 1980)
4(1980 2002 2003 1981)
4(1981 2003 2004 1982)
4(1982 2004 2005 1983)
4(1983 2005 2006 1984)
4(1984 2006 2007 1985)
4(1986 2008 2009 1987)
4(1987 2009 2010 1988)
4(1988 2010 2011 1989)
4(1989 2011 2012 1990)
4(1990 2012 2013 1991)
4(1991 2013 2014 1992)
4(1992 2014 2015 1993)
4(1993 2015 2016 1994)
4(1994 2016 2017 1995)
4(1995 2017 2018 1996)
4(1996 2018 2019 1997)
4(1997 2019 2020 1998)
4(1998 2020 2021 1999)
4(1999 2021 2022 2000)
4(2000 2022 2023 2001)
4(2001 2023 2024 2002)
4(2002 2024 2025 2003)
4(2003 2025 2026 2004)
4(2004 2026 2027 2005)
4(2005 2027 2028 2006)
4(2006 2028 2029 2007)
4(2008 2030 2031 2009)
4(2009 2031 2032 2010)
4(2010 2032 2033 2011)
4(2011 2033 2034 2012)
4(2012 2034 2035 2013)
4(2013 2035 2036 2014)
4(2014 2036 2037 2015)
4(2015 2037 2038 2016)
4(2016 2038 2039 2017)
4(2017 2039 2040 2018)
4(2018 2040 2041 2019)
4(2019 2041 2042 2020)
4(2020 2042 2043 2021)
4(2021 2043 2044 2022)
4(2022 2044 2045 2023)
4(2023 2045 2046 2024)
4(2024 2046 2047 2025)
4(2025 2047 2048 2026)
4(2026 2048 2049 2027)
4(2027 2049 2050 2028)
4(2028 2050 2051 2029)
4(2030 2052 2053 2031)
4(2031 2053 2054 2032)
4(2032 2054 2055 2033)
4(2033 2055 2056 2034)
4(2034 2056 2057 2035)
4(2035 2057 2058 2036)
4(2036 2058 2059 2037)
4(2037 2059 2060 2038)
4(2038 2060 2061 2039)
4(2039 2061 2062 2040)
4(2040 2062 2063 2041)
4(2041 2063 2064 2042)
4(2042 2064 2065 2043)
4(2043 2065 2066 2044)
4(2044 2066 2067 2045)
4(2045 2067 2068 2046)
4(2046 2068 2069 2047)
4(2047 2069 2070 2048)
4(2048 2070 2071 2049)
4(2049 2071 2072 2050)
4(2050 2072 2073 2051)
4(2052 2074 2075 2053)
4(2053 2075 2076 2054)
4(2054 2076 2077 2055)
4(2055 2077 2078 2056)
4(2056 2078 2079 2057)
4(2057 2079 2080 2058)
4(2058 2080 2081 2059)
4(2059 2081 2082 2060)
4(2060 2082 2083 2061)
4(2061 2083 2084 2062)
4(2062 2084 2085 2063)
4(2063 2085 2086 2064)
4(2064 2086 2087 2065)
4(2065 2087 2088 2066)
4(2066 2088 2089 2067)
4(2067 2089 2090 2068)
4(2068 2090 2091 2069)
4(2069 2091 2092 2070)
4(2070 2092 2093 2071)
4(2071 2093 2094 2072)
4(2072 2094 2095 2073)
4(2074 2096 2097 2075)
4(2075 2097 2098 2076)
4(2076 2098 2099 2077)
4(2077 2099 2100 2078)
4(2078 2100 2101 2079)
4(2079 2101 2102 2080)
4(2080 2102 2103 2081)
4(2081 2103 2104 2082)
4(2082 2104 2105 2083)
4(2083 2105 2106 2084)
4(2084 2106 2107 2085)
4(2085 2107 2108 2086)
4(2086 2108 2109 2087)
4(2087 2109 2110 2088)
4(2088 2110 2111 2089)
4(2089 2111 2112 2090)
4(2090 2112 2113 2091)
4(2091 2113 2114 2092)
4(2092 2114 2115 2093)
4(2093 2115 2116 2094)
4(2094 2116 2117 2095)
4(2096 2118 2119 2097)
4(2097 2119 2120 2098)
4(2098 2120 2121 2099)
4(2099 2121 2122 2100)
4(2100 2122 2123 2101)
4(2101 2123 2124 2102)
4(2102 2124 2125 2103)
4(2103 2125 2126 2104)
4(2104 2126 2127 2105)
4(2105 2127 2128 2106)
4(2106 2128 2129 2107)
4(2107 2129 2130 2108)
4(2108 2130 2131 2109)
4(2109 2131 2132 2110)
4(2110 2132 2133 2111)
4(2111 2133 2134 2112)
4(2112 2134 2135 2113)
4(2113 2135 2136 2114)
4(2114 2136 2137 2115)
4(2115 2137 2138 2116)
4(2116 2138 2139 2117)
4(2118 2140 2141 2119)
4(2119 2141 2142 2120)
4(2120 2142 2143 2121)
4(2121 2143 2144 2122)
4(2122 2144 2145 2123)
4(2123 2145 2146 2124)
4(2124 2146 2147 2125)
4(2125 2147 2148 2126)
4(2126 2148 2149 2127)
4(2127 2149 2150 2128)
4(2128 2150 2151 2129)
4(2129 2151 2152 2130)
4(2130 2152 2153 2131)
4(2131 2153 2154 2132)
4(2132 2154 2155 2133)
4(2133 2155 2156 2134)
4(2134 2156 2157 2135)
4(2135 2157 2158 2136)
4(2136 2158 2159 2137)
4(2137 2159 2160 2138)
4(2138 2160 2161 2139)
4(2140 2162 2163 2141)
4(2141 2163 2164 2142)
4(2142 2164 2165 2143)
4(2143 2165 2166 2144)
4(2144 2166 2167 2145)
4(2145 2167 2168 2146)
4(2146 2168 2169 2147)
4(2147 2169 2170 2148)
4(2148 2170 2171 2149)
4(2149 2171 2172 2150)
4(2150 2172 2173 2151)
4(2151 2173 2174 2152)
4(2152 2174 2175 2153)
4(2153 2175 2176 2154)
4(2154 2176 2177 2155)
4(2155 2177 2178 2156)
4(2156 2178 2179 2157)
4(2157 2179 2180 2158)
4(2158 2180 2181 2159)
4(2159 2181 2182 2160)
4(2160 2182 2183 2161)
4(2162 2184 2185 2163)
4(2163 2185 2186 2164)
4(2164 2186 2187 2165)
4(2165 2187 2188 2166)
4(2166 2188 2189 2167)
4(2167 2189 2190 2168)
4(2168 2190 2191 2169)
4(2169 2191 2192 2170)
4(2170 2192 2193 2171)
4(2171 2193 2194 2172)
4(2172 2194 2195 2173)
4(2173 2195 2196 2174)
4(2174 2196 2197 2175)
4(2175 2197 2198 2176)
4(2176 2198 2199 2177)
4(2177 2199 2200 2178)
4(2178 2200 2201 2179)
4(2179 2201 2202 2180)
4(2180 2202 2203 2181)
4(2181 2203 2204 2182)
4(2182 2204 2205 2183)
4(2184 2206 2207 2185)
4(2185 2207 2208 2186)
4(2186 2208 2209 2187)
4(2187 2209 2210 2188)
4(2188 2210 2211 2189)
4(2189 2211 2212 2190)
4(2190 2212 2213 2191)
4(2191 2213 2214 2192)
4(2192 2214 2215 2193)
4(2193 2215 2216 2194)
4(2194 2216 2217 2195)
4(2195 2217 2218 2196)
4(2196 2218 2219 2197)
4(2197 2219 2220 2198)
4(2198 2220 2221 2199)
4(2199 2221 2222 2200)
4(2200 2222 2223 2201)
4(2201 2223 2224 2202)
4(2202 2224 2225 2203)
4(2203 2225 2226 2204)
4(2204 2226 2227 2205)
4(2206 2228 2229 2207)
4(2207 2229 2230 2208)
4(2208 2230 2231 2209)
4(2209 2231 2232 2210)
4(2210 2232 2233 2211)
4(2211 2233 2234 2212)
4(2212 2234 2235 2213)
4(2213 2235 2236 2214)
4(2214 2236 2237 2215)
4(2215 2237 2238 2216)
4(2216 2238 2239 2217)
4(2217 2239 2240 2218)
4(2218 2240 2241 2219)
4(2219 2241 2242 2220)
4(2220 2242 2243 2221)
4(2221 2243 2244 2222)
4(2222 2244 2245 2223)
4(2223 2245 2246 2224)
4(2224 2246 2247 2225)
4(2225 2247 2248 2226)
4(2226 2248 2249 2227)
4(2228 2250 2251 2229)
4(2229 2251 2252 2230)
4(2230 2252 2253 2231)
4(2231 2253 2254 2232)
4(2232 2254 2255 2233)
4(2233 2255 2256 2234)
4(2234 2256 2257 2235)
4(2235 2257 2258 2236)
4(2236 2258 2259 2237)
4(2237 2259 2260 2238)
4(2238 2260 2261 2239)
4(2239 2261 2262 2240)
4(2240 2262 2263 2241)
4(2241 2263 2264 2242)
4(2242 2264 2265 2243)
4(2243 2265 2266 2244)
4(2244 2266 2267 2245)
4(2245 2267 2268 2246)
4(2246 2268 2269 2247)
4(2247 2269 2270 2248)
4(2250 2271 2272 2251)
4(2251 2272 2273 2252)
4(2252 2273 2274 2253)
4(2253 2274 2275 2254)
4(2254 2275 2276 2255)
4(2255 2276 2277 2256)
4(2256 2277 2278 2257)
4(2257 2278 2279 2258)
4(2258 2279 2280 2259)
4(2259 2280 2281 2260)
4(2260 2281 2282 2261)
4(2261 2282 2283 2262)
4(2262 2283 2284 2263)
4(2263 2284 2285 2264)
4(2264 2285 2286 2265)
4(2265 2286 2287 2266)
4(2266 2287 2288 2267)
4(2267 2288 2289 2268)
4(2268 2289 2290 2269)
4(2269 2290 2291 2270)
4(2271 2292 2293 2272)
4(2272 2293 2294 2273)
4(2273 2294 2295 2274)
4(2274 2295 2296 2275)
4(2275 2296 2297 2276)
4(2276 2297 2298 2277)
4(2277 2298 2299 2278)
4(2278 2299 2300 2279)
4(2279 2300 2301 2280)
4(2280 2301 2302 2281)
4(2281 2302 2303 2282)
4(2282 2303 2304 2283)
4(2283 2304 2305 2284)
4(2284 2305 2306 2285)
4(2285 2306 2307 2286)
4(2286 2307 2308 2287)
4(2287 2308 2309 2288)
4(2288 2309 2310 2289)
4(2289 2310 2311 2290)
4(2290 2311 2312 2291)
4(2292 2313 2314 2293)
4(2293 2314 2315 2294)
4(2294 2315 2316 2295)
4(2295 2316 2317 2296)
4(2296 2317 2318 2297)
4(2297 2318 2319 2298)
4(2298 2319 2320 2299)
4(2299 2320 2321 2300)
4(2300 2321 2322 2301)
4(2301 2322 2323 2302)
4(2302 2323 2324 2303)
4(2303 2324 2325 2304)
4(2304 2325 2326 2305)
4(2305 2326 2327 2306)
4(2306 2327 2328 2307)
4(2307 2328 2329 2308)
4(2308 2329 2330 2309)
4(2309 2330 2331 2310)
4(2310 2331 2332 2311)
4(2311 2332 2333 2312)
4(2313 2334 2335 2314)
4(2314 2335 2336 2315)
4(2315 2336 2337 2316)
4(2316 2337 2338 2317)
4(2317 2338 2339 2318)
4(2318 2339 2340 2319)
4(2319 2340 2341 2320)
4(2320 2341 2342 2321)
4(2321 2342 2343 2322)
4(2322 2343 2344 2323)
4(2323 2344 2345 2324)
4(2324 2345 2346 2325)
4(2325 2346 2347 2326)
4(2326 2347 2348 2327)
4(2327 2348 2349 2328)
4(2328 2349 2350 2329)
4(2329 2350 2351 2330)
4(2330 2351 2352 2331)
4(2331 2352 2353 2332)
4(2332 2353 2354 2333)
4(2334 2355 2356 2335)
4(2335 2356 2357 2336)
4(2336 2357 2358 2337)
4(2337 2358 2359 2338)
4(2338 2359 2360 2339)
4(2339 2360 2361 2340)
4(2340 2361 2362 2341)
4(2341 2362 2363 2342)
4(2342 2363 2364 2343)
4(2343 2364 2365 2344)
4(2344 2365 2366 2345)
4(2345 2366 2367 2346)
4(2346 2367 2368 2347)
4(2347 2368 2369 2348)
4(2348 2369 2370 2349)
4(2349 2370 2371 2350)
4(2350 2371 2372 2351)
4(2351 2372 2373 2352)
4(2352 2373 2374 2353)
4(2353 2374 2375 2354)
4(2355 2376 2377 2356)
4(2356 2377 2378 2357)
4(2357 2378 2379 2358)
4(2358 2379 2380 2359)
4(2359 2380 2381 2360)
4(2360 2381 2382 2361)
4(2361 2382 2383 2362)
4(2362 2383 2384 2363)
4(2363 2384 2385 2364)
4(2364 2385 2386 2365)
4(2365 2386 2387 2366)
4(2366 2387 2388 2367)
4(2367 2388 2389 2368)
4(2368 2389 2390 2369)
4(2369 2390 2391 2370)
4(2370 2391 2392 2371)
4(2371 2392 2393 2372)
4(2372 2393 2394 2373)
4(2373 2394 2395 2374)
4(2374 2395 2396 2375)
4(2376 2397 2398 2377)
4(2377 2398 2399 2378)
4(2378 2399 2400 2379)
4(2379 2400 2401 2380)
4(2380 2401 2402 2381)
4(2381 2402 2403 2382)
4(2382 2403 2404 2383)
4(2383 2404 2405 2384)
4(2384 2405 2406 2385)
4(2385 2406 2407 2386)
4(2386 2407 2408 2387)
4(2387 2408 2409 2388)
4(2388 2409 2410 2389)
4(2389 2410 2411 2390)
4(2390 2411 2412 2391)
4(2391 2412 2413 2392)
4(2392 2413 2414 2393)
4(2393 2414 2415 2394)
4(2394 2415 2416 2395)
4(2395 2416 2417 2396)
4(2397 2418 2419 2398)
4(2398 2419 2420 2399)
4(2399 2420 2421 2400)
4(2400 2421 2422 2401)
4(2401 2422 2423 2402)
4(2402 2423 2424 2403)
4(2403 2424 2425 2404)
4(2404 2425 2426 2405)
4(2405 2426 2427 2406)
4(2406 2427 2428 2407)
4(2407 2428 2429 2408)
4(2408 2429 2430 2409)
4(2409 2430 2431 2410)
4(2410 2431 2432 2411)
4(2411 2432 2433 2412)
4(2412 2433 2434 2413)
4(2413 2434 2435 2414)
4(2414 2435 2436 2415)
4(2415 2436 2437 2416)
4(2416 2437 2438 2417)
4(2418 2439 2440 2419)
4(2419 2440 2441 2420)
4(2420 2441 2442 2421)
4(2421 2442 2443 2422)
4(2422 2443 2444 2423)
4(2423 2444 2445 2424)
4(2424 2445 2446 2425)
4(2425 2446 2447 2426)
4(2426 2447 2448 2427)
4(2427 2448 2449 2428)
4(2428 2449 2450 2429)
4(2429 2450 2451 2430)
4(2430 2451 2452 2431)
4(2431 2452 2453 2432)
4(2432 2453 2454 2433)
4(2433 2454 2455 2434)
4(2434 2455 2456 2435)
4(2435 2456 2457 2436)
4(2436 2457 2458 2437)
4(2437 2458 2459 2438)
4(2439 2460 2461 2440)
4(2440 2461 2462 2441)
4(2441 2462 2463 2442)
4(2442 2463 2464 2443)
4(2443 2464 2465 2444)
4(2444 2465 2466 2445)
4(2445 2466 2467 2446)
4(2446 2467 2468 2447)
4(2447 2468 2469 2448)
4(2448 2469 2470 2449)
4(2449 2470 2471 2450)
4(2450 2471 2472 2451)
4(2451 2472 2473 2452)
4(2452 2473 2474 2453)
4(2453 2474 2475 2454)
4(2454 2475 2476 2455)
4(2455 2476 2477 2456)
4(2456 2477 2478 2457)
4(2457 2478 2479 2458)
4(2458 2479 2480 2459)
4(2460 2481 2482 2461)
4(2461 2482 2483 2462)
4(2462 2483 2484 2463)
4(2463 2484 2485 2464)
4(2464 2485 2486 2465)
4(2465 2486 2487 2466)
4(2466 2487 2488 2467)
4(2467 2488 2489 2468)
4(2468 2489 2490 2469)
4(2469 2490 2491 2470)
4(2470 2491 2492 2471)
4(2471 2492 2493 2472)
4(2472 2493 2494 2473)
4(2473 2494 2495 2474)
4(2474 2495 2496 2475)
4(2475 2496 2497 2476)
4(2476 2497 2498 2477)
4(2477 2498 2499 2478)
4(2478 2499 2500 2479)
4(2479 2500 2501 2480)
4(2481 2502 2503 2482)
4(2482 2503 2504 2483)
4(2483 2504 2505 2484)
4(2484 2505 2506 2485)
4(2485 2506 2507 2486)
4(2486 2507 2508 2487)
4(2487 2508 2509 2488)
4(2488 2509 2510 2489)
4(2489 2510 2511 2490)
4(2490 2511 2512 2491)
4(2491 2512 2513 2492)
4(2492 2513 2514 2493)
4(2493 2514 2515 2494)
4(2494 2515 2516 2495)
4(2495 2516 2517 2496)
4(2496 2517 2518 2497)
4(2497 2518 2519 2498)
4(2498 2519 2520 2499)
4(2499 2520 2521 2500)
4(2500 2521 2522 2501)
4(2502 2523 2524 2503)
4(2503 2524 2525 2504)
4(2504 2525 2526 2505)
4(2505 2526 2527 2506)
4(2506 2527 2528 2507)
4(2507 2528 2529 2508)
4(2508 2529 2530 2509)
4(2509 2530 2531 2510)
4(2510 2531 2532 2511)
4(2511 2532 2533 2512)
4(2512 2533 2534 2513)
4(2513 2534 2535 2514)
4(2514 2535 2536 2515)
4(2515 2536 2537 2516)
4(2516 2537 2538 2517)
4(2517 2538 2539 2518)
4(2518 2539 2540 2519)
4(2519 2540 2541 2520)
4(2520 2541 2542 2521)
4(2521 2542 2543 2522)
4(2523 2544 2545 2524)
4(2524 2545 2546 2525)
4(2525 2546 2547 2526)
4(2526 2547 2548 2527)
4(2527 2548 2549 2528)
4(2528 2549 2550 2529)
4(2529 2550 2551 2530)
4(2530 2551 2552 2531)
4(2531 2552 2553 2532)
4(2532 2553 2554 2533)
4(2533 2554 2555 2534)
4(2534 2555 2556 2535)
4(2535 2556 2557 2536)
4(2536 2557 2558 2537)
4(2537 2558 2559 2538)
4(2538 2559 2560 2539)
4(2539 2560 2561 2540)
4(2540 2561 2562 2541)
4(2541 2562 2563 2542)
4(2542 2563 2564 2543)
4(2544 2565 2566 2545)
4(2545 2566 2567 2546)
4(2546 2567 2568 2547)
4(2547 2568 2569 2548)
4(2548 2569 2570 2549)
4(2549 2570 2571 2550)
4(2550 2571 2572 2551)
4(2551 2572 2573 2552)
4(2552 2573 2574 2553)
4(2553 2574 2575 2554)
4(2554 2575 2576 2555)
4(2555 2576 2577 2556)
4(2556 2577 2578 2557)
4(2557 2578 2579 2558)
4(2558 2579 2580 2559)
4(2559 2580 2581 2560)
4(2560 2581 2582 2561)
4(2561 2582 2583 2562)
4(2562 2583 2584 2563)
4(2563 2584 2585 2564)
4(2565 2586 2587 2566)
4(2566 2587 2588 2567)
4(2567 2588 2589 2568)
4(2568 2589 2590 2569)
4(2569 2590 2591 2570)
4(2570 2591 2592 2571)
4(2571 2592 2593 2572)
4(2572 2593 2594 2573)
4(2573 2594 2595 2574)
4(2574 2595 2596 2575)
4(2575 2596 2597 2576)
4(2576 2597 2598 2577)
4(2577 2598 2599 2578)
4(2578 2599 2600 2579)
4(2579 2600 2601 2580)
4(2580 2601 2602 2581)
4(2581 2602 2603 2582)
4(2582 2603 2604 2583)
4(2583 2604 2605 2584)
4(2584 2605 2606 2585)
4(2586 2607 2608 2587)
4(2587 2608 2609 2588)
4(2588 2609 2610 2589)
4(2589 2610 2611 2590)
4(2590 2611 2612 2591)
4(2591 2612 2613 2592)
4(2592 2613 2614 2593)
4(2593 2614 2615 2594)
4(2594 2615 2616 2595)
4(2595 2616 2617 2596)
4(2596 2617 2618 2597)
4(2597 2618 2619 2598)
4(2598 2619 2620 2599)
4(2599 2620 2621 2600)
4(2600 2621 2622 2601)
4(2601 2622 2623 2602)
4(2602 2623 2624 2603)
4(2603 2624 2625 2604)
4(2604 2625 2626 2605)
4(2605 2626 2627 2606)
4(2607 2628 2629 2608)
4(2608 2629 2630 2609)
4(2609 2630 2631 2610)
4(2610 2631 2632 2611)
4(2611 2632 2633 2612)
4(2612 2633 2634 2613)
4(2613 2634 2635 2614)
4(2614 2635 2636 2615)
4(2615 2636 2637 2616)
4(2616 2637 2638 2617)
4(2617 2638 2639 2618)
4(2618 2639 2640 2619)
4(2619 2640 2641 2620)
4(2620 2641 2642 2621)
4(2621 2642 2643 2622)
4(2622 2643 2644 2623)
4(2623 2644 2645 2624)
4(2624 2645 2646 2625)
4(2625 2646 2647 2626)
4(2626 2647 2648 2627)
4(2628 2649 2650 2629)
4(2629 2650 2651 2630)
4(2630 2651 2652 2631)
4(2631 2652 2653 2632)
4(2632 2653 2654 2633)
4(2633 2654 2655 2634)
4(2634 2655 2656 2635)
4(2635 2656 2657 2636)
4(2636 2657 2658 2637)
4(2637 2658 2659 2638)
4(2638 2659 2660 2639)
4(2639 2660 2661 2640)
4(2640 2661 2662 2641)
4(2641 2662 2663 2642)
4(2642 2663 2664 2643)
4(2643 2664 2665 2644)
4(2644 2665 2666 2645)
4(2645 2666 2667 2646)
4(2646 2667 2668 2647)
4(2647 2668 2669 2648)
4(2649 2670 2671 2650)
4(2650 2671 2672 2651)
4(2651 2672 2673 2652)
4(2652 2673 2674 2653)
4(2653 2674 2675 2654)
4(2654 2675 2676 2655)
4(2655 2676 2677 2656)
4(2656 2677 2678 2657)
4(2657 2678 2679 2658)
4(2658 2679 2680 2659)
4(2659 2680 2681 2660)
4(2660 2681 2682 2661)
4(2661 2682 2683 2662)
4(2662 2683 2684 2663)
4(2663 2684 2685 2664)
4(2664 2685 2686 2665)
4(2665 2686 2687 2666)
4(2666 2687 2688 2667)
4(2667 2688 2689 2668)
4(2668 2689 2690 2669)
4(2670 2691 2692 2671)
4(2671 2692 2693 2672)
4(2672 2693 2694 2673)
4(2673 2694 2695 2674)
4(2674 2695 2696 2675)
4(2675 2696 2697 2676)
4(2676 2697 2698 2677)
4(2677 2698 2699 2678)
4(2678 2699 2700 2679)
4(2679 2700 2701 2680)
4(2680 2701 2702 2681)
4(2681 2702 2703 2682)
4(2682 2703 2704 2683)
4(2683 2704 2705 2684)
4(2684 2705 2706 2685)
4(2685 2706 2707 2686)
4(2686 2707 2708 2687)
4(2687 2708 2709 2688)
4(2688 2709 2710 2689)
4(2689 2710 2711 2690)
4(2691 2712 2713 2692)
4(2692 2713 2714 2693)
4(2693 2714 2715 2694)
4(2694 2715 2716 2695)
4(2695 2716 2717 2696)
4(2696 2717 2718 2697)
4(2697 2718 2719 2698)
4(2698 2719 2720 2699)
4(2699 2720 2721 2700)
4(2700 2721 2722 2701)
4(2701 2722 2723 2702)
4(2702 2723 2724 2703)
4(2703 2724 2725 2704)
4(2704 2725 2726 2705)
4(2705 2726 2727 2706)
4(2706 2727 2728 2707)
4(2707 2728 2729 2708)
4(2708 2729 2730 2709)
4(2709 2730 2731 2710)
4(2710 2731 2732 2711)
4(2712 2733 2734 2713)
4(2713 2734 2735 2714)
4(2714 2735 2736 2715)
4(2715 2736 2737 2716)
4(2716 2737 2738 2717)
4(2717 2738 2739 2718)
4(2718 2739 2740 2719)
4(2719 2740 2741 2720)
4(2720 2741 2742 2721)
4(2721 2742 2743 2722)
4(2722 2743 2744 2723)
4(2723 2744 2745 2724)
4(2724 2745 2746 2725)
4(2725 2746 2747 2726)
4(2726 2747 2748 2727)
4(2727 2748 2749 2728)
4(2728 2749 2750 2729)
4(2729 2750 2751 2730)
4(2730 2751 2752 2731)
4(2731 2752 2753 2732)
4(2733 2754 2755 2734)
4(2734 2755 2756 2735)
4(2735 2756 2757 2736)
4(2736 2757 2758 2737)
4(2737 2758 2759 2738)
4(2738 2759 2760 2739)
4(2739 2760 2761 2740)
4(2740 2761 2762 2741)
4(2741 2762 2763 2742)
4(2742 2763 2764 2743)
4(2743 2764 2765 2744)
4(2744 2765 2766 2745)
4(2745 2766 2767 2746)
4(2746 2767 2768 2747)
4(2747 2768 2769 2748)
4(2748 2769 2770 2749)
4(2749 2770 2771 2750)
4(2750 2771 2772 2751)
4(2751 2772 2773 2752)
4(2752 2773 2774 2753)
4(2754 2775 2776 2755)
4(2755 2776 2777 2756)
4(2756 2777 2778 2757)
4(2757 2778 2779 2758)
4(2758 2779 2780 2759)
4(2759 2780 2781 2760)
4(2760 2781 2782 2761)
4(2761 2782 2783 2762)
4(2762 2783 2784 2763)
4(2763 2784 2785 2764)
4(2764 2785 2786 2765)
4(2765 2786 2787 2766)
4(2766 2787 2788 2767)
4(2767 2788 2789 2768)
4(2768 2789 2790 2769)
4(2769 2790 2791 2770)
4(2770 2791 2792 2771)
4(2771 2792 2793 2772)
4(2772 2793 2794 2773)
4(2773 2794 2795 2774)
4(2775 2796 2797 2776)
4(2776 2797 2798 2777)
4(2777 2798 2799 2778)
4(2778 2799 2800 2779)
4(2779 2800 2801 2780)
4(2780 2801 2802 2781)
4(2781 2802 2803 2782)
4(2782 2803 2804 2783)
4(2783 2804 2805 2784)
4(2784 2805 2806 2785)
4(2785 2806 2807 2786)
4(2786 2807 2808 2787)
4(2787 2808 2809 2788)
4(2788 2809 2810 2789)
4(2789 2810 2811 2790)
4(2790 2811 2812 2791)
4(2791 2812 2813 2792)
4(2792 2813 2814 2793)
4(2793 2814 2815 2794)
4(2794 2815 2816 2795)
4(2796 2817 2818 2797)
4(2797 2818 2819 2798)
4(2798 2819 2820 2799)
4(2799 2820 2821 2800)
4(2800 2821 2822 2801)
4(2801 2822 2823 2802)
4(2802 2823 2824 2803)
4(2803 2824 2825 2804)
4(2804 2825 2826 2805)
4(2805 2826 2827 2806)
4(2806 2827 2828 2807)
4(2807 2828 2829 2808)
4(2808 2829 2830 2809)
4(2809 2830 2831 2810)
4(2810 2831 2832 2811)
4(2811 2832 2833 2812)
4(2812 2833 2834 2813)
4(2813 2834 2835 2814)
4(2814 2835 2836 2815)
4(2815 2836 2837 2816)
4(2817 2838 2839 2818)
4(2818 2839 2840 2819)
4(2819 2840 2841 2820)
4(2820 2841 2842 2821)
4(2821 2842 2843 2822)
4(2822 2843 2844 2823)
4(2823 2844 2845 2824)
4(2824 2845 2846 2825)
4(2825 2846 2847 2826)
4(2826 2847 2848 2827)
4(2827 2848 2849 2828)
4(2828 2849 2850 2829)
4(2829 2850 2851 2830)
4(2830 2851 2852 2831)
4(2831 2852 2853 2832)
4(2832 2853 2854 2833)
4(2833 2854 2855 2834)
4(2834 2855 2856 2835)
4(2835 2856 2857 2836)
4(2836 2857 2858 2837)
4(2838 2859 2860 2839)
4(2839 2860 2861 2840)
4(2840 2861 2862 2841)
4(2841 2862 2863 2842)
4(2842 2863 2864 2843)
4(2843 2864 2865 2844)
4(2844 2865 2866 2845)
4(2845 2866 2867 2846)
4(2846 2867 2868 2847)
4(2847 2868 2869 2848)
4(2848 2869 2870 2849)
4(2849 2870 2871 2850)
4(2850 2871 2872 2851)
4(2851 2872 2873 2852)
4(2852 2873 2874 2853)
4(2853 2874 2875 2854)
4(2854 2875 2876 2855)
4(2855 2876 2877 2856)
4(2856 2877 2878 2857)
4(2857 2878 2879 2858)
4(2859 2880 2881 2860)
4(2860 2881 2882 2861)
4(2861 2882 2883 2862)
4(2862 2883 2884 2863)
4(2863 2884 2885 2864)
4(2864 2885 2886 2865)
4(2865 2886 2887 2866)
4(2866 2887 2888 2867)
4(2867 2888 2889 2868)
4(2868 2889 2890 2869)
4(2869 2890 2891 2870)
4(2870 2891 2892 2871)
4(2871 2892 2893 2872)
4(2872 2893 2894 2873)
4(2873 2894 2895 2874)
4(2874 2895 2896 2875)
4(2875 2896 2897 2876)
4(2876 2897 2898 2877)
4(2877 2898 2899 2878)
4(2878 2899 2900 2879)
4(2880 2901 2902 2881)
4(2881 2902 2903 2882)
4(2882 2903 2904 2883)
4(2883 2904 2905 2884)
4(2884 2905 2906 2885)
4(2885 2906 2907 2886)
4(2886 2907 2908 2887)
4(2887 2908 2909 2888)
4(2888 2909 2910 2889)
4(2889 2910 2911 2890)
4(2890 2911 2912 2891)
4(2891 2912 2913 2892)
4(2892 2913 2914 2893)
4(2893 2914 2915 2894)
4(2894 2915 2916 2895)
4(2895 2916 2917 2896)
4(2896 2917 2918 2897)
4(2897 2918 2919 2898)
4(2898 2919 2920 2899)
4(2899 2920 2921 2900)
4(2901 2922 2923 2902)
4(2902 2923 2924 2903)
4(2903 2924 2925 2904)
4(2904 2925 2926 2905)
4(2905 2926 2927 2906)
4(2906 2927 2928 2907)
4(2907 2928 2929 2908)
4(2908 2929 2930 2909)
4(2909 2930 2931 2910)
4(2910 2931 2932 2911)
4(2911 2932 2933 2912)
4(2912 2933 2934 2913)
4(2913 2934 2935 2914)
4(2914 2935 2936 2915)
4(2915 2936 2937 2916)
4(2916 2937 2938 2917)
4(2917 2938 2939 2918)
4(2918 2939 2940 2919)
4(2919 2940 2941 2920)
4(2920 2941 2942 2921)
4(2922 2943 2944 2923)
4(2923 2944 2945 2924)
4(2924 2945 2946 2925)
4(2925 2946 2947 2926)
4(2926 2947 2948 2927)
4(2927 2948 2949 2928)
4(2928 2949 2950 2929)
4(2929 2950 2951 2930)
4(2930 2951 2952 2931)
4(2931 2952 2953 2932)
4(2932 2953 2954 2933)
4(2933 2954 2955 2934)
4(2934 2955 2956 2935)
4(2935 2956 2957 2936)
4(2936 2957 2958 2937)
4(2937 2958 2959 2938)
4(2938 2959 2960 2939)
4(2939 2960 2961 2940)
4(2940 2961 2962 2941)
4(2941 2962 2963 2942)
4(2943 2964 2965 2944)
4(2944 2965 2966 2945)
4(2945 2966 2967 2946)
4(2946 2967 2968 2947)
4(2947 2968 2969 2948)
4(2948 2969 2970 2949)
4(2949 2970 2971 2950)
4(2950 2971 2972 2951)
4(2951 2972 2973 2952)
4(2952 2973 2974 2953)
4(2953 2974 2975 2954)
4(2954 2975 2976 2955)
4(2955 2976 2977 2956)
4(2956 2977 2978 2957)
4(2957 2978 2979 2958)
4(2958 2979 2980 2959)
4(2959 2980 2981 2960)
4(2960 2981 2982 2961)
4(2961 2982 2983 2962)
4(2962 2983 2984 2963)
4(2964 2985 2986 2965)
4(2965 2986 2987 2966)
4(2966 2987 2988 2967)
4(2967 2988 2989 2968)
4(2968 2989 2990 2969)
4(2969 2990 2991 2970)
4(2970 2991 2992 2971)
4(2971 2992 2993 2972)
4(2972 2993 2994 2973)
4(2973 2994 2995 2974)
4(2974 2995 2996 2975)
4(2975 2996 2997 2976)
4(2976 2997 2998 2977)
4(2977 2998 2999 2978)
4(2978 2999 3000 2979)
4(2979 3000 3001 2980)
4(2980 3001 3002 2981)
4(2981 3002 3003 2982)
4(2982 3003 3004 2983)
4(2983 3004 3005 2984)
4(2985 3006 3007 2986)
4(2986 3007 3008 2987)
4(2987 3008 3009 2988)
4(2988 3009 3010 2989)
4(2989 3010 3011 2990)
4(2990 3011 3012 2991)
4(2991 3012 3013 2992)
4(2992 3013 3014 2993)
4(2993 3014 3015 2994)
4(2994 3015 3016 2995)
4(2995 3016 3017 2996)
4(2996 3017 3018 2997)
4(2997 3018 3019 2998)
4(2998 3019 3020 2999)
4(2999 3020 3021 3000)
4(3000 3021 3022 3001)
4(3001 3022 3023 3002)
4(3002 3023 3024 3003)
4(3003 3024 3025 3004)
4(3004 3025 3026 3005)
4(3006 3027 3028 3007)
4(3007 3028 3029 3008)
4(3008 3029 3030 3009)
4(3009 3030 3031 3010)
4(3010 3031 3032 3011)
4(3011 3032 3033 3012)
4(3012 3033 3034 3013)
4(3013 3034 3035 3014)
4(3014 3035 3036 3015)
4(3015 3036 3037 3016)
4(3016 3037 3038 3017)
4(3017 3038 3039 3018)
4(3018 3039 3040 3019)
4(3019 3040 3041 3020)
4(3020 3041 3042 3021)
4(3021 3042 3043 3022)
4(3022 3043 3044 3023)
4(3023 3044 3045 3024)
4(3024 3045 3046 3025)
4(3025 3046 3047 3026)
4(3027 3048 3049 3028)
4(3028 3049 3050 3029)
4(3029 3050 3051 3030)
4(3030 3051 3052 3031)
4(3031 3052 3053 3032)
4(3032 3053 3054 3033)
4(3033 3054 3055 3034)
4(3034 3055 3056 3035)
4(3035 3056 3057 3036)
4(3036 3057 3058 3037)
4(3037 3058 3059 3038)
4(3038 3059 3060 3039)
4(3039 3060 3061 3040)
4(3040 3061 3062 3041)
4(3041 3062 3063 3042)
4(3042 3063 3064 3043)
4(3043 3064 3065 3044)
4(3044 3065 3066 3045)
4(3045 3066 3067 3046)
4(3046 3067 3068 3047)
4(3048 3069 3070 3049)
4(3049 3070 3071 3050)
4(3050 3071 3072 3051)
4(3051 3072 3073 3052)
4(3052 3073 3074 3053)
4(3053 3074 3075 3054)
4(3054 3075 3076 3055)
4(3055 3076 3077 3056)
4(3056 3077 3078 3057)
4(3057 3078 3079 3058)
4(3058 3079 3080 3059)
4(3059 3080 3081 3060)
4(3060 3081 3082 3061)
4(3061 3082 3083 3062)
4(3062 3083 3084 3063)
4(3063 3084 3085 3064)
4(3064 3085 3086 3065)
4(3065 3086 3087 3066)
4(3066 3087 3088 3067)
4(3067 3088 3089 3068)
4(3069 3090 3091 3070)
4(3070 3091 3092 3071)
4(3071 3092 3093 3072)
4(3072 3093 3094 3073)
4(3073 3094 3095 3074)
4(3074 3095 3096 3075)
4(3075 3096 3097 3076)
4(3076 3097 3098 3077)
4(3077 3098 3099 3078)
4(3078 3099 3100 3079)
4(3079 3100 3101 3080)
4(3080 3101 3102 3081)
4(3081 3102 3103 3082)
4(3082 3103 3104 3083)
4(3083 3104 3105 3084)
4(3084 3105 3106 3085)
4(3085 3106 3107 3086)
4(3086 3107 3108 3087)
4(3087 3108 3109 3088)
4(3088 3109 3110 3089)
4(3090 3111 3112 3091)
4(3091 3112 3113 3092)
4(3092 3113 3114 3093)
4(3093 3114 3115 3094)
4(3094 3115 3116 3095)
4(3095 3116 3117 3096)
4(3096 3117 3118 3097)
4(3097 3118 3119 3098)
4(3098 3119 3120 3099)
4(3099 3120 3121 3100)
4(3100 3121 3122 3101)
4(3101 3122 3123 3102)
4(3102 3123 3124 3103)
4(3103 3124 3125 3104)
4(3104 3125 3126 3105)
4(3105 3126 3127 3106)
4(3106 3127 3128 3107)
4(3107 3128 3129 3108)
4(3108 3129 3130 3109)
4(3109 3130 3131 3110)
4(3111 3132 3133 3112)
4(3112 3133 3134 3113)
4(3113 3134 3135 3114)
4(3114 3135 3136 3115)
4(3115 3136 3137 3116)
4(3116 3137 3138 3117)
4(3117 3138 3139 3118)
4(3118 3139 3140 3119)
4(3119 3140 3141 3120)
4(3120 3141 3142 3121)
4(3121 3142 3143 3122)
4(3122 3143 3144 3123)
4(3123 3144 3145 3124)
4(3124 3145 3146 3125)
4(3125 3146 3147 3126)
4(3126 3147 3148 3127)
4(3127 3148 3149 3128)
4(3128 3149 3150 3129)
4(3129 3150 3151 3130)
4(3130 3151 3152 3131)
4(3132 3153 3154 3133)
4(3133 3154 3155 3134)
4(3134 3155 3156 3135)
4(3135 3156 3157 3136)
4(3136 3157 3158 3137)
4(3137 3158 3159 3138)
4(3138 3159 3160 3139)
4(3139 3160 3161 3140)
4(3140 3161 3162 3141)
4(3141 3162 3163 3142)
4(3142 3163 3164 3143)
4(3143 3164 3165 3144)
4(3144 3165 3166 3145)
4(3145 3166 3167 3146)
4(3146 3167 3168 3147)
4(3147 3168 3169 3148)
4(3148 3169 3170 3149)
4(3149 3170 3171 3150)
4(3150 3171 3172 3151)
4(3151 3172 3173 3152)
4(3153 3174 3175 3154)
4(3154 3175 3176 3155)
4(3155 3176 3177 3156)
4(3156 3177 3178 3157)
4(3157 3178 3179 3158)
4(3158 3179 3180 3159)
4(3159 3180 3181 3160)
4(3160 3181 3182 3161)
4(3161 3182 3183 3162)
4(3162 3183 3184 3163)
4(3163 3184 3185 3164)
4(3164 3185 3186 3165)
4(3165 3186 3187 3166)
4(3166 3187 3188 3167)
4(3167 3188 3189 3168)
4(3168 3189 3190 3169)
4(3169 3190 3191 3170)
4(3170 3191 3192 3171)
4(3171 3192 3193 3172)
4(3172 3193 3194 3173)
4(3174 3195 3196 3175)
4(3175 3196 3197 3176)
4(3176 3197 3198 3177)
4(3177 3198 3199 3178)
4(3178 3199 3200 3179)
4(3179 3200 3201 3180)
4(3180 3201 3202 3181)
4(3181 3202 3203 3182)
4(3182 3203 3204 3183)
4(3183 3204 3205 3184)
4(3184 3205 3206 3185)
4(3185 3206 3207 3186)
4(3186 3207 3208 3187)
4(3187 3208 3209 3188)
4(3188 3209 3210 3189)
4(3189 3210 3211 3190)
4(3190 3211 3212 3191)
4(3191 3212 3213 3192)
4(3192 3213 3214 3193)
4(3193 3214 3215 3194)
4(3195 3216 3217 3196)
4(3196 3217 3218 3197)
4(3197 3218 3219 3198)
4(3198 3219 3220 3199)
4(3199 3220 3221 3200)
4(3200 3221 3222 3201)
4(3201 3222 3223 3202)
4(3202 3223 3224 3203)
4(3203 3224 3225 3204)
4(3204 3225 3226 3205)
4(3205 3226 3227 3206)
4(3206 3227 3228 3207)
4(3207 3228 3229 3208)
4(3208 3229 3230 3209)
4(3209 3230 3231 3210)
4(3210 3231 3232 3211)
4(3211 3232 3233 3212)
4(3212 3233 3234 3213)
4(3213 3234 3235 3214)
4(3214 3235 3236 3215)
4(3216 3237 3238 3217)
4(3217 3238 3239 3218)
4(3218 3239 3240 3219)
4(3219 3240 3241 3220)
4(3220 3241 3242 3221)
4(3221 3242 3243 3222)
4(3222 3243 3244 3223)
4(3223 3244 3245 3224)
4(3224 3245 3246 3225)
4(3225 3246 3247 3226)
4(3226 3247 3248 3227)
4(3227 3248 3249 3228)
4(3228 3249 3250 3229)
4(3229 3250 3251 3230)
4(3230 3251 3252 3231)
4(3231 3252 3253 3232)
4(3232 3253 3254 3233)
4(3233 3254 3255 3234)
4(3234 3255 3256 3235)
4(3235 3256 3257 3236)
4(3237 3258 3259 3238)
4(3238 3259 3260 3239)
4(3239 3260 3261 3240)
4(3240 3261 3262 3241)
4(3241 3262 3263 3242)
4(3242 3263 3264 3243)
4(3243 3264 3265 3244)
4(3244 3265 3266 3245)
4(3245 3266 3267 3246)
4(3246 3267 3268 3247)
4(3247 3268 3269 3248)
4(3248 3269 3270 3249)
4(3249 3270 3271 3250)
4(3250 3271 3272 3251)
4(3251 3272 3273 3252)
4(3252 3273 3274 3253)
4(3253 3274 3275 3254)
4(3254 3275 3276 3255)
4(3255 3276 3277 3256)
4(3256 3277 3278 3257)
4(3258 3279 3280 3259)
4(3259 3280 3281 3260)
4(3260 3281 3282 3261)
4(3261 3282 3283 3262)
4(3262 3283 3284 3263)
4(3263 3284 3285 3264)
4(3264 3285 3286 3265)
4(3265 3286 3287 3266)
4(3266 3287 3288 3267)
4(3267 3288 3289 3268)
4(3268 3289 3290 3269)
4(3269 3290 3291 3270)
4(3270 3291 3292 3271)
4(3271 3292 3293 3272)
4(3272 3293 3294 3273)
4(3273 3294 3295 3274)
4(3274 3295 3296 3275)
4(3275 3296 3297 3276)
4(3276 3297 3298 3277)
4(3277 3298 3299 3278)
4(3279 3300 3301 3280)
4(3280 3301 3302 3281)
4(3281 3302 3303 3282)
4(3282 3303 3304 3283)
4(3283 3304 3305 3284)
4(3284 3305 3306 3285)
4(3285 3306 3307 3286)
4(3286 3307 3308 3287)
4(3287 3308 3309 3288)
4(3288 3309 3310 3289)
4(3289 3310 3311 3290)
4(3290 3311 3312 3291)
4(3291 3312 3313 3292)
4(3292 3313 3314 3293)
4(3293 3314 3315 3294)
4(3294 3315 3316 3295)
4(3295 3316 3317 3296)
4(3296 3317 3318 3297)
4(3297 3318 3319 3298)
4(3298 3319 3320 3299)
4(3300 3321 3322 3301)
4(3301 3322 3323 3302)
4(3302 3323 3324 3303)
4(3303 3324 3325 3304)
4(3304 3325 3326 3305)
4(3305 3326 3327 3306)
4(3306 3327 3328 3307)
4(3307 3328 3329 3308)
4(3308 3329 3330 3309)
4(3309 3330 3331 3310)
4(3310 3331 3332 3311)
4(3311 3332 3333 3312)
4(3312 3333 3334 3313)
4(3313 3334 3335 3314)
4(3314 3335 3336 3315)
4(3315 3336 3337 3316)
4(3316 3337 3338 3317)
4(3317 3338 3339 3318)
4(3318 3339 3340 3319)
4(3319 3340 3341 3320)
4(3321 3342 3343 3322)
4(3322 3343 3344 3323)
4(3323 3344 3345 3324)
4(3324 3345 3346 3325)
4(3325 3346 3347 3326)
4(3326 3347 3348 3327)
4(3327 3348 3349 3328)
4(3328 3349 3350 3329)
4(3329 3350 3351 3330)
4(3330 3351 3352 3331)
4(3331 3352 3353 3332)
4(3332 3353 3354 3333)
4(3333 3354 3355 3334)
4(3334 3355 3356 3335)
4(3335 3356 3357 3336)
4(3336 3357 3358 3337)
4(3337 3358 3359 3338)
4(3338 3359 3360 3339)
4(3339 3360 3361 3340)
4(3340 3361 3362 3341)
4(3342 3363 3364 3343)
4(3343 3364 3365 3344)
4(3344 3365 3366 3345)
4(3345 3366 3367 3346)
4(3346 3367 3368 3347)
4(3347 3368 3369 3348)
4(3348 3369 3370 3349)
4(3349 3370 3371 3350)
4(3350 3371 3372 3351)
4(3351 3372 3373 3352)
4(3352 3373 3374 3353)
4(3353 3374 3375 3354)
4(3354 3375 3376 3355)
4(3355 3376 3377 3356)
4(3356 3377 3378 3357)
4(3357 3378 3379 3358)
4(3358 3379 3380 3359)
4(3359 3380 3381 3360)
4(3360 3381 3382 3361)
4(3361 3382 3383 3362)
4(3384 3385 1 0)
4(3385 3386 2 1)
4(3386 3387 3 2)
4(3387 3388 4 3)
4(3388 3389 5 4)
4(3389 3390 6 5)
4(3390 3391 7 6)
4(3391 3392 8 7)
4(3392 3393 9 8)
4(3393 3394 10 9)
4(3394 3395 11 10)
4(3395 3396 12 11)
4(3396 3397 13 12)
4(3397 3398 14 13)
4(3398 3399 15 14)
4(3399 3400 16 15)
4(3400 3401 17 16)
4(3401 3402 18 17)
4(3402 3403 19 18)
4(3403 3404 20 19)
4(0 1 22 21)
4(1 2 23 22)
4(2 3 24 23)
4(3 4 25 24)
4(4 5 26 25)
4(5 6 27 26)
4(6 7 28 27)
4(7 8 29 28)
4(8 9 30 29)
4(9 10 31 30)
4(10 11 32 31)
4(11 12 33 32)
4(12 13 34 33)
4(13 14 35 34)
4(14 15 36 35)
4(15 16 37 36)
4(16 17 38 37)
4(17 18 39 38)
4(18 19 40 39)
4(19 20 41 40)
4(21 22 43 42)
4(22 23 44 43)
4(23 24 45 44)
4(24 25 46 45)
4(25 26 47 46)
4(26 27 48 47)
4(27 28 49 48)
4(28 29 50 49)
4(29 30 51 50)
4(30 31 52 51)
4(31 32 53 52)
4(32 33 54 53)
4(33 34 55 54)
4(34 35 56 55)
4(35 36 57 56)
4(36 37 58 57)
4(37 38 59 58)
4(38 39 60 59)
4(39 40 61 60)
4(40 41 62 61)
4(42 43 64 63)
4(43 44 65 64)
4(44 45 66 65)
4(45 46 67 66)
4(46 47 68 67)
4(47 48 69 68)
4(48 49 70 69)
4(49 50 71 70)
4(50 51 72 71)
4(51 52 73 72)
4(52 53 74 73)
4(53 54 75 74)
4(54 55 76 75)
4(55 56 77 76)
4(56 57 78 77)
4(57 58 79 78)
4(58 59 80 79)
4(59 60 81 80)
4(60 61 82 81)
4(61 62 83 82)
4(63 64 85 84)
4(64 65 86 85)
4(65 66 87 86)
4(66 67 88 87)
4(67 68 89 88)
4(68 69 90 89)
4(69 70 91 90)
4(70 71 92 91)
4(71 72 93 92)
4(72 73 94 93)
4(73 74 95 94)
4(74 75 96 95)
4(75 76 97 96)
4(76 77 98 97)
4(77 78 99 98)
4(78 79 100 99)
4(79 80 101 100)
4(80 81 102 101)
4(81 82 103 102)
4(82 83 104 103)
4(84 85 106 105)
4(85 86 107 106)
4(86 87 108 107)
4(87 88 109 108)
4(88 89 110 109)
4(89 90 111 110)
4(90 91 112 111)
4(91 92 113 112)
4(92 93 114 113)
4(93 94 115 114)
4(94 95 116 115)
4(95 96 117 116)
4(96 97 118 117)
4(97 98 119 118)
4(98 99 120 119)
4(99 100 121 120)
4(100 101 122 121)
4(101 102 123 122)
4(102 103 124 123)
4(103 104 125 124)
4(105 106 127 126)
4(106 107 128 127)
4(107 108 129 128)
4(108 109 130 129)
4(109 110 131 130)
4(110 111 132 131)
4(111 112 133 132)
4(112 113 134 133)
4(113 114 135 134)
4(114 115 136 135)
4(115 116 137 136)
4(116 117 138 137)
4(117 118 139 138)
4(118 119 140 139)
4(119 120 141 140)
4(120 121 142 141)
4(121 122 143 142)
4(122 123 144 143)
4(123 124 145 144)
4(124 125 146 145)
4(126 127 148 147)
4(127 128 149 148)
4(128 129 150 149)
4(129 130 151 150)
4(130 131 152 151)
4(131 132 153 152)
4(132 133 154 153)
4(133 134 155 154)
4(134 135 156 155)
4(135 136 157 156)
4(136 137 158 157)
4(137 138 159 158)
4(138 139 160 159)
4(139 140 161 160)
4(140 141 162 161)
4(141 142 163 162)
4(142 143 164 163)
4(143 144 165 164)
4(144 145 166 165)
4(145 146 167 166)
4(147 148 169 168)
4(148 149 170 169)
4(149 150 171 170)
4(150 151 172 171)
4(151 152 173 172)
4(152 153 174 173)
4(153 154 175 174)
4(154 155 176 175)
4(155 156 177 176)
4(156 157 178 177)
4(157 158 179 178)
4(158 159 180 179)
4(159 160 181 180)
4(160 161 182 181)
4(161 162 183 182)
4(162 163 184 183)
4(163 164 185 184)
4(164 165 186 185)
4(165 166 187 186)
4(166 167 188 187)
4(168 169 190 189)
4(169 170 191 190)
4(170 171 192 191)
4(171 172 193 192)
4(172 173 194 193)
4(173 174 195 194)
4(174 175 196 195)
4(175 176 197 196)
4(176 177 198 197)
4(177 178 199 198)
4(178 179 200 199)
4(179 180 201 200)
4(180 181 202 201)
4(181 182 203 202)
4(182 183 204 203)
4(183 184 205 204)
4(184 185 206 205)
4(185 186 207 206)
4(186 187 208 207)
4(187 188 209 208)
4(189 190 211 210)
4(190 191 212 211)
4(191 192 213 212)
4(192 193 214 213)
4(193 194 215 214)
4(194 195 216 215)
4(195 196 217 216)
4(196 197 218 217)
4(197 198 219 218)
4(198 199 220 219)
4(199 200 221 220)
4(200 201 222 221)
4(201 202 223 222)
4(202 203 224 223)
4(203 204 225 224)
4(204 205 226 225)
4(205 206 227 226)
4(206 207 228 227)
4(207 208 229 228)
4(208 209 230 229)
4(210 211 232 231)
4(211 212 233 232)
4(212 213 234 233)
4(213 214 235 234)
4(214 215 236 235)
4(215 216 237 236)
4(216 217 238 237)
4(217 218 239 238)
4(218 219 240 239)
4(219 220 241 240)
4(220 221 242 241)
4(221 222 243 242)
4(222 223 244 243)
4(223 224 245 244)
4(224 225 246 245)
4(225 226 247 246)
4(226 227 248 247)
4(227 228 249 248)
4(228 229 250 249)
4(229 230 251 250)
4(231 232 253 252)
4(232 233 254 253)
4(233 234 255 254)
4(234 235 256 255)
4(235 236 257 256)
4(236 237 258 257)
4(237 238 259 258)
4(238 239 260 259)
4(239 240 261 260)
4(240 241 262 261)
4(241 242 263 262)
4(242 243 264 263)
4(243 244 265 264)
4(244 245 266 265)
4(245 246 267 266)
4(246 247 268 267)
4(247 248 269 268)
4(248 249 270 269)
4(249 250 271 270)
4(250 251 272 271)
4(252 253 274 273)
4(253 254 275 274)
4(254 255 276 275)
4(255 256 277 276)
4(256 257 278 277)
4(257 258 279 278)
4(258 259 280 279)
4(259 260 281 280)
4(260 261 282 281)
4(261 262 283 282)
4(262 263 284 283)
4(263 264 285 284)
4(264 265 286 285)
4(265 266 287 286)
4(266 267 288 287)
4(267 268 289 288)
4(268 269 290 289)
4(269 270 291 290)
4(270 271 292 291)
4(271 272 293 292)
4(273 274 296 295)
4(274 275 297 296)
4(275 276 298 297)
4(276 277 299 298)
4(277 278 300 299)
4(278 279 301 300)
4(279 280 302 301)
4(280 281 303 302)
4(281 282 304 303)
4(282 283 305 304)
4(283 284 306 305)
4(284 285 307 306)
4(285 286 308 307)
4(286 287 309 308)
4(287 288 310 309)
4(288 289 311 310)
4(289 290 312 311)
4(290 291 313 312)
4(291 292 314 313)
4(292 293 315 314)
4(294 295 317 316)
4(295 296 318 317)
4(296 297 319 318)
4(297 298 320 319)
4(298 299 321 320)
4(299 300 322 321)
4(300 301 323 322)
4(301 302 324 323)
4(302 303 325 324)
4(303 304 326 325)
4(304 305 327 326)
4(305 306 328 327)
4(306 307 329 328)
4(307 308 330 329)
4(308 309 331 330)
4(309 310 332 331)
4(310 311 333 332)
4(311 312 334 333)
4(312 313 335 334)
4(313 314 336 335)
4(314 315 337 336)
4(316 317 339 338)
4(317 318 340 339)
4(318 319 341 340)
4(319 320 342 341)
4(320 321 343 342)
4(321 322 344 343)
4(322 323 345 344)
4(323 324 346 345)
4(324 325 347 346)
4(325 326 348 347)
4(326 327 349 348)
4(327 328 350 349)
4(328 329 351 350)
4(329 330 352 351)
4(330 331 353 352)
4(331 332 354 353)
4(332 333 355 354)
4(333 334 356 355)
4(334 335 357 356)
4(335 336 358 357)
4(336 337 359 358)
4(338 339 361 360)
4(339 340 362 361)
4(340 341 363 362)
4(341 342 364 363)
4(342 343 365 364)
4(343 344 366 365)
4(344 345 367 366)
4(345 346 368 367)
4(346 347 369 368)
4(347 348 370 369)
4(348 349 371 370)
4(349 350 372 371)
4(350 351 373 372)
4(351 352 374 373)
4(352 353 375 374)
4(353 354 376 375)
4(354 355 377 376)
4(355 356 378 377)
4(356 357 379 378)
4(357 358 380 379)
4(358 359 381 380)
4(360 361 383 382)
4(361 362 384 383)
4(362 363 385 384)
4(363 364 386 385)
4(364 365 387 386)
4(365 366 388 387)
4(366 367 389 388)
4(367 368 390 389)
4(368 369 391 390)
4(369 370 392 391)
4(370 371 393 392)
4(371 372 394 393)
4(372 373 395 394)
4(373 374 396 395)
4(374 375 397 396)
4(375 376 398 397)
4(376 377 399 398)
4(377 378 400 399)
4(378 379 401 400)
4(379 380 402 401)
4(380 381 403 402)
4(382 383 405 404)
4(383 384 406 405)
4(384 385 407 406)
4(385 386 408 407)
4(386 387 409 408)
4(387 388 410 409)
4(388 389 411 410)
4(389 390 412 411)
4(390 391 413 412)
4(391 392 414 413)
4(392 393 415 414)
4(393 394 416 415)
4(394 395 417 416)
4(395 396 418 417)
4(396 397 419 418)
4(397 398 420 419)
4(398 399 421 420)
4(399 400 422 421)
4(400 401 423 422)
4(401 402 424 423)
4(402 403 425 424)
4(404 405 427 426)
4(405 406 428 427)
4(406 407 429 428)
4(407 408 430 429)
4(408 409 431 430)
4(409 410 432 431)
4(410 411 433 432)
4(411 412 434 433)
4(412 413 435 434)
4(413 414 436 435)
4(414 415 437 436)
4(415 416 438 437)
4(416 417 439 438)
4(417 418 440 439)
4(418 419 441 440)
4(419 420 442 441)
4(420 421 443 442)
4(421 422 444 443)
4(422 423 445 444)
4(423 424 446 445)
4(424 425 447 446)
4(426 427 449 448)
4(427 428 450 449)
4(428 429 451 450)
4(429 430 452 451)
4(430 431 453 452)
4(431 432 454 453)
4(432 433 455 454)
4(433 434 456 455)
4(434 435 457 456)
4(435 436 458 457)
4(436 437 459 458)
4(437 438 460 459)
4(438 439 461 460)
4(439 440 462 461)
4(440 441 463 462)
4(441 442 464 463)
4(442 443 465 464)
4(443 444 466 465)
4(444 445 467 466)
4(445 446 468 467)
4(446 447 469 468)
4(448 449 471 470)
4(449 450 472 471)
4(450 451 473 472)
4(451 452 474 473)
4(452 453 475 474)
4(453 454 476 475)
4(454 455 477 476)
4(455 456 478 477)
4(456 457 479 478)
4(457 458 480 479)
4(458 459 481 480)
4(459 460 482 481)
4(460 461 483 482)
4(461 462 484 483)
4(462 463 485 484)
4(463 464 486 485)
4(464 465 487 486)
4(465 466 488 487)
4(466 467 489 488)
4(467 468 490 489)
4(468 469 491 490)
4(470 471 493 492)
4(471 472 494 493)
4(472 473 495 494)
4(473 474 496 495)
4(474 475 497 496)
4(475 476 498 497)
4(476 477 499 498)
4(477 478 500 499)
4(478 479 501 500)
4(479 480 502 501)
4(480 481 503 502)
4(481 482 504 503)
4(482 483 505 504)
4(483 484 506 505)
4(484 485 507 506)
4(485 486 508 507)
4(486 487 509 508)
4(487 488 510 509)
4(488 489 511 510)
4(489 490 512 511)
4(490 491 513 512)
4(492 493 515 514)
4(493 494 516 515)
4(494 495 517 516)
4(495 496 518 517)
4(496 497 519 518)
4(497 498 520 519)
4(498 499 521 520)
4(499 500 522 521)
4(500 501 523 522)
4(501 502 524 523)
4(502 503 525 524)
4(503 504 526 525)
4(504 505 527 526)
4(505 506 528 527)
4(506 507 529 528)
4(507 508 530 529)
4(508 509 531 530)
4(509 510 532 531)
4(510 511 533 532)
4(511 512 534 533)
4(512 513 535 534)
4(514 515 537 536)
4(515 516 538 537)
4(516 517 539 538)
4(517 518 540 539)
4(518 519 541 540)
4(519 520 542 541)
4(520 521 543 542)
4(521 522 544 543)
4(522 523 545 544)
4(523 524 546 545)
4(524 525 547 546)
4(525 526 548 547)
4(526 527 549 548)
4(527 528 550 549)
4(528 529 551 550)
4(529 530 552 551)
4(530 531 553 552)
4(531 532 554 553)
4(532 533 555 554)
4(533 534 556 555)
4(534 535 557 556)
4(536 537 559 558)
4(537 538 560 559)
4(538 539 561 560)
4(539 540 562 561)
4(540 541 563 562)
4(541 542 564 563)
4(542 543 565 564)
4(543 544 566 565)
4(544 545 567 566)
4(545 546 568 567)
4(546 547 569 568)
4(547 548 570 569)
4(548 549 571 570)
4(549 550 572 571)
4(550 551 573 572)
4(551 552 574 573)
4(552 553 575 574)
4(553 554 576 575)
4(554 555 577 576)
4(555 556 578 577)
4(558 559 580 579)
4(559 560 581 580)
4(560 561 582 581)
4(561 562 583 582)
4(562 563 584 583)
4(563 564 585 584)
4(564 565 586 585)
4(565 566 587 586)
4(566 567 588 587)
4(567 568 589 588)
4(568 569 590 589)
4(569 570 591 590)
4(570 571 592 591)
4(571 572 593 592)
4(572 573 594 593)
4(573 574 595 594)
4(574 575 596 595)
4(575 576 597 596)
4(576 577 598 597)
4(577 578 599 598)
4(579 580 601 600)
4(580 581 602 601)
4(581 582 603 602)
4(582 583 604 603)
4(583 584 605 604)
4(584 585 606 605)
4(585 586 607 606)
4(586 587 608 607)
4(587 588 609 608)
4(588 589 610 609)
4(589 590 611 610)
4(590 591 612 611)
4(591 592 613 612)
4(592 593 614 613)
4(593 594 615 614)
4(594 595 616 615)
4(595 596 617 616)
4(596 597 618 617)
4(597 598 619 618)
4(598 599 620 619)
4(600 601 622 621)
4(601 602 623 622)
4(602 603 624 623)
4(603 604 625 624)
4(604 605 626 625)
4(605 606 627 626)
4(606 607 628 627)
4(607 608 629 628)
4(608 609 630 629)
4(609 610 631 630)
4(610 611 632 631)
4(611 612 633 632)
4(612 613 634 633)
4(613 614 635 634)
4(614 615 636 635)
4(615 616 637 636)
4(616 617 638 637)
4(617 618 639 638)
4(618 619 640 639)
4(619 620 641 640)
4(621 622 643 642)
4(622 623 644 643)
4(623 624 645 644)
4(624 625 646 645)
4(625 626 647 646)
4(626 627 648 647)
4(627 628 649 648)
4(628 629 650 649)
4(629 630 651 650)
4(630 631 652 651)
4(631 632 653 652)
4(632 633 654 653)
4(633 634 655 654)
4(634 635 656 655)
4(635 636 657 656)
4(636 637 658 657)
4(637 638 659 658)
4(638 639 660 659)
4(639 640 661 660)
4(640 641 662 661)
4(642 643 664 663)
4(643 644 665 664)
4(644 645 666 665)
4(645 646 667 666)
4(646 647 668 667)
4(647 648 669 668)
4(648 649 670 669)
4(649 650 671 670)
4(650 651 672 671)
4(651 652 673 672)
4(652 653 674 673)
4(653 654 675 674)
4(654 655 676 675)
4(655 656 677 676)
4(656 657 678 677)
4(657 658 679 678)
4(658 659 680 679)
4(659 660 681 680)
4(660 661 682 681)
4(661 662 683 682)
4(663 664 685 684)
4(664 665 686 685)
4(665 666 687 686)
4(666 667 688 687)
4(667 668 689 688)
4(668 669 690 689)
4(669 670 691 690)
4(670 671 692 691)
4(671 672 693 692)
4(672 673 694 693)
4(673 674 695 694)
4(674 675 696 695)
4(675 676 697 696)
4(676 677 698 697)
4(677 678 699 698)
4(678 679 700 699)
4(679 680 701 700)
4(680 681 702 701)
4(681 682 703 702)
4(682 683 704 703)
4(684 685 706 705)
4(685 686 707 706)
4(686 687 708 707)
4(687 688 709 708)
4(688 689 710 709)
4(689 690 711 710)
4(690 691 712 711)
4(691 692 713 712)
4(692 693 714 713)
4(693 694 715 714)
4(694 695 716 715)
4(695 696 717 716)
4(696 697 718 717)
4(697 698 719 718)
4(698 699 720 719)
4(699 700 721 720)
4(700 701 722 721)
4(701 702 723 722)
4(702 703 724 723)
4(703 704 725 724)
4(705 706 727 726)
4(706 707 728 727)
4(707 708 729 728)
4(708 709 730 729)
4(709 710 731 730)
4(710 711 732 731)
4(711 712 733 732)
4(712 713 734 733)
4(713 714 735 734)
4(714 715 736 735)
4(715 716 737 736)
4(716 717 738 737)
4(717 718 739 738)
4(718 719 740 739)
4(719 720 741 740)
4(720 721 742 741)
4(721 722 743 742)
4(722 723 744 743)
4(723 724 745 744)
4(724 725 746 745)
4(726 727 748 747)
4(727 728 749 748)
4(728 729 750 749)
4(729 730 751 750)
4(730 731 752 751)
4(731 732 753 752)
4(732 733 754 753)
4(733 734 755 754)
4(734 735 756 755)
4(735 736 757 756)
4(736 737 758 757)
4(737 738 759 758)
4(738 739 760 759)
4(739 740 761 760)
4(740 741 762 761)
4(741 742 763 762)
4(742 743 764 763)
4(743 744 765 764)
4(744 745 766 765)
4(745 746 767 766)
4(747 748 769 768)
4(748 749 770 769)
4(749 750 771 770)
4(750 751 772 771)
4(751 752 773 772)
4(752 753 774 773)
4(753 754 775 774)
4(754 755 776 775)
4(755 756 777 776)
4(756 757 778 777)
4(757 758 779 778)
4(758 759 780 779)
4(759 760 781 780)
4(760 761 782 781)
4(761 762 783 782)
4(762 763 784 783)
4(763 764 785 784)
4(764 765 786 785)
4(765 766 787 786)
4(766 767 788 787)
4(768 769 790 789)
4(769 770 791 790)
4(770 771 792 791)
4(771 772 793 792)
4(772 773 794 793)
4(773 774 795 794)
4(774 775 796 795)
4(775 776 797 796)
4(776 777 798 797)
4(777 778 799 798)
4(778 779 800 799)
4(779 780 801 800)
4(780 781 802 801)
4(781 782 803 802)
4(782 783 804 803)
4(783 784 805 804)
4(784 785 806 805)
4(785 786 807 806)
4(786 787 808 807)
4(787 788 809 808)
4(789 790 811 810)
4(790 791 812 811)
4(791 792 813 812)
4(792 793 814 813)
4(793 794 815 814)
4(794 795 816 815)
4(795 796 817 816)
4(796 797 818 817)
4(797 798 819 818)
4(798 799 820 819)
4(799 800 821 820)
4(800 801 822 821)
4(801 802 823 822)
4(802 803 824 823)
4(803 804 825 824)
4(804 805 826 825)
4(805 806 827 826)
4(806 807 828 827)
4(807 808 829 828)
4(808 809 830 829)
4(810 811 832 831)
4(811 812 833 832)
4(812 813 834 833)
4(813 814 835 834)
4(814 815 836 835)
4(815 816 837 836)
4(816 817 838 837)
4(817 818 839 838)
4(818 819 840 839)
4(819 820 841 840)
4(820 821 842 841)
4(821 822 843 842)
4(822 823 844 843)
4(823 824 845 844)
4(824 825 846 845)
4(825 826 847 846)
4(826 827 848 847)
4(827 828 849 848)
4(828 829 850 849)
4(829 830 851 850)
4(831 832 853 852)
4(832 833 854 853)
4(833 834 855 854)
4(834 835 856 855)
4(835 836 857 856)
4(836 837 858 857)
4(837 838 859 858)
4(838 839 860 859)
4(839 840 861 860)
4(840 841 862 861)
4(841 842 863 862)
4(842 843 864 863)
4(843 844 865 864)
4(844 845 866 865)
4(845 846 867 866)
4(846 847 868 867)
4(847 848 869 868)
4(848 849 870 869)
4(849 850 871 870)
4(850 851 872 871)
4(852 853 874 873)
4(853 854 875 874)
4(854 855 876 875)
4(855 856 877 876)
4(856 857 878 877)
4(857 858 879 878)
4(858 859 880 879)
4(859 860 881 880)
4(860 861 882 881)
4(861 862 883 882)
4(862 863 884 883)
4(863 864 885 884)
4(864 865 886 885)
4(865 866 887 886)
4(866 867 888 887)
4(867 868 889 888)
4(868 869 890 889)
4(869 870 891 890)
4(870 871 892 891)
4(871 872 893 892)
4(873 874 895 894)
4(874 875 896 895)
4(875 876 897 896)
4(876 877 898 897)
4(877 878 899 898)
4(878 879 900 899)
4(879 880 901 900)
4(880 881 902 901)
4(881 882 903 902)
4(882 883 904 903)
4(883 884 905 904)
4(884 885 906 905)
4(885 886 907 906)
4(886 887 908 907)
4(887 888 909 908)
4(888 889 910 909)
4(889 890 911 910)
4(890 891 912 911)
4(891 892 913 912)
4(892 893 914 913)
4(894 895 916 915)
4(895 896 917 916)
4(896 897 918 917)
4(897 898 919 918)
4(898 899 920 919)
4(899 900 921 920)
4(900 901 922 921)
4(901 902 923 922)
4(902 903 924 923)
4(903 904 925 924)
4(904 905 926 925)
4(905 906 927 926)
4(906 907 928 927)
4(907 908 929 928)
4(908 909 930 929)
4(909 910 931 930)
4(910 911 932 931)
4(911 912 933 932)
4(912 913 934 933)
4(913 914 935 934)
4(915 916 937 936)
4(916 917 938 937)
4(917 918 939 938)
4(918 919 940 939)
4(919 920 941 940)
4(920 921 942 941)
4(921 922 943 942)
4(922 923 944 943)
4(923 924 945 944)
4(924 925 946 945)
4(925 926 947 946)
4(926 927 948 947)
4(927 928 949 948)
4(928 929 950 949)
4(929 930 951 950)
4(930 931 952 951)
4(931 932 953 952)
4(932 933 954 953)
4(933 934 955 954)
4(934 935 956 955)
4(936 937 958 957)
4(937 938 959 958)
4(938 939 960 959)
4(939 940 961 960)
4(940 941 962 961)
4(941 942 963 962)
4(942 943 964 963)
4(943 944 965 964)
4(944 945 966 965)
4(945 946 967 966)
4(946 947 968 967)
4(947 948 969 968)
4(948 949 970 969)
4(949 950 971 970)
4(950 951 972 971)
4(951 952 973 972)
4(952 953 974 973)
4(953 954 975 974)
4(954 955 976 975)
4(955 956 977 976)
4(957 958 979 978)
4(958 959 980 979)
4(959 960 981 980)
4(960 961 982 981)
4(961 962 983 982)
4(962 963 984 983)
4(963 964 985 984)
4(964 965 986 985)
4(965 966 987 986)
4(966 967 988 987)
4(967 968 989 988)
4(968 969 990 989)
4(969 970 991 990)
4(970 971 992 991)
4(971 972 993 992)
4(972 973 994 993)
4(973 974 995 994)
4(974 975 996 995)
4(975 976 997 996)
4(976 977 998 997)
4(978 979 1000 999)
4(979 980 1001 1000)
4(980 981 1002 1001)
4(981 982 1003 1002)
4(982 983 1004 1003)
4(983 984 1005 1004)
4(984 985 1006 1005)
4(985 986 1007 1006)
4(986 987 1008 1007)
4(987 988 1009 1008)
4(988 989 1010 1009)
4(989 990 1011 1010)
4(990 991 1012 1011)
4(991 992 1013 1012)
4(992 993 1014 1013)
4(993 994 1015 1014)
4(994 995 1016 1015)
4(995 996 1017 1016)
4(996 997 1018 1017)
4(997 998 1019 1018)
4(999 1000 1021 1020)
4(1000 1001 1022 1021)
4(1001 1002 1023 1022)
4(1002 1003 1024 1023)
4(1003 1004 1025 1024)
4(1004 1005 1026 1025)
4(1005 1006 1027 1026)
4(1006 1007 1028 1027)
4(1007 1008 1029 1028)
4(1008 1009 1030 1029)
4(1009 1010 1031 1030)
4(1010 1011 1032 1031)
4(1011 1012 1033 1032)
4(1012 1013 1034 1033)
4(1013 1014 1035 1034)
4(1014 1015 1036 1035)
4(1015 1016 1037 1036)
4(1016 1017 1038 1037)
4(1017 1018 1039 1038)
4(1018 1019 1040 1039)
4(1020 1021 1042 1041)
4(1021 1022 1043 1042)
4(1022 1023 1044 1043)
4(1023 1024 1045 1044)
4(1024 1025 1046 1045)
4(1025 1026 1047 1046)
4(1026 1027 1048 1047)
4(1027 1028 1049 1048)
4(1028 1029 1050 1049)
4(1029 1030 1051 1050)
4(1030 1031 1052 1051)
4(1031 1032 1053 1052)
4(1032 1033 1054 1053)
4(1033 1034 1055 1054)
4(1034 1035 1056 1055)
4(1035 1036 1057 1056)
4(1036 1037 1058 1057)
4(1037 1038 1059 1058)
4(1038 1039 1060 1059)
4(1039 1040 1061 1060)
4(1041 1042 1063 1062)
4(1042 1043 1064 1063)
4(1043 1044 1065 1064)
4(1044 1045 1066 1065)
4(1045 1046 1067 1066)
4(1046 1047 1068 1067)
4(1047 1048 1069 1068)
4(1048 1049 1070 1069)
4(1049 1050 1071 1070)
4(1050 1051 1072 1071)
4(1051 1052 1073 1072)
4(1052 1053 1074 1073)
4(1053 1054 1075 1074)
4(1054 1055 1076 1075)
4(1055 1056 1077 1076)
4(1056 1057 1078 1077)
4(1057 1058 1079 1078)
4(1058 1059 1080 1079)
4(1059 1060 1081 1080)
4(1060 1061 1082 1081)
4(1062 1063 1084 1083)
4(1063 1064 1085 1084)
4(1064 1065 1086 1085)
4(1065 1066 1087 1086)
4(1066 1067 1088 1087)
4(1067 1068 1089 1088)
4(1068 1069 1090 1089)
4(1069 1070 1091 1090)
4(1070 1071 1092 1091)
4(1071 1072 1093 1092)
4(1072 1073 1094 1093)
4(1073 1074 1095 1094)
4(1074 1075 1096 1095)
4(1075 1076 1097 1096)
4(1076 1077 1098 1097)
4(1077 1078 1099 1098)
4(1078 1079 1100 1099)
4(1079 1080 1101 1100)
4(1080 1081 1102 1101)
4(1081 1082 1103 1102)
4(1083 1084 1105 1104)
4(1084 1085 1106 1105)
4(1085 1086 1107 1106)
4(1086 1087 1108 1107)
4(1087 1088 1109 1108)
4(1088 1089 1110 1109)
4(1089 1090 1111 1110)
4(1090 1091 1112 1111)
4(1091 1092 1113 1112)
4(1092 1093 1114 1113)
4(1093 1094 1115 1114)
4(1094 1095 1116 1115)
4(1095 1096 1117 1116)
4(1096 1097 1118 1117)
4(1097 1098 1119 1118)
4(1098 1099 1120 1119)
4(1099 1100 1121 1120)
4(1100 1101 1122 1121)
4(1101 1102 1123 1122)
4(1102 1103 1124 1123)
4(1104 1105 1126 1125)
4(1105 1106 1127 1126)
4(1106 1107 1128 1127)
4(1107 1108 1129 1128)
4(1108 1109 1130 1129)
4(1109 1110 1131 1130)
4(1110 1111 1132 1131)
4(1111 1112 1133 1132)
4(1112 1113 1134 1133)
4(1113 1114 1135 1134)
4(1114 1115 1136 1135)
4(1115 1116 1137 1136)
4(1116 1117 1138 1137)
4(1117 1118 1139 1138)
4(1118 1119 1140 1139)
4(1119 1120 1141 1140)
4(1120 1121 1142 1141)
4(1121 1122 1143 1142)
4(1122 1123 1144 1143)
4(1123 1124 1145 1144)
4(1125 1126 1147 1146)
4(1126 1127 1148 1147)
4(1127 1128 1149 1148)
4(1128 1129 1150 1149)
4(1129 1130 1151 1150)
4(1130 1131 1152 1151)
4(1131 1132 1153 1152)
4(1132 1133 1154 1153)
4(1133 1134 1155 1154)
4(1134 1135 1156 1155)
4(1135 1136 1157 1156)
4(1136 1137 1158 1157)
4(1137 1138 1159 1158)
4(1138 1139 1160 1159)
4(1139 1140 1161 1160)
4(1140 1141 1162 1161)
4(1141 1142 1163 1162)
4(1142 1143 1164 1163)
4(1143 1144 1165 1164)
4(1144 1145 1166 1165)
4(1146 1147 1168 1167)
4(1147 1148 1169 1168)
4(1148 1149 1170 1169)
4(1149 1150 1171 1170)
4(1150 1151 1172 1171)
4(1151 1152 1173 1172)
4(1152 1153 1174 1173)
4(1153 1154 1175 1174)
4(1154 1155 1176 1175)
4(1155 1156 1177 1176)
4(1156 1157 1178 1177)
4(1157 1158 1179 1178)
4(1158 1159 1180 1179)
4(1159 1160 1181 1180)
4(1160 1161 1182 1181)
4(1161 1162 1183 1182)
4(1162 1163 1184 1183)
4(1163 1164 1185 1184)
4(1164 1165 1186 1185)
4(1165 1166 1187 1186)
4(1167 1168 1189 1188)
4(1168 1169 1190 1189)
4(1169 1170 1191 1190)
4(1170 1171 1192 1191)
4(1171 1172 1193 1192)
4(1172 1173 1194 1193)
4(1173 1174 1195 1194)
4(1174 1175 1196 1195)
4(1175 1176 1197 1196)
4(1176 1177 1198 1197)
4(1177 1178 1199 1198)
4(1178 1179 1200 1199)
4(1179 1180 1201 1200)
4(1180 1181 1202 1201)
4(1181 1182 1203 1202)
4(1182 1183 1204 1203)
4(1183 1184 1205 1204)
4(1184 1185 1206 1205)
4(1185 1186 1207 1206)
4(1186 1187 1208 1207)
4(1188 1189 1210 1209)
4(1189 1190 1211 1210)
4(1190 1191 1212 1211)
4(1191 1192 1213 1212)
4(1192 1193 1214 1213)
4(1193 1194 1215 1214)
4(1194 1195 1216 1215)
4(1195 1196 1217 1216)
4(1196 1197 1218 1217)
4(1197 1198 1219 1218)
4(1198 1199 1220 1219)
4(1199 1200 1221 1220)
4(1200 1201 1222 1221)
4(1201 1202 1223 1222)
4(1202 1203 1224 1223)
4(1203 1204 1225 1224)
4(1204 1205 1226 1225)
4(1205 1206 1227 1226)
4(1206 1207 1228 1227)
4(1207 1208 1229 1228)
4(1209 1210 1231 1230)
4(1210 1211 1232 1231)
4(1211 1212 1233 1232)
4(1212 1213 1234 1233)
4(1213 1214 1235 1234)
4(1214 1215 1236 1235)
4(1215 1216 1237 1236)
4(1216 1217 1238 1237)
4(1217 1218 1239 1238)
4(1218 1219 1240 1239)
4(1219 1220 1241 1240)
4(1220 1221 1242 1241)
4(1221 1222 1243 1242)
4(1222 1223 1244 1243)
4(1223 1224 1245 1244)
4(1224 1225 1246 1245)
4(1225 1226 1247 1246)
4(1226 1227 1248 1247)
4(1227 1228 1249 1248)
4(1228 1229 1250 1249)
4(1230 1231 1252 1251)
4(1231 1232 1253 1252)
4(1232 1233 1254 1253)
4(1233 1234 1255 1254)
4(1234 1235 1256 1255)
4(1235 1236 1257 1256)
4(1236 1237 1258 1257)
4(1237 1238 1259 1258)
4(1238 1239 1260 1259)
4(1239 1240 1261 1260)
4(1240 1241 1262 1261)
4(1241 1242 1263 1262)
4(1242 1243 1264 1263)
4(1243 1244 1265 1264)
4(1244 1245 1266 1265)
4(1245 1246 1267 1266)
4(1246 1247 1268 1267)
4(1247 1248 1269 1268)
4(1248 1249 1270 1269)
4(1249 1250 1271 1270)
4(1251 1252 1273 1272)
4(1252 1253 1274 1273)
4(1253 1254 1275 1274)
4(1254 1255 1276 1275)
4(1255 1256 1277 1276)
4(1256 1257 1278 1277)
4(1257 1258 1279 1278)
4(1258 1259 1280 1279)
4(1259 1260 1281 1280)
4(1260 1261 1282 1281)
4(1261 1262 1283 1282)
4(1262 1263 1284 1283)
4(1263 1264 1285 1284)
4(1264 1265 1286 1285)
4(1265 1266 1287 1286)
4(1266 1267 1288 1287)
4(1267 1268 1289 1288)
4(1268 1269 1290 1289)
4(1269 1270 1291 1290)
4(1270 1271 1292 1291)
4(1272 1273 1294 1293)
4(1273 1274 1295 1294)
4(1274 1275 1296 1295)
4(1275 1276 1297 1296)
4(1276 1277 1298 1297)
4(1277 1278 1299 1298)
4(1278 1279 1300 1299)
4(1279 1280 1301 1300)
4(1280 1281 1302 1301)
4(1281 1282 1303 1302)
4(1282 1283 1304 1303)
4(1283 1284 1305 1304)
4(1284 1285 1306 1305)
4(1285 1286 1307 1306)
4(1286 1287 1308 1307)
4(1287 1288 1309 1308)
4(1288 1289 1310 1309)
4(1289 1290 1311 1310)
4(1290 1291 1312 1311)
4(1291 1292 1313 1312)
4(1293 1294 1315 1314)
4(1294 1295 1316 1315)
4(1295 1296 1317 1316)
4(1296 1297 1318 1317)
4(1297 1298 1319 1318)
4(1298 1299 1320 1319)
4(1299 1300 1321 1320)
4(1300 1301 1322 1321)
4(1301 1302 1323 1322)
4(1302 1303 1324 1323)
4(1303 1304 1325 1324)
4(1304 1305 1326 1325)
4(1305 1306 1327 1326)
4(1306 1307 1328 1327)
4(1307 1308 1329 1328)
4(1308 1309 1330 1329)
4(1309 1310 1331 1330)
4(1310 1311 1332 1331)
4(1311 1312 1333 1332)
4(1312 1313 1334 1333)
4(1314 1315 1336 1335)
4(1315 1316 1337 1336)
4(1316 1317 1338 1337)
4(1317 1318 1339 1338)
4(1318 1319 1340 1339)
4(1319 1320 1341 1340)
4(1320 1321 1342 1341)
4(1321 1322 1343 1342)
4(1322 1323 1344 1343)
4(1323 1324 1345 1344)
4(1324 1325 1346 1345)
4(1325 1326 1347 1346)
4(1326 1327 1348 1347)
4(1327 1328 1349 1348)
4(1328 1329 1350 1349)
4(1329 1330 1351 1350)
4(1330 1331 1352 1351)
4(1331 1332 1353 1352)
4(1332 1333 1354 1353)
4(1333 1334 1355 1354)
4(1335 1336 1357 1356)
4(1336 1337 1358 1357)
4(1337 1338 1359 1358)
4(1338 1339 1360 1359)
4(1339 1340 1361 1360)
4(1340 1341 1362 1361)
4(1341 1342 1363 1362)
4(1342 1343 1364 1363)
4(1343 1344 1365 1364)
4(1344 1345 1366 1365)
4(1345 1346 1367 1366)
4(1346 1347 1368 1367)
4(1347 1348 1369 1368)
4(1348 1349 1370 1369)
4(1349 1350 1371 1370)
4(1350 1351 1372 1371)
4(1351 1352 1373 1372)
4(1352 1353 1374 1373)
4(1353 1354 1375 1374)
4(1354 1355 1376 1375)
4(1356 1357 1378 1377)
4(1357 1358 1379 1378)
4(1358 1359 1380 1379)
4(1359 1360 1381 1380)
4(1360 1361 1382 1381)
4(1361 1362 1383 1382)
4(1362 1363 1384 1383)
4(1363 1364 1385 1384)
4(1364 1365 1386 1385)
4(1365 1366 1387 1386)
4(1366 1367 1388 1387)
4(1367 1368 1389 1388)
4(1368 1369 1390 1389)
4(1369 1370 1391 1390)
4(1370 1371 1392 1391)
4(1371 1372 1393 1392)
4(1372 1373 1394 1393)
4(1373 1374 1395 1394)
4(1374 1375 1396 1395)
4(1375 1376 1397 1396)
4(1377 1378 1399 1398)
4(1378 1379 1400 1399)
4(1379 1380 1401 1400)
4(1380 1381 1402 1401)
4(1381 1382 1403 1402)
4(1382 1383 1404 1403)
4(1383 1384 1405 1404)
4(1384 1385 1406 1405)
4(1385 1386 1407 1406)
4(1386 1387 1408 1407)
4(1387 1388 1409 1408)
4(1388 1389 1410 1409)
4(1389 1390 1411 1410)
4(1390 1391 1412 1411)
4(1391 1392 1413 1412)
4(1392 1393 1414 1413)
4(1393 1394 1415 1414)
4(1394 1395 1416 1415)
4(1395 1396 1417 1416)
4(1396 1397 1418 1417)
4(1398 1399 1420 1419)
4(1399 1400 1421 1420)
4(1400 1401 1422 1421)
4(1401 1402 1423 1422)
4(1402 1403 1424 1423)
4(1403 1404 1425 1424)
4(1404 1405 1426 1425)
4(1405 1406 1427 1426)
4(1406 1407 1428 1427)
4(1407 1408 1429 1428)
4(1408 1409 1430 1429)
4(1409 1410 1431 1430)
4(1410 1411 1432 1431)
4(1411 1412 1433 1432)
4(1412 1413 1434 1433)
4(1413 1414 1435 1434)
4(1414 1415 1436 1435)
4(1415 1416 1437 1436)
4(1416 1417 1438 1437)
4(1417 1418 1439 1438)
4(1419 1420 1441 1440)
4(1420 1421 1442 1441)
4(1421 1422 1443 1442)
4(1422 1423 1444 1443)
4(1423 1424 1445 1444)
4(1424 1425 1446 1445)
4(1425 1426 1447 1446)
4(1426 1427 1448 1447)
4(1427 1428 1449 1448)
4(1428 1429 1450 1449)
4(1429 1430 1451 1450)
4(1430 1431 1452 1451)
4(1431 1432 1453 1452)
4(1432 1433 1454 1453)
4(1433 1434 1455 1454)
4(1434 1435 1456 1455)
4(1435 1436 1457 1456)
4(1436 1437 1458 1457)
4(1437 1438 1459 1458)
4(1438 1439 1460 1459)
4(1440 1441 1462 1461)
4(1441 1442 1463 1462)
4(1442 1443 1464 1463)
4(1443 1444 1465 1464)
4(1444 1445 1466 1465)
4(1445 1446 1467 1466)
4(1446 1447 1468 1467)
4(1447 1448 1469 1468)
4(1448 1449 1470 1469)
4(1449 1450 1471 1470)
4(1450 1451 1472 1471)
4(1451 1452 1473 1472)
4(1452 1453 1474 1473)
4(1453 1454 1475 1474)
4(1454 1455 1476 1475)
4(1455 1456 1477 1476)
4(1456 1457 1478 1477)
4(1457 1458 1479 1478)
4(1458 1459 1480 1479)
4(1459 1460 1481 1480)
4(1461 1462 1483 1482)
4(1462 1463 1484 1483)
4(1463 1464 1485 1484)
4(1464 1465 1486 1485)
4(1465 1466 1487 1486)
4(1466 1467 1488 1487)
4(1467 1468 1489 1488)
4(1468 1469 1490 1489)
4(1469 1470 1491 1490)
4(1470 1471 1492 1491)
4(1471 1472 1493 1492)
4(1472 1473 1494 1493)
4(1473 1474 1495 1494)
4(1474 1475 1496 1495)
4(1475 1476 1497 1496)
4(1476 1477 1498 1497)
4(1477 1478 1499 1498)
4(1478 1479 1500 1499)
4(1479 1480 1501 1500)
4(1480 1481 1502 1501)
4(1482 1483 1504 1503)
4(1483 1484 1505 1504)
4(1484 1485 1506 1505)
4(1485 1486 1507 1506)
4(1486 1487 1508 1507)
4(1487 1488 1509 1508)
4(1488 1489 1510 1509)
4(1489 1490 1511 1510)
4(1490 1491 1512 1511)
4(1491 1492 1513 1512)
4(1492 1493 1514 1513)
4(1493 1494 1515 1514)
4(1494 1495 1516 1515)
4(1495 1496 1517 1516)
4(1496 1497 1518 1517)
4(1497 1498 1519 1518)
4(1498 1499 1520 1519)
4(1499 1500 1521 1520)
4(1500 1501 1522 1521)
4(1501 1502 1523 1522)
4(1503 1504 1525 1524)
4(1504 1505 1526 1525)
4(1505 1506 1527 1526)
4(1506 1507 1528 1527)
4(1507 1508 1529 1528)
4(1508 1509 1530 1529)
4(1509 1510 1531 1530)
4(1510 1511 1532 1531)
4(1511 1512 1533 1532)
4(1512 1513 1534 1533)
4(1513 1514 1535 1534)
4(1514 1515 1536 1535)
4(1515 1516 1537 1536)
4(1516 1517 1538 1537)
4(1517 1518 1539 1538)
4(1518 1519 1540 1539)
4(1519 1520 1541 1540)
4(1520 1521 1542 1541)
4(1521 1522 1543 1542)
4(1522 1523 1544 1543)
4(1524 1525 1546 1545)
4(1525 1526 1547 1546)
4(1526 1527 1548 1547)
4(1527 1528 1549 1548)
4(1528 1529 1550 1549)
4(1529 1530 1551 1550)
4(1530 1531 1552 1551)
4(1531 1532 1553 1552)
4(1532 1533 1554 1553)
4(1533 1534 1555 1554)
4(1534 1535 1556 1555)
4(1535 1536 1557 1556)
4(1536 1537 1558 1557)
4(1537 1538 1559 1558)
4(1538 1539 1560 1559)
4(1539 1540 1561 1560)
4(1540 1541 1562 1561)
4(1541 1542 1563 1562)
4(1542 1543 1564 1563)
4(1543 1544 1565 1564)
4(1545 1546 1567 1566)
4(1546 1547 1568 1567)
4(1547 1548 1569 1568)
4(1548 1549 1570 1569)
4(1549 1550 1571 1570)
4(1550 1551 1572 1571)
4(1551 1552 1573 1572)
4(1552 1553 1574 1573)
4(1553 1554 1575 1574)
4(1554 1555 1576 1575)
4(1555 1556 1577 1576)
4(1556 1557 1578 1577)
4(1557 1558 1579 1578)
4(1558 1559 1580 1579)
4(1559 1560 1581 1580)
4(1560 1561 1582 1581)
4(1561 1562 1583 1582)
4(1562 1563 1584 1583)
4(1563 1564 1585 1584)
4(1564 1565 1586 1585)
4(1566 1567 1588 1587)
4(1567 1568 1589 1588)
4(1568 1569 1590 1589)
4(1569 1570 1591 1590)
4(1570 1571 1592 1591)
4(1571 1572 1593 1592)
4(1572 1573 1594 1593)
4(1573 1574 1595 1594)
4(1574 1575 1596 1595)
4(1575 1576 1597 1596)
4(1576 1577 1598 1597)
4(1577 1578 1599 1598)
4(1578 1579 1600 1599)
4(1579 1580 1601 1600)
4(1580 1581 1602 1601)
4(1581 1582 1603 1602)
4(1582 1583 1604 1603)
4(1583 1584 1605 1604)
4(1584 1585 1606 1605)
4(1585 1586 1607 1606)
4(1587 1588 1609 1608)
4(1588 1589 1610 1609)
4(1589 1590 1611 1610)
4(1590 1591 1612 1611)
4(1591 1592 1613 1612)
4(1592 1593 1614 1613)
4(1593 1594 1615 1614)
4(1594 1595 1616 1615)
4(1595 1596 1617 1616)
4(1596 1597 1618 1617)
4(1597 1598 1619 1618)
4(1598 1599 1620 1619)
4(1599 1600 1621 1620)
4(1600 1601 1622 1621)
4(1601 1602 1623 1622)
4(1602 1603 1624 1623)
4(1603 1604 1625 1624)
4(1604 1605 1626 1625)
4(1605 1606 1627 1626)
4(1606 1607 1628 1627)
4(1608 1609 1630 1629)
4(1609 1610 1631 1630)
4(1610 1611 1632 1631)
4(1611 1612 1633 1632)
4(1612 1613 1634 1633)
4(1613 1614 1635 1634)
4(1614 1615 1636 1635)
4(1615 1616 1637 1636)
4(1616 1617 1638 1637)
4(1617 1618 1639 1638)
4(1618 1619 1640 1639)
4(1619 1620 1641 1640)
4(1620 1621 1642 1641)
4(1621 1622 1643 1642)
4(1622 1623 1644 1643)
4(1623 1624 1645 1644)
4(1624 1625 1646 1645)
4(1625 1626 1647 1646)
4(1626 1627 1648 1647)
4(1627 1628 1649 1648)
4(1629 1630 1651 1650)
4(1630 1631 1652 1651)
4(1631 1632 1653 1652)
4(1632 1633 1654 1653)
4(1633 1634 1655 1654)
4(1634 1635 1656 1655)
4(1635 1636 1657 1656)
4(1636 1637 1658 1657)
4(1637 1638 1659 1658)
4(1638 1639 1660 1659)
4(1639 1640 1661 1660)
4(1640 1641 1662 1661)
4(1641 1642 1663 1662)
4(1642 1643 1664 1663)
4(1643 1644 1665 1664)
4(1644 1645 1666 1665)
4(1645 1646 1667 1666)
4(1646 1647 1668 1667)
4(1647 1648 1669 1668)
4(1648 1649 1670 1669)
4(1650 1651 1672 1671)
4(1651 1652 1673 1672)
4(1652 1653 1674 1673)
4(1653 1654 1675 1674)
4(1654 1655 1676 1675)
4(1655 1656 1677 1676)
4(1656 1657 1678 1677)
4(1657 1658 1679 1678)
4(1658 1659 1680 1679)
4(1659 1660 1681 1680)
4(1660 1661 1682 1681)
4(1661 1662 1683 1682)
4(1662 1663 1684 1683)
4(1663 1664 1685 1684)
4(1664 1665 1686 1685)
4(1665 1666 1687 1686)
4(1666 1667 1688 1687)
4(1667 1668 1689 1688)
4(1668 1669 1690 1689)
4(1669 1670 1691 1690)
4(1671 1672 3364 3363)
4(1672 1673 3365 3364)
4(1673 1674 3366 3365)
4(1674 1675 3367 3366)
4(1675 1676 3368 3367)
4(1676 1677 3369 3368)
4(1677 1678 3370 3369)
4(1678 1679 3371 3370)
4(1679 1680 3372 3371)
4(1680 1681 3373 3372)
4(1681 1682 3374 3373)
4(1682 1683 3375 3374)
4(1683 1684 3376 3375)
4(1684 1685 3377 3376)
4(1685 1686 3378 3377)
4(1686 1687 3379 3378)
4(1687 1688 3380 3379)
4(1688 1689 3381 3380)
4(1689 1690 3382 3381)
4(1690 1691 3383 3382)
3(0 1692 3384)
4(21 1713 1692 0)
4(42 1734 1713 21)
4(63 1755 1734 42)
4(84 1776 1755 63)
4(105 1797 1776 84)
4(126 1818 1797 105)
4(147 1839 1818 126)
4(168 1860 1839 147)
4(189 1881 1860 168)
4(210 1902 1881 189)
4(231 1923 1902 210)
4(252 1944 1923 231)
4(273 1965 1944 252)
4(295 1987 1965 273)
4(294 1986 1987 295)
4(316 2008 1986 294)
4(338 2030 2008 316)
4(360 2052 2030 338)
4(382 2074 2052 360)
4(404 2096 2074 382)
4(426 2118 2096 404)
4(448 2140 2118 426)
4(470 2162 2140 448)
4(492 2184 2162 470)
4(514 2206 2184 492)
4(536 2228 2206 514)
4(558 2250 2228 536)
4(579 2271 2250 558)
4(600 2292 2271 579)
4(621 2313 2292 600)
4(642 2334 2313 621)
4(663 2355 2334 642)
4(684 2376 2355 663)
4(705 2397 2376 684)
4(726 2418 2397 705)
4(747 2439 2418 726)
4(768 2460 2439 747)
4(789 2481 2460 768)
4(810 2502 2481 789)
4(831 2523 2502 810)
4(852 2544 2523 831)
4(873 2565 2544 852)
4(894 2586 2565 873)
4(915 2607 2586 894)
4(936 2628 2607 915)
4(957 2649 2628 936)
4(978 2670 2649 957)
4(999 2691 2670 978)
4(1020 2712 2691 999)
4(1041 2733 2712 1020)
4(1062 2754 2733 1041)
4(1083 2775 2754 1062)
4(1104 2796 2775 1083)
4(1125 2817 2796 1104)
4(1146 2838 2817 1125)
4(1167 2859 2838 1146)
4(1188 2880 2859 1167)
4(1209 2901 2880 1188)
4(1230 2922 2901 1209)
4(1251 2943 2922 1230)
4(1272 2964 2943 1251)
4(1293 2985 2964 1272)
4(1314 3006 2985 1293)
4(1335 3027 3006 1314)
4(1356 3048 3027 1335)
4(1377 3069 3048 1356)
4(1398 3090 3069 1377)
4(1419 3111 3090 1398)
4(1440 3132 3111 1419)
4(1461 3153 3132 1440)
4(1482 3174 3153 1461)
4(1503 3195 3174 1482)
4(1524 3216 3195 1503)
4(1545 3237 3216 1524)
4(1566 3258 3237 1545)
4(1587 3279 3258 1566)
4(1608 3300 3279 1587)
4(1629 3321 3300 1608)
4(1650 3342 3321 1629)
4(1671 3363 3342 1650)
3(20 3404 1712)
4(41 20 1712 1733)
4(62 41 1733 1754)
4(83 62 1754 1775)
4(104 83 1775 1796)
4(125 104 1796 1817)
4(146 125 1817 1838)
4(167 146 1838 1859)
4(188 167 1859 1880)
4(209 188 1880 1901)
4(230 209 1901 1922)
4(251 230 1922 1943)
4(272 251 1943 1964)
4(293 272 1964 1985)
4(315 293 1985 2007)
4(337 315 2007 2029)
4(359 337 2029 2051)
4(381 359 2051 2073)
4(403 381 2073 2095)
4(425 403 2095 2117)
4(447 425 2117 2139)
4(469 447 2139 2161)
4(491 469 2161 2183)
4(513 491 2183 2205)
4(535 513 2205 2227)
4(557 535 2227 2249)
4(556 557 2249 2248)
4(578 556 2248 2270)
4(599 578 2270 2291)
4(620 599 2291 2312)
4(641 620 2312 2333)
4(662 641 2333 2354)
4(683 662 2354 2375)
4(704 683 2375 2396)
4(725 704 2396 2417)
4(746 725 2417 2438)
4(767 746 2438 2459)
4(788 767 2459 2480)
4(809 788 2480 2501)
4(830 809 2501 2522)
4(851 830 2522 2543)
4(872 851 2543 2564)
4(893 872 2564 2585)
4(914 893 2585 2606)
4(935 914 2606 2627)
4(956 935 2627 2648)
4(977 956 2648 2669)
4(998 977 2669 2690)
4(1019 998 2690 2711)
4(1040 1019 2711 2732)
4(1061 1040 2732 2753)
4(1082 1061 2753 2774)
4(1103 1082 2774 2795)
4(1124 1103 2795 2816)
4(1145 1124 2816 2837)
4(1166 1145 2837 2858)
4(1187 1166 2858 2879)
4(1208 1187 2879 2900)
4(1229 1208 2900 2921)
4(1250 1229 2921 2942)
4(1271 1250 2942 2963)
4(1292 1271 2963 2984)
4(1313 1292 2984 3005)
4(1334 1313 3005 3026)
4(1355 1334 3026 3047)
4(1376 1355 3047 3068)
4(1397 1376 3068 3089)
4(1418 1397 3089 3110)
4(1439 1418 3110 3131)
4(1460 1439 3131 3152)
4(1481 1460 3152 3173)
4(1502 1481 3173 3194)
4(1523 1502 3194 3215)
4(1544 1523 3215 3236)
4(1565 1544 3236 3257)
4(1586 1565 3257 3278)
4(1607 1586 3278 3299)
4(1628 1607 3299 3320)
4(1649 1628 3320 3341)
4(1670 1649 3341 3362)
4(1691 1670 3362 3383)
)
// ************************************************************************* //
| |
cb395c4af7f53467b7669edab39999bbbb66857e | 90dcd14a98660f08a26fb5640f37cff452f2b628 | /PivotRowColumn.cc | 3f0f0a1c0810b4ce7832cb3a201a53ae1ce74622 | [] | no_license | bura2017/thesis_cpu | b50441ebaa86da834d588c5227d6de710a711a20 | 11e8aeb1aeab8058f2d9503e40e2af3c7ce7c66b | refs/heads/master | 2020-06-03T06:48:59.928420 | 2017-06-25T15:16:33 | 2017-06-25T15:16:33 | 94,119,788 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 875 | cc | PivotRowColumn.cc | #include "PivotRowColumn.h"
#include "Epsilon.h"
int pivotRow(Matrix const &matrix) {
for (int i = 1; i < matrix.rows; i++) {
if (cmp(matrix.e[i + 0 * matrix.m], 0) == -1) {
return i;
}
}
return 0;
}
int pivotColumn(Matrix const &matrix, const int row) {
int ret = 0;
for (int j = 1; j < matrix.cols; j++) {
if (cmp(matrix.e[row + j * matrix.m], 0) == -1) {
if (ret == 0) {
ret = j;
} else {
for (int i = 0; i < matrix.rows; i++) {
double val1 = - matrix.e[i + ret * matrix.m] / matrix.e[row + ret * matrix.m];
double val2 = - matrix.e[i + j * matrix.m] / matrix.e[row + j * matrix.m];
int c = cmp(val1,val2);
if (c == 1) {
ret = j;
break;
}
if (c == -1) {
break;
}
}
}
}
}
return ret;
}
|
10eb418f591ebc6bca0ab793de4fb63625a83497 | 7db5c172ec35bfa26970b804e2ea4f35e5058d9c | /Rotoscope/qzonedessin.cpp | ef20cd8d94a89755fd891d3dbfae876b0f4bd016 | [] | no_license | yehudi/Rotoscope | dd262a97fd852795b252af7deaf3771fc307457e | a39f87eb062e582171f3253b9e6b525bb6a60c21 | refs/heads/master | 2020-06-02T20:26:43.020884 | 2015-03-02T14:12:37 | 2015-03-02T14:12:37 | 31,478,376 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,106 | cpp | qzonedessin.cpp |
#include "qzonedessin.h"
#include "drawview.h"
#include <iostream>
#include <QtGui>
#include <QtCore>
#include <QDebug>
QZoneDessin::QZoneDessin(QWidget * parent) : QWidget(parent){
this->m_image = NULL;
m_actif = 0;
this->current_picture = 0;
this->afficherDecor = true;
this->nombrePelures = 1;
this->frequenceDessin = 1;
this->drawed_picture = NULL;
m_position = NULL;
erase =false;
this->acceptDrops();
this->pen = QPen(Qt::black, 5, Qt::SolidLine, Qt::RoundCap);
}
void QZoneDessin::loadImage(int number){
int old =this->current_picture;
if(number >= this->paths.size()){
this->current_picture = this->paths.size()-1;
}else{
this->current_picture = number;
}
if(this->current_picture >= 0){
if(this->m_image != NULL)
delete this->m_image;
if(this->drawed_picture != NULL){
this->drawed_picture->save(this->paths[old]+".png");
delete this->drawed_picture;
}
QImage temp(this->paths[this->current_picture]);
this->drawed_picture = new QImage(this->paths[this->current_picture]+".png");
this->m_image = new QImage(temp.scaled(640,480,Qt::KeepAspectRatio));
this->update();
this->setFixedSize(this->m_image->size());
}
}
void QZoneDessin::setPen(QPen pen){
this->pen = pen;
}
void QZoneDessin::resizeEvent(QResizeEvent * e)
{
/*QImage * image = new QImage(e->size(),QImage::Format_ARGB32);
image->fill(Qt::white);
//copie de l'image
QPainter p(image);
p.drawImage(0,0,*m_image);
p.drawImage(0,0,*(this->movie_pictures[this->current_picture]));
p.drawImage(0,0,*(this->drawed_pictures[this->current_picture]));
delete m_image;
m_image = new QImage(*image);*/
}
void QZoneDessin::refresh()
{
QPainter p(this);
p.fillRect(0,0,5000,5000, Qt::white);
if(this->afficherDecor)
p.drawImage(0,0,*this->m_image);
//p.drawImage(0,0,*this->movie_pictures[this->current_picture]);
int nbre = (this->nombrePelures -1 > this->current_picture)? this->current_picture: this->nombrePelures-1;
qreal opacity;
if (nbre == 0)
opacity = 1.0;
else
opacity = 1.0/(float)(nbre+1);
p.setOpacity(0);
for(int i=nbre; i>0; --i){
if(this->current_picture-i*this->frequenceDessin >= 0){
p.setOpacity(p.opacity() + opacity);
QImage img(this->paths[this->current_picture-i*this->frequenceDessin]+".png");
p.drawImage(0,0,img);
}
}
p.setOpacity(1);
p.drawImage(0,0,*this->drawed_picture);
}
void QZoneDessin::paintEvent(QPaintEvent * e)
{
this->refresh();
}
void QZoneDessin::mousePressEvent(QMouseEvent *event)
{
m_position = new QPoint(event->pos() );
m_actif = 1;
QPainter paint(this->drawed_picture);
paint.setRenderHint(QPainter::Antialiasing);
paint.setBackgroundMode(Qt::TransparentMode);
QPen pen = this->pen;
QPoint position(event->pos());
if(erase){
pen.setColor(Qt::transparent);
paint.setCompositionMode(QPainter::CompositionMode_DestinationOut);
}
paint.setPen(pen);
paint.drawPoint(QPointF(position));
this->update();
}
void QZoneDessin::mouseMoveEvent(QMouseEvent *event){
if (m_actif==1)
{
emit draw();
QPainter paint(this->drawed_picture);
paint.setRenderHint(QPainter::Antialiasing);
QPen pen = this->pen;
if(erase){
pen.setColor(Qt::transparent);
paint.setCompositionMode(QPainter::CompositionMode_SourceOut);
}
paint.setPen(pen);
QPoint position(event->pos());
paint.drawLine(QLine(*m_position,position));
delete m_position;
m_position = new QPoint(position);
this->update();
}
}
void QZoneDessin::mouseReleaseEvent(QMouseEvent *event)
{
//std::cout << "relache" << std::endl;
delete m_position;
m_actif = 0;
}
void QZoneDessin::clearDessin()
{
this->drawed_picture->fill(Qt::transparent);
this->update();
}
|
6d0ae2618556c8de97cfba4a31adcf7a19500e11 | 433a999d6291252692404cce90d1eb6352477da5 | /offer_22.cpp | 47028b074194015950839290229613c9b4de5ac8 | [] | no_license | Hrockets/algorithm_practice | dff6aaf7cc8fae23413762b50b64459f4bd23fb1 | ecd8459f99a775454b7e8797ae86e56bd98e2306 | refs/heads/master | 2020-06-23T06:40:28.277996 | 2019-09-06T07:29:31 | 2019-09-06T07:29:31 | 198,546,029 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 512 | cpp | offer_22.cpp | /*剑指offer —— 22 从上到下打印二叉树
描述:从上往下打印出二叉树的每个节点,同层节点从左至右打印。
*/
class Solution {
public:
vector<int> PrintFromTopToBottom(TreeNode* root) {
vector<int> res;
if (root == NULL) return res;
queue<TreeNode*> q;
q.push(root);
while (!q.empty())
{
TreeNode* n = q.front();
res.push_back(n->val);
if (n->left != NULL) q.push(n->left);
if (n->right != NULL) q.push(n->right);
q.pop();
}
return res;
}
}; |
e852aea4e78badebdf7793dffe4bad77886b84d5 | ef166a4749347472f72c53a97441200de87f3c3f | /autosavedata.cpp | ec8e89bc5f2e7f6a6332bc2bf3cdd8a90838ae43 | [] | no_license | Tskysheep/ethylene | 93d36f2f7f994bfad602cd1862d2f44fb9e6be36 | 9783ee510150ad6057c4644cc6d5bbaaf025862c | refs/heads/master | 2020-04-11T21:04:04.907091 | 2019-02-25T08:24:33 | 2019-02-25T08:24:33 | 162,093,551 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,814 | cpp | autosavedata.cpp | #include "autosavedata.h"
//初始化相关参数
AutoSaveData::AutoSaveData(QString df,QObject *parent) : QObject(parent),dateFormat(df)
{
// {"H110","H111","H112","H113","H114","H115","H116","H117","H118","H119","H120"}
stoveNumber[0]="H110";
stoveNumber[1]="H111";
stoveNumber[2]="H112";
stoveNumber[3]="H113";
stoveNumber[4]="H114";
stoveNumber[5]="H115";
stoveNumber[6]="H116";
stoveNumber[7]="H117";
stoveNumber[8]="H118";
stoveNumber[9]="H119";
stoveNumber[10]="H120";
timer.setInterval (300000);
// timer.setInterval(5000);
timer.setSingleShot (false);
timer.setTimerType (Qt::VeryCoarseTimer);
connect (&timer,&QTimer::timeout,this,&AutoSaveData::check);
timer.start ();
}
AutoSaveData::~AutoSaveData()
{
}
//特化使用,返回两个时间内的月份差
int AutoSaveData::monthTo(const QDate &firstDate, const QDate &secondDate, int defaultValue, bool *ok)
{
if(firstDate.isValid ()&&secondDate.isValid ()) {
int firstyear=firstDate.year ();
int secondyear=secondDate.year ();
int firstmooth=firstDate.month ();
int secondmooth=secondDate.month ();
int yearpoor=secondyear-firstyear;
if(yearpoor>=0) {
int yeartomooth=yearpoor*12;
int moothpoor=secondmooth-1-firstmooth+yeartomooth;
if(ok!=NULL) {
*ok=true;
}
return moothpoor;
} else if(yearpoor<0){
int yeartomooth=yearpoor*12;
int moothpoor=secondmooth+1-firstmooth+yeartomooth;
if(ok!=NULL) {
*ok=true;
}
return moothpoor;
}
} else {
if(ok!=NULL) {
*ok=false;
}
return defaultValue;
}
}
//特化,返回date的monthValue月前的日期
QDate AutoSaveData::upDateformonth(QDate date, int monthValue)
{
int year=date.year();
int month=date.month();
int tmpV=month-monthValue;
if(tmpV>0) {
return QDate(year,tmpV,1);
} else {
year--;
month=12+tmpV;
return QDate(year,month,1);
}
}
void AutoSaveData::check()
{
bool *ok=new bool;
int cycleValue=settingINI.getValue ("/YJS/cycle",1).toInt (ok);
QString savePath=QString(settingINI.getValue("/YJS/savrPath","").toByteArray());
if(savePath=="") {
qDebug()<<"路径没有设置";
return;
}
// saveData (savePath);
if(!(*ok)) {
qDebug()<<"备份周期获取转换失败";
return;
}
QDate currentDate=QDate::currentDate ();
// QDate currentDate(2015,3,1);//测试
QString lastSaveDateStr=QString(settingINI.getValue ("/YJS/SaveDate","null").toByteArray ());
if(lastSaveDateStr!="null") {
QDate lastSaveDate=QDate::fromString (lastSaveDateStr,dateFormat);
if(!lastSaveDate.isValid ()) {
qDebug()<<"上次备份日期获取无效";
return ;
}
int monthPoor=monthTo (lastSaveDate,currentDate,0,ok);
if(!(*ok)) {
qDebug()<<"日期有毒无法比较";
return;
}
if(monthPoor>=cycleValue) {
// 备份去吧,备份规则是什么呢??偷懒的妥妥1号规则
QDate beginDate=upDateformonth(currentDate,cycleValue);
QDate overDate=upDateformonth(currentDate,1);
overDate.setDate(overDate.year(),overDate.month(),overDate.daysInMonth());
saveData (savePath,beginDate,overDate);
} else {
qDebug()<<"时辰未到";
return;
}
} else {
qDebug()<<"备份第一次";
QDate beginDate=upDateformonth(currentDate,cycleValue);
QDate overDate=upDateformonth(currentDate,1);
overDate.setDate(overDate.year(),overDate.month(),overDate.daysInMonth());
saveData (savePath,beginDate,overDate);
}
}
//存储数据为excel
void AutoSaveData::saveData(QString savePath, QDate beginD, QDate overD)
{
savePath=savePath.remove(0,8);
settingINI.setValue("/YJS/SaveDate",overD.toString(dateFormat));
QString tmpstove;
for(int i=0;i<11;i++) {
QString tmpstove=stoveNumber[i];
qDebug()<<"pathCreate:"<<savePath+"/"+tmpstove<<endl;
QDir tmpdir(savePath+"/"+tmpstove);
if(!tmpdir.exists()) {
tmpdir.mkpath(savePath+"/"+tmpstove);
}
}
QString timeStr=beginD.toString("yyyy-MM-dd")+"_"+overD.toString("yyyy-MM-dd")+".xlsx";
QDateTime bDT(beginD,QTime(0,0,0,0));
QDateTime oDT(overD,QTime(24,59,59));
for(int i=0;i<11;i++) {
MysqlServer * tmpSql=new MysqlServer();
tmpSql->all_tube_show(i,bDT,oDT);
tmpSql->exportExcel(savePath+"/"+stoveNumber[i]+"/"+timeStr);
delete tmpSql;
}
}
|
2b17715654047f2a2667f1d8fc6337fc2163ec5b | 7211f67272eea1ad8f9e3985e69ae0c8f72aa43c | /KMP.cpp | 491c59b9a420d872e5282efcf8f713e254c68499 | [] | no_license | VirgileEcard/KMP | e02f02f71440c20152afb59e454aeb61c4edc4af | 20da6c6b8a96db1f4fb347ca82a5c261a56522de | refs/heads/main | 2023-04-18T15:53:48.713496 | 2021-04-22T18:42:48 | 2021-04-22T18:42:48 | 359,433,036 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,100 | cpp | KMP.cpp | #include <iostream>
#include <string>
#include <vector>
#include "fonctions.h"
using namespace std;
int main(int argc, char *argv[]) {
string seq, txt, fichTxt;
bool spefSeq=0, spefTxt=0, aff=0;
//on parcourt les arguments
for(int i=0; i<argc; i++){
//affichage du texte d'aide
if ((string)argv[i]=="help"){
help();
return 0;
}
//définition de la séquence
if ((string)argv[i]=="s"){
spefSeq=1;
try{
seq=(string)argv[i+1];
}
catch(const logic_error & e){
cout<<"Entrez la sequence a rechercher apres le 's'"<<endl;
}
}
//définition du fichier texte dans lequel effectuer la recherche
if ((string)argv[i]=="t"){
spefTxt=1;
try{
fichTxt=(string)argv[i+1];
}
catch(const logic_error & e){
cout<<"Entrez le nom du fichier apres le 't'"<<endl;
}
}
//option d'affichage du texte avec les occurences de la séquence colorées après la recherche
if ((string)argv[i]=="a"){
aff=1;
}
}
//S'ils n'ont pas été définis dans les arguments, on demande la séquence et/ou le fichier source
if(!spefSeq){
cout<<"Entrez la sequence a chercher : ";
getline(cin, seq);
}
if(!spefTxt){
cout<<"Entrez le fichier dans lequel effecture la recherche : ";
getline(cin, fichTxt);
}
txt = setTxt(fichTxt);
//on met en place le tableau des correspondances
int Tab[seq.length()];
chevauchement(Tab, seq);
//on effectue la recherche et on stocke la position des occurences de la séquence dans un vector
vector<int> res = recherche(Tab, seq, txt);
//on affiche ces occurences
if (res.size()){
for(int i=0; i<res.size(); i++){
cout<<"La sequence est presente a la position "<<res[i]<<endl;;
}
}
else cout<<"Aucune occurence de "<<seq<<" n'a été trouvée dans le texte"<<endl;
//si ça a été demandé dans les arguments, on affiche le texte avec les occurences de la séquence colorées en rouge
if(aff) affichageResultat(txt, res, seq.length());
cout<<endl;
return 0;
}
|
b39d0269b773b4bcae95e3d592d9ac249c63cd38 | ffdc77394c5b5532b243cf3c33bd584cbdc65cb7 | /mindspore/ccsrc/minddata/dataset/util/queue.h | d6ef40b8b42e4868ffed9df06195e4bb7efe74b2 | [
"Apache-2.0",
"LicenseRef-scancode-proprietary-license",
"MPL-1.0",
"OpenSSL",
"LGPL-3.0-only",
"LicenseRef-scancode-warranty-disclaimer",
"BSD-3-Clause-Open-MPI",
"MIT",
"MPL-2.0-no-copyleft-exception",
"NTP",
"BSD-3-Clause",
"GPL-1.0-or-later",
"0BSD",
"MPL-2.0",
"LicenseRef-scancode-free-unknown",
"AGPL-3.0-only",
"Libpng",
"MPL-1.1",
"IJG",
"GPL-2.0-only",
"BSL-1.0",
"Zlib",
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-python-cwi",
"BSD-2-Clause",
"LicenseRef-scancode-gary-s-brown",
"LGPL-2.1-only",
"LicenseRef-scancode-other-permissive",
"Python-2.0",
"LicenseRef-scancode-mit-nagy",
"LicenseRef-scancode-other-copyleft",
"LicenseRef-scancode-unknown-license-reference",
"Unlicense"
] | permissive | mindspore-ai/mindspore | ca7d5bb51a3451c2705ff2e583a740589d80393b | 54acb15d435533c815ee1bd9f6dc0b56b4d4cf83 | refs/heads/master | 2023-07-29T09:17:11.051569 | 2023-07-17T13:14:15 | 2023-07-17T13:14:15 | 239,714,835 | 4,178 | 768 | Apache-2.0 | 2023-07-26T22:31:11 | 2020-02-11T08:43:48 | C++ | UTF-8 | C++ | false | false | 9,857 | h | queue.h | /**
* Copyright 2019-2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MINDSPORE_CCSRC_MINDDATA_DATASET_UTIL_QUEUE_H_
#define MINDSPORE_CCSRC_MINDDATA_DATASET_UTIL_QUEUE_H_
#include <atomic>
#include <memory>
#include <mutex>
#include <string>
#include <type_traits>
#include <utility>
#include <vector>
#include "./securec.h"
#include "utils/ms_utils.h"
#include "minddata/dataset/util/allocator.h"
#include "minddata/dataset/util/log_adapter.h"
#include "minddata/dataset/util/services.h"
#include "minddata/dataset/util/cond_var.h"
#include "minddata/dataset/util/task_manager.h"
namespace mindspore {
namespace dataset {
// A simple thread safe queue using a fixed size array
template <typename T>
class Queue {
public:
using value_type = T;
using pointer = T *;
using const_pointer = const T *;
using reference = T &;
using const_reference = const T &;
explicit Queue(int sz)
: sz_(sz), arr_(Services::GetAllocator<T>()), head_(0), tail_(0), my_name_(Services::GetUniqueID()) {
Status rc = arr_.allocate(sz);
if (rc.IsError()) {
MS_LOG(ERROR) << "Fail to create a queue.";
std::terminate();
} else {
MS_LOG(DEBUG) << "Create Q with uuid " << my_name_ << " of size " << sz_ << ".";
}
}
virtual ~Queue() { ResetQue(); }
size_t size() const {
std::unique_lock<std::mutex> _lock(mux_);
size_t v = 0;
if (tail_ >= head_) {
v = tail_ - head_;
}
return v;
}
size_t capacity() const {
std::unique_lock<std::mutex> _lock(mux_);
return sz_;
}
bool empty() const {
std::unique_lock<std::mutex> _lock(mux_);
return head_ == tail_;
}
void Reset() {
std::unique_lock<std::mutex> _lock(mux_);
ResetQue();
extra_arr_.clear();
}
// Producer
Status Add(const_reference ele) noexcept {
std::unique_lock<std::mutex> _lock(mux_);
// Block when full
Status rc =
full_cv_.Wait(&_lock, [this]() -> bool { return (SizeWhileHoldingLock() != CapacityWhileHoldingLock()); });
if (rc.IsOk()) {
RETURN_IF_NOT_OK(this->AddWhileHoldingLock(ele));
empty_cv_.NotifyAll();
_lock.unlock();
} else {
empty_cv_.Interrupt();
}
return rc;
}
Status Add(T &&ele) noexcept {
std::unique_lock<std::mutex> _lock(mux_);
// Block when full
Status rc =
full_cv_.Wait(&_lock, [this]() -> bool { return (SizeWhileHoldingLock() != CapacityWhileHoldingLock()); });
if (rc.IsOk()) {
RETURN_IF_NOT_OK(this->AddWhileHoldingLock(std::forward<T>(ele)));
empty_cv_.NotifyAll();
_lock.unlock();
} else {
empty_cv_.Interrupt();
}
return rc;
}
template <typename... Ts>
Status EmplaceBack(Ts &&... args) noexcept {
std::unique_lock<std::mutex> _lock(mux_);
// Block when full
Status rc =
full_cv_.Wait(&_lock, [this]() -> bool { return (SizeWhileHoldingLock() != CapacityWhileHoldingLock()); });
if (rc.IsOk()) {
auto k = tail_++ % sz_;
new (arr_[k]) T(std::forward<Ts>(args)...);
empty_cv_.NotifyAll();
_lock.unlock();
} else {
empty_cv_.Interrupt();
}
return rc;
}
// Consumer
virtual Status PopFront(pointer p) {
std::unique_lock<std::mutex> _lock(mux_);
// Block when empty
Status rc = empty_cv_.Wait(&_lock, [this]() -> bool { return !EmptyWhileHoldingLock(); });
if (rc.IsOk()) {
RETURN_IF_NOT_OK(this->PopFrontWhileHoldingLock(p, true));
full_cv_.NotifyAll();
_lock.unlock();
} else {
full_cv_.Interrupt();
}
return rc;
}
Status Register(TaskGroup *vg) {
Status rc1 = empty_cv_.Register(vg->GetIntrpService());
Status rc2 = full_cv_.Register(vg->GetIntrpService());
if (rc1.IsOk()) {
return rc2;
} else {
return rc1;
}
}
Status Resize(int32_t new_capacity) {
std::unique_lock<std::mutex> _lock(mux_);
CHECK_FAIL_RETURN_UNEXPECTED(new_capacity > 0,
"New capacity: " + std::to_string(new_capacity) + ", should be larger than 0");
RETURN_OK_IF_TRUE(new_capacity == static_cast<int32_t>(CapacityWhileHoldingLock()));
std::vector<T> queue;
// pop from the original queue until the new_capacity is full
for (int32_t i = 0; i < new_capacity; ++i) {
if (head_ < tail_) {
// if there are elements left in queue, pop out
T temp;
RETURN_IF_NOT_OK(this->PopFrontWhileHoldingLock(&temp, true));
queue.push_back(temp);
} else {
// if there is nothing left in queue, check extra_arr_
if (!extra_arr_.empty()) {
// if extra_arr_ is not empty, push to fill the new_capacity
queue.push_back(extra_arr_[0]);
extra_arr_.erase(extra_arr_.begin());
} else {
// if everything in the queue and extra_arr_ is popped out, break the loop
break;
}
}
}
// if there are extra elements in queue, put them to extra_arr_
while (head_ < tail_) {
T temp;
RETURN_IF_NOT_OK(this->PopFrontWhileHoldingLock(&temp, false));
extra_arr_.push_back(temp);
}
this->ResetQue();
RETURN_IF_NOT_OK(arr_.allocate(new_capacity));
sz_ = new_capacity;
for (int32_t i = 0; i < static_cast<int32_t>(queue.size()); ++i) {
RETURN_IF_NOT_OK(this->AddWhileHoldingLock(queue[i]));
}
queue.clear();
_lock.unlock();
return Status::OK();
}
private:
size_t sz_;
MemGuard<T, Allocator<T>> arr_;
std::vector<T> extra_arr_; // used to store extra elements after reducing capacity, will not be changed by Add,
// will pop when there is a space in queue (by PopFront or Resize)
size_t head_;
size_t tail_;
std::string my_name_;
mutable std::mutex mux_;
CondVar empty_cv_;
CondVar full_cv_;
// Helper function for Add, must be called when holding a lock
Status AddWhileHoldingLock(const_reference ele) {
auto k = tail_++ % sz_;
*(arr_[k]) = ele;
return Status::OK();
}
// Helper function for Add, must be called when holding a lock
Status AddWhileHoldingLock(T &&ele) {
auto k = tail_++ % sz_;
*(arr_[k]) = std::forward<T>(ele);
return Status::OK();
}
// Helper function for PopFront, must be called when holding a lock
Status PopFrontWhileHoldingLock(pointer p, bool clean_extra) {
auto k = head_++ % sz_;
*p = std::move(*(arr_[k]));
if (!extra_arr_.empty() && clean_extra) {
RETURN_IF_NOT_OK(this->AddWhileHoldingLock(std::forward<T>(extra_arr_[0])));
extra_arr_.erase(extra_arr_.begin());
}
return Status::OK();
}
void ResetQue() noexcept {
while (head_ < tail_) {
T val;
this->PopFrontWhileHoldingLock(&val, false);
MS_LOG(DEBUG) << "Address of val: " << &val;
}
empty_cv_.ResetIntrpState();
full_cv_.ResetIntrpState();
head_ = 0;
tail_ = 0;
}
size_t SizeWhileHoldingLock() const {
size_t v = 0;
if (tail_ >= head_) {
v = tail_ - head_;
}
return v;
}
size_t CapacityWhileHoldingLock() const { return sz_; }
bool EmptyWhileHoldingLock() const { return head_ == tail_; }
};
// A container of queues with [] operator accessors. Basically this is a wrapper over of a vector of queues
// to help abstract/simplify code that is maintaining multiple queues.
template <typename T>
class QueueList {
public:
QueueList() {}
void Init(int num_queues, int capacity) {
(void)queue_list_.reserve(num_queues);
for (int i = 0; i < num_queues; i++) {
(void)queue_list_.emplace_back(std::make_unique<Queue<T>>(capacity));
}
}
Status Register(TaskGroup *vg) {
if (vg == nullptr) {
RETURN_STATUS_UNEXPECTED("Null task group during QueueList registration.");
}
for (int i = 0; i < queue_list_.size(); ++i) {
RETURN_IF_NOT_OK(queue_list_[i]->Register(vg));
}
return Status::OK();
}
auto size() const {
std::unique_lock<std::mutex> _lock(mux_);
return queue_list_.size();
}
std::unique_ptr<Queue<T>> &operator[](const int index) {
std::unique_lock<std::mutex> _lock(mux_);
return queue_list_[index];
}
const std::unique_ptr<Queue<T>> &operator[](const int index) const {
std::unique_lock<std::mutex> _lock(mux_);
return queue_list_[index];
}
~QueueList() = default;
Status AddQueue(TaskGroup *vg) {
std::unique_lock<std::mutex> _lock(mux_);
(void)queue_list_.emplace_back(std::make_unique<Queue<T>>(queue_list_[0]->capacity()));
return queue_list_[queue_list_.size() - 1]->Register(vg);
}
Status RemoveLastQueue() {
std::unique_lock<std::mutex> _lock(mux_);
CHECK_FAIL_RETURN_UNEXPECTED(queue_list_.size() > 1, "Cannot remove more than the current queues.");
(void)queue_list_.pop_back();
return Status::OK();
}
private:
// Queue contains non-copyable objects, so it cannot be added to a vector due to the vector
// requirement that objects must have copy semantics. To resolve this, we use a vector of unique
// pointers. This allows us to provide dynamic creation of queues in a container.
std::vector<std::unique_ptr<Queue<T>>> queue_list_;
mutable std::mutex mux_;
};
} // namespace dataset
} // namespace mindspore
#endif // MINDSPORE_CCSRC_MINDDATA_DATASET_UTIL_QUEUE_H_
|
be3a19457f722f964e40519823e1790b5c0e225f | 7294e92fb82fc9a40cdb76b0b134abfc2a984042 | /piece2.cpp | 64d92a5b943438c008032a6f0d8f5394497da9cb | [] | no_license | kossrg/Draughts-Qt | e95973ebbefad28155bd06e4fd4ab6f20e5f91ca | 534a842fac4601ef7ecc92696399f5555bd60b3b | refs/heads/master | 2020-06-28T07:55:18.704798 | 2019-08-02T08:12:08 | 2019-08-02T08:12:08 | 200,182,021 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 11,141 | cpp | piece2.cpp | #include "piece2.h"
piece2::piece2(QWidget *parent) : QLabel (parent)
{
}
void piece2::mousePressEvent(QMouseEvent *event)
{
//int x = event->x() - this->x();
//int y = event->y() - this->y();
//this->move(event->x() - this->x(), event->y() - this->y());
this->captured = true;
//this->x() = x;
//this->y() = event->y();
//if (event->type() == QEvent::MouseMove)
//{
//this->move(this->x() + event->x(), this->y()+event->y());
//}
Q_UNUSED(event);
}
void piece2::mouseReleaseEvent(QMouseEvent *event)
{
this->captured = false;
int x, y;
if ( (this->y()-50)%40 < 20){
y = 50 + 10 + 40*((this->y()-50)/40);
}
else{
y = 50 + 10 + 40*((this->y()-60)/40) + 40;
}
if ((this->x()-15)%40 < 20){
x = 15 + 3 + 40*((this->x()-15)/40);
}
else{
x = 15 + 3 + 40*((this->x()-15)/40) + 40;
}
if (y < 50) y += 50;
if (x < 15) x += 15;
if (y > 370) y -=40;
if (x > 335) x -=40;
int newx = (x-15)/40 + 1;
int newy = 8 - (y-50)/40;
int incx = this->coordX - newx;
int incy = this->coordY - newy;
if (this->checkLegitMove(incx, incy)){
this->coordX = newx;
this->coordY = newy;
this->move(x, y);
}
else {
x = 15 + 3 + (this->coordX - 1)*40;
y = 50 + 10 +(8 - this->coordY)*40;
this->move(x, y);
}
Q_UNUSED(event);
}
void piece2::mouseMoveEvent(QMouseEvent *event)
{
static const int x = event->x();
static const int y = event->y();
if (this->captured){
this->move(this->x() + event->x() - x, this->y() + event->y() - y);
}
}
bool piece2::checkLegitMove(int x, int y)
{
if (!(x != 1 xor x != -1)) return false;
if (!(y != 1 xor y != -1)) return false;
if ((this->coordX + x) > 9 || (this->coordX + x) < 0) return false;
if ((this->coordY + y) > 9 || (this->coordY + y) < 0) return false;
return true;
}
void piece2::place()
{
this->setGeometry(15+4+40*(this->coordX - 1), 35+10+40*(8-this->coordY), 34, 20);
}
/*
QPixmap pix1("D:\\Programming\\prg\\Educational tasks\\MenuBar\\res\\piece_b.bmp");
pix1.setMask(pix1.createMaskFromColor(QColor(255, 255, 255)));
for (int i = 0; i < 12; i++){
bPiece[i] = new piece2(this);
bPiece[i]->coordY = 8 - i/4;
bPiece[i]->coordX = (i%4+1)*2-(i/4)%2;
//bPiece[i]->setGeometry(18+40*(bPiece[i]->coordX - 1), 60+40*(8-bPiece[i]->coordY), 34, 20);
bPiece[i]->place();
bPiece[i]->setPixmap(pix1);
}
QPixmap pix2("D:\\Programming\\prg\\Educational tasks\\MenuBar\\res\\piece_w.bmp");
pix2.setMask(pix2.createMaskFromColor(QColor(255, 255, 255)));
for (int i = 0; i < 12; i++){
wPiece[i] = new piece2(this);
wPiece[i]->coordY = i/4 + 1;
wPiece[i]->coordX = (i%4+1)*2-(1-(i/4)%2);
wPiece[i]->place();
//wPiece[i]->setGeometry(18+40*(wPiece[i]->coordX - 1), 260+40*(8-wPiece[i]->coordY), 34, 20);
wPiece[i]->setPixmap(pix2);
}
void abstractPiece::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
this->setCursor(QCursor(Qt::ArrowCursor));
QPoint newPos = this->getNewBPosition(this->pos());
bool move = this->checkLegitMove(newPos);
if (move) {
parentBoard->setBox(this->getBPosition(), 0);
this->setBPosition(newPos);
parentBoard->setBox(this->getBPosition(), this->kind);
this->setWPosition();
}
this->setPos(this->getWPosition());
if (this->getBY() == 1)
emit makeKing(this->getBX(), 1, 0);
if (this->getBY() == 8)
emit makeKing(this->getBX(), 8, 1);
Q_UNUSED(event);
}
bool abstractPiece::checkForJumps()
{
for (int i = 8; i > 0; i--){
for (int j = 1; j < 9; j++){
if (!((i+j)%2) && parentBoard->getBox(j, i) == 1*kind*6){
if (checkForKingJumps(j, i)) return true;
}
if (!((i+j)%2) && parentBoard->getBox(j, i) == 1*kind){
if (j - 2 > 0 && i - 2*kind > 0 && i - 2*kind < 9 && parentBoard->getBox(j - 2, i - 2*kind) == 0 && (parentBoard->getBox(j - 1, i - 1*kind) == (-1)*kind || parentBoard->getBox(j - 1, i - 1*kind) == (-1)*kind*6))
return true;
if (j + 2 < 9 && i - 2*kind > 0 && i - 2*kind < 9 && parentBoard->getBox(j + 2, i - 2*kind) == 0 && (parentBoard->getBox(j + 1, i - 1*kind) == (-1)*kind || parentBoard->getBox(j - 1, i - 1*kind) == (-1)*kind*6))
return true;
}
}
}
return false;
}
bool abstractPiece::checkForKingJumps(int x, int y)
{
for(int i = 1, j = 1; x + j < 9 && y + i < 9; i++, j++){
if (parentBoard->getBox(x+j, y+i) == kind || parentBoard->getBox(x+j, y+i) == kind*6) break;
if (parentBoard->getBox(x+j, y+i) == kind*(-1) || parentBoard->getBox(x+j, y+i) == kind*6*(-1)){
if (x+j+1 < 9 && y+i+1 < 9 && parentBoard->getBox(x+j+1, y+i+1) == 0)
return true;
}
}
for(int i = 1, j = 1; x - j > 0 && y + i < 9; i++, j++){
if (parentBoard->getBox(x-j, y+i) == kind || parentBoard->getBox(x-j, y+i) == kind*6) break;
if (parentBoard->getBox(x-j, y+i) == kind*(-1) || parentBoard->getBox(x-j, y+i) == kind*6*(-1)){
if (x-j-1 > 0 && y+i+1 < 9 && parentBoard->getBox(x-j-1, y+i+1) == 0)
return true;
}
}
for(int i = 1, j = 1; x + j < 9 && y - i > 0; i++, j++){
if (parentBoard->getBox(x+j, y-i) == kind || parentBoard->getBox(x+j, y-i) == kind*6) break;
if (parentBoard->getBox(x+j, y-i) == kind*(-1) || parentBoard->getBox(x+j, y-i) == kind*6*(-1)){
if (x+j+1 < 9 && y-i-1 > 0 && parentBoard->getBox(x+j+1, y-i-1) == 0)
return true;
}
}
for(int i = 1, j = 1; x - j > 0 && y - i > 0; i++, j++){
if (parentBoard->getBox(x-j, y-i) == kind || parentBoard->getBox(x-j, y-i) == kind*6) break;
if (parentBoard->getBox(x-j, y-i) == kind*(-1) || parentBoard->getBox(x-j, y-i) == kind*6*(-1)){
if (x-j-1 > 0 && y-i-1 > 0 && parentBoard->getBox(x-j-1, y-i-1) == 0)
return true;
}
}
return false;
}
FOR WHITE
for (int i = 8; i > 0; i--){
for (int j = 1; j < 9; j++){
if (!(i+j)%2 && gBoard.getBox(j, i) == -1){
if (j - 1 > 0 && i + 1 < 9 && gBoard.getBox(j - 1, i + 1) == 0)
pMoves.push_back(new move(QPoint(j, i), QPoint(j-1, i+1), kind));
if (j + 1 < 9 && i + 1 < 9 && gBoard.getBox(j + 1, i + 1) == 0)
pMoves.push_back(new move(QPoint(j, i), QPoint(j+1, i+1), kind));
}
}
}
void MainWindow::paintEvent(QPaintEvent *)
{
QPainter paint1(this);
paint1.setPen(Qt::NoPen);
paint1.setBrush(Qt::SolidPattern);
paint1.setBrush(QColor(255, 255, 255));
paint1.drawRect(QRect(15, 50, 320, 320));
paint1.setBrush(QColor(0, 151, 0));
for (int i = 0; i < 8; i++){
for (int j = 0; j < 8; j++){
if ((i+j)%2){
paint1.drawRect(QRect((j%8)*40+15, (i%8)*40+50, 40, 40));
}
}
}
//QPixmap pix("D:\\Programming\\prg\\Educational tasks\\MenuBar\\res\\piece_b.bmp");
//paint1.drawPixmap(pis->getX(), pis->getY(), pis->pixmap());
//pis->paint(&paint1, NULL, this);
}
bool MainWindow::chkForMovJmp(int k)
{
for (int i = 8; i > 0; i--){
for (int j = 1; j < 9; j++){
if (!((i+j)%2) && board->getBox(j, i) == 1*k*6){
if (chkForKMov(j, i, k)) return true;
}
if (!((i+j)%2) && board->getBox(j, i) == 1*k){
if (j - 1 > 0 && i - 1*k > 0 && i - 1*k < 9 && board->getBox(j - 1, i - 1*k) == 0)
return true;
if (j + 1 < 9 && i - 1*k > 0 && i - 1*k < 9 && board->getBox(j + 1, i - 1*k) == 0)
return true;
}
}
}
for (int i = 8; i > 0; i--){
for (int j = 1; j < 9; j++){
if (!((i+j)%2) && board->getBox(j, i) == 1*k*6){
if (chkForKJmp(j, i, k)) return true;
}
if (!((i+j)%2) && board->getBox(j, i) == 1*k){
if (j - 2 > 0 && i - 2*k > 0 && i - 2*k < 9 && board->getBox(j - 2, i - 2*k) == 0 && (board->getBox(j - 1, i - 1*k) == (-1)*k || board->getBox(j - 1, i - 1*k) == (-1)*k*6))
return true;
if (j + 2 < 9 && i - 2*k > 0 && i - 2*k < 9 && board->getBox(j + 2, i - 2*k) == 0 && (board->getBox(j + 1, i - 1*k) == (-1)*k || board->getBox(j - 1, i - 1*k) == (-1)*k*6))
return true;
}
}
}
return false;
}
bool MainWindow::chkForKMov(int x, int y, int k)
{
if (x+1 < 9 && y+1 < 9 && board->getBox(x+1, y+1) == 0) return true;
if (x-1 > 0 && y+1 < 9 && board->getBox(x-1, y+1) == 0) return true;
if (x+1 < 9 && y-1 > 0 && board->getBox(x+1, y-1) == 0) return true;
if (x-1 > 0 && y-1 > 0 && board->getBox(x-1, y-1) == 0) return true;
return false;
}
bool MainWindow::chkForKJmp(int x, int y, int k)
{
for(int i = 1, j = 1; x + j < 9 && y + i < 9; i++, j++){
if (board->getBox(x+j, y+i) == k || board->getBox(x+j, y+i) == k*6) break;
if (board->getBox(x+j, y+i) == k*(-1) || board->getBox(x+j, y+i) == k*6*(-1)){
if (x+j+1 < 9 && y+i+1 < 9 && board->getBox(x+j+1, y+i+1) == 0)
return true;
}
}
for(int i = 1, j = 1; x - j > 0 && y + i < 9; i++, j++){
if (board->getBox(x-j, y+i) == k || board->getBox(x-j, y+i) == k*6) break;
if (board->getBox(x-j, y+i) == k*(-1) || board->getBox(x-j, y+i) == k*6*(-1)){
if (x-j-1 > 0 && y+i+1 < 9 && board->getBox(x-j-1, y+i+1) == 0)
return true;
}
}
for(int i = 1, j = 1; x + j < 9 && y - i > 0; i++, j++){
if (board->getBox(x+j, y-i) == k || board->getBox(x+j, y-i) == k*6) break;
if (board->getBox(x+j, y-i) == k*(-1) || board->getBox(x+j, y-i) == k*6*(-1)){
if (x+j+1 < 9 && y-i-1 > 0 && board->getBox(x+j+1, y-i-1) == 0)
return true;
}
}
for(int i = 1, j = 1; x - j > 0 && y - i > 0; i++, j++){
if (board->getBox(x-j, y-i) == k || board->getBox(x-j, y-i) == k*6) break;
if (board->getBox(x-j, y-i) == k*(-1) || board->getBox(x-j, y-i) == k*6*(-1)){
if (x-j-1 > 0 && y-i-1 > 0 && board->getBox(x-j-1, y-i-1) == 0)
return true;
}
}
return false;
}
//if (vsPC) {
wPiece[i]->setPlayPiece(true);
//}
//else {
// wPiece[i]->setPlayPiece(false);
//}
*/
|
efe1b02ae22287c209cf08221086675535aa14b5 | dd80a584130ef1a0333429ba76c1cee0eb40df73 | /external/chromium/chrome/browser/policy/policy_map.cc | 50c8c429f5824cac3d098ed9c8ac12f0843860c1 | [
"MIT",
"BSD-3-Clause"
] | permissive | karunmatharu/Android-4.4-Pay-by-Data | 466f4e169ede13c5835424c78e8c30ce58f885c1 | fcb778e92d4aad525ef7a995660580f948d40bc9 | refs/heads/master | 2021-03-24T13:33:01.721868 | 2017-02-18T17:48:49 | 2017-02-18T17:48:49 | 81,847,777 | 0 | 2 | MIT | 2020-03-09T00:02:12 | 2017-02-13T16:47:00 | null | UTF-8 | C++ | false | false | 1,699 | cc | policy_map.cc | // Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/policy/policy_map.h"
#include <algorithm>
#include "base/stl_util-inl.h"
namespace policy {
PolicyMap::PolicyMap() {
}
PolicyMap::~PolicyMap() {
Clear();
}
const Value* PolicyMap::Get(ConfigurationPolicyType policy) const {
PolicyMapType::const_iterator entry = map_.find(policy);
return entry == map_.end() ? NULL : entry->second;
}
void PolicyMap::Set(ConfigurationPolicyType policy, Value* value) {
std::swap(map_[policy], value);
delete value;
}
void PolicyMap::Erase(ConfigurationPolicyType policy) {
const const_iterator entry = map_.find(policy);
if (entry != map_.end()) {
delete entry->second;
map_.erase(entry->first);
}
}
void PolicyMap::Swap(PolicyMap* other) {
map_.swap(other->map_);
}
bool PolicyMap::Equals(const PolicyMap& other) const {
return other.map_.size() == map_.size() &&
std::equal(map_.begin(), map_.end(), other.map_.begin(), MapEntryEquals);
}
bool PolicyMap::empty() const {
return map_.empty();
}
size_t PolicyMap::size() const {
return map_.size();
}
PolicyMap::const_iterator PolicyMap::begin() const {
return map_.begin();
}
PolicyMap::const_iterator PolicyMap::end() const {
return map_.end();
}
void PolicyMap::Clear() {
STLDeleteValues(&map_);
}
// static
bool PolicyMap::MapEntryEquals(const PolicyMap::PolicyMapType::value_type& a,
const PolicyMap::PolicyMapType::value_type& b) {
return a.first == b.first && Value::Equals(a.second, b.second);
}
} // namespace policy
|
1f4c05186ed9a39f75e3650e01f100bd5c269808 | c86d23356ebbd946038a70f681017a917ed9ca9b | /question21.cpp | c85503d527352507e3ba908a3b2e0d64c8b8e869 | [] | no_license | premnigamkar/lab-3 | fa621d10049efd485d66158080a49680b5ebd151 | a1701e5c7fb754eb427b3992cc6463946e77bd98 | refs/heads/master | 2021-06-30T06:46:12.904324 | 2017-09-15T14:34:36 | 2017-09-15T14:34:36 | 103,666,265 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 411 | cpp | question21.cpp | #include <iostream>
using namespace std;
int main() {
int u=0,a=0,surch=0,tot=0;
cout<<"Enter the units of electricity consumed";
cin>>u;
if(u<=50)
a=u*0.50;
else if(u<=150)
a=25+((u-50)*0.75);
else if(u<=250)
a=100+((u-150)*1.2);
else
a=220+((u-250)*1.5);
surch=a*0.2;
tot=a+surch;
cout<<"The electricity bill is "<<tot;
return 0;
}
|
0323de26bb3c19532b6d474bbd99f1ee7e79be1b | c777995b830c5b01b1ca7db74098666c959e6c37 | /CmdParseApp/KeyEdit.cpp | d0eb342b1f751e2ad2965181bf268009853f1d2f | [] | no_license | mbox54/CmdParseApp | 870020cec4513a888ad660e13f8cd9f358144a29 | 20e0bdcc82c92441e9affea6609b758550c9452a | refs/heads/master | 2020-07-02T03:03:30.468817 | 2019-08-15T10:36:40 | 2019-08-15T10:36:40 | 201,395,653 | 0 | 0 | null | null | null | null | WINDOWS-1251 | C++ | false | false | 1,583 | cpp | KeyEdit.cpp | // KeyEdit.cpp
// implementation file
#include "pch.h"
#include "framework.h"
#include "CmdParseApp.h"
#include "CmdParseDlg.h"
#include "KeyEdit.h"
////////////////////////////////////////////////////////////////////////////////
// CKeyEdit
////////////////////////////////////////////////////////////////////////////////
IMPLEMENT_DYNAMIC(CKeyEdit, CEdit)
CKeyEdit::CKeyEdit()
{
}
CKeyEdit::~CKeyEdit()
{
}
////////////////////////////////////////////////////////////////////////////////
// MESSAGE_MAP
////////////////////////////////////////////////////////////////////////////////
BEGIN_MESSAGE_MAP(CKeyEdit, CEdit)
ON_WM_CHAR()
ON_WM_KEYDOWN()
END_MESSAGE_MAP()
////////////////////////////////////////////////////////////////////////////////
// CKeyEdit message handlers
void CKeyEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
if (nChar == VK_RETURN)
return;
CEdit::OnChar(nChar, nRepCnt, nFlags);
}
void CKeyEdit::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
if (nChar == VK_RETURN)
{
// Предполагаем, что родительское окно эдит-бокса -
// диалог класса CVCPThreadDlg, который имеет буфер хранения
// введенного текста m_strCommand типа CString.
CCmdParseDlg* pDlg = (CCmdParseDlg*)GetParent();
//GetWindowText(pDlg->m_strCommand);
pDlg->ExecuteCommand();
//pDlg->GetNextDlgTabItem(this)->SetFocus();
return; // запрет обработки по-умолчанию
}
CEdit::OnKeyDown(nChar, nRepCnt, nFlags);
}
|
0bdd75fa5e9be7ef7c7cb7169f6b82dfce4c0c74 | 264cdb545bf88feb772864f447f7c577e27d2b21 | /Vjudge/kuangbin/2/HDU-1043.cpp | 6378ebc0fe2f7d18e834f163acd045cc0ab52826 | [] | no_license | youngle37/ACM | b36c9d987f1047a50e6ff279f2ad78f9aa6b6c33 | f6b5ba887b1411fbb52b898225abda760f741dda | refs/heads/master | 2022-08-19T15:21:34.708476 | 2022-08-14T19:28:17 | 2022-08-14T19:28:17 | 89,566,936 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,855 | cpp | HDU-1043.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#define x first
#define y second
using namespace std;
struct Node {
int s[9];
int cur; // 目前 x 位置
int n; // 康托展開值 (hash)
} state;
int fac[9] = {1, 1, 2, 6, 24, 120, 720, 5040, 40320};
int endState[9] = {1, 2, 3, 4, 5, 6, 7, 8, 0};
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};
char p1[4] = {'d', 'u', 'r', 'l'};
char p2[4] = {'u', 'd', 'l', 'r'};
int vis1[362885], vis2[362885]; // 9! = 362880
string path[362885];
int getReverseOrderNum(){
int num = 0;
for(int i=0; i<8; i++){
if(state.s[i]){
for(int j=i+1; j<9; j++)
if(state.s[j] < state.s[i] && state.s[j])
num++;
}
}
return num;
}
int cantor(int *s){
int sum = 1;
for(int i=0; i<8; i++){
int k = 0;
for(int j=i+1; j<9; j++)
if(s[j] < s[i]) k++;
sum += k * fac[8 - i];
}
return sum;
}
void dbfs(){
memset(vis1, 0, sizeof(vis1));
memset(vis2, 0, sizeof(vis2));
queue<Node> q1, q2;
state.n = cantor(state.s);
q1.push(state);
vis1[state.n] = 1;
path[state.n] = "";
Node end;
memcpy(end.s, endState, sizeof(end.s));
end.cur = 8;
end.n = cantor(end.s);
q2.push(end);
vis2[end.n] = 1;
path[end.n] = "";
while(q1.size() || q2.size()){
Node cur1 = q1.front();
q1.pop();
int x1 = cur1.cur / 3;
int y1 = cur1.cur % 3;
for(int i=0; i<4; i++){
int nx = x1 + dx[i];
int ny = y1 + dy[i];
if(nx < 0 || ny < 0 || nx > 2 || ny > 2) continue;
Node tmp = cur1;
tmp.cur = nx*3 + ny;
swap(tmp.s[tmp.cur], tmp.s[cur1.cur]);
tmp.n = cantor(tmp.s);
if(vis2[tmp.n]){
reverse(path[tmp.n].begin(), path[tmp.n].end());
cout << path[cur1.n] << p1[i] << path[tmp.n] << '\n';
return;
}
if(!vis1[tmp.n]){
vis1[tmp.n] = 1;
path[tmp.n] = path[cur1.n];
path[tmp.n] += p1[i];
q1.push(tmp);
}
}
Node cur2 = q2.front();
q2.pop();
int x2 = cur2.cur / 3;
int y2 = cur2.cur % 3;
for(int i=0; i<4; i++){
int nx = x2 + dx[i];
int ny = y2 + dy[i];
if(nx < 0 || ny < 0 || nx > 2 || ny > 2) continue;
Node tmp = cur2;
tmp.cur = nx*3 + ny;
swap(tmp.s[tmp.cur], tmp.s[cur2.cur]);
tmp.n = cantor(tmp.s);
if(vis1[tmp.n]){
reverse(path[cur2.n].begin(), path[cur2.n].end());
cout << path[tmp.n] << p2[i] << path[cur2.n] << '\n';
return;
}
if(!vis2[tmp.n]){
vis2[tmp.n] = 1;
path[tmp.n] = path[cur2.n];
path[tmp.n] += p2[i];
q2.push(tmp);
}
}
}
}
int main(){
ios::sync_with_stdio(false);
string line;
while(getline(cin, line, '\n')){
istringstream SI(line);
char c;
int cnt = 0;
while(SI >> c){
if(c == 'x'){
state.s[cnt] = 0;
state.cur = cnt++;
} else {
state.s[cnt++] = c - '0';
}
}
// 檢查逆序數 (忽略 x)
// 由於目標狀態 (12345678) 為偶,因此當前狀態也應為偶
// 否則無解
// 證明:https://blog.csdn.net/tailzhou/article/details/3002442
if(getReverseOrderNum() & 1)
cout << "unsolvable\n";
else
dbfs(); // 雙向 BFS
}
return 0;
}
|
f7b1b07843a215a6b3a5944456b5d2f774c70bf9 | 0deeaaed18f11b60908135964758dd715434e92c | /ctp2_code/gs/utility/DiplDynArr.h | df6662614ec67d0990e22df1f5f9e47642da7f8b | [] | no_license | civctp2/civctp2 | 0a8deaf7f525cfff2ec5bab99f015b0ba52cf11b | 67532c1338ad8c0f8e943a6e04633782543fa06a | refs/heads/master | 2023-09-04T12:44:38.436220 | 2020-09-27T15:05:43 | 2023-03-02T02:31:57 | 152,506,474 | 66 | 22 | null | 2023-09-03T21:20:51 | 2018-10-11T00:20:01 | C++ | UTF-8 | C++ | false | false | 464 | h | DiplDynArr.h | #ifdef HAVE_PRAGMA_ONCE
#pragma once
#endif
#ifndef __DIPLOMATICREQUEST_DYNAMIC_ARRAY_H__
#define __DIPLOMATICREQUEST_DYNAMIC_ARRAY_H__
#include "DiplomaticRequest.h"
#include "dynarr.h"
class DiplomaticRequestDynamicArray : public DynamicArray<DiplomaticRequest> {
public:
DiplomaticRequestDynamicArray();
DiplomaticRequestDynamicArray(const sint32 size);
DiplomaticRequestDynamicArray (const DynamicArray<DiplomaticRequest> ©me);
};
#endif
|
e6ce33a3e9235ea3a706b7353086198097707b28 | d8cca1c4a2b8beaf162dd7da4f97e3b3d08fcbdf | /examples/processglobalfitting/globalfitfunction.cpp | d38dff092f85b1faa52afb2f9ab960cb821175ff | [] | no_license | andyfaff/libgencurvefit | 0e570f341ba48eb17ed3733d7d8f3c401b4a2006 | 36d9840d172f2ea6ee23c61355dd4046afc93c64 | refs/heads/master | 2021-01-20T17:42:38.374517 | 2018-05-24T04:49:50 | 2018-05-24T04:49:50 | 61,265,962 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 38 | cpp | globalfitfunction.cpp | ../globalfitting/globalfitfunction.cpp |
612bf1d00ef2b056e395dc9fb62303193c5ad04d | d04fb2e7f3739373fc9765771c8d0cceb32a4fe6 | /sketches/bluetooth/sketch_jan22a-BT_Test_01/sketch_jan22a-BT_Test_01.ino | 27b5898812bf8c8cbe546fa9d9617dfa9c29712c | [] | no_license | disanben/arduino_rem | e5c69ea4e6a9d49f364e91e17d4394e7f764b8bf | c66cac05fbe727a90174f223ac2ec3d355718618 | refs/heads/master | 2020-04-26T09:35:49.042181 | 2019-03-26T17:02:14 | 2019-03-26T17:02:14 | 173,461,372 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,082 | ino | sketch_jan22a-BT_Test_01.ino | //Code begin here
#include <SoftwareSerial.h>
SoftwareSerial BT(10,11); //RX, TX rispettivamente
String state; //Memorizza messaggi da bluetooth
void setup(){
pinMode(13, OUTPUT); //Led connesso al pin 13
pinMode(10, INPUT);
pinMode(11, OUTPUT);
BT.begin (9600); //Bluetooth serial prenderà i pin 10 e 11
Serial.begin(9600); //Serial communication con il monitor seriale
}
void loop(){
//Verifica se c'e' qualcosa da leggere nel BlueTooth
//Serial.print("Sono nel loop ");
while (BT.available()){
Serial.print("Just arrived: ");
delay(10); //Delay added to make thing stable
char c = BT.read(); //Lettura seriale
Serial.println(c);
state += c; //Costruisce la stringa ON o OFF
}
if(state.length()>0){
Serial.println(state);
if(state == "ON"){
digitalWrite(13, HIGH);
BT.print("Luce Accesa");
Serial.println("Luce Accesa");
}
else if(state == "OFF"){
digitalWrite(13, LOW);
BT.print("Luce Spenta");
Serial.println("Luce Spenta");
}
state="";
}
}
//Fine del codice
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.