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
0b8c561dc4d34b7b2236879e070ac68a9eed5c6e
dec0718a64314acd8a2bedaeff43a90db6ef9172
/src/User Code/FrigateBSphere.cpp
6beb61faea60d111186ec3a961535a80781f1d89
[ "MIT" ]
permissive
anunez97/fergilnad-game-engine
148a0763365bd6e732cc968fa0d5bffccd2945e0
75528633d32aed41223e0f52d8d7715073d9210a
refs/heads/main
2023-02-08T10:38:41.950808
2020-12-30T08:51:56
2020-12-30T08:51:56
325,496,306
1
0
null
null
null
null
UTF-8
C++
false
false
918
cpp
FrigateBSphere.cpp
#include "FrigateBSphere.h" #include "ModelManager.h" #include "ShaderManager.h" #include "SceneManager.h" #include "Scene.h" FrigateBSphere::FrigateBSphere() :BsphereToggle(false) { pBSphereModel = ModelManager::Get("Sphere"); pBSphereShader = ShaderManager::Get("ColorConstant"); BSphereColor = Vect(0.0f, 0.0f, 1.0f, 1.0f); pSpaceShip_BSphere = new GraphicsObject_WireframeConstantColor(pBSphereModel, pBSphereShader, BSphereColor); Drawable::SubmitDrawRegistration(); } void FrigateBSphere::Draw() { pSpaceShip_BSphere->Render(SceneManager::GetCurrentScene()->GetCurrentCamera()); } void FrigateBSphere::SetWorld(Matrix world) { pSpaceShip_BSphere->SetWorld(world); } void FrigateBSphere::SetToggle(bool toggle) { BsphereToggle = toggle; } FrigateBSphere::~FrigateBSphere() { DebugMsg::out("Frigate Bounding Sphere destructor\n"); delete pSpaceShip_BSphere; }
77579a41a8b15b5fcc85fdfb0de9c5b1ca29e1c3
aba0bd335fea1859f12636ea2a13d110ad1a5bc4
/03_increasing_order_search_tree.cpp
12321c768cfc0c24cdebc9ef1ad235f7cdba2b60
[]
no_license
jishnupramod/leetcode-december-challenge
e509d242e05c7705300a8c782d5b33910b52debd
20d65d1409e5b6689e13817731f3f1dea46910b5
refs/heads/master
2023-02-09T02:00:54.195767
2021-01-02T06:10:54
2021-01-02T06:10:54
317,488,193
0
0
null
null
null
null
UTF-8
C++
false
false
2,168
cpp
03_increasing_order_search_tree.cpp
/* Given the root of a binary search tree, rearrange the tree in in-order so that the leftmost node in the tree is now the root of the tree, and every node has no left child and only one right child. Example 1: Input: root = [5,3,6,2,4,null,8,1,null,null,null,7,9] Output: [1,null,2,null,3,null,4,null,5,null,6,null,7,null,8,null,9] Example 2: Input: root = [5,1,7] Output: [1,null,5,null,7] Constraints: The number of nodes in the given tree will be in the range [1, 100]. 0 <= Node.val <= 1000 */ /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode() : val(0), left(nullptr), right(nullptr) {} * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {} * TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {} * }; */ class Solution { private: TreeNode* newRoot = new TreeNode(-1); TreeNode* temp = newRoot; void inorder(TreeNode* root) { if (!root) return; inorder(root->left); newRoot->right = new TreeNode(root->val); newRoot = newRoot->right; inorder(root->right); } public: TreeNode* increasingBST(TreeNode* root) { inorder(root); return temp->right; } }; // O(H) - Recursive stack space complexity solution - Relinking the BST nodes /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode() : val(0), left(nullptr), right(nullptr) {} * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {} * TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {} * }; */ class Solution { private: TreeNode* curr; void inorder(TreeNode* root) { if (!root) return; inorder(root->left); root->left = nullptr; curr->right = root; curr = curr->right; inorder(root->right); } public: TreeNode* increasingBST(TreeNode* root) { TreeNode* ans = new TreeNode(-1); curr = ans; inorder(root); return ans->right; } };
ae4d7d5f68b652212297d49273c391160a43b9c4
dad2886c292238399545efa43bbfc124920b0750
/NetworkedGame/NetworkLibrary/Client.h
782c9463776dfc89b8c3628beda33137193b7673
[]
no_license
CKeddie/SFML
b770814aa1658441992199cc327d64066955d92d
e218df50511697936c383808bbfd4318ebac051e
refs/heads/master
2021-08-19T16:37:11.318522
2017-11-26T23:58:42
2017-11-26T23:58:42
107,399,969
0
0
null
2017-11-26T23:58:42
2017-10-18T11:40:32
HTML
UTF-8
C++
false
false
855
h
Client.h
#pragma once #include "IObserver.h" #include <SFML/System/Vector2.hpp> #include <SFML/Network.hpp> #include <string> #include <vector> #include <memory> #include <string> #include <iostream> class Client { public: Client(sf::TcpSocket * socket, sf::Int32 id); ~Client(); sf::Int32 GetID() { return _id; } void SetName(const std::string name) { _name = name; } std::string GetName() { return _name; } sf::TcpSocket * GetTcpSocket() { return _tcp_socket; }; sf::UdpSocket * GetUdpSocket() { return _udp_socket; }; sf::IpAddress GetAddress() { return _tcp_socket->getRemoteAddress(); } void SetTimeout(sf::Time time) { _timeout = time; } sf::Time GetTimeout() { return _timeout; } protected: sf::Int32 _id = 0; sf::Int32 _authority = 1; std::string _name; sf::TcpSocket * _tcp_socket; sf::UdpSocket * _udp_socket; sf::Time _timeout; };
4f2647aa3f726672b1f2cad313ad40776e7fe98b
aab49f04e01a3f248ce5adb0d65088bc921fb380
/1.Introduction-to-Programming-Practice/week-13/70-fill-diagonals.cpp
ac23944d8de1e26d62b4a99d509bdafebb8e9309
[]
no_license
gyokkoo/Introduction-to-Programming-FMI-2017
bb8983c159cf802cf3b9b533e503a3dceaf24b4a
6a467f894991d69c6a06cd36309b600d46e91a93
refs/heads/master
2023-06-14T10:27:10.622804
2021-07-07T16:37:41
2021-07-07T16:37:41
107,156,320
2
0
null
null
null
null
UTF-8
C++
false
false
733
cpp
70-fill-diagonals.cpp
/** * * Solution to exercises * Introduction to programming course * Faculty of Mathematics and Informatics of Sofia University * Winter semester 2017/2018 * * @author Gyokan Syuleymanov * @idnumber 62117 * @task 70 * @compiler GCC * */ #include <iostream> const int MAX_LENGTH = 100; int main() { int n = 10; int matrix[MAX_LENGTH][MAX_LENGTH]; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { if (i == j || i + j == n - 1) { matrix[i][j] = 1; } else { matrix[i][j] = 0; } std::cout << matrix[i][j] << " "; } std::cout << "\n"; } return 0; }
df863cc6c1de4dc4d67b8930bef26f9c9e0798ae
784358115aa144b04b6f18f3d112ffa53d973563
/Sandbox/src/Test.cpp
9731f2a7c1ecfdff5f817a92487e727f580d67c6
[]
no_license
ShingenTakeda/SFMLExamples
899b713fe910de33255c908acf4cd5f91eda343d
7285a4b2a6888623d94d95442028219471d662b0
refs/heads/master
2022-04-16T14:31:30.139296
2020-04-12T05:01:00
2020-04-12T05:01:00
254,989,749
0
0
null
null
null
null
UTF-8
C++
false
false
88
cpp
Test.cpp
#include "Test.hpp" void Test::Message() { std::cout<<"Window closed"<<std::endl; }
dff0eb0cc92acfcdf1696431f9d7a2ba8a065f74
34b1d716043a31509647023d2f23ff0b83b5c004
/SW/Reader/v1/src/main.cpp
b1e97acba1066286dca6fbc6ff4eb4a9f1258648
[]
no_license
diffstorm/WiFiMifareReader
352196de44d436ca2ac7b6f581592ca20877917f
b29736e66a0be9f888177a50a9be840e2dcb311c
refs/heads/master
2023-06-07T08:34:02.136697
2020-05-03T15:24:00
2020-05-03T15:24:00
244,669,622
0
0
null
null
null
null
UTF-8
C++
false
false
978
cpp
main.cpp
#include <ESP8266WiFi.h> #include <FS.h> #include "Reader.h" #include "Buzzer.h" #include "IR.h" #include "tools.h" #include "FileSystem.h" #include "whitelist.h" extern "C" { #include "user_interface.h" #include <espnow.h> } RF_PRE_INIT() { system_phy_set_powerup_option(31); // Do full RF calibration on power-up system_phy_set_max_tpw(82); // Set max TX power } inline void SetupBoard() { pinMode(15, OUTPUT); } void setup() { #ifdef WDT ESP.wdtDisable(); ESP.wdtEnable(WDTO_8S); #endif #ifdef SERIAL_PORT Serial.begin(115200); Serial.setDebugOutput(true); Serial.flush(); #endif LOG_Init(115200); Reader_Init(); #ifdef IR_CARD_DETECT IR_Init(); #endif BZR_Init(); #ifdef SERIAL_PORT WiFi.printDiag(Serial); system_show_malloc(); #endif LOGp("Testing %d and %f also %s", 123, 12.3, "this"); } void loop() { #ifdef WDT ESP.wdtFeed(); #endif }
896b73ddbc7e50965a65b18dada1a5342db0b227
4f10ad722fa52e085f53112f9c914381cf19baab
/modules/path/src/prepare_main.cc
86e24fc4146629ccb491838ea36a6760ea44ed00
[ "MIT", "Apache-2.0" ]
permissive
motis-project/motis
47d4bc8b784b542cef083bcde7e2e47e80c04565
55fec7085b4fabf29d49ae060bfd14959d24a952
refs/heads/master
2023-08-31T07:01:20.217618
2023-08-20T13:15:49
2023-08-20T13:15:49
255,657,224
126
46
MIT
2023-09-04T15:39:07
2020-04-14T16:05:37
C++
UTF-8
C++
false
false
1,229
cc
prepare_main.cc
#include <iostream> #include "conf/options_parser.h" #include "utl/progress_tracker.h" #include "motis/core/common/logging.h" #include "motis/path/prepare/prepare.h" #include "version.h" namespace m = motis; namespace mp = motis::path; namespace ml = motis::logging; int main(int argc, char const** argv) { try { mp::prepare_settings opt; try { conf::options_parser parser({&opt}); parser.read_command_line_args(argc, argv, false); if (parser.help()) { std::cout << "\n\tpath-prepare (v" << m::short_version() << ")\n\n"; parser.print_help(std::cout); return 0; } else if (parser.version()) { std::cout << "path-prepare (v" << m::long_version() << ")\n"; return 0; } parser.read_configuration_file(false); parser.print_used(std::cout); } catch (std::exception const& e) { LOG(ml::emrg) << "options error: " << e.what(); return 1; } utl::activate_progress_tracker("path"); mp::prepare(opt); return 0; } catch (std::exception const& e) { LOG(ml::emrg) << "exception caught: " << e.what(); return 1; } catch (...) { LOG(ml::emrg) << "unknown exception caught"; return 1; } }
a5891f787cfc7b0bc13974ff34c3120cb7999239
4dde61c749d1228f0b82640de5f5b9edb74c2ab9
/tests/changeline_test.h
c103f892b521dad54269c7d12e0ae1a7e05dd20a
[]
no_license
UgryumovM/TestingTwo
488478b7a65981eabe8703a25c5ac3f6069ec223
6b4c143cffc689dc033ef3b641e36bf607dd32bf
refs/heads/master
2022-10-03T11:13:02.784728
2020-06-03T10:34:17
2020-06-03T10:34:17
260,162,989
0
0
null
null
null
null
UTF-8
C++
false
false
1,215
h
changeline_test.h
#ifndef CHANGELINE_TEST_H #define CHANGELINE_TEST_H #include <gtest/gtest.h> #include <gmock/gmock-matchers.h> #include <fstream> #include "func.h" /* using namespace testing; */ extern "C++" { #include "text/_text.h" #include "text/text.h" #include "common.h" } TEST(clTest, Pos){ string inputs = "sample text 2\nsample text\ns a m p l e\nt e x t 3\n\ns\n4\0"; text txt = create_text(); input(txt); m(txt, 1, 0); cn(txt); save(txt, "Poutput"); string poside; std::ifstream f("Poutput"); std::string fileo; poside.assign( (std::istreambuf_iterator<char>(f) ), (std::istreambuf_iterator<char>() ) ); ASSERT_EQ(inputs, poside); } TEST(clTest, Neg){ text txt = create_text(); input(txt); string inputs; inputs = "sample text\nsample text 2\ns a m p l e\nt e x t 3\n\ns\n4\0"; m(txt,10,0); cn(txt); save(txt, "negout"); string negide; std::ifstream f("negout"); std::string fileo; negide.assign( (std::istreambuf_iterator<char>(f) ), (std::istreambuf_iterator<char>() ) ); ASSERT_EQ(negide, inputs); } #endif // CHANGELINE_TEST_H
fa4b263427898f6d0de85e33a14e4001577ee154
7efe08063fd383640455cc709ef04c889b8ebc42
/src/libmw/test/tests/models/crypto/Test_BigInteger.cpp
70753fe81ae313283f172864e9d845c76bbb7faa
[ "MIT" ]
permissive
litecoin-project/litecoin
0d55434c63e41409f3c69b43199a9cb6bd256a83
5ac781487cc9589131437b23c69829f04002b97e
refs/heads/master
2023-09-05T21:38:55.634991
2023-04-24T04:08:34
2023-05-12T06:47:49
4,646,198
4,040
4,600
MIT
2023-07-29T19:58:50
2012-06-13T04:18:26
C++
UTF-8
C++
false
false
2,126
cpp
Test_BigInteger.cpp
// Copyright (c) 2021 The Litecoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include <mw/models/crypto/BigInteger.h> #include <test_framework/TestMWEB.h> BOOST_FIXTURE_TEST_SUITE(TestBigInt, MWEBTestingSetup) BOOST_AUTO_TEST_CASE(BigIntTest) { BigInt<8> bigInt1 = BigInt<8>::FromHex("0123456789AbCdEf"); BOOST_REQUIRE(bigInt1.ToHex() == "0123456789abcdef"); BOOST_REQUIRE(bigInt1.size() == 8); BOOST_REQUIRE(!bigInt1.IsZero()); BOOST_REQUIRE(BigInt<8>().IsZero()); BOOST_REQUIRE(bigInt1.vec() == std::vector<uint8_t>({ 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef })); BOOST_REQUIRE((bigInt1.ToArray() == std::array<uint8_t, 8>({ 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }))); BigInt<4> bigInt2 = BigInt<4>::Max(); BOOST_REQUIRE(bigInt2.ToHex() == "ffffffff"); BigInt<8> bigInt3 = BigInt<8>::ValueOf(12); BOOST_REQUIRE(bigInt3.ToHex() == "000000000000000c"); BOOST_REQUIRE(bigInt1[3] == 0x67); BOOST_REQUIRE(bigInt1 > bigInt3); BOOST_REQUIRE(!(bigInt1 < bigInt3)); BOOST_REQUIRE(!(bigInt1 < bigInt1)); BOOST_REQUIRE(!(bigInt1 > bigInt1)); BOOST_REQUIRE(bigInt1 >= bigInt1); BOOST_REQUIRE(bigInt1 <= bigInt1); BOOST_REQUIRE(bigInt1 == bigInt1); BOOST_REQUIRE(!(bigInt1 != bigInt1)); BigInt<8> bigInt4 = bigInt1; BOOST_REQUIRE(bigInt1 == bigInt4); BOOST_REQUIRE(bigInt1 != bigInt3); BigInt<8> bigInt5 = bigInt1.vec(); BOOST_REQUIRE(bigInt1 == bigInt5); bigInt5 = bigInt1.ToArray(); BOOST_REQUIRE(bigInt1 == bigInt5); bigInt5 = BigInt<8>(bigInt1.data()); BOOST_REQUIRE(bigInt1 == bigInt5); BOOST_REQUIRE((bigInt1 ^ bigInt3).ToHex() == "0123456789abcde3"); bigInt1 ^= bigInt3; BOOST_REQUIRE(bigInt1.ToHex() == "0123456789abcde3"); bigInt1 ^= bigInt3; BOOST_REQUIRE(bigInt1.ToHex() == "0123456789abcdef"); std::vector<uint8_t> serialized = bigInt1.Serialized(); BOOST_REQUIRE(bigInt1 == BigInt<8>::Deserialize(serialized)); } BOOST_AUTO_TEST_SUITE_END()
4ee048f2fb9d37c0bab66ad4fa39b9aa7369032a
d5d1448c21d47bbf96ee9ac9fadf1533c4e14152
/Tut5-Poly/Rectangle.cpp
8bb4a69e3eb14cc3f64125f2388f08569845957f
[]
no_license
mrmakhura/Tut-5
182aa9565099fe0fa47ce159e4e9dd589653cb66
e4fe3dcfe51562c0e08a7f8d65f4575e43c4585f
refs/heads/master
2020-06-01T18:18:16.109918
2015-04-28T11:56:03
2015-04-28T11:56:03
34,727,098
0
0
null
null
null
null
UTF-8
C++
false
false
711
cpp
Rectangle.cpp
#include <iostream> #include <string> #include<iomanip> #include "Rectangle.h" using namespace std; Rectangle::Rectangle() { height = 10; base = 25; } void Rectangle::name() const { cout << "This Shape is Called A Rectangle ..."<<endl; } float Rectangle::perimeter() { return(2 * base + 2 * height); } float Rectangle::area() { return(base*height); } void Rectangle :: setHB(float b, float h) { base = b; height = h; } void Rectangle::draw() const { cout << " *******************" << endl; cout << " * *" << endl; cout << " * *" << endl; cout << " * *" << endl; cout << " * *" << endl; cout << " *******************" << endl; }
7b5ef7c7f803fb1ada4abb78c5fe9fbfe32c009a
189f52bf5454e724d5acc97a2fa000ea54d0e102
/combustion/ras/moriyoshiHomogeneous/0.0014/nut
cdf15c8bf59164bdee8b7b7574ba4258b13d78f3
[]
no_license
pyotr777/openfoam_samples
5399721dd2ef57545ffce68215d09c49ebfe749d
79c70ac5795decff086dd16637d2d063fde6ed0d
refs/heads/master
2021-01-12T16:52:18.126648
2016-11-05T08:30:29
2016-11-05T08:30:29
71,456,654
0
0
null
null
null
null
UTF-8
C++
false
false
30,394
nut
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: v1606+ | | \\ / A nd | Web: www.OpenFOAM.com | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volScalarField; location "0.0014"; object nut; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 2 -1 0 0 0 0]; internalField nonuniform List<scalar> 2450 ( 3.83939e-05 0.000395514 0.000481536 0.000502148 0.00050947 0.000510751 0.000510747 0.000510411 0.000510202 0.000510077 0.000509998 0.000509945 0.000509906 0.000509876 0.000509853 0.000509834 0.000509819 0.000509806 0.000509794 0.000509785 0.000509776 0.000509769 0.000509762 0.000509756 0.00050975 0.000509745 0.000509741 0.000509737 0.000509733 0.000509729 0.000509726 0.000509723 0.00050972 0.000509718 0.000509715 0.000509713 0.000509711 0.000509709 0.000509707 0.000509705 0.000509703 0.000509701 0.0005097 0.000509698 0.000509697 0.000509696 0.000509694 0.000509693 0.000509692 0.000509691 0.00050969 0.000509689 0.000509688 0.000509688 0.000509687 0.000509686 0.000509685 0.000509685 0.000509684 0.000509684 0.000509683 0.000509683 0.000509683 0.000509682 0.000509682 0.000509682 0.000509681 0.00050968 0.000509679 0.000509679 0.000395696 0.000460364 0.000490972 0.000505636 0.000510264 0.000510831 0.000510696 0.000510381 0.000510189 0.000510072 0.000509996 0.000509944 0.000509905 0.000509876 0.000509853 0.000509835 0.000509819 0.000509806 0.000509795 0.000509785 0.000509777 0.000509769 0.000509762 0.000509756 0.000509751 0.000509746 0.000509741 0.000509737 0.000509734 0.00050973 0.000509727 0.000509724 0.000509721 0.000509718 0.000509716 0.000509713 0.000509711 0.000509709 0.000509707 0.000509705 0.000509704 0.000509702 0.0005097 0.000509699 0.000509698 0.000509696 0.000509695 0.000509694 0.000509693 0.000509692 0.000509691 0.00050969 0.000509689 0.000509688 0.000509688 0.000509687 0.000509686 0.000509686 0.000509685 0.000509685 0.000509684 0.000509684 0.000509683 0.000509683 0.000509683 0.000509682 0.000509681 0.00050968 0.000509679 0.000509679 0.00048169 0.000491034 0.00050394 0.000509621 0.000510875 0.000510926 0.000510567 0.00051031 0.000510153 0.000510053 0.000509986 0.000509938 0.000509902 0.000509874 0.000509852 0.000509834 0.000509819 0.000509806 0.000509795 0.000509786 0.000509777 0.00050977 0.000509763 0.000509757 0.000509752 0.000509747 0.000509743 0.000509739 0.000509735 0.000509731 0.000509728 0.000509725 0.000509722 0.00050972 0.000509717 0.000509715 0.000509713 0.000509711 0.000509709 0.000509707 0.000509705 0.000509703 0.000509702 0.0005097 0.000509699 0.000509698 0.000509696 0.000509695 0.000509694 0.000509693 0.000509692 0.000509691 0.00050969 0.00050969 0.000509689 0.000509688 0.000509687 0.000509687 0.000509686 0.000509686 0.000509685 0.000509685 0.000509685 0.000509684 0.000509684 0.000509683 0.000509683 0.000509681 0.00050968 0.000509679 0.000502258 0.000505691 0.000509643 0.00051088 0.000511062 0.000510716 0.000510421 0.000510232 0.000510111 0.000510028 0.00050997 0.000509928 0.000509895 0.00050987 0.000509849 0.000509832 0.000509817 0.000509805 0.000509795 0.000509785 0.000509777 0.00050977 0.000509763 0.000509757 0.000509752 0.000509747 0.000509743 0.000509739 0.000509735 0.000509732 0.000509729 0.000509726 0.000509723 0.00050972 0.000509718 0.000509715 0.000509713 0.000509711 0.000509709 0.000509707 0.000509706 0.000509704 0.000509702 0.000509701 0.0005097 0.000509698 0.000509697 0.000509696 0.000509695 0.000509694 0.000509693 0.000509692 0.000509691 0.00050969 0.000509689 0.000509689 0.000509688 0.000509687 0.000509687 0.000509686 0.000509686 0.000509686 0.000509685 0.000509685 0.000509685 0.000509684 0.000509683 0.000509682 0.00050968 0.000509679 0.000509539 0.000510325 0.000510899 0.000511071 0.000510778 0.000510491 0.000510293 0.000510159 0.000510067 0.000510001 0.000509953 0.000509916 0.000509887 0.000509863 0.000509844 0.000509828 0.000509815 0.000509803 0.000509793 0.000509784 0.000509776 0.000509769 0.000509763 0.000509757 0.000509752 0.000509747 0.000509743 0.000509739 0.000509735 0.000509732 0.000509728 0.000509725 0.000509723 0.00050972 0.000509718 0.000509715 0.000509713 0.000509711 0.000509709 0.000509707 0.000509706 0.000509704 0.000509703 0.000509701 0.0005097 0.000509698 0.000509697 0.000509696 0.000509695 0.000509694 0.000509693 0.000509692 0.000509691 0.00050969 0.00050969 0.000509689 0.000509688 0.000509688 0.000509687 0.000509687 0.000509686 0.000509686 0.000509685 0.000509685 0.000509685 0.000509684 0.000509683 0.000509682 0.00050968 0.000509679 0.000510797 0.000510869 0.000510949 0.000510728 0.000510496 0.000510318 0.000510189 0.000510095 0.000510026 0.000509974 0.000509934 0.000509903 0.000509877 0.000509856 0.000509839 0.000509824 0.000509811 0.0005098 0.000509791 0.000509782 0.000509774 0.000509768 0.000509762 0.000509756 0.000509751 0.000509746 0.000509742 0.000509738 0.000509735 0.000509731 0.000509728 0.000509725 0.000509722 0.00050972 0.000509717 0.000509715 0.000509713 0.000509711 0.000509709 0.000509707 0.000509706 0.000509704 0.000509702 0.000509701 0.0005097 0.000509698 0.000509697 0.000509696 0.000509695 0.000509694 0.000509693 0.000509692 0.000509691 0.00050969 0.00050969 0.000509689 0.000509688 0.000509688 0.000509687 0.000509687 0.000509686 0.000509686 0.000509685 0.000509685 0.000509685 0.000509684 0.000509683 0.000509682 0.00050968 0.000509679 0.000510779 0.000510723 0.000510587 0.000510434 0.0005103 0.000510192 0.000510107 0.000510041 0.00050999 0.000509949 0.000509916 0.000509889 0.000509867 0.000509848 0.000509833 0.000509819 0.000509807 0.000509797 0.000509788 0.00050978 0.000509773 0.000509766 0.00050976 0.000509755 0.00050975 0.000509745 0.000509741 0.000509738 0.000509734 0.000509731 0.000509728 0.000509725 0.000509722 0.00050972 0.000509717 0.000509715 0.000509713 0.000509711 0.000509709 0.000509707 0.000509705 0.000509704 0.000509702 0.000509701 0.0005097 0.000509698 0.000509697 0.000509696 0.000509695 0.000509694 0.000509693 0.000509692 0.000509691 0.00050969 0.00050969 0.000509689 0.000509688 0.000509688 0.000509687 0.000509687 0.000509686 0.000509686 0.000509685 0.000509685 0.000509685 0.000509684 0.000509683 0.000509682 0.00050968 0.000509679 0.000510435 0.000510403 0.000510327 0.000510245 0.000510168 0.0005101 0.000510043 0.000509996 0.000509957 0.000509925 0.000509898 0.000509876 0.000509857 0.00050984 0.000509826 0.000509814 0.000509803 0.000509794 0.000509785 0.000509777 0.000509771 0.000509764 0.000509759 0.000509754 0.000509749 0.000509744 0.00050974 0.000509737 0.000509733 0.00050973 0.000509727 0.000509724 0.000509722 0.000509719 0.000509717 0.000509715 0.000509713 0.000509711 0.000509709 0.000509707 0.000509705 0.000509704 0.000509702 0.000509701 0.000509699 0.000509698 0.000509697 0.000509696 0.000509695 0.000509694 0.000509693 0.000509692 0.000509691 0.00050969 0.00050969 0.000509689 0.000509688 0.000509688 0.000509687 0.000509687 0.000509686 0.000509686 0.000509685 0.000509685 0.000509685 0.000509684 0.000509683 0.000509682 0.00050968 0.000509679 0.000510221 0.000510207 0.000510168 0.000510122 0.000510076 0.000510032 0.000509993 0.000509959 0.000509929 0.000509904 0.000509882 0.000509863 0.000509847 0.000509832 0.00050982 0.000509809 0.000509799 0.00050979 0.000509782 0.000509775 0.000509768 0.000509762 0.000509757 0.000509752 0.000509748 0.000509743 0.00050974 0.000509736 0.000509733 0.000509729 0.000509727 0.000509724 0.000509721 0.000509719 0.000509716 0.000509714 0.000509712 0.00050971 0.000509708 0.000509707 0.000509705 0.000509703 0.000509702 0.000509701 0.000509699 0.000509698 0.000509697 0.000509696 0.000509695 0.000509694 0.000509693 0.000509692 0.000509691 0.00050969 0.000509689 0.000509689 0.000509688 0.000509688 0.000509687 0.000509687 0.000509686 0.000509686 0.000509685 0.000509685 0.000509685 0.000509684 0.000509683 0.000509682 0.00050968 0.000509679 0.000510093 0.000510087 0.000510067 0.00051004 0.00051001 0.000509981 0.000509953 0.000509928 0.000509905 0.000509885 0.000509867 0.000509851 0.000509837 0.000509824 0.000509813 0.000509803 0.000509794 0.000509786 0.000509779 0.000509772 0.000509766 0.00050976 0.000509755 0.000509751 0.000509746 0.000509742 0.000509739 0.000509735 0.000509732 0.000509729 0.000509726 0.000509723 0.000509721 0.000509718 0.000509716 0.000509714 0.000509712 0.00050971 0.000509708 0.000509706 0.000509705 0.000509703 0.000509702 0.0005097 0.000509699 0.000509698 0.000509697 0.000509696 0.000509694 0.000509693 0.000509693 0.000509692 0.000509691 0.00050969 0.000509689 0.000509689 0.000509688 0.000509688 0.000509687 0.000509687 0.000509686 0.000509686 0.000509685 0.000509685 0.000509685 0.000509684 0.000509683 0.000509682 0.00050968 0.000509679 0.000510012 0.00051001 0.000509998 0.000509981 0.000509961 0.000509941 0.000509921 0.000509902 0.000509884 0.000509868 0.000509853 0.00050984 0.000509828 0.000509817 0.000509807 0.000509798 0.00050979 0.000509782 0.000509776 0.000509769 0.000509764 0.000509758 0.000509754 0.000509749 0.000509745 0.000509741 0.000509737 0.000509734 0.000509731 0.000509728 0.000509725 0.000509723 0.00050972 0.000509718 0.000509716 0.000509714 0.000509712 0.00050971 0.000509708 0.000509706 0.000509705 0.000509703 0.000509702 0.0005097 0.000509699 0.000509698 0.000509696 0.000509695 0.000509694 0.000509693 0.000509692 0.000509692 0.000509691 0.00050969 0.000509689 0.000509689 0.000509688 0.000509688 0.000509687 0.000509687 0.000509686 0.000509686 0.000509685 0.000509685 0.000509685 0.000509684 0.000509683 0.000509682 0.00050968 0.000509679 0.000509957 0.000509956 0.000509949 0.000509938 0.000509924 0.00050991 0.000509895 0.00050988 0.000509866 0.000509853 0.000509841 0.00050983 0.000509819 0.00050981 0.000509801 0.000509793 0.000509785 0.000509779 0.000509772 0.000509766 0.000509761 0.000509756 0.000509752 0.000509747 0.000509744 0.00050974 0.000509736 0.000509733 0.00050973 0.000509727 0.000509725 0.000509722 0.00050972 0.000509717 0.000509715 0.000509713 0.000509711 0.000509709 0.000509708 0.000509706 0.000509704 0.000509703 0.000509701 0.0005097 0.000509699 0.000509697 0.000509696 0.000509695 0.000509694 0.000509693 0.000509692 0.000509691 0.000509691 0.00050969 0.000509689 0.000509689 0.000509688 0.000509687 0.000509687 0.000509686 0.000509686 0.000509686 0.000509685 0.000509685 0.000509685 0.000509684 0.000509683 0.000509682 0.00050968 0.000509679 0.000509917 0.000509917 0.000509913 0.000509905 0.000509895 0.000509885 0.000509873 0.000509862 0.000509851 0.00050984 0.00050983 0.00050982 0.000509811 0.000509803 0.000509795 0.000509788 0.000509781 0.000509775 0.000509769 0.000509764 0.000509759 0.000509754 0.00050975 0.000509746 0.000509742 0.000509739 0.000509735 0.000509732 0.000509729 0.000509726 0.000509724 0.000509721 0.000509719 0.000509717 0.000509715 0.000509713 0.000509711 0.000509709 0.000509707 0.000509706 0.000509704 0.000509702 0.000509701 0.0005097 0.000509698 0.000509697 0.000509696 0.000509695 0.000509694 0.000509693 0.000509692 0.000509691 0.000509691 0.00050969 0.000509689 0.000509689 0.000509688 0.000509687 0.000509687 0.000509686 0.000509686 0.000509686 0.000509685 0.000509685 0.000509685 0.000509684 0.000509683 0.000509682 0.00050968 0.000509679 0.000509887 0.000509887 0.000509885 0.000509879 0.000509872 0.000509864 0.000509855 0.000509846 0.000509837 0.000509828 0.000509819 0.000509811 0.000509804 0.000509796 0.000509789 0.000509783 0.000509777 0.000509771 0.000509766 0.000509761 0.000509756 0.000509752 0.000509748 0.000509744 0.000509741 0.000509737 0.000509734 0.000509731 0.000509728 0.000509726 0.000509723 0.000509721 0.000509718 0.000509716 0.000509714 0.000509712 0.00050971 0.000509709 0.000509707 0.000509705 0.000509704 0.000509702 0.000509701 0.000509699 0.000509698 0.000509697 0.000509696 0.000509695 0.000509694 0.000509693 0.000509692 0.000509691 0.00050969 0.00050969 0.000509689 0.000509688 0.000509688 0.000509687 0.000509687 0.000509686 0.000509686 0.000509686 0.000509685 0.000509685 0.000509685 0.000509684 0.000509683 0.000509682 0.00050968 0.000509679 0.000509864 0.000509864 0.000509862 0.000509859 0.000509853 0.000509847 0.00050984 0.000509833 0.000509825 0.000509818 0.00050981 0.000509803 0.000509797 0.00050979 0.000509784 0.000509778 0.000509773 0.000509768 0.000509763 0.000509758 0.000509754 0.00050975 0.000509746 0.000509743 0.000509739 0.000509736 0.000509733 0.00050973 0.000509727 0.000509725 0.000509722 0.00050972 0.000509718 0.000509716 0.000509714 0.000509712 0.00050971 0.000509708 0.000509706 0.000509705 0.000509703 0.000509702 0.000509701 0.000509699 0.000509698 0.000509697 0.000509696 0.000509695 0.000509694 0.000509693 0.000509692 0.000509691 0.00050969 0.00050969 0.000509689 0.000509688 0.000509688 0.000509687 0.000509687 0.000509686 0.000509686 0.000509686 0.000509685 0.000509685 0.000509685 0.000509684 0.000509683 0.000509682 0.00050968 0.000509679 0.000509845 0.000509845 0.000509845 0.000509842 0.000509838 0.000509832 0.000509827 0.000509821 0.000509815 0.000509808 0.000509802 0.000509796 0.00050979 0.000509785 0.000509779 0.000509774 0.000509769 0.000509764 0.00050976 0.000509756 0.000509752 0.000509748 0.000509744 0.000509741 0.000509738 0.000509735 0.000509732 0.000509729 0.000509726 0.000509724 0.000509722 0.000509719 0.000509717 0.000509715 0.000509713 0.000509711 0.000509709 0.000509708 0.000509706 0.000509705 0.000509703 0.000509702 0.0005097 0.000509699 0.000509698 0.000509697 0.000509696 0.000509695 0.000509694 0.000509693 0.000509692 0.000509691 0.00050969 0.00050969 0.000509689 0.000509688 0.000509688 0.000509687 0.000509687 0.000509686 0.000509686 0.000509686 0.000509685 0.000509685 0.000509685 0.000509684 0.000509683 0.000509682 0.00050968 0.000509679 0.00050983 0.00050983 0.00050983 0.000509828 0.000509824 0.00050982 0.000509816 0.000509811 0.000509805 0.0005098 0.000509795 0.00050979 0.000509784 0.000509779 0.000509775 0.00050977 0.000509765 0.000509761 0.000509757 0.000509753 0.000509749 0.000509746 0.000509743 0.000509739 0.000509736 0.000509733 0.000509731 0.000509728 0.000509726 0.000509723 0.000509721 0.000509719 0.000509717 0.000509715 0.000509713 0.000509711 0.000509709 0.000509707 0.000509706 0.000509704 0.000509703 0.000509701 0.0005097 0.000509699 0.000509698 0.000509696 0.000509695 0.000509694 0.000509693 0.000509692 0.000509692 0.000509691 0.00050969 0.000509689 0.000509689 0.000509688 0.000509688 0.000509687 0.000509687 0.000509686 0.000509686 0.000509685 0.000509685 0.000509685 0.000509685 0.000509684 0.000509683 0.000509682 0.00050968 0.000509679 0.000509817 0.000509817 0.000509817 0.000509816 0.000509813 0.00050981 0.000509806 0.000509802 0.000509797 0.000509793 0.000509788 0.000509784 0.000509779 0.000509775 0.00050977 0.000509766 0.000509762 0.000509758 0.000509754 0.000509751 0.000509747 0.000509744 0.000509741 0.000509738 0.000509735 0.000509732 0.00050973 0.000509727 0.000509725 0.000509722 0.00050972 0.000509718 0.000509716 0.000509714 0.000509712 0.00050971 0.000509709 0.000509707 0.000509705 0.000509704 0.000509702 0.000509701 0.0005097 0.000509698 0.000509697 0.000509696 0.000509695 0.000509694 0.000509693 0.000509692 0.000509692 0.000509691 0.00050969 0.000509689 0.000509689 0.000509688 0.000509688 0.000509687 0.000509687 0.000509686 0.000509686 0.000509685 0.000509685 0.000509685 0.000509685 0.000509684 0.000509683 0.000509682 0.00050968 0.000509679 0.000509806 0.000509807 0.000509807 0.000509806 0.000509804 0.000509801 0.000509798 0.000509794 0.00050979 0.000509786 0.000509782 0.000509778 0.000509774 0.00050977 0.000509766 0.000509763 0.000509759 0.000509755 0.000509752 0.000509748 0.000509745 0.000509742 0.000509739 0.000509736 0.000509734 0.000509731 0.000509728 0.000509726 0.000509724 0.000509721 0.000509719 0.000509717 0.000509715 0.000509713 0.000509712 0.00050971 0.000509708 0.000509706 0.000509705 0.000509703 0.000509702 0.000509701 0.000509699 0.000509698 0.000509697 0.000509696 0.000509695 0.000509694 0.000509693 0.000509692 0.000509691 0.000509691 0.00050969 0.000509689 0.000509689 0.000509688 0.000509687 0.000509687 0.000509687 0.000509686 0.000509686 0.000509685 0.000509685 0.000509685 0.000509684 0.000509684 0.000509683 0.000509682 0.00050968 0.000509679 0.000509797 0.000509797 0.000509798 0.000509797 0.000509795 0.000509793 0.00050979 0.000509787 0.000509784 0.00050978 0.000509777 0.000509773 0.00050977 0.000509766 0.000509763 0.000509759 0.000509756 0.000509753 0.000509749 0.000509746 0.000509743 0.00050974 0.000509738 0.000509735 0.000509732 0.00050973 0.000509727 0.000509725 0.000509723 0.000509721 0.000509719 0.000509717 0.000509715 0.000509713 0.000509711 0.000509709 0.000509708 0.000509706 0.000509705 0.000509703 0.000509702 0.0005097 0.000509699 0.000509698 0.000509697 0.000509696 0.000509695 0.000509694 0.000509693 0.000509692 0.000509691 0.00050969 0.00050969 0.000509689 0.000509688 0.000509688 0.000509687 0.000509687 0.000509686 0.000509686 0.000509686 0.000509685 0.000509685 0.000509685 0.000509684 0.000509684 0.000509683 0.000509682 0.00050968 0.000509679 0.000509789 0.00050979 0.00050979 0.00050979 0.000509788 0.000509786 0.000509784 0.000509781 0.000509778 0.000509775 0.000509772 0.000509769 0.000509766 0.000509763 0.000509759 0.000509756 0.000509753 0.00050975 0.000509747 0.000509744 0.000509741 0.000509739 0.000509736 0.000509734 0.000509731 0.000509729 0.000509726 0.000509724 0.000509722 0.00050972 0.000509718 0.000509716 0.000509714 0.000509712 0.000509711 0.000509709 0.000509707 0.000509706 0.000509704 0.000509703 0.000509701 0.0005097 0.000509699 0.000509698 0.000509697 0.000509696 0.000509695 0.000509694 0.000509693 0.000509692 0.000509691 0.00050969 0.00050969 0.000509689 0.000509688 0.000509688 0.000509687 0.000509687 0.000509686 0.000509686 0.000509686 0.000509685 0.000509685 0.000509685 0.000509684 0.000509684 0.000509683 0.000509682 0.00050968 0.000509679 0.000509782 0.000509783 0.000509784 0.000509783 0.000509782 0.00050978 0.000509778 0.000509776 0.000509773 0.000509771 0.000509768 0.000509765 0.000509762 0.000509759 0.000509756 0.000509754 0.000509751 0.000509748 0.000509745 0.000509742 0.00050974 0.000509737 0.000509735 0.000509732 0.00050973 0.000509728 0.000509725 0.000509723 0.000509721 0.000509719 0.000509717 0.000509715 0.000509714 0.000509712 0.00050971 0.000509708 0.000509707 0.000509705 0.000509704 0.000509703 0.000509701 0.0005097 0.000509699 0.000509698 0.000509696 0.000509695 0.000509694 0.000509693 0.000509693 0.000509692 0.000509691 0.00050969 0.00050969 0.000509689 0.000509688 0.000509688 0.000509687 0.000509687 0.000509686 0.000509686 0.000509686 0.000509685 0.000509685 0.000509685 0.000509684 0.000509684 0.000509683 0.000509682 0.00050968 0.000509679 0.000509776 0.000509777 0.000509778 0.000509778 0.000509777 0.000509775 0.000509773 0.000509771 0.000509769 0.000509767 0.000509764 0.000509762 0.000509759 0.000509756 0.000509754 0.000509751 0.000509748 0.000509746 0.000509743 0.000509741 0.000509738 0.000509736 0.000509733 0.000509731 0.000509729 0.000509727 0.000509725 0.000509722 0.00050972 0.000509718 0.000509717 0.000509715 0.000509713 0.000509711 0.00050971 0.000509708 0.000509706 0.000509705 0.000509704 0.000509702 0.000509701 0.0005097 0.000509698 0.000509697 0.000509696 0.000509695 0.000509694 0.000509693 0.000509692 0.000509692 0.000509691 0.00050969 0.000509689 0.000509689 0.000509688 0.000509688 0.000509687 0.000509687 0.000509686 0.000509686 0.000509686 0.000509685 0.000509685 0.000509685 0.000509684 0.000509684 0.000509683 0.000509682 0.00050968 0.000509679 0.000509771 0.000509772 0.000509773 0.000509773 0.000509772 0.000509771 0.000509769 0.000509767 0.000509765 0.000509763 0.000509761 0.000509759 0.000509756 0.000509754 0.000509751 0.000509749 0.000509746 0.000509744 0.000509741 0.000509739 0.000509737 0.000509734 0.000509732 0.00050973 0.000509728 0.000509726 0.000509724 0.000509722 0.00050972 0.000509718 0.000509716 0.000509714 0.000509712 0.000509711 0.000509709 0.000509708 0.000509706 0.000509705 0.000509703 0.000509702 0.000509701 0.000509699 0.000509698 0.000509697 0.000509696 0.000509695 0.000509694 0.000509693 0.000509692 0.000509691 0.000509691 0.00050969 0.000509689 0.000509689 0.000509688 0.000509688 0.000509687 0.000509687 0.000509686 0.000509686 0.000509686 0.000509685 0.000509685 0.000509685 0.000509684 0.000509684 0.000509683 0.000509682 0.00050968 0.000509679 0.000509767 0.000509768 0.000509769 0.000509769 0.000509768 0.000509767 0.000509765 0.000509764 0.000509762 0.00050976 0.000509758 0.000509756 0.000509754 0.000509751 0.000509749 0.000509747 0.000509744 0.000509742 0.00050974 0.000509738 0.000509735 0.000509733 0.000509731 0.000509729 0.000509727 0.000509725 0.000509723 0.000509721 0.000509719 0.000509717 0.000509715 0.000509714 0.000509712 0.00050971 0.000509709 0.000509707 0.000509706 0.000509704 0.000509703 0.000509702 0.0005097 0.000509699 0.000509698 0.000509697 0.000509696 0.000509695 0.000509694 0.000509693 0.000509692 0.000509691 0.000509691 0.00050969 0.000509689 0.000509689 0.000509688 0.000509688 0.000509687 0.000509687 0.000509686 0.000509686 0.000509685 0.000509685 0.000509685 0.000509685 0.000509684 0.000509684 0.000509683 0.000509682 0.00050968 0.000509679 0.000509763 0.000509764 0.000509765 0.000509765 0.000509764 0.000509763 0.000509762 0.000509761 0.000509759 0.000509757 0.000509755 0.000509753 0.000509751 0.000509749 0.000509747 0.000509745 0.000509743 0.000509741 0.000509738 0.000509736 0.000509734 0.000509732 0.00050973 0.000509728 0.000509726 0.000509724 0.000509722 0.00050972 0.000509718 0.000509717 0.000509715 0.000509713 0.000509712 0.00050971 0.000509708 0.000509707 0.000509705 0.000509704 0.000509703 0.000509701 0.0005097 0.000509699 0.000509698 0.000509697 0.000509696 0.000509695 0.000509694 0.000509693 0.000509692 0.000509691 0.000509691 0.00050969 0.000509689 0.000509689 0.000509688 0.000509687 0.000509687 0.000509687 0.000509686 0.000509686 0.000509685 0.000509685 0.000509685 0.000509685 0.000509684 0.000509684 0.000509683 0.000509682 0.00050968 0.000509679 0.00050976 0.000509761 0.000509762 0.000509762 0.000509761 0.00050976 0.000509759 0.000509758 0.000509756 0.000509755 0.000509753 0.000509751 0.000509749 0.000509747 0.000509745 0.000509743 0.000509741 0.000509739 0.000509737 0.000509735 0.000509733 0.000509731 0.000509729 0.000509727 0.000509725 0.000509723 0.000509721 0.00050972 0.000509718 0.000509716 0.000509714 0.000509713 0.000509711 0.00050971 0.000509708 0.000509707 0.000509705 0.000509704 0.000509702 0.000509701 0.0005097 0.000509699 0.000509698 0.000509697 0.000509696 0.000509695 0.000509694 0.000509693 0.000509692 0.000509691 0.00050969 0.00050969 0.000509689 0.000509688 0.000509688 0.000509687 0.000509687 0.000509686 0.000509686 0.000509686 0.000509685 0.000509685 0.000509685 0.000509685 0.000509684 0.000509684 0.000509683 0.000509682 0.00050968 0.000509679 0.000509757 0.000509758 0.000509759 0.000509759 0.000509759 0.000509758 0.000509757 0.000509756 0.000509754 0.000509753 0.000509751 0.000509749 0.000509748 0.000509746 0.000509744 0.000509742 0.00050974 0.000509738 0.000509736 0.000509734 0.000509732 0.00050973 0.000509728 0.000509726 0.000509725 0.000509723 0.000509721 0.000509719 0.000509717 0.000509716 0.000509714 0.000509712 0.000509711 0.000509709 0.000509708 0.000509706 0.000509705 0.000509704 0.000509702 0.000509701 0.0005097 0.000509699 0.000509697 0.000509696 0.000509695 0.000509694 0.000509694 0.000509693 0.000509692 0.000509691 0.00050969 0.00050969 0.000509689 0.000509688 0.000509688 0.000509687 0.000509687 0.000509686 0.000509686 0.000509686 0.000509685 0.000509685 0.000509685 0.000509685 0.000509684 0.000509684 0.000509683 0.000509682 0.00050968 0.000509679 0.000509755 0.000509756 0.000509757 0.000509757 0.000509757 0.000509756 0.000509755 0.000509754 0.000509752 0.000509751 0.000509749 0.000509748 0.000509746 0.000509744 0.000509742 0.000509741 0.000509739 0.000509737 0.000509735 0.000509733 0.000509731 0.000509729 0.000509728 0.000509726 0.000509724 0.000509722 0.00050972 0.000509719 0.000509717 0.000509715 0.000509714 0.000509712 0.00050971 0.000509709 0.000509707 0.000509706 0.000509705 0.000509703 0.000509702 0.000509701 0.0005097 0.000509698 0.000509697 0.000509696 0.000509695 0.000509694 0.000509693 0.000509692 0.000509692 0.000509691 0.00050969 0.00050969 0.000509689 0.000509688 0.000509688 0.000509687 0.000509687 0.000509686 0.000509686 0.000509686 0.000509685 0.000509685 0.000509685 0.000509684 0.000509684 0.000509684 0.000509683 0.000509682 0.00050968 0.000509679 0.000509753 0.000509753 0.000509755 0.000509755 0.000509755 0.000509754 0.000509753 0.000509752 0.000509751 0.000509749 0.000509748 0.000509746 0.000509745 0.000509743 0.000509741 0.000509739 0.000509738 0.000509736 0.000509734 0.000509732 0.00050973 0.000509729 0.000509727 0.000509725 0.000509723 0.000509721 0.00050972 0.000509718 0.000509716 0.000509715 0.000509713 0.000509712 0.00050971 0.000509708 0.000509707 0.000509706 0.000509704 0.000509703 0.000509702 0.0005097 0.000509699 0.000509698 0.000509697 0.000509696 0.000509695 0.000509694 0.000509693 0.000509692 0.000509691 0.000509691 0.00050969 0.000509689 0.000509689 0.000509688 0.000509688 0.000509687 0.000509687 0.000509686 0.000509686 0.000509685 0.000509685 0.000509685 0.000509685 0.000509684 0.000509684 0.000509684 0.000509683 0.000509682 0.00050968 0.000509679 0.000509751 0.000509752 0.000509753 0.000509753 0.000509753 0.000509752 0.000509751 0.00050975 0.000509749 0.000509748 0.000509746 0.000509745 0.000509743 0.000509742 0.00050974 0.000509738 0.000509737 0.000509735 0.000509733 0.000509731 0.00050973 0.000509728 0.000509726 0.000509724 0.000509722 0.000509721 0.000509719 0.000509717 0.000509716 0.000509714 0.000509713 0.000509711 0.000509709 0.000509708 0.000509707 0.000509705 0.000509704 0.000509702 0.000509701 0.0005097 0.000509699 0.000509698 0.000509697 0.000509696 0.000509695 0.000509694 0.000509693 0.000509692 0.000509691 0.00050969 0.00050969 0.000509689 0.000509688 0.000509688 0.000509687 0.000509687 0.000509686 0.000509686 0.000509686 0.000509685 0.000509685 0.000509685 0.000509684 0.000509684 0.000509684 0.000509683 0.000509683 0.000509681 0.000509679 0.000509678 0.000509749 0.00050975 0.000509751 0.000509751 0.000509751 0.00050975 0.000509749 0.000509748 0.000509747 0.000509746 0.000509745 0.000509743 0.000509742 0.00050974 0.000509738 0.000509737 0.000509735 0.000509733 0.000509732 0.00050973 0.000509728 0.000509727 0.000509725 0.000509723 0.000509721 0.00050972 0.000509718 0.000509716 0.000509715 0.000509713 0.000509712 0.00050971 0.000509709 0.000509707 0.000509706 0.000509704 0.000509703 0.000509702 0.0005097 0.000509699 0.000509698 0.000509697 0.000509696 0.000509695 0.000509694 0.000509693 0.000509692 0.000509691 0.00050969 0.00050969 0.000509689 0.000509688 0.000509688 0.000509687 0.000509687 0.000509686 0.000509686 0.000509685 0.000509685 0.000509685 0.000509684 0.000509684 0.000509684 0.000509683 0.000509683 0.000509683 0.000509682 0.000509681 0.000509679 0.000509678 0.000509748 0.000509748 0.000509748 0.000509749 0.000509748 0.000509748 0.000509747 0.000509746 0.000509745 0.000509743 0.000509742 0.000509741 0.000509739 0.000509738 0.000509736 0.000509735 0.000509733 0.000509731 0.00050973 0.000509728 0.000509726 0.000509725 0.000509723 0.000509721 0.00050972 0.000509718 0.000509716 0.000509715 0.000509713 0.000509711 0.00050971 0.000509708 0.000509707 0.000509706 0.000509704 0.000509703 0.000509701 0.0005097 0.000509699 0.000509698 0.000509697 0.000509695 0.000509694 0.000509693 0.000509692 0.000509692 0.000509691 0.00050969 0.000509689 0.000509688 0.000509688 0.000509687 0.000509686 0.000509686 0.000509685 0.000509685 0.000509684 0.000509684 0.000509684 0.000509683 0.000509683 0.000509683 0.000509682 0.000509682 0.000509682 0.000509681 0.000509681 0.000509679 0.000509678 0.000509676 0.000509746 0.000509746 0.000509746 0.000509746 0.000509745 0.000509745 0.000509744 0.000509743 0.000509742 0.000509741 0.000509739 0.000509738 0.000509737 0.000509735 0.000509734 0.000509732 0.000509731 0.000509729 0.000509727 0.000509726 0.000509724 0.000509722 0.000509721 0.000509719 0.000509717 0.000509716 0.000509714 0.000509712 0.000509711 0.000509709 0.000509708 0.000509706 0.000509705 0.000509703 0.000509702 0.000509701 0.000509699 0.000509698 0.000509697 0.000509696 0.000509695 0.000509694 0.000509692 0.000509691 0.000509691 0.00050969 0.000509689 0.000509688 0.000509687 0.000509686 0.000509686 0.000509685 0.000509684 0.000509684 0.000509683 0.000509683 0.000509683 0.000509682 0.000509682 0.000509681 0.000509681 0.000509681 0.000509681 0.00050968 0.00050968 0.00050968 0.000509679 0.000509678 0.000509676 0.000509675 0.000509745 0.000509745 0.000509745 0.000509744 0.000509744 0.000509743 0.000509742 0.000509741 0.00050974 0.000509739 0.000509738 0.000509737 0.000509735 0.000509734 0.000509732 0.000509731 0.000509729 0.000509728 0.000509726 0.000509724 0.000509723 0.000509721 0.000509719 0.000509718 0.000509716 0.000509714 0.000509713 0.000509711 0.00050971 0.000509708 0.000509707 0.000509705 0.000509704 0.000509702 0.000509701 0.0005097 0.000509698 0.000509697 0.000509696 0.000509695 0.000509693 0.000509692 0.000509691 0.00050969 0.000509689 0.000509689 0.000509688 0.000509687 0.000509686 0.000509685 0.000509685 0.000509684 0.000509683 0.000509683 0.000509682 0.000509682 0.000509681 0.000509681 0.000509681 0.00050968 0.00050968 0.00050968 0.00050968 0.000509679 0.000509679 0.000509679 0.000509678 0.000509677 0.000509675 0.000509674 ) ; boundaryField { left { type symmetryPlane; } right { type symmetryPlane; } top { type symmetryPlane; } bottom { type symmetryPlane; } frontAndBack { type empty; } } // ************************************************************************* //
0fdacf4273265333551eac8e6208f2d75df0e158
7767d050a80638b8dc2f80175eca3155ddedfeaf
/tankwidget.cpp
f3c8bd566a91841226fd1a614003a2d2c5f97d17
[]
no_license
knipl/Tanks
a0ff62f87032e3ebb11cba45d9166fe7592047a9
74738930504f3ddb0e702f36e2fc1cab832da90d
refs/heads/master
2021-01-10T08:28:04.502132
2015-05-25T04:16:22
2015-05-25T04:16:22
36,188,413
0
0
null
null
null
null
UTF-8
C++
false
false
2,020
cpp
tankwidget.cpp
#include "tankwidget.h" #include "graphics.hpp" #include <math.h> #include <iostream> using namespace std; using namespace genv; TankWidget :: TankWidget(float _x, float _y, float _mx, float _my, Tank *_tank):Widget(_x,_y,_mx,_my), tank(_tank) { } void TankWidget::rajzol() { if(tank -> GetEle()) { float golyo_x=tank -> GetGolyoX(); float golyo_y=tank -> GetGolyoY(); float loveg=tank -> GetLoveg(); float tank_x=tank -> GetX(); float tank_y=tank -> GetY(); float pi=3.14159265; if(tank -> GetPlayer()) { if(tank -> GetGolyoLatszodik()) { gout<<move_to(tank_x, tank_y)<< color(200,10,10)<< box(30,30); gout<<move_to(tank_x, tank_y + 10) << line(-(sqrt(900) * cos(loveg*pi/180)), sqrt(900)*sin(-loveg*pi/180)); gout<<move_to(golyo_x, golyo_y + 10)<<color(1,1,1)<<box(3,3); } else { gout<<move_to(tank_x, tank_y)<< color(200,10,10)<< box(30,30); gout<<move_to(tank_x, tank_y + 10) << line(-(sqrt(900) * cos(loveg*pi/180)), sqrt(900)*sin(-loveg*pi/180)); } } else { if(tank -> GetGolyoLatszodik()) { gout<<move_to(tank_x, tank_y)<< color(10,10,200)<< box(30,30); gout<<move_to(tank_x + 30, tank_y + 10) << line((sqrt(900) * cos(loveg*pi/180)), sqrt(900)*sin(-loveg*pi/180)); gout<<move_to(golyo_x, golyo_y + 10)<<color(1,1,1)<<box(3,3); } else { gout<<move_to(tank_x, tank_y)<< color(10,10,200)<< box(30,30); gout<<move_to(tank_x + 30, tank_y + 10) << line((sqrt(900) * cos(loveg*pi/180)), sqrt(900)*sin(-loveg*pi/180)); } } } else { gout<<move_to(0,0)<<color(1,1,1)<<box(800,400); gout<<move_to(350,200)<<color(199,199,199) <<text("Game Over \n Press Esc to exit!"); } }
86c53dad7713d98efc9826aca5e45f35b533bed4
b01e58e74ba0f989c5beb8f532eec2c11f5439b5
/contests/amman/J.cpp
5d80882cde009547ffe1b9007e31cd4406365c20
[]
no_license
breno-helf/TAPA.EXE
54d56e2a2c15e709819c172695200479b1b34729
3ac36a3d2401a2d4861fc7a51ce9b1b6a20ab112
refs/heads/master
2021-01-19T11:18:15.958602
2018-08-03T22:25:03
2018-08-03T22:25:03
82,236,704
0
0
null
null
null
null
UTF-8
C++
false
false
894
cpp
J.cpp
#include <bits/stdc++.h> using namespace std; #define debug(args...) fprintf (stderr, args) const int maxn = 1e5 + 10; const int MASK = (1 << 9) + 10; int t, n, q; int a[maxn]; int m[maxn]; // divisores de m int d[MASK][maxn]; inline void compute () { for (int k = 1; k < MASK; ++k) for (int i = 1; i <= n; ++i) { d[k][i] = d[k][i - 1]; if ((m[i] & k)) ++d[k][i]; } } int main () { scanf ("%d", &t); while (t--) { scanf ("%d %d", &n, &q); for (int i = 1; i <= n; ++i) { scanf ("%d", &a[i]); m[i] = 0; for (int k = 2; k <= 10; ++k) if (a[i] % k == 0) m[i] += (1 << (k - 2)); } compute(); while (q--) { int l, r; scanf ("%d %d", &l, &r); int s; scanf ("%d", &s); if ((1 << 0) & s) { printf ("%d\n", r - l + 1); continue; } s /= 2; printf ("%d\n", d[s][r] - d[s][l - 1]); } } return 0; }
d4feb044259145a718a0539d44883a0521d17b4d
26df6604faf41197c9ced34c3df13839be6e74d4
/src/org/apache/poi/hssf/record/chart/LineFormatRecord.hpp
5bf93137ac544fcec05cd16c49982a516cb39a93
[ "Apache-2.0" ]
permissive
pebble2015/cpoi
58b4b1e38a7769b13ccfb2973270d15d490de07f
6dcc0c5e13e3e722b4ef9fd0baffbf62bf71ead6
refs/heads/master
2021-07-09T09:02:41.986901
2017-10-08T12:12:56
2017-10-08T12:12:56
105,988,119
0
0
null
null
null
null
UTF-8
C++
false
false
3,358
hpp
LineFormatRecord.hpp
// Generated from /POI/java/org/apache/poi/hssf/record/chart/LineFormatRecord.java #pragma once #include <fwd-POI.hpp> #include <java/lang/fwd-POI.hpp> #include <org/apache/poi/hssf/record/fwd-POI.hpp> #include <org/apache/poi/hssf/record/chart/fwd-POI.hpp> #include <org/apache/poi/util/fwd-POI.hpp> #include <org/apache/poi/hssf/record/StandardRecord.hpp> #include <java/lang/Cloneable.hpp> struct default_init_tag; class poi::hssf::record::chart::LineFormatRecord final : public ::poi::hssf::record::StandardRecord , public ::java::lang::Cloneable { public: typedef ::poi::hssf::record::StandardRecord super; static constexpr int16_t sid { int16_t(4103) }; private: static ::poi::util::BitField* auto__; static ::poi::util::BitField* drawTicks_; static ::poi::util::BitField* unknown_; int32_t field_1_lineColor { }; int16_t field_2_linePattern { }; public: static constexpr int16_t LINE_PATTERN_SOLID { int16_t(0) }; static constexpr int16_t LINE_PATTERN_DASH { int16_t(1) }; static constexpr int16_t LINE_PATTERN_DOT { int16_t(2) }; static constexpr int16_t LINE_PATTERN_DASH_DOT { int16_t(3) }; static constexpr int16_t LINE_PATTERN_DASH_DOT_DOT { int16_t(4) }; static constexpr int16_t LINE_PATTERN_NONE { int16_t(5) }; static constexpr int16_t LINE_PATTERN_DARK_GRAY_PATTERN { int16_t(6) }; static constexpr int16_t LINE_PATTERN_MEDIUM_GRAY_PATTERN { int16_t(7) }; static constexpr int16_t LINE_PATTERN_LIGHT_GRAY_PATTERN { int16_t(8) }; private: int16_t field_3_weight { }; public: static constexpr int16_t WEIGHT_HAIRLINE { int16_t(-1) }; static constexpr int16_t WEIGHT_NARROW { int16_t(0) }; static constexpr int16_t WEIGHT_MEDIUM { int16_t(1) }; static constexpr int16_t WEIGHT_WIDE { int16_t(2) }; private: int16_t field_4_format { }; int16_t field_5_colourPaletteIndex { }; protected: void ctor(); void ctor(::poi::hssf::record::RecordInputStream* in); public: ::java::lang::String* toString() override; void serialize(::poi::util::LittleEndianOutput* out) override; public: /* protected */ int32_t getDataSize() override; public: int16_t getSid() override; LineFormatRecord* clone() override; int32_t getLineColor(); void setLineColor(int32_t field_1_lineColor); int16_t getLinePattern(); void setLinePattern(int16_t field_2_linePattern); int16_t getWeight(); void setWeight(int16_t field_3_weight); int16_t getFormat(); void setFormat(int16_t field_4_format); int16_t getColourPaletteIndex(); void setColourPaletteIndex(int16_t field_5_colourPaletteIndex); void setAuto(bool value); bool isAuto(); void setDrawTicks(bool value); bool isDrawTicks(); void setUnknown(bool value); bool isUnknown(); // Generated LineFormatRecord(); LineFormatRecord(::poi::hssf::record::RecordInputStream* in); protected: LineFormatRecord(const ::default_init_tag&); public: static ::java::lang::Class *class_(); static void clinit(); int32_t serialize(int32_t offset, ::int8_tArray* data); ::int8_tArray* serialize(); private: static ::poi::util::BitField*& auto_(); static ::poi::util::BitField*& drawTicks(); static ::poi::util::BitField*& unknown(); virtual ::java::lang::Class* getClass0(); };
7fd310e996a74dbdeac5de00ddb91c5b6cf47f28
4f7dfd2848082f57c4168049f6f22a5a76184f69
/data/tplcache/55365549eadd7ae031f928d6b5e7c813.inc
ad788cd32f3506b855c4ce640cc57fb543e6d207
[]
no_license
yangsiji2016/nxxys
4d401d06e2508b337df97b4962fb9cd6d7d2f7f9
f4ef4b3c398449d0567a966fb8763dfefa9c4721
refs/heads/master
2020-06-23T19:33:36.664335
2016-11-25T07:36:52
2016-11-25T07:36:52
74,642,682
0
0
null
null
null
null
UTF-8
C++
false
false
1,213
inc
55365549eadd7ae031f928d6b5e7c813.inc
{dede:field name='keywords'}{/dede:field} {dede:field name='description'}{/dede:field} {dede:field name='title'}关于《长江三峡》特种邮票藏品托管入库公告{/dede:field} {dede:field name='writer'}{/dede:field} {dede:field name='source'}未知&nbsp{/dede:field} {dede:field name='pubdate'}2016-10-19 17:38:00 &nbsp{/dede:field} {dede:field name='body'}<span style="color: rgb(51, 51, 51); font-family: 微软雅黑, 宋体; font-size: 16px; line-height: 32px; text-indent: 28px;">经宁夏西邮文化艺术品交易中心(以下简称&ldquo;西邮所&rdquo;)会员申请,中心专家委员会评估审核,1994-18特种邮票&ldquo;长江三峡&rdquo;(以下简称&ldquo;长江三峡&rdquo;)藏品已完成托管入库流程,详情见下表:</span> <div style="text-align: center;"> <strong style="padding: 0px; margin: 0px; color: rgb(51, 51, 51); font-family: 微软雅黑, 宋体; font-size: 16px; line-height: 32px; text-indent: 28px;">入库藏品清单<br /> <img alt="" src="/uploads/allimg/c161124/14O9554215VP-54P3.jpg" style="width: 628px; height: 161px;" /></strong>{/dede:field} {dede:field name='litpic'}/uploads/allimg/c161124/14O9554215VP-54P3_lit.jpg{/dede:field}
f5628c8f195d25e5be14b2fc953eb01ac488e364
c1a4934feda7a0aed41ac1a9f9a5416c5923ff15
/photoResistor/photoResistor.ino
86e967e25ed5ba5bf38de147fce46682f90c28e8
[ "Apache-2.0" ]
permissive
ramsharan072011/arduino-sketches
42ce3a0bbdf393ab9cffe73dd1287eec4d324227
ed71338b37867daf18698df6751beebd5733e0f2
refs/heads/master
2022-04-18T19:54:53.987418
2020-04-25T17:14:23
2020-04-25T17:14:23
258,828,377
2
0
null
null
null
null
UTF-8
C++
false
false
488
ino
photoResistor.ino
void setup() { // put your setup code here, to run once: int photo_resisistor_value; pinMode(A0,INPUT); pinMode(7,OUTPUT); Serial.begin(9600); } void loop() { // put your main code here, to run repeatedly: int photo_resisistor_value; photo_resisistor_value=analogRead(A0); Serial.println(photo_resisistor_value); if(photo_resisistor_value>499){ digitalWrite(7,HIGH); } else if (photo_resisistor_value<499) { digitalWrite(7,LOW); } }
9c895473e13a67d0efd8658a6e98a245d7bdc089
f16f162f0fc95874d0ec5ef6673be09108ae5949
/Bellum/Bellum/BRook.cpp
520faa942900691e1f7d9400f272659af790b1aa
[]
no_license
Azayro/Chess-Game
0539bd961d663d1a24746f9b7cbe6ad6e694c851
59ec12bbd21a8593d675024bd6cdf996301f75f9
refs/heads/master
2021-01-18T14:24:14.716173
2014-07-23T14:40:47
2014-07-23T14:40:47
null
0
0
null
null
null
null
UTF-8
C++
false
false
868
cpp
BRook.cpp
#include "BRook.h" char BRook::GetPiece() { return 'R'; } bool BRook::CheckSquares(int cRow, int cCol, int dRow, int dCol, BPiece* arrayBoard[10][10]) { if (cRow == dRow) { // If the player chooses to move the rook horizontally // Make sure that all invervening squares are empty int iColOffset = (dCol - cCol > 0) ? 1 : -1; for (int Col = cCol + iColOffset; Col != dCol; Col = Col + iColOffset) { if (arrayBoard[cRow][Col] != 0) { return false; } } return true; } else if (dCol == cCol) { // If the player chooses to move the rook vertically // Make sure that all invervening squares are empty int iRowOffset = (dRow - cRow > 0) ? 1 : -1; for (int Row = cRow + iRowOffset; Row != dRow; Row = Row + iRowOffset) { if (arrayBoard[Row][cCol] != 0) { return false; } } return true; } return false; }
617e9498092d7482ceb8eef6c63697a5c1b8b707
54e923807ec7bc1d20ad28f40802dce5d148a880
/ShapesContainer.h
cb0df21606b3c7aeaf450ddbe252a67188154015
[]
no_license
AlexPasheva/Work-With-SVG-Files
648d7d736c3593fa1a9eb241a0e8e317b1ba2594
cd91ae16fa15b5a6badfe442424ff6d323da22fc
refs/heads/master
2022-11-12T07:27:17.779798
2020-07-04T16:57:39
2020-07-04T16:57:39
260,860,001
0
0
null
null
null
null
UTF-8
C++
false
false
907
h
ShapesContainer.h
#include "Rectangle.h" class ShapesContainer { private: Shapes** shapes; int capacity; int count; void CopyFrom(const ShapesContainer& other); void Free(); void Resize(int NewCappacity); public: ShapesContainer(); ShapesContainer(const ShapesContainer& other); ShapesContainer& operator=(const ShapesContainer& other); ~ShapesContainer(); int GetCount()const; Shapes* AtIndex(int index); void AddShape(const char* shape, double startX, double startY, const char* color, double endX, double endY=0); void PrintAllInStrm(ostream& strm); void PrintAll()const; void Erase(int index); void WithinCircle(double startX, double startY, double radius); void WithinRectangle(double startX, double startY, double width, double height); void TranslateShape(double vertical, double horizontal); void TranslateShape(double vertical, double horizontal, int n); };
a87a6cb9612643de03ce9c9a347e4369fb517484
75349e38b5590fa172b6c78a935f7bce3d369665
/LintCode/92背包问题.cpp
153fa4ff8652d91e547b2666aba970d100a6fd85
[]
no_license
CmosZhang/Code_Practice
f5a329d5405987426a0094a7a252b11008752b87
e901d82396a83d4b6e48cbc305551a346eb1073a
refs/heads/master
2020-09-25T10:47:08.141466
2020-01-03T08:05:47
2020-01-03T08:05:47
225,989,438
1
0
null
null
null
null
GB18030
C++
false
false
868
cpp
92背包问题.cpp
#include<iostream> #include<algorithm> #include<vector> using namespace std; //92. 背包问题 //您的提交打败了 39.00% 的提交! int backPack(int m, vector<int> &A) { // write your code here if (A.empty() || m <= 0) { return 0; } int len = A.size(); vector<vector<int>> dp(m + 1, vector<int>(len + 1, 0)); //i代表背包容量 for (int i = 0; i <= m; i++) { for (int j = 0; j <= len; j++) { if (i == 0 || j == 0) { dp[i][j] = 0; } else if (A[j - 1] > i)//当前大小大于剩余背包容器 { dp[i][j] = dp[i][j - 1]; } else { dp[i][j] = max(dp[i][j - 1], A[j - 1] + dp[i - A[j - 1]][j - 1]); } } } return dp[m][len]; } int main() { vector<int> nums = { 12,3,7,4,5,13,2,8,4,7,6,5,7 }; int m = 90; int res = backPack(m, nums); cout << res << endl; system("pause"); return 0; }
2b37470b3c0b1f80717e97ac9382d365f6a56cd0
9877cdaf61c54520757dbf2b981269fe93211293
/PlayerHurt.hpp
2a73e1d2927e9352751cef48edb9b34ec59f7847
[]
no_license
hackwaretech/hackware-bot
1ed44245b333abfc0f18c6a9047839441ef2e3b5
163c32b1bb9f20cd710f83b112726d3f0f1e9769
refs/heads/master
2020-05-02T15:46:39.366795
2020-04-10T09:34:54
2020-04-10T09:34:54
178,051,769
0
1
null
null
null
null
UTF-8
C++
false
false
408
hpp
PlayerHurt.hpp
#pragma once #include "IGameEvent.hpp" struct HitMarker { float expTime; int dmg; }; class PlayerHurtEvent : public GameEventListener2 { public: void FireGameEvent(GameEvent *gEvent); int GetEventDebugID(void); void registerSelf(void); void unregisterSelf(void); void paint(void); private: std::vector<HitMarker> hitMarkers; }; extern PlayerHurtEvent *playerHurtEvent;
712a3983e2a8e6e02be0f7d4625d3ca4dc83782a
400ff661684148cbb6aa99f4ebbc82bc551356d9
/tools/aria2/parse_dht_dat.cpp
822383a398cf9969af1b9f49cd4aa2a2e096728a
[]
no_license
csw201710/demo
32d71f333dc7f78fab0e2ab53f6a7e051847eea3
386a56961e8099b632115015cbeec599765ead01
refs/heads/master
2021-08-26T08:03:49.055496
2021-08-18T11:22:45
2021-08-18T11:22:45
171,476,054
7
11
null
null
null
null
UTF-8
C++
false
false
3,915
cpp
parse_dht_dat.cpp
#pragma pack(1) typedef struct { char header[8];//8 uint64_t time;//16 char localnode[8];//24 char localnodeId[20];//44 char reserved1[4];//48 uint32_t numNodes; char reserved2[4]; } ARIA2_V3; #pragma pack() inline uint64_t byteswap64(uint64_t x) { uint64_t v1 = ntohl(x & 0x00000000ffffffffllu); uint64_t v2 = ntohl(x >> 32); return (v1 << 32) | v2; } // 32bit swap UINT Swap32(UINT value) { UINT r; ((BYTE *)&r)[0] = ((BYTE *)&value)[3]; ((BYTE *)&r)[1] = ((BYTE *)&value)[2]; ((BYTE *)&r)[2] = ((BYTE *)&value)[1]; ((BYTE *)&r)[3] = ((BYTE *)&value)[0]; return r; } // 64-bit swap UINT64 Swap64(UINT64 value) { UINT64 r; ((BYTE *)&r)[0] = ((BYTE *)&value)[7]; ((BYTE *)&r)[1] = ((BYTE *)&value)[6]; ((BYTE *)&r)[2] = ((BYTE *)&value)[5]; ((BYTE *)&r)[3] = ((BYTE *)&value)[4]; ((BYTE *)&r)[4] = ((BYTE *)&value)[3]; ((BYTE *)&r)[5] = ((BYTE *)&value)[2]; ((BYTE *)&r)[6] = ((BYTE *)&value)[1]; ((BYTE *)&r)[7] = ((BYTE *)&value)[0]; return r; } //#include <winsock2.h> #pragma comment(lib,"Ws2_32.lib") class ARIA_DHT { private: ARIA2_V3 m_header; std::unique_ptr<char[]> m_buf; int m_pos; public: ARIA_DHT() { memset(&m_header, 0x00, sizeof(m_header)); m_pos = 0; } virtual ~ARIA_DHT() { } int loadFile(const char * path) { FILE *fp = fopen(path, "rb"); if (fp == 0) { throw "open file failed"; } fseek(fp, 0, SEEK_END); long size = ftell(fp); if (size == 0) { fclose(fp); throw "file size invalid"; } m_buf = std::unique_ptr<char[]>(new char[size]); fseek(fp, 0, SEEK_SET); if (fread(m_buf.get(), sizeof(char), size, fp) != size) { fclose(fp); throw "file size invalid"; } fclose(fp); return 0; } int readBytes(void *buf, int len) { if (len > 0) { memcpy(buf, m_buf.get() + m_pos, len); m_pos += len; } else { throw "read len is invalid"; } } int parse() { char header[8] = {0}; // magic header[0] = 0xa1u; header[1] = 0xa2u; // format ID header[2] = 0x02u; // version header[6] = 0; header[7] = 0x03u; if (m_buf.get() == 0) { throw "please call loadFile first "; } readBytes((char*)&m_header, sizeof(m_header)); if (memcmp(m_header.header, header, 8) != 0) { throw "invalid header magic"; } m_header.time = Swap64(m_header.time); m_header.numNodes = Swap32(m_header.numNodes); int compactlen = 6;//IPV4 char zero[18] = {0}; printf("m_header.numNodes: %d\n\n", m_header.numNodes); for (int i = 0;i < m_header.numNodes;i++) { char buf[255] = {0}; // 1byte compact peer info length uint8_t peerInfoLen; readBytes( &peerInfoLen, sizeof(peerInfoLen)); if (peerInfoLen != compactlen) { // skip this entry readBytes(buf, 7 + 48); continue; } // 7bytes reserved readBytes(buf, 7); // compactlen bytes compact peer info readBytes(buf, compactlen);// ip + port //无效ip和端口跳过 if (memcmp(zero, buf, compactlen) == 0) { // skip this entry readBytes(buf, 48 - compactlen); continue; } unpackcompact(buf, 6); // 24-compactlen bytes reserved readBytes(buf, 24 - compactlen); // node ID readBytes(buf, 20); // 4bytes reserved readBytes(buf, 4); } } void unpackcompact(const char* compact, int f) { int portOffset = f == 6 ? 4 : 16; char buf[30]; { in_addr inaddr; memcpy(&inaddr, compact, 4); //inaddr.S_un.S_addr = Swap32(*(UINT*)&inaddr); char *ipaddr = inet_ntoa(inaddr); printf("%20s ", ipaddr); } { uint16_t portN; memcpy(&portN, compact + portOffset, sizeof(portN)); int port = ntohs(portN); printf("%d\n", port); } } }; int main(int argc, char **argv) { ARIA_DHT obj; try { obj.loadFile("aria2-1.35.0-win-64bit-build1\\dht.dat"); obj.parse(); } catch (char *s) { std::cout << "Exception:"<< s << std::endl; } catch (...) { std::cout << "unkonw error" << std::endl; } return 0; }
b3009beee348518c799fc9072c67d3637de4ffe1
0e72bd8f10ff53b212d5b325ccb4a75e3b8ee74a
/BOJ/BruteForce/BJ1018.cpp
cfbe6a06d47bbb4a2126e8b69426cc6203246152
[]
no_license
ky8778/study_algorithm
cd5d5fac55bb7c56c31ffb62148f41c70d41e81e
8b632374adcad024e50c5bb465c704ca7bf52c52
refs/heads/master
2023-08-08T01:27:23.547426
2021-09-28T13:29:28
2021-09-28T13:29:28
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,495
cpp
BJ1018.cpp
//! 20200122 // TODO BruteForce // BJ1018 : https://www.acmicpc.net/problem/1018 #include <cstdio> #include <vector> #include <algorithm> using namespace std; const int white = 0; const int black = 1; int dataMap[60][60]; int N,M; int checkMap(int row,int col){ // result[0] : 백으로 시작 result[1] : 흑으로 시작 int result[2] = {0,}; for(int i = row ; i < row + 8 ;i++){ for(int j = col ; j < col + 8 ; j++){ if(i%2 == j%2){ if(dataMap[i][j] == white) result[1]++; else result[0]++; }else{ if(dataMap[i][j] == black) result[1]++; else result[0]++; } } } return result[0] > result[1] ? result[1] : result[0]; } int getResult(){ int min = 987987987; for(int i=0;i<=N-8;i++){ for(int j=0;j<=M-8;j++){ int tmp = checkMap(i,j); if(tmp < min) min = tmp; } } return min; } int main(){ scanf("%d %d",&N,&M); for(int n=0;n<N;n++){ char tmpRow[60]; scanf("%s",tmpRow); for(int m=0;m<M;m++){ if(tmpRow[m]=='W') dataMap[n][m] = 0; else dataMap[n][m] = 1; } } // printf("====================================\n"); // for(int i=0;i<N;i++){ // for(int j=0;j<M;j++){ // printf("%d ",dataMap[i][j]); // } // printf("\n"); // } printf("%d\n",getResult()); return 0; }
9ef967441a3b30e810432868de08755ee3de44e8
9272fad30fada5c18d6a64b5dd64bbb0c10ed297
/pentalib/figure.cpp
969e34d3a4284dc0f71e8e7505949d80d65af9f6
[ "MIT" ]
permissive
rdremov/pentamino
65f512ebf1e3c9063c6949b99c75b2ecdd04375f
51389de0cc69be90514ce08458e7bf1b294491ca
refs/heads/master
2022-04-25T03:45:00.282192
2020-04-23T02:59:42
2020-04-23T02:59:42
256,638,274
0
0
null
null
null
null
UTF-8
C++
false
false
5,255
cpp
figure.cpp
#include "figure.h" #include <thread> static const PT figures[figure_count][piece_count] = { 0,0, 2,0, 0,1, 1,1, 2,1, // c 1,0, 0,1, 1,1, 2,1, 1,2, // + 1,0, 0,1, 1,1, 0,2, 1,2, // p 1,0, 0,1, 1,1, 1,2, 2,2, // t 0,0, 0,1, 0,2, 0,3, 0,4, // I 0,0, 1,0, 2,0, 1,1, 1,2, // T 1,0, 2,0, 3,0, 0,1, 1,1, // 4 1,0, 2,0, 0,1, 1,1, 0,2, // W 0,0, 1,0, 1,1, 1,2, 2,2, // Z 2,0, 2,1, 0,2, 1,2, 2,2, // L 0,0, 0,1, 1,1, 2,1, 3,1, // J 2,0, 0,1, 1,1, 2,1, 3,1, // h }; static const char rots[figure_count] = { 4, 1, 4, 4, 2, 4, 4, 4, 2, 4, 4, 4 }; static const char mirs[figure_count] = { 1, 1, 2, 2, 1, 1, 2, 1, 2, 1, 2, 2 }; class Sizes { IND _w[figure_count]; IND _h[figure_count]; public: static Sizes const& Get() { static Sizes sizes; return sizes; } IND Width(IND k) const {return _w[k];} IND Height(IND k) const {return _h[k];} protected: Sizes() { for (IND k=0; k<figure_count; k++) { IND w = 0, h = 0; for (IND n=0; n<piece_count; n++) { auto pt = figures[k][n]; if (w < pt.x) w = pt.x; if (h < pt.y) h = pt.y; } _w[k] = w + 1; _h[k] = h + 1; } } }; class HoleFinder { public: HoleFinder(Field const& f) : _field(f), _hole{}, _visit(f.Width(), f.Height()) {} bool Find(IND x, IND y) { if (_field.IsOutside(x, y)) return false; if (!_visit.IsEmpty(x, y)) return false; if (_field.IsEmpty(x, y)) { _hole = {x, y}; return true; } _visit.Set(x, y, 0); if (_visit.Width() - x < _visit.Height() - y) return Find(x-1, y) || Find(x, y-1) || Find(x+1, y) || Find(x, y+1); return Find(x, y-1) || Find(x-1, y) || Find(x, y+1) || Find(x+1, y); } PT Get() const {return _hole;} private: Field _visit; Field const& _field; PT _hole; }; class Figure { public: Figure(IND k) : _color(k) { memcpy(_data, figures[k], sizeof(_data)); _w = Sizes::Get().Width(k); _h = Sizes::Get().Height(k); } void Rotate() { IND temp = _w, _w = _h, _h = temp; for (IND n=0; n<piece_count; n++) { auto& pt = _data[n]; temp = pt.x, pt.x = -pt.y + _w, pt.y = temp; } } void Mirror() { for (IND n=0; n<piece_count; n++) _data[n].x = -_data[n].x + _w - 1; } bool FitIn(Field const& f, PT pt, IND index) const { IND dx = pt.x - _data[index].x; IND dy = pt.y - _data[index].y; for (IND n=0; n<piece_count; n++) { IND x = _data[n].x + dx; IND y = _data[n].y + dy; if (f.IsOutside(x, y)) return false; if (!f.IsEmpty(x, y)) { return false; } } return true; } void MarkIn(Field& f, PT pt, IND index) const { IND dx = pt.x - _data[index].x; IND dy = pt.y - _data[index].y; for (IND n=0; n<piece_count; n++) { IND x = _data[n].x + dx; IND y = _data[n].y + dy; f.Set(x, y, _color); } } private: IND _w, _h; IND _color; PT _data[piece_count]; }; class Index { IND _count; IND _data[figure_count]; public: Index() : _count(figure_count) { for (IND k=0; k<_count; k++) _data[k] = k; } Index(const Index& index, IND skip) : _count(index._count - 1) { for (IND k=0; k<skip; k++) _data[k] = index._data[k]; for (IND k=skip; k<_count; k++) _data[k] = index._data[k+1]; } IND Count() const {return _count;} IND Get(IND k) const {return _data[k];} }; struct Frame { Field field; Index index; PT hole; Frame(const Field* p) : field(*p), hole{p->FirstHole()} {} Frame(const Frame* p, IND skip) : field(p->field), index(p->index, skip), hole{} {} Frame(const Field& f, const Index& i, IND skip) : field(f), index(i, skip), hole{} {} void Solve(Context& cntx) { for (IND k=0; k<index.Count(); k++) Solve1(cntx, k); } void Solve1(Context& cntx, IND k) { cntx.dbgcnt++; IND x = index.Get(k); Figure fig(x); IND nm = cntx.mirror ? mirs[x] : 1; for (char mir=0; mir<nm; mir++) { for (char rot=0; rot<rots[x]; rot++) { for (IND n=0; n<piece_count; n++) { if (fig.FitIn(field, hole, n)) { Frame fr(this, k); fig.MarkIn(fr.field, hole, n); if (fr.IsDone(cntx)) break; HoleFinder hf(fr.field); if (hf.Find(hole.x, hole.y)) { fr.hole = hf.Get(); fr.Solve(cntx); } } } fig.Rotate(); } fig.Mirror(); } } protected: bool IsDone(Context& cntx) { if (index.Count() ) return false; cntx.sol.push_back(field); return true; } }; static void solve1(Context* pCntx, IND k, const Field* pField) { Frame fr(pField); fr.Solve1(*pCntx, k); } void Field::SolveMT(Context& cntx) { struct TC { std::thread th; Solution sol; Context cntx; TC() : cntx{sol} {} Context* Cntx(bool mirror) {cntx.mirror = mirror; return &cntx;} }; TC tcs[figure_count]; { for (IND k=0; k<figure_count; k++) tcs[k].th = std::thread(solve1, tcs[k].Cntx(cntx.mirror), k, this); for (auto& tc : tcs) tc.th.join(); } for (auto& tc : tcs) { cntx.dbgcnt += tc.cntx.dbgcnt; cntx.sol.insert(cntx.sol.end(), tc.cntx.sol.begin(), tc.cntx.sol.end()); } } void Field::Solve(Context& cntx) { Frame fr(this); fr.Solve(cntx); }
afa76f3e14849819e9b5fd6ab1d4f8b746cb6c6e
3e69c168cd139937ef9a4d49c9fd670858839271
/SL_Amber/Src/Amber/AssetManager/AssetCreator/Tree.h
7f53bd443ed063a574e623361abe960a155ac919
[]
no_license
Amberskies/Qt3D_The_Amber_Project
4f207c3600c77ea15f1a266dc697a8054eb45a63
feaaf2600dc0efadc489e552c2751e17ca890a65
refs/heads/master
2020-03-21T05:19:27.295765
2018-07-13T05:12:24
2018-07-13T05:12:24
138,155,311
1
1
null
null
null
null
UTF-8
C++
false
false
503
h
Tree.h
#pragma once #include <QEntity> #include <QMesh> #include <QDiffuseSpecularMaterial> #include <QTextureMaterial> #include <QVector3D> class Tree : public Qt3DCore::QEntity { public: explicit Tree(QEntity *root = nullptr); ~Tree(); void createTree(int index, QVector3D location); //Get Qt3DCore::QEntity * getTree(); //Set private: QEntity * m_rootEntity = nullptr; QEntity * m_Tree[100]; Qt3DRender::QMesh *m_TreeMesh = nullptr; Qt3DExtras::QTextureMaterial *m_TreeMaterial = nullptr; };
75bb37cdd475ac0dc1e7d14fa8e11489b57fd86e
ba65f3ee473bdbb748adad181be32f3be89ab873
/yyp/HW3/date.cpp
5b54db6c3fad1cbc07f056b71f5e0ddf5cbb1c09
[]
no_license
ss8651twtw/oop_2016
34bef9957fe96dc5294b86d4354ad2a76d999532
58a9e27fa76ed506e668c5dc74061c0bdeb2e555
refs/heads/master
2021-01-21T04:50:15.347435
2016-06-07T19:08:14
2016-06-07T19:08:14
53,347,493
0
0
null
null
null
null
UTF-8
C++
false
false
821
cpp
date.cpp
#include "date.h" #include <iostream> using namespace std; unsigned short int cnt[] = {0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366}; unsigned short int Date::getDate_data()const{ return Date_data; } unsigned short int Date::getDay()const{ unsigned short int tmp = Date_data % 366; return tmp - cnt[getMon() - 1] + 1; } unsigned short int Date::getMon()const{ unsigned short int tmp = Date_data % 366, stop = 0; for(unsigned short int i = 1; i < 13; i++){ stop = cnt[i]; if(tmp < stop)return i; } } unsigned short int Date::getYr()const{ return 2000 + (Date_data / 366); } void Date::setDate(const short int& a, const short int& b, const short int& c){ Date_data = (a - 2000) * 366 + cnt[b - 1] + c - 1; } void Date::showDate(){ cout << getYr() << " " << getMon() << " " << getDay() << "\n"; }
860ba4ba3e0f96cdd8c7765d5a64daf1460fe02f
1a2552f1941318b4aa854a6f8306b40344874f23
/src/runtime/errors_and_diagnostics/pregenerated/other_diagnostics.h
9d49f771028f905d21ccd535429c760240173acb
[ "GPL-3.0-or-later", "Zlib", "BSL-1.0", "Apache-2.0", "LicenseRef-scancode-flex-2.5", "LicenseRef-scancode-mit-old-style", "W3C", "LicenseRef-scancode-warranty-disclaimer", "GPL-1.0-or-later", "LicenseRef-scancode-proprietary-license", "LGPL-2.0-or-later", "LicenseRef-scancode-swig", "ICU", "LicenseRef-scancode-other-copyleft", "CC-BY-ND-3.0", "LicenseRef-scancode-unknown-license-reference", "curl", "LGPL-2.1-or-later", "LicenseRef-scancode-other-permissive", "BSD-3-Clause", "MIT" ]
permissive
zorba-processor/zorba
23176504346703a6e6f48a37f10844ef170774ab
7a7d77144521029c230359d9f54c83ab8ec71ac7
refs/heads/master
2022-12-11T13:49:34.429854
2022-09-06T13:08:17
2022-09-06T13:08:17
59,799,419
44
20
Apache-2.0
2022-11-17T00:53:20
2016-05-27T02:56:03
C++
UTF-8
C++
false
false
4,547
h
other_diagnostics.h
/* * Copyright 2006-2012 2006-2016 zorba.io. * * 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. */ // ****************************************** // * * // * THIS IS A GENERATED FILE. DO NOT EDIT! * // * SEE .xml FILE WITH SAME NAME * // * * // ****************************************** #ifndef ZORBA_RUNTIME_ERRORS_AND_DIAGNOSTICS_OTHER_DIAGNOSTICS_H #define ZORBA_RUNTIME_ERRORS_AND_DIAGNOSTICS_OTHER_DIAGNOSTICS_H #include "common/shared_types.h" #include "runtime/base/narybase.h" namespace zorba { /** * op-zorba:read-line * Author: Zorba Team */ class ReadLineIterator : public NaryBaseIterator<ReadLineIterator, PlanIteratorState> { public: SERIALIZABLE_CLASS(ReadLineIterator); SERIALIZABLE_CLASS_CONSTRUCTOR2T(ReadLineIterator, NaryBaseIterator<ReadLineIterator, PlanIteratorState>); void serialize( ::zorba::serialization::Archiver& ar); ReadLineIterator( static_context* sctx, const QueryLoc& loc, std::vector<PlanIter_t>& children) : NaryBaseIterator<ReadLineIterator, PlanIteratorState>(sctx, loc, children) {} virtual ~ReadLineIterator(); zstring getNameAsString() const; void accept(PlanIterVisitor& v) const; bool nextImpl(store::Item_t& result, PlanState& aPlanState) const; }; /** * op-zorba:print * Author: Zorba Team */ class PrintIterator : public NaryBaseIterator<PrintIterator, PlanIteratorState> { protected: bool thePrintToConsole; // public: SERIALIZABLE_CLASS(PrintIterator); SERIALIZABLE_CLASS_CONSTRUCTOR2T(PrintIterator, NaryBaseIterator<PrintIterator, PlanIteratorState>); void serialize( ::zorba::serialization::Archiver& ar); PrintIterator( static_context* sctx, const QueryLoc& loc, std::vector<PlanIter_t>& children, bool aPrintToConsole = true) : NaryBaseIterator<PrintIterator, PlanIteratorState>(sctx, loc, children), thePrintToConsole(aPrintToConsole) {} virtual ~PrintIterator(); zstring getNameAsString() const; void accept(PlanIterVisitor& v) const; bool nextImpl(store::Item_t& result, PlanState& aPlanState) const; }; /** * * This is just a dummy iterator, which calls * its children. This iterator is used to wrap * inlined expressions to be able to add the call * to the call stack in case of an exception. * * Author: Zorba Team */ class FunctionTraceIterator : public NaryBaseIterator<FunctionTraceIterator, PlanIteratorState> { protected: store::Item_t theFunctionName; //stores the name of the function it substitutes QueryLoc theFunctionLocation; //stores the location of the function call QueryLoc theFunctionCallLocation; //stores the location of the function which it calls unsigned int theFunctionArity; //stores the arity of the function being called public: SERIALIZABLE_CLASS(FunctionTraceIterator); SERIALIZABLE_CLASS_CONSTRUCTOR2T(FunctionTraceIterator, NaryBaseIterator<FunctionTraceIterator, PlanIteratorState>); void serialize( ::zorba::serialization::Archiver& ar); FunctionTraceIterator( static_context* sctx, const QueryLoc& loc, std::vector<PlanIter_t>& children) : NaryBaseIterator<FunctionTraceIterator, PlanIteratorState>(sctx, loc, children), theFunctionName(), theFunctionLocation(), theFunctionCallLocation(), theFunctionArity() {} virtual ~FunctionTraceIterator(); zstring getNameAsString() const; public: void setFunctionName(const store::Item_t& aFunctionName); void setFunctionCallLocation(const QueryLoc& aFunctionLocation); void setFunctionLocation(const QueryLoc& aFunctionLocation); void setFunctionArity(unsigned int arity); bool countImpl(store::Item_t& result, PlanState& planState) const; bool skipImpl(int64_t count, PlanState& planState) const; void accept(PlanIterVisitor& v) const; bool nextImpl(store::Item_t& result, PlanState& aPlanState) const; }; } #endif /* * Local variables: * mode: c++ * End: */
929a9948c78cc2a3620fe353770d311737411fa9
5b96e69b809970466e2fb6d4b4e4badfd5e79a8b
/Homeworks/Homework3/1/Bank.h
40e0fc56d81630ffe2c83f2c4cc118a95dc5561b
[]
no_license
StoyanYanev/Object-oriented-programming
95da06fc5268762c7b1617f1e4658495cbfd201f
6fc6ffaa3a276f40b6bdf2def3f08c85f2944ee6
refs/heads/master
2020-03-23T18:01:00.095776
2018-09-08T19:05:30
2018-09-08T19:05:30
141,885,671
0
0
null
null
null
null
UTF-8
C++
false
false
1,514
h
Bank.h
#ifndef BANK_H #define BANK_H #include <iostream> #include <string> #include <vector> #include"Customer.h" #include "CurrentAccount.h" #include"SavingsAccount.h" #include"PrivilegeAccount.h" class Bank { public: Bank(std::string nameOfBank, const std::string addressOfBank); Bank(const Bank& b); Bank &operator=(const Bank& b); const std::string GetNameOfBank()const; const std::string GetAdressOfBank()const; void SetNameOfBank(const std::string name); void SetAddresOfBank(std::string address); void AddCustomer(int customerId, const std::string name, const std::string address); void ListCustomers()const; void DeleteCustomer(int customerId); void AddAccount(const std::string accountType, const std::string iban, int ownerId, double amount); void DeleteAccount(const std::string iban); void ListAccounts()const; void ListCustomerAccounts(int customerId); void Transfer(const std::string fromIBAN, const std::string toIBAN, double amount); // transfer sum from iban to iban void WithdrawFromAccount(const std::string IBAN, double sum); void DepositToAccount(const std::string IBAN, double sum); void Display()const; ~Bank(); private: void DeleteCustomerAccounts(int id); int FindCustomerById(int customerId); int FindOwnerByIBAN(const std::string iban); void CopyFrom(const Bank &b); void Destroy(); std::string m_nameOfBank; std::string m_addressOfBank; std::vector<Customer> m_customers; std::vector<Account*> m_accounts; }; #endif
b07bb42bd21b36b2365736599fb5257e31b8d719
4652840c8fa0d701aaca8de426bf64c340a5e831
/components/physical_web/data_source/physical_web_data_source.cc
31e8349694a27fa3d6c998c6593c3ca4c9d8e009
[ "BSD-3-Clause" ]
permissive
remzert/BraveBrowser
de5ab71293832a5396fa3e35690ebd37e8bb3113
aef440e3d759cb825815ae12bd42f33d71227865
refs/heads/master
2022-11-07T03:06:32.579337
2017-02-28T23:02:29
2017-02-28T23:02:29
84,563,445
1
5
BSD-3-Clause
2022-10-26T06:28:58
2017-03-10T13:38:48
null
UTF-8
C++
false
false
678
cc
physical_web_data_source.cc
// Copyright 2016 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 "components/physical_web/data_source/physical_web_data_source.h" const char kPhysicalWebDescriptionKey[] = "description"; const char kPhysicalWebDistanceEstimateKey[] = "distanceEstimate"; const char kPhysicalWebGroupIdKey[] = "groupId"; const char kPhysicalWebIconUrlKey[] = "icon"; const char kPhysicalWebResolvedUrlKey[] = "resolvedUrl"; const char kPhysicalWebScanTimestampKey[] = "scanTimestamp"; const char kPhysicalWebScannedUrlKey[] = "scannedUrl"; const char kPhysicalWebTitleKey[] = "title";
29a9b9475c53b501e9fd060c57f934bbd55601d4
2075fd64d072fca5f88b4fbe2c2397a3f12a29bd
/mediatek/platform/mt6575/hardware/mhal/src/core/pipe/6575/display_isp/display_isp_tuning_if.h
4fca00064968b5419241c3d86e491ed90ef51e4a
[]
no_license
4Fwolf/signal75-77_kernel_3.4.67
380fc4cee56b52060da78eecfa70a4ecea5f1278
bcca0b70dc87e8ba7af8878666076f7baf6c6b7a
HEAD
2016-09-01T16:01:49.247082
2016-01-29T09:56:21
2016-01-29T09:56:21
48,953,336
1
3
null
null
null
null
UTF-8
C++
false
false
9,710
h
display_isp_tuning_if.h
/******************************************************************************************** * LEGAL DISCLAIMER * * (Header of MediaTek Software/Firmware Release or Documentation) * * BY OPENING OR USING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE") RECEIVED * FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON AN "AS-IS" BASIS * ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES, EXPRESS OR IMPLIED, * INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR * A PARTICULAR PURPOSE OR NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY * WHATSOEVER WITH RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, * INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK * ONLY TO SUCH THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO * NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S SPECIFICATION * OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM. * * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE LIABILITY WITH * RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE, OR REFUND ANY SOFTWARE LICENSE * FEES OR SERVICE CHARGE PAID BY BUYER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. * * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE WITH THE LAWS * OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF LAWS PRINCIPLES. ************************************************************************************************/ #ifndef _DISPLAY_ISP_TUNING_IF_H_ #define _DISPLAY_ISP_TUNING_IF_H_ #include "display_isp_tuning_if_base.h" #define LOGD(fmt, arg...) XLOGD(fmt, ##arg) namespace NSDisplayIspTuning { /******************************************************************************* * *******************************************************************************/ class DisplayIspTuningIF : public DisplayIspTuningIFBase { enum { PCA_LUT_SIZE = sizeof(DISPLAY_ISP_PCA_BIN_T)*PCA_BIN_NUM }; //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ protected: //// Ctor/Dtor. DisplayIspTuningIF(); virtual ~DisplayIspTuningIF(); //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // Interfaces. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ public: static DisplayIspTuningIFBase* getInstance(); virtual void destroyInstance(); virtual MINT32 init(); virtual MINT32 deinit(); virtual const PRZ_T& getPRZParam(); virtual MINT32 loadISPParam(); virtual MINT32 unloadISPParam(); virtual MBOOL checkISPParamEffectiveness(); virtual MINT32 setISPParamIndex(MUINT32 u4PcaSkinLutIdx, MUINT32 u4PcaGrassLutIdx, MUINT32 u4PcaSkyLutIdx, MUINT32 u4YCCGOIdx, MUINT32 u4PRZIdx); virtual MINT32 getISPParamIndex(MUINT32& u4PcaSkinLutIdx, MUINT32& u4PcaGrassLutIdx, MUINT32& u4PcaSkyLutIdx, MUINT32& u4YCCGOIdx, MUINT32& u4PRZIdx); MINT32 allocSysram(NSIspSysram::EUser_T const eUsr, MUINT32 const u4BytesToAlloc, MVOID*& rPA, MVOID*& rVA); MINT32 freeSysram(NSIspSysram::EUser_T const eUsr); //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // PCA LUT //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ inline MBOOL isPCAEnabled() const { return (0 != m_rParam.rPcaCfg[m_rParam.rIndex.PcaCfg].ctrl.bits.EN); } inline MVOID disablePCA() const { if (m_pIspReg) ISP_BITS(m_pIspReg, CAM_PCA_CON, EN) = 0; } inline MUINT32 getPCALutSize() const { return PCA_LUT_SIZE; } inline MVOID mergePCALut() { MINT32 i; // merge skin color // if (m_bIsPcaSkinLutIdxChanged) { for (i = PCA_SKIN_BIN_START; i < PCA_SKIN_BIN_START + PCA_SKIN_BIN_NUM; i++) { m_rPcaLut.lut[i] = m_rParam.rPcaSkinLut[m_rParam.rIndex.PcaSkinLut].lut[i - PCA_SKIN_BIN_START]; // LOGD("m_rPcaLut.lut[%d].hue_shit = %d\n", i, m_rPcaLut.lut[i].hue_shift); } m_bIsPcaSkinLutIdxChanged = MFALSE; // } // merge grass color // if (m_bIsPcaGrassLutIdxChanged) { for (i = PCA_GRASS_BIN_START; i < PCA_GRASS_BIN_START + PCA_GRASS_BIN_NUM; i++) { m_rPcaLut.lut[i] = m_rParam.rPcaGrassLut[m_rParam.rIndex.PcaGrassLut].lut[i - PCA_GRASS_BIN_START]; // LOGD("m_rPcaLut.lut[%d].hue_shit = %d\n", i, m_rPcaLut.lut[i].hue_shift); } m_bIsPcaGrassLutIdxChanged = MFALSE; // } // merge sky color // if (m_bIsPcaSkyLutIdxChanged) { for (i = PCA_SKY_BIN_START; i < PCA_BIN_NUM; i++) { m_rPcaLut.lut[i] = m_rParam.rPcaSkyLut[m_rParam.rIndex.PcaSkyLut].lut[i - PCA_SKY_BIN_START]; // LOGD("m_rPcaLut.lut[%d].hue_shit = %d\n", i, m_rPcaLut.lut[i].hue_shift); } for (i = 0; i < PCA_SKY_BIN_NUM - (PCA_BIN_NUM - PCA_SKY_BIN_START); i++) { m_rPcaLut.lut[i] = m_rParam.rPcaSkyLut[m_rParam.rIndex.PcaSkyLut].lut[i + (PCA_BIN_NUM - PCA_SKY_BIN_START)]; // LOGD("m_rPcaLut.lut[%d].hue_shit = %d\n", i, m_rPcaLut.lut[i].hue_shift); } m_bIsPcaSkyLutIdxChanged = MFALSE; // } } inline MVOID loadPCALutToSysram() { // VA <- PCA LUT ::memcpy(m_PcaVA, &m_rPcaLut.lut[0], PCA_LUT_SIZE); } inline MVOID loadSysramLutToISP() { ISP_REG(m_pIspReg, CAM_PCA_TBA) = reinterpret_cast<MUINT32>(m_PcaPA); } inline MBOOL isPCALutLoadBusy() const { return (0 != ISP_BITS(m_pIspReg, CAM_PCA_CON, PCA_BUSY)); } //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // ISP Parameter //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ inline MBOOL isNR2Enabled() const { return ((0 != m_rParam.rNR2[m_rParam.rIndex.NR2].ctrl.bits.ENY) || (0 != m_rParam.rNR2[m_rParam.rIndex.NR2].ctrl.bits.ENC)); } inline MBOOL isYCCGOEnabled() const { return (0 != m_rParam.rYCCGO[m_rParam.rIndex.YCCGO].ctrl.val); } inline MVOID loadEEParam() { ISP_REG(m_pIspReg, CAM_EE_CTRL) = 0x00000000; // disable EE } inline MVOID loadNR2Param() { ISP_REG(m_pIspReg, CAM_NR2_CON) = m_rParam.rNR2[m_rParam.rIndex.NR2].ctrl.val; ISP_REG(m_pIspReg, CAM_NR2_CFG_C1) = m_rParam.rNR2[m_rParam.rIndex.NR2].cfg1.val; ISP_REG(m_pIspReg, CAM_NR2_CFG2) = m_rParam.rNR2[m_rParam.rIndex.NR2].cfg2.val; ISP_REG(m_pIspReg, CAM_NR2_CFG3) = m_rParam.rNR2[m_rParam.rIndex.NR2].cfg3.val; ISP_REG(m_pIspReg, CAM_NR2_CFG4) = m_rParam.rNR2[m_rParam.rIndex.NR2].cfg4.val; ISP_REG(m_pIspReg, CAM_NR2_CFG_C2) = m_rParam.rNR2[m_rParam.rIndex.NR2].luma.val; ISP_REG(m_pIspReg, CAM_NR2_CFG_L1) = m_rParam.rNR2[m_rParam.rIndex.NR2].lce_gain.val; ISP_REG(m_pIspReg, CAM_NR2_CFG_L2) = m_rParam.rNR2[m_rParam.rIndex.NR2].lce_gain_div.val; ISP_REG(m_pIspReg, CAM_NR2_CFG_N1) = m_rParam.rNR2[m_rParam.rIndex.NR2].mode1_cfg1.val; ISP_REG(m_pIspReg, CAM_NR2_CFG_N2) = m_rParam.rNR2[m_rParam.rIndex.NR2].mode1_cfg2.val; ISP_REG(m_pIspReg, CAM_NR2_CFG_N3) = m_rParam.rNR2[m_rParam.rIndex.NR2].mode1_cfg3.val; } inline MVOID loadPcaParam() { ISP_REG(m_pIspReg, CAM_PCA_CON) = m_rParam.rPcaCfg[m_rParam.rIndex.PcaCfg].ctrl.val; ISP_REG(m_pIspReg, CAM_PCA_GMC) = m_rParam.rPcaCfg[m_rParam.rIndex.PcaCfg].gmc.val; } inline MVOID loadYCCGOParam() { ISP_REG(m_pIspReg, CAM_YCCGO_CON) = m_rParam.rYCCGO[m_rParam.rIndex.YCCGO].ctrl.val; ISP_REG(m_pIspReg, CAM_YCCGO_CFG1) = m_rParam.rYCCGO[m_rParam.rIndex.YCCGO].cfg1.val; ISP_REG(m_pIspReg, CAM_YCCGO_CFG2) = m_rParam.rYCCGO[m_rParam.rIndex.YCCGO].cfg2.val; ISP_REG(m_pIspReg, CAM_YCCGO_CFG3) = m_rParam.rYCCGO[m_rParam.rIndex.YCCGO].cfg3.val; ISP_REG(m_pIspReg, CAM_YCCGO_CFG4) = m_rParam.rYCCGO[m_rParam.rIndex.YCCGO].cfg4.val; ISP_REG(m_pIspReg, CAM_YCCGO_CFG5) = m_rParam.rYCCGO[m_rParam.rIndex.YCCGO].cfg5.val; ISP_REG(m_pIspReg, CAM_YCCGO_CFG6) = m_rParam.rYCCGO[m_rParam.rIndex.YCCGO].cfg6.val; ISP_REG(m_pIspReg, CAM_YCCGO_CFG7) = m_rParam.rYCCGO[m_rParam.rIndex.YCCGO].cfg7.val; ISP_REG(m_pIspReg, CAM_YCCGO_CFG8) = m_rParam.rYCCGO[m_rParam.rIndex.YCCGO].cfg8.val; ISP_REG(m_pIspReg, CAM_YCCGO_CFG9) = m_rParam.rYCCGO[m_rParam.rIndex.YCCGO].cfg9.val; } private: DISPLAY_ISP_T m_rParam; DISPLAY_ISP_PCA_LUT_T m_rPcaLut; IspDrv* m_pIspDrv; isp_reg_t* m_pIspReg; NSIspSysram::IspSysramDrv* m_pSysramDrv; MVOID* m_PcaPA; MVOID* m_PcaVA; MBOOL m_bIsPcaSkinLutIdxChanged; MBOOL m_bIsPcaGrassLutIdxChanged; MBOOL m_bIsPcaSkyLutIdxChanged; volatile MINT32 m_Users; mutable android::Mutex m_Lock; }; }; // namespace NSDisplayIspTuning #endif // _DISPLAY_ISP_TUNING_IF_H_
466a057c2ce7e0df3b01e02aaad1e40ee0a2bc21
fc6d835bc3125052721c66f5302fbff71ae3454d
/leetcode/94_二叉树的中序遍历.cpp
25600751d6deea33d17c165733efea99dee9b240
[]
no_license
Scofyyy/leetcode
c1b0a6af9acd10a39f4548b0761af7bff7980b72
edac9340d117f47799bef3cbafa75ff3fc5f3def
refs/heads/master
2020-08-24T09:17:28.451782
2019-12-26T08:11:29
2019-12-26T08:11:29
216,801,451
0
0
null
null
null
null
UTF-8
C++
false
false
502
cpp
94_二叉树的中序遍历.cpp
//使用栈的方法 #include <vector> #include <stack> #include "BinaryTreeNode.h" using namespace std; class Solution { public: vector<int> inorderTraversal(BinaryTreeNode *root) { vector<int> ans; helper(root,ans); return ans; } void helper(BinaryTreeNode* root,vector<int> ans) { if(root==nullptr) { return; } helper(root->left,ans); ans.push_back(root->val); helper(root->right,ans); } };
84d4d67b37093648ea537cc8ff59c2416c7e9b5e
bf0e0ca8d71c453c506176ab40b343297ce77fc8
/venus/sdlc/sdl2json/Lex.h
a7aa3cadcd559f5ae7ae7ee62cf7e86315ec452f
[ "MIT" ]
permissive
vihariswamy/cerl
59ad9cebcf5443e0487160c47423cd4a872bf82e
02b75ab9daf19f63294b7c078a73753328e2984b
refs/heads/master
2022-12-26T04:09:22.807492
2020-10-01T10:57:40
2020-10-01T10:57:40
300,246,396
0
0
MIT
2020-10-01T10:57:07
2020-10-01T10:57:06
null
UTF-8
C++
false
false
5,475
h
Lex.h
/* ------------------------------------------------------------------------- // CERL: C++ Erlang Server Model // // Module: cerl/Lex.h // Creator: xushiwei // Email: xushiweizh@gmail.com // Date: 2009-3-26 19:41:58 // // $Id: Lex.h 2419 2010-04-08 14:00:42Z scm $ // -----------------------------------------------------------------------*/ #ifndef CERL_LEX_H #define CERL_LEX_H #ifndef TPL_C_LEX_H #include <tpl/c/Lex.h> #endif #ifndef TPL_REGEXP_H #include <tpl/RegExp.h> #endif #ifndef TR #define TR TPL_INFO("TRACE") #endif // ========================================================================= using namespace tpl; typedef impl::Result dom; extern dom::Document doc; extern dom::Mark tagModule; extern dom::NodeMark tagSentences; extern dom::NodeMark tagCodedef; extern dom::Mark tagName; extern dom::Mark tagValue; extern dom::NodeMark tagTypedef; extern dom::Mark tagName; extern dom::NodeMark tagType; extern dom::NodeMark tagServer; extern dom::NodeMark tagSentences; extern dom::NodeMark tagConstructor; extern dom::NodeMark tagArgs; extern dom::NodeMark tagCodedef; extern dom::NodeMark tagTypedef; extern dom::NodeMark tagFunction; extern dom::Mark tagId; extern dom::Mark tagAsync; extern dom::Mark tagName; extern dom::NodeMark tagArgs; extern dom::NodeMark tagType; extern dom::NodeMark tagType; extern dom::NodeMark tagNamedType; extern dom::Mark tagName; extern dom::NodeMark tagStruct; extern dom::NodeMark tagVars; extern dom::NodeMark tagType; extern dom::Mark tagName; extern dom::NodeMark tagCodedType; extern dom::NodeMark tagItems; extern dom::Mark tagCode; extern dom::NodeMark tagVars; extern dom::NodeMark tagType; extern dom::Mark tagName; extern dom::NodeMark tagArray; extern dom::Mark tagSize; extern impl::Allocator alloc; extern impl::MarkedGrammar rType; extern NS_STDEXT::String serverName; // ------------------------------------------------------------------------- // common #define sdl_keyword(kw) gr(c_symbol()/eq(kw)) #define sdl_keyword2(kw, tag) gr(c_symbol()/eq(kw)/tag) #define sdl_symbol_l (lower() + *c_symbol_next_char()) #define sdl_symbol_u (upper() + *c_symbol_next_char()) #define sdl_code gr(sdl_symbol_l/tagCode) #define sdl_func_name gr(sdl_symbol_l/tagName) #define sdl_var_name gr(sdl_symbol_l/tagName) #define sdl_type_name gr(sdl_symbol_u/tagName) #define sdl_type_name2(var) gr(sdl_symbol_u/assign(var)/tagName) // ------------------------------------------------------------------------- // module #define sdl_module (sdl_keyword("module") + c_symbol()/tagModule + ';') // ------------------------------------------------------------------------- // type // // var #define sdl_var (ref(rType) + sdl_var_name) // // coded type #define sdl_coded_struct ('{' + sdl_code + *(',' + sdl_var/tagVars) + '}') #define sdl_coded_type_item (sdl_code | sdl_coded_struct) #define sdl_coded_type ((sdl_coded_type_item/tagItems % '|')/tagCodedType) // // named type #define sdl_named_type (sdl_type_name/tagNamedType) // // struct #define sdl_struct (('{' + sdl_var/tagVars % ',' + '}')/tagStruct) // // type #define sdl_array (('[' + !gr(c_integer()/tagSize) + ']')/tagArray) #define sdl_type (((sdl_coded_type | sdl_named_type | sdl_struct) + !sdl_array)/tagType) // ------------------------------------------------------------------------- // codedef #define sdl_codedef ((sdl_keyword("code") + sdl_var_name + '=' + c_integer()/tagValue + ';')/tagCodedef) // ------------------------------------------------------------------------- // typedef #define sdl_typedef ((sdl_keyword("type") + sdl_type_name + '=' + ref(rType) + ';')/tagTypedef) // ------------------------------------------------------------------------- // function #define sdl_id (gr("id") + '=' + c_integer()/tagId) #define sdl_func_attrs ('[' + sdl_id + !(',' + sdl_keyword2("async", tagAsync)) + ']') #define sdl_function_arg sdl_var #define sdl_function_head (sdl_func_name + '(' + !(sdl_function_arg/tagArgs % ',') + ')') #define sdl_ret_type (sdl_coded_type/tagType) #define sdl_function ((sdl_func_attrs + sdl_function_head + !("->" + sdl_ret_type) + ';')/tagFunction) // ------------------------------------------------------------------------- // server #define sdl_constructor_impl (gr(sdl_symbol_u/eq(serverName)) + '(' + !(sdl_function_arg/tagArgs % ',') + ')') #define sdl_constructor ((sdl_constructor_impl + ';')/tagConstructor) #define sdl_server_sentence (sdl_function | sdl_typedef | sdl_codedef | sdl_constructor | ';') #define sdl_server_body (*(sdl_server_sentence/tagSentences)) #define sdl_server ((sdl_keyword("server") + sdl_type_name2(serverName) + '{' + sdl_server_body + '}')/tagServer) // ------------------------------------------------------------------------- // sentence #define sdl_gbl_sentence (sdl_codedef | sdl_typedef | sdl_server | ';') // ------------------------------------------------------------------------- // doc #define sdl_doc (cpp_skip_[ sdl_module + *(sdl_gbl_sentence/tagSentences) ]/doc) // ========================================================================= // $Log: $ #endif /* CERL_LEX_H */
7b4a0ee377a46568b6dccd1cdc5f496d689db8d5
7feafc361420ba68c0df24840e62d18ccfdf11ef
/CSE/Quiz.cpp
4652eb6f35c6a1fc4cf8c30120b2deceeb2728c1
[]
no_license
omarKaushru/Numb-UV-Life-activites
b7e94645c9bbc52317fcb80cd6c83e95793fcefb
63a74e875edee6dc5cfe77439247172da009f2c5
refs/heads/master
2022-12-05T11:34:12.142216
2020-09-01T18:19:41
2020-09-01T18:19:41
292,070,016
2
0
null
null
null
null
UTF-8
C++
false
false
346
cpp
Quiz.cpp
#include<stdio.h> #include<conio.h> main(){ int quiz[5]; int i,sum; sum=0; printf("Enter number of five quzes :"); for(i=0;i<5;i=i+1) scanf("%d",&quiz[i]); for(i=0;i<5;i=i+1) { sum=sum+quiz[i]; } printf("Total number of the quiz:%d ",sum); getch(); }
72e321d865fbbe1ebd1fa8b3253cb9fd179dca9a
7ba7e2b3023ae6d0b05bdc83f9432200f52f264a
/2nd_year/half1/OOP/L4/L4EX.CPP
6fea660ac6e40d9aee873b36530eb05483040d91
[]
no_license
everthinq/University-related
f81fc62fcffb092b46e0a626295353d70a10026e
e68f97b2ab9a1a49964238c59e3081e9e717409d
refs/heads/master
2021-01-20T04:47:25.063019
2017-12-02T13:18:11
2017-12-02T13:18:11
89,733,551
0
0
null
null
null
null
UTF-8
C++
false
false
3,753
cpp
L4EX.CPP
#include <iostream.h> #include <conio.h> #include <stdlib.h> #include <iomanip.h> class list { struct mylist { int value; mylist* next; }; mylist *top; public: int print_list(); int add (int n, int value); int find_n (int n); int find_val (int value); int delete_list (); int delete_n (int n); list(); ~list(); } list::list() { top = 0; } ///////////print list////////////////////////////////// int list::print_list() { mylist* temp = top; if (!temp) return -1; for(; temp; temp = temp -> next) cout << temp -> value << " "; return 0; } ////////////////////////////////////////////////////// ///////////add elem in list///////////////////////// int list::add (int n, int value) { mylist* el = new mylist; if (!el) return -1; el -> value = value; if (!top) n = 0; if (n <= 0) { el -> next = top; top = el; } else { mylist *temp = top; for (int i = 0; (i < (n - 1)) && (temp -> next); i++) temp = temp -> next; el -> next = temp -> next; temp -> next = el; } return 0; } ////////////////////////////////////////////////////////// ////////////find n_elem////////////////////////////////// int list::find_n (int n) { mylist* temp = top; if (n <= 0) return -1; else { for (int i = 1; (i < n) && (temp); i++) temp = temp -> next; if (!temp) return -1; else return temp -> value; } } ////////////////////////////////////////////////////////// ///////////////find elem by value//////////////// int list::find_val (int value) { mylist* temp = top; int i = 1; for (; temp; temp = temp -> next, i++) if (temp -> value == value) return i; return -1; } ////////////////////////////////////////////////////////// /////////////////////delete list/////////////////////// int list::delete_list () { if (!top) return 0; mylist* temp = top -> next; for (; top; temp = temp -> next) { delete top; top = temp; } return 1; } ////////////////////////////////////////////////////////// ///////////delete n_elem///////////////////////////// int list::delete_n (int n) { n--; if (!top) return -1; if (n <= 0) { mylist* temp; temp = top -> next; delete top; top = temp; return 0; } if (top -> next == 0) { mylist *temp; temp = top; delete top; top = 0; return 0; } else { mylist* temp = top; for (int i=0;(i<(n-1))&&(temp->next)&&(temp->next->next);i++) temp = temp -> next; mylist* temp2 = temp -> next; temp -> next = temp -> next -> next; delete temp2; } return 0; } list::~list() { delete_list(); } ///////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////// void main() { list p; int number=0; int q=0; int value=0; int n=0; while(q!=5) { clrscr(); cout<<" print_list = 0"<<endl; cout<<" add elem in list = 1"<<endl; cout<<" delete elem = 2"<<endl; cout<<" find n_elem = 3"<<endl; cout<<"find elem by value = 4"<<endl; cout<<" quit = 5"<<endl; cout<<endl; cin>>q; switch(q) { case 0: { cout<<endl; p.print_list(); break; } case 1: { cout<<"enter value of element"<<endl; cin>>value; cout<<"enter number of position in list"<<endl; cin>>n; cout<<endl; p.add(n, value); p.print_list(); break; } case 2: { cout<<"enter position number in list"<<endl; cin>>n; cout<<endl; p.delete_n(n); p.print_list(); break; } case 3: { cout<<"enter position number in list"<<endl; cin>>number; cout<<endl; p.print_list(); cout<<endl; cout<<p.find_n(number); break; } case 4: { cout<<"enter value in list"<<endl; cin>>value; cout<<endl; p.print_list(); cout<<endl; cout<<p.find_val(value); break; } } getch(); } } /////////////////////////////////////////////////////////////////
6b215b5ba2e43c73e2396a4d5203df733360245a
b5ba3e27b0f0619f503ba61c291f375d87cbfac3
/Volume-012/prob1203.cpp
35b6f46c28dd2d58fa72c4776222f39fce43dff2
[]
no_license
GreenRecycleBin/UVA
e67ff058385cf3b144543a2df4b8cb1ed996737c
d2dda860ff1856278a146aa64cc448d7edeffe61
refs/heads/master
2021-01-22T03:14:00.776549
2015-01-19T15:59:00
2015-01-19T15:59:00
2,405,520
0
0
null
null
null
null
UTF-8
C++
false
false
875
cpp
prob1203.cpp
#include <cstdio> #include <iostream> #include <map> #include <string> #include <queue> using namespace std; // Pair of (id, interval) typedef pair<int, int> ii; struct Comparator { bool operator()(const ii &a, const ii &b) { if (a.second == b.second) return a.first > b.first; return a.second > b.second; } }; typedef priority_queue<ii, vector<ii>, Comparator> pqii; typedef map<int, int> mii; int main() { pqii pq; mii intervals; string input; int id, interval; while (cin >> input && input != "#") { scanf("%d %d", &id, &interval); pq.push(ii(id, interval)); intervals[id] = interval; } int n; scanf("%d", &n); for (int i = 0; i < n; ++i) { ii next_job = pq.top(); pq.pop(); printf("%d\n", next_job.first); pq.push(ii(next_job.first, next_job.second += intervals[next_job.first])); } return 0; }
37025261ac8c8e53c5a1b272d732bcb69af32550
6b2a8dd202fdce77c971c412717e305e1caaac51
/solutions_5652388522229760_1/C++/lsmll/pa.cpp
fc2bb287f61d8b6b59b11c85972cd0674849a311
[]
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
527
cpp
pa.cpp
#include<cstdio> #include<cstring> #include<algorithm> using namespace std; typedef long long ll; ll tmp; int tests,ans,tc,a[21],i,j,k,n,m; void work(ll x){ tmp=x; for (;x;x/=10) if (!a[x%10]) a[x%10]=1,m++; } int main(){ for (tc=1,scanf("%d",&tests);tests--;tc++){ fprintf(stderr,"%d\n",tc); scanf("%d",&n); if (!n){ printf("Case #%d: INSOMNIA\n",tc);continue; } memset(a,0,sizeof(a));m=0; for (i=1;m<10;i++) work((ll)i*(ll)n); printf("Case #%d: %lld\n",tc,tmp); } return 0; }
3f2a12e7824686b258f1cdd26c99eebb4db789fd
c1aa8f596a6463e6a5a8361fb107f9dfc40b749a
/71/B.cpp
00a06c627788ba874a222a3627e8f2403b5fd364
[]
no_license
JadedBeast/Codeforces
73b31ad8a0b84d511c446300d277dc864002fa08
c1ce253ee39da6007d5fc458557188a9e279658e
refs/heads/master
2020-05-30T22:55:07.191077
2020-04-05T15:49:36
2020-04-05T15:49:36
190,004,594
0
0
null
null
null
null
UTF-8
C++
false
false
917
cpp
B.cpp
// In the name of **** God **** /* Copyright (C) JadedBeast Morocco created : 05/01/2020 */ #include <bits/stdc++.h> using namespace std; #define endl "\n" #define ll long long #define debug(x) cout<<"Mayday Mayday : "<<x<<endl; #define debugg(x) cout<<"----Mayday Mayday : "<<x<<endl; #define debuggg(x) cout<<"****Mayday Mayday : "<<x<<endl; inline void JadedBeast() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); } const int mod = 1e9+7; const int MAX = 1e6+9; int main(void) { JadedBeast(); int n,k,t; cin >> n >> k >>t; int rep=(n*k*t)/100; for(int i=0;i<rep/k;i++) cout << k<<" "; n-=rep/k; for(int i=0;i<n;i++){ if(i==0) cout<<rep%k<<" "; else cout<<"0 "; } return 0; }
1903ff92bfb1b661d09703657562647cd8607659
513218cd5a42717a55e43300272b32711a2ea993
/src/application/permissionsSetter.cpp
98ebcb80d1a0f1779dd677f8af1519c034cab02a
[]
no_license
ral-facilities/gridftp_acl_plugin
0bd6e187fc4535be3e0c98d70933443bcf5a921b
2c5a1e905d0a3bbab7cff37e679eaa5a9bbc080a
refs/heads/master
2021-07-29T20:07:57.898525
2021-07-23T15:01:45
2021-07-23T15:01:45
145,568,458
0
0
null
2018-11-09T10:00:37
2018-08-21T13:34:00
C++
UTF-8
C++
false
false
1,071
cpp
permissionsSetter.cpp
#include "PermissionsSetter.h" #include <stdexcept> #include <map> #include <vector> #include "IUtils.h" void PermissionsSetter::SetPermissions(std::string fileLocation, std::string permissions, IUtils* utils, IFileInfoProvider* fileInfoProvider) { if (!fileInfoProvider->Exists(fileLocation)) { throw std::runtime_error("File not found"); } std::map<std::string, std::string> permissionsMap; try { permissionsMap = utils->SettingsStringToMap(permissions); } catch(std::runtime_error const & e) { throw e; } int mode = stoi(permissionsMap.find("mode")->second); int groupID = stoi(permissionsMap.find("groupID")->second); int userID = stoi(permissionsMap.find("userID")->second); if (fileInfoProvider->SetMode(fileLocation, mode) != 1 ) { throw std::runtime_error("Failed to set file mode"); } if (fileInfoProvider->SetUserAndGroupID(fileLocation, userID, groupID) != 1 ) { throw std::runtime_error("Failed to set file user and group ID"); } }
4780eef82d9706e8a2000590bc2af38ca6a018b1
c513ce00f4da812d7fc0ce0d8ff3dd252376440d
/TextRPG/Monster.cpp
40dd6d6f21eff253d6eeb1bbe5da571b6dc9c22d
[]
no_license
NicholasDenaro/Text-Based-RPG
f09d5d002e15d59abb4d19ef70b1b1743b039408
73a7e54d2e58740a50a1915616667fcca61a3dcf
refs/heads/master
2016-09-06T03:04:41.157275
2014-01-30T21:37:38
2014-01-30T21:37:38
null
0
0
null
null
null
null
UTF-8
C++
false
false
5,297
cpp
Monster.cpp
/* Monster.cpp - ** Written by Nicholas Denaro */ #pragma once #include <math.h> #include <iostream> #include "Monster.h" #include "rapidxml-1.13\rapidxml.hpp" #include "rapidxml-1.13\rapidxml_utils.hpp" #include "Printer.h" using namespace std; Monster::Monster(){} Monster::Monster(string name, int baseHealth) { Name=name; BaseHealth=baseHealth; Skills=vector<MonsterSkill>(0); } Monster::Monster(Monster& monster,int level) { Name=monster.Name; BaseHealth=monster.BaseHealth; Level=level; MaxHealth=BaseHealth*Level/2; Health=MaxHealth; Skills=monster.Skills; } string Monster::GetName() const { return(Name); } int Monster::GetHealth() const { return(Health); } int Monster::GetMaxHealth() const { return(MaxHealth); } int Monster::GetLevel() const { return(Level); } map<string,Monster> Monster::MonsterMap; map<int,vector<string>> Monster::MonsterLevelMap; map<string,Monster> Monster::BossMap; map<int,vector<string>> Monster::BossLevelMap; void Monster::LoadMonsters(string dir, string fname) { string path=dir+fname; rapidxml::file<> xmlFile(path.c_str()); rapidxml::xml_document<> doc;// character type defaults to char doc.parse<0>(xmlFile.data());// 0 means default parse flags rapidxml::xml_node<>* node=doc.first_node("Monsters"); rapidxml::xml_node<>* monsterNode; rapidxml::xml_node<>* skillNode; while(node->first_node()!=0) { monsterNode=node->first_node(); string name=monsterNode->first_attribute("Name")->value(); int baseHealth=Printer::StringToInt(monsterNode->first_attribute("BaseHealth")->value()); int lowLevel=Printer::StringToInt(monsterNode->first_attribute("LowLevel")->value()); int highLevel=Printer::StringToInt(monsterNode->first_attribute("HighLevel")->value()); Monster monster=Monster(name,baseHealth); for(int i=lowLevel;i<=highLevel;i+=1) { MonsterLevelMap[i].push_back(monster.GetName()); } while(monsterNode->first_node()!=0) { skillNode=monsterNode->first_node(); monster.AddSkill(MonsterSkill(skillNode->first_attribute("Name")->value(),skillNode->first_attribute("Damage")->value())); monsterNode->remove_first_node(); } MonsterMap[name]=monster; node->remove_first_node(); } } void Monster::LoadBosses(string dir, string fname) { string path=dir+fname; rapidxml::file<> xmlFile(path.c_str()); rapidxml::xml_document<> doc;// character type defaults to char doc.parse<0>(xmlFile.data());// 0 means default parse flags rapidxml::xml_node<>* node=doc.first_node("Bosses"); rapidxml::xml_node<>* monsterNode; rapidxml::xml_node<>* skillNode; while(node->first_node()!=0) { monsterNode=node->first_node(); string name=monsterNode->first_attribute("Name")->value(); int baseHealth=Printer::StringToInt(monsterNode->first_attribute("BaseHealth")->value()); int lowLevel=Printer::StringToInt(monsterNode->first_attribute("LowLevel")->value()); int highLevel=Printer::StringToInt(monsterNode->first_attribute("HighLevel")->value()); Monster monster=Monster(name,baseHealth); for(int i=lowLevel;i<=highLevel;i+=1) { BossLevelMap[i].push_back(monster.GetName()); } while(monsterNode->first_node()!=0) { skillNode=monsterNode->first_node(); monster.AddSkill(MonsterSkill(skillNode->first_attribute("Name")->value(),skillNode->first_attribute("Damage")->value())); monsterNode->remove_first_node(); } BossMap[name]=monster; node->remove_first_node(); } } map<string,Monster> Monster::GetLevelRange(int low, int high) { map<string,Monster> monsters; for(int i=low;i<=high;i+=1) { vector<string> levelGroup=MonsterLevelMap[i]; string name; for(unsigned int j=0;j<levelGroup.size();j+=1) { name=levelGroup[j]; monsters[name]=MonsterMap[name]; } } return(monsters); } map<string,Monster> Monster::GetBossLevelRange(int low, int high) { map<string,Monster> monsters; for(int i=low;i<=high;i+=1) { vector<string> levelGroup=BossLevelMap[i]; string name; for(unsigned int j=0;j<levelGroup.size();j+=1) { name=levelGroup[j]; monsters[name]=BossMap[name]; } } return(monsters); } Monster& Monster::GetRandomMonster(int level) { vector<string> monsters=MonsterLevelMap[level]; int r=rand()%monsters.size(); //random monster from the level return(Monster::MonsterMap[monsters[r]]); } void Monster::AddSkill(MonsterSkill skill) { Skills.push_back(skill); } bool Monster::IsDead() const { return(Health<=0); } void Monster::Damage(int damage) { Health-=damage; if(Health>MaxHealth) Health=MaxHealth; if(Health<0) Health=0; } MonsterSkill Monster::RandomSkill() const { int r=rand()%Skills.size(); return(Skills[r]); } ostream& operator<<(ostream& os, Monster& monster) { os<<monster.Name<<'\n'; os<<monster.BaseHealth<<'\n'; os<<monster.Level<<'\n'; os<<monster.Skills.size()<<'\n'; for(unsigned int i=0;i<monster.Skills.size();i+=1) { os<<monster.Skills[i]<<'\n'; } os<<monster.MaxHealth<<'\n'; os<<monster.Health; return(os); } istream& operator>>(istream& is, Monster& monster) { int size; string tempname; is>>monster.Name; getline(is,tempname); monster.Name+=tempname; is>>monster.BaseHealth>>monster.Level>>size; for(int i=0;i<size;i+=1) { MonsterSkill ms; is>>ms; monster.Skills.push_back(ms); } is>>monster.MaxHealth>>monster.Health; return(is); }
673f9a2b7f3d0b604b1d7bd9437237fd15bb578d
c607b1a700f684de638d0b848462350b689864e6
/namhun/11721.cpp
16ff6a2acc7ec1febb1f033e56b59baca8bac0c7
[]
no_license
Goodgaym/ProblemSolving
a9893ea6eab9123a98e6cf199ffd2cd72ad2bf3a
d5a092e93f0e5cf49c6f95ba73078b88c88df787
refs/heads/master
2020-04-28T16:46:25.910385
2019-03-30T05:47:43
2019-03-30T05:47:43
175,423,491
1
0
null
2019-03-13T13:11:06
2019-03-13T13:11:05
null
UTF-8
C++
false
false
267
cpp
11721.cpp
#include <iostream> #include <string> using namespace std; int main() { char *c = new char[100]; fgets(c, 100, stdin); for (int i = 0; i < 100; i++) { if (c[i] == '\0') break; if ((i % 10) == 0 && i != 0) cout << endl; cout << c[i]; } return 0; }
b420b896f6761b9baaf676c1ebdda2fdc24e5dc7
29646caf5bc4ee528fe925522c40102c2a644658
/mque.h
27fdfeeffb7d194df52bba1b0003c1f45f3cf581
[]
no_license
schlansker/ZMSG-Code
2f897c41d691da55b0fe3715f42416078627017f
d53b0af1cdd1eb1c4fdbf1e663596fb2fc7a0e2e
refs/heads/master
2021-06-30T08:56:40.979377
2017-09-21T17:51:33
2017-09-21T17:51:33
104,374,351
0
0
null
null
null
null
WINDOWS-1252
C++
false
false
3,506
h
mque.h
#ifndef _MQ_H #define _MQ_H /* © Copyright 2017 Hewlett Packard Enterprise Development LP Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. 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. 3. Neither the name of the copyright holder 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. */ //Mike Schlansker and Ali Munir #include "zrecord.h" #include "sim_signal.h" /* DGMQ is used as a rcv port for each physical ZBRIDGE */ #define S_PORT_NAME_ALREADY_DEFINED 1 //receiver return a logical, port credit to the sender //these constants define circular merge queues with power of two size & matching index mask #define RING_SIZE 0x100 ////256 and 1024 #define RING_MASK 0xff class signal_status{ public: semaphore s; int success; }; struct mq_record{ //merge queue record volatile int ready; //useed for concurrent insertion signal_status* reverse_signal; // for signaling completion back to sending zengine zrecord msg; }; void init_mq_record(mq_record* rec); void insert_imm_msg_mq_record(mq_record* rec_ptr, char* msg, zheader header); struct merge_queue{ // one merge_queue is dedicated to each ZBridge public: int cid; //Component ID used to reach this ring unsigned head; //oldest entry unsigned tail; //next available slot unsigned total_slots; //total number of slots unsigned actual_slots; //actually holds one less mq_record slots[RING_SIZE]; //static declaration for actual buffer int num_samples; //statistics int cumulative_size; //statistics unsigned index_mask; //used to mask indexing operations }; void init_merge_queue(merge_queue*, int mtu, int index); int size_merge_queue(merge_queue* q); int too_full_merge_queue(merge_queue* q); mq_record* insert_header_merge_queue(merge_queue* q, zheader header); //test for sufficient space mq_record* insert_header_wait_merge_queue(merge_queue* q, zheader header); //wait for sufficient space mq_record* peek_head_merge_queue(merge_queue* q ); //get pointer to inspect head element void remove_head_merge_queue(merge_queue* q); //retire the head element when done processing unsigned get_tail_merge_queue(merge_queue* q); //get next entry at tail of queue int is_empty_merge_queue(merge_queue* q); #endif
7bd5bafc6f1f27e01dc8b13ef1abaf3ba5a6afb6
fa3c0befd3e9d41bd22871e6fdb156642bc0039a
/main.cpp
33422aa93c775c426b63bbfa1cec92bced544ac2
[]
no_license
eddu-gtz/Lista_Adyacencia
79d74425b64733809cc55afac4b946b898b96597
12439641ebc5cd28010d73f24cff2d5ec207b40e
refs/heads/main
2023-01-09T13:31:13.415585
2020-11-10T23:39:40
2020-11-10T23:39:40
311,810,806
0
0
null
null
null
null
UTF-8
C++
false
false
15,232
cpp
main.cpp
#include <iostream> #include "cnodografo.h" #include "cedgeinfo.h" #include "clista.h" #include "clistaAdyacencia.h" using namespace std; int main() { int opc; int satisfaccion, costo, id=0; int vertice1, vertice2; string nombre; CLista listaMaestra; CListaAdyacencia listaAd; CIterador it; CIteradorAdyacencia itAdyacencia; CNodoGrafo* pueblito0 = new CNodoGrafo(id,"Mazamitla, Jalisco",8,6); CNodoGrafo* pueblito1 = new CNodoGrafo(++id,"Tequila, Jalisco",7,6); CNodoGrafo* pueblito2 = new CNodoGrafo(++id,"Tapalpa, Jalisco",6,5); CNodoGrafo* pueblito3 = new CNodoGrafo(++id,"Lagos de Moreno, Jalisco",6,4); CNodoGrafo* pueblito4 = new CNodoGrafo(++id,"Valladolid, Yucatan",7,7); CNodoGrafo* pueblito5 = new CNodoGrafo(++id,"Mascota, Jalisco",5,5); CNodoGrafo* pueblito6 = new CNodoGrafo(++id,"Talpa de Allende, Jalisco",6,7); CNodoGrafo* pueblito7 = new CNodoGrafo(++id,"Dolores Hidalgo, Guanajuato",7,7); CNodoGrafo* pueblito8 = new CNodoGrafo(++id,"Jala, Nayarit",5,3); CNodoGrafo* pueblito9 = new CNodoGrafo(++id,"San Joaquin, Queretaro",4,5); CNodoGrafo* pueblito10 = new CNodoGrafo(++id,"Palenque, Chiapas",9,7); CNodoGrafo* pueblito11 = new CNodoGrafo(++id,"Patzcuaro, Michoacan",8,5); CNodoGrafo* pueblito12 = new CNodoGrafo(++id,"Valle de Bravo, Estado de Mexico",6,7); CNodoGrafo* pueblito13 = new CNodoGrafo(++id,"Mineral de Pozos, Guanajuato",6,5); CNodoGrafo* pueblito14 = new CNodoGrafo(++id,"Loreto, Baja California Sur",8,6); CNodoGrafo* pueblito15 = new CNodoGrafo(++id,"Papantla, Veracruz",9,8); CNodoGrafo* pueblito16 = new CNodoGrafo(++id,"San Cristobal de las Casas, Chiapas",8,7); CNodoGrafo* pueblito17 = new CNodoGrafo(++id,"San Pablo Villa de Mitla, Oaxaca",4,3); CNodoGrafo* pueblito18 = new CNodoGrafo(++id,"Sombrerete, Zacatecas",6,7); CNodoGrafo* pueblito19 = new CNodoGrafo(++id,"Taxco de Alarcon, Guerrero",6,7); ///INSERTAR NODOS listaMaestra.insertarAlFinal(pueblito0); listaMaestra.insertarAlFinal(pueblito1); listaMaestra.insertarAlFinal(pueblito2); listaMaestra.insertarAlFinal(pueblito3); listaMaestra.insertarAlFinal(pueblito4); listaMaestra.insertarAlFinal(pueblito5); listaMaestra.insertarAlFinal(pueblito6); listaMaestra.insertarAlFinal(pueblito7); listaMaestra.insertarAlFinal(pueblito8); listaMaestra.insertarAlFinal(pueblito9); listaMaestra.insertarAlFinal(pueblito10); listaMaestra.insertarAlFinal(pueblito11); listaMaestra.insertarAlFinal(pueblito12); listaMaestra.insertarAlFinal(pueblito13); listaMaestra.insertarAlFinal(pueblito14); listaMaestra.insertarAlFinal(pueblito15); listaMaestra.insertarAlFinal(pueblito16); listaMaestra.insertarAlFinal(pueblito17); listaMaestra.insertarAlFinal(pueblito18); listaMaestra.insertarAlFinal(pueblito19); ///INSERTAR ARISTAS CListaAdyacencia* arista = new CListaAdyacencia(); arista = listaMaestra.buscar(0); arista->insertarAlFinal(pueblito1,36); arista->insertarAlFinal(pueblito2, 27); arista->insertarAlFinal(pueblito11, 79); arista = listaMaestra.buscar(1); arista->insertarAlFinal(pueblito0, 36); arista->insertarAlFinal(pueblito3, 47); arista = listaMaestra.buscar(2); arista->insertarAlFinal(pueblito0, 27); arista->insertarAlFinal(pueblito6, 31); arista->insertarAlFinal(pueblito5, 35); arista = listaMaestra.buscar(3); arista->insertarAlFinal(pueblito7, 38); arista = listaMaestra.buscar(4); arista->insertarAlFinal(pueblito10, 195); arista = listaMaestra.buscar(5); arista->insertarAlFinal(pueblito2, 35); arista->insertarAlFinal(pueblito8, 42); arista = listaMaestra.buscar(6); arista->insertarAlFinal(pueblito2, 31); arista->insertarAlFinal(pueblito9, 136); arista = listaMaestra.buscar(7); arista->insertarAlFinal(pueblito3, 38); arista->insertarAlFinal(pueblito9, 53); arista->insertarAlFinal(pueblito13, 15); arista = listaMaestra.buscar(8); arista->insertarAlFinal(pueblito5, 42); arista->insertarAlFinal(pueblito14, 115); arista->insertarAlFinal(pueblito18, 87); arista = listaMaestra.buscar(9); arista->insertarAlFinal(pueblito7, 53); arista->insertarAlFinal(pueblito15, 93); arista->insertarAlFinal(pueblito6, 196); arista = listaMaestra.buscar(10); arista->insertarAlFinal(pueblito4, 195); arista->insertarAlFinal(pueblito16, 23); arista->insertarAlFinal(pueblito17, 157); arista = listaMaestra.buscar(11); arista->insertarAlFinal(pueblito0, 79); arista->insertarAlFinal(pueblito12, 82); arista->insertarAlFinal(pueblito17, 180); arista = listaMaestra.buscar(12); arista->insertarAlFinal(pueblito11, 82); arista->insertarAlFinal(pueblito19, 91); arista = listaMaestra.buscar(13); arista->insertarAlFinal(pueblito7, 15); arista = listaMaestra.buscar(14); arista->insertarAlFinal(pueblito8, 115); arista = listaMaestra.buscar(15); arista->insertarAlFinal(pueblito9, 93); arista = listaMaestra.buscar(16); arista->insertarAlFinal(pueblito10, 23); arista = listaMaestra.buscar(17); arista->insertarAlFinal(pueblito11, 180); arista->insertarAlFinal(pueblito19, 103); arista->insertarAlFinal(pueblito10, 157); arista = listaMaestra.buscar(18); arista->insertarAlFinal(pueblito8, 87); arista = listaMaestra.buscar(19); arista->insertarAlFinal(pueblito12, 91); arista->insertarAlFinal(pueblito17, 103); do { ///Imprimir menu system("cls"); cout<<" [1] Ingresar Pueblo Magico (vertice)"<<endl; cout<<" [2] Ingresar relacion entre pueblos (arista)"<<endl; cout<<" [3] Imprimir lista de adyacencia"<<endl; cout<<" [4] Eliminar Arista"<<endl; cout<<" [5] Eliminar Nodo"<<endl; cout<<" [6] Salir"<<endl; cout<<"\n Ingresa una opcion: "; cin>>opc; cin.sync(); switch(opc) { ///NUEVO VERTICE case 1: { system("cls"); ///VERTICE //id++; cout<<endl<<" Ingresa el nombre del pueblo magico: "; getline(cin, nombre); cout<<endl<<" Ingresa el grado de satisfaccion que te brinda: "; cin>>satisfaccion; cout<<endl<<" Ingresa el costo por estar ahi: "; cin>>costo; CNodoGrafo* pueblito = new CNodoGrafo(id,nombre,satisfaccion,costo); ///insertar en el arreglo listaMaestra.insertarAlFinal(pueblito); id++; } break; ///NUEVA ARISTA case 2: system("cls"); if(!listaMaestra.isEmpty()) { cout<<endl<<" Lista de pueblitos magicos (vertices)"<<endl<<endl; listaMaestra.Imprimir(); cout<<endl<<" Ingresa el ID del primer pueblo a enlazar: "; cin>>vertice1; cout<<endl<<" Ingresa el ID del segundo pueblo a enlazar: "; cin>>vertice2; cout<<endl<<" Ingresa el costo por transitar entre estos dos pueblos: "; cin>>costo; CListaAdyacencia* arista = new CListaAdyacencia(); CNodoGrafo* nodo = new CNodoGrafo(); ///ENLAZAR EL PRIMER VERTICE //Regresa la informacion del segundo vertice nodo = listaMaestra.buscarVertice(vertice2); //Regresa la lista de adyacencia buscada arista = listaMaestra.buscar(vertice1); //Si se encontraron datos if(arista != 0 && nodo != 0){ //se crea una arista CEdgeInfo* dest = new CEdgeInfo(nodo, costo); //Insertar una arista en la lista de adyacencia arista->insertarAlFinal(dest); } else { //No hay ningun dato cout<<endl<<" Hay algun elemento erroneo "<<endl; break; } ///ENLAZAR EL SEGUNDO VERTICE //Regresa la informacion del primer vertice nodo = listaMaestra.buscarVertice(vertice1); //Regresa la lista de adyacencia buscada arista = listaMaestra.buscar(vertice2); if(arista != 0 && nodo != 0){ //se crea una arista CEdgeInfo* dest = new CEdgeInfo(nodo, costo); //Insertar una arista en esa lista de adyacencia arista->insertarAlFinal(dest); } else{ ///No hay ningun dato cout<<endl<<" No coincide algun elemento del segundo ingresado"<<endl; break; } } else { cout<<" La lista esta vacia"<<endl; } system("pause"); break; ///IMPRIMIR LISTA DE ADYACENCIA case 3: { system("cls"); if(!listaMaestra.isEmpty()) { listaMaestra.ImprimirTodo(); } else { cout<<" La lista esta vacia"<<endl; } system("pause"); } break; ///ELIMINAR ARISTA case 4: { bool eliminado1 = false, eliminado2 = false; //Pedir datos de los nodos cout<<endl<<" Ingresa el ID del primer pueblo: "; cin>>vertice1; cout<<endl<<" Ingresa el ID del segundo pueblo: "; cin>>vertice2; CListaAdyacencia* arista1 = new CListaAdyacencia(); CListaAdyacencia* arista2 = new CListaAdyacencia(); CEdgeInfo* dest = new (CEdgeInfo); //Regresa la lista de adyacencia buscada arista1 = listaMaestra.buscar(vertice1); //Regresa la lista de adyacencia buscada arista2 = listaMaestra.buscar(vertice2); if(arista1 != 0 && arista2 != 0){ for(itAdyacencia = arista1->Begin(); itAdyacencia != arista1->End(); itAdyacencia++){ dest = *itAdyacencia; if(dest->getID() == vertice2){ itAdyacencia.EliminarSiguiente(); eliminado1 = true; break; } } for(itAdyacencia = arista2->Begin(); itAdyacencia != arista2->End(); itAdyacencia++){ dest = *itAdyacencia; if(dest->getID() == vertice1){ itAdyacencia.EliminarSiguiente(); eliminado2 = true; break; } } if(eliminado1 && eliminado2) cout<<endl<<" Se ha eliminado la adyacencia correctamente"<<endl; } else{ ///No hay ningun dato cout<<endl<<" No coincide algun elemento ingresado"<<endl; } delete dest; system("pause"); break; } ///ELIMINAR NODO case 5: { bool eliminado = false; CIteradorAdyacencia itAd; //Pedir datos de los nodos cout<<endl<<" Ingresa el ID del pueblo a eliminar: "; cin>>vertice1; CListaAdyacencia* arista = new CListaAdyacencia(); CListaAdyacencia* arista2 = new CListaAdyacencia(); CEdgeInfo* dest = new (CEdgeInfo); //Regresa la lista de adyacencia buscada arista = listaMaestra.buscar(vertice1); ///Eliminar relaciones if(arista != 0){ for(itAdyacencia = arista->Begin(); itAdyacencia != arista->End(); itAdyacencia++){ dest = *itAdyacencia; //Buscar sus aristas vertice2 = dest->getID(); arista2 = listaMaestra.buscar(vertice2); for(itAd= arista2->Begin(); itAd != arista2->End(); itAd++){ dest = *itAd; //eliminar la informacion de adyacencia de las demas aristas if(dest->getID() == vertice1){ itAd.EliminarSiguiente(); break; } } } } CNodoGrafo* eliminar = new CNodoGrafo(); ///Eliminar nodo for(it = listaMaestra.Begin(); it != listaMaestra.End(); it++){ //Retorna el nodo de la listaMaestra; eliminar = +it; if(eliminar->getID() == vertice1){ it--; it.EliminarSiguiente(); eliminado = true; break; } } if(eliminado){ cout<<endl<<" Se elimino el nodo correctamente"<<endl<<endl; } delete dest; system("pause"); break; } ///SALIR case 6: cout<<" Ha salido del programa"<<endl; break; default: cout<<" Esa opcion no existe"<<endl; } } while(opc != 6); //Liberacion de memoria delete pueblito0; delete pueblito1; delete pueblito2; delete pueblito3; delete pueblito4; delete pueblito5; delete pueblito6; delete pueblito7; delete pueblito8; delete pueblito9; delete pueblito10; delete pueblito11; delete pueblito12; delete pueblito13; delete pueblito14; delete pueblito15; delete pueblito16; delete pueblito17; delete pueblito18; delete pueblito19; delete arista; return 0; }
aedc025f2a110b9b585ef9867d2e36ca3017be3c
4e3d62583b5aec0c1ff36d6796dfaf72b379cd97
/maxCD_minCM.cpp
cd75604705881239f45c40b000810feb1cf28b4d
[]
no_license
Qzsl123/cccode
9edee79109b259fd3f303e5831d3ca740cbe62e9
d2aaca246260ef976af18b88cb55e313fd891014
refs/heads/master
2021-01-19T21:08:14.288409
2017-08-24T02:23:05
2017-08-24T02:23:05
101,246,364
0
0
null
null
null
null
UTF-8
C++
false
false
795
cpp
maxCD_minCM.cpp
/************************************************ * 作者:zsl * 题目:p3038 max common divisor and min common multiple problem **************************************************/ #include <iostream> using namespace std; int MinCM(int x, int y); int MaxCD(int x, int y); int main(int argc, char const *argv[]) { int input1, input2, sum = 0; cin >> input1 >> input2; cout << MaxCD(input1, input2) << " " << MinCM(input1, input2) << endl; return 0; } int MaxCD(int x, int y) { int tmp; if(x > y) { tmp = x; x = y; y = tmp; } int r = x; while(r != 0) { r = y % x; y = x; x = r; } return y; } int MinCM(int x, int y) { return x * y / (MaxCD(x, y)); }
bfde13f608757331417307746e35b5541a9b5e64
c995761406386ebd0aaeae62998bc43029d66045
/employeeTableWidget.h
5911d03374a3a3aab56e21514a726a788a369ec3
[]
no_license
zhongming2013/dynamicLocation
1589fba7a381899ae32fbafe8504dfd8c09676ac
72837c34cb6ddfc3d92e199e2917c09b3887b17a
refs/heads/master
2016-09-03T00:30:42.667422
2013-03-17T12:36:25
2013-03-17T12:36:25
null
0
0
null
null
null
null
UTF-8
C++
false
false
596
h
employeeTableWidget.h
#ifndef EMPLOYEETABLEWIDGET_H #define EMPLOYEETABLEWIDGET_H #include <QTableWidget> #include <QTableWidgetItem> #include <QStringList> class EmployeeTableWidget : public QTableWidget { Q_OBJECT public: EmployeeTableWidget(); public slots: void updateTable(const int fixId); private: QStringList rowLabel; QStringList columnLabel; QTableWidgetItem *fixIdItem; QTableWidgetItem *nameItem; QTableWidgetItem *deptItem; QTableWidgetItem *extensionItem; QTableWidgetItem *emailItem; QTableWidgetItem *startDateItem; }; #endif // EMPLOYEETABLEWIDGET_H
9398556f9add3d50fd43ff41f85c4968b96ced5e
386fad5de6b1a6a9e5557947bd1aeffda8821656
/TIOJ/1609.cpp
34dd53b6303b5dffd2dc006f55dc4b0282878745
[]
no_license
xxyyzz/Competitive-Programming_Solutions
6c1f06232ab63f85d913bdd27a90eff892bfe18d
cca393f4330e784eb0f9edb44df290adc105ce3b
refs/heads/master
2021-06-02T13:33:48.530485
2016-09-25T14:15:37
2016-09-25T14:15:37
null
0
0
null
null
null
null
UTF-8
C++
false
false
306
cpp
1609.cpp
#include <iostream> using namespace std; int a[1000000]; int main(){ int i, n; scanf("%d", &n); for( i=0; i<n; i++ ) scanf("%d", &a[i]); sort(a, a+n); for( i=0; i<n; i++ ) { if( i>0 ) putchar(' '); printf("%d", a[i]); } //while(1); return 0; }
b5859fd810d3fc0b417afb18173d20799af11ad3
fc456686a23f43ef16e6920232130abc3d09ad8d
/src/common/ErrorAccumulator.h
7fc720a9809305da95c8834944b3c50fd7ab0d14
[ "LicenseRef-scancode-unknown-license-reference", "GPL-1.0-or-later", "MIT" ]
permissive
DKFZ-ODCF/FastqIndEx
6bae84c3c7ae8433231faf2f581071a00b5b79c8
e21ef731a1f3341e5ac4525146891689e0cbf9ce
refs/heads/master
2021-12-12T18:49:47.973233
2021-06-21T15:49:00
2021-06-21T15:49:00
169,750,232
1
0
MIT
2019-07-31T13:57:04
2019-02-08T14:52:25
C++
UTF-8
C++
false
false
2,856
h
ErrorAccumulator.h
/** * Copyright (c) 2019 DKFZ - ODCF * * Distributed under the MIT License (license terms are at https://github.com/dkfz-odcf/FastqIndEx/blob/master/LICENSE.txt). */ #ifndef FASTQINDEX_ERRORACCUMULATOR_H #define FASTQINDEX_ERRORACCUMULATOR_H #include <iostream> #include <string> #include <vector> using std::vector; using std::string; /** * The class is used to provide basic error storage methods. */ class ErrorAccumulator { typedef const string &_cstr; private: /** * Keep a list of errors which came up during fulfillsPremises() */ vector<string> errorMessages; static int verbosity; public: virtual ~ErrorAccumulator() = default; /** * Set the runners verbosity level in a range from 0 to 3 IF and only IF the passed value is in this range. * * 0 == severe messages and important messages only * 1 == warnings as well * 2 == informational messages * 3 == debug messages * * @param verbosity */ static void setVerbosity(int verbosity); static bool verbosityIsSetToDebug(); static void always(_cstr s0, _cstr s1 = "", _cstr s2 = "", _cstr s3 = "", _cstr s4 = "", _cstr s5 = "", _cstr s6 = ""); static void debug(_cstr s0, _cstr s1 = "", _cstr s2 = "", _cstr s3 = "", _cstr s4 = "", _cstr s5 = "", _cstr s6 = ""); static void info(const string &msg); static void warning(const string &msg); static void severe(const string &msg); virtual vector<string> getErrorMessages(); /** * This would actually be a perfect example for a variadic function but handling variadic functions is tricky as * the 'va_...()' macros don't know about the number of passed arguments. */ void addErrorMessage(_cstr s0, _cstr s1 = "", _cstr s2 = "", _cstr s3 = "", _cstr s4 = "", _cstr s5 = "", _cstr s6 = ""); static string join(_cstr s0, _cstr s1 = "", _cstr s2 = "", _cstr s3 = "", _cstr s4 = "", _cstr s5 = "", _cstr s6 = ""); /** * This method can be used, if two vectors should be merged. Note, that we always copy the content of the two source * vectors into the new vector. However, as this is method is mostly intended to be used with the ErrorAccumulator * messages and these are only requested and, when errors came up, we'll accept the price of copy. * @param l The left vector * @param r The right vector * @return A new vector<string> with both vectors merged. The messages of l will be placed before the messages of r. */ static vector<string> concatenateVectors(const vector<string> &l, const vector<string> &r); /** * Similar to its version with two input parameters. */ static vector<string> concatenateVectors(const vector<string> &a, const vector<string> &b, const vector<string> &c); }; #endif //FASTQINDEX_ERRORACCUMULATOR_H
829da318569530183c59ad3e6a0b68e88f137d88
4e5488ca16bbbbae430a87486d51ab4c9c7cc959
/strongtalk/src/cpp/main/vm/oop/ByteArrayOopDescriptor.cpp
0e793e9ead1907086b1b578b37091e9c91974928
[]
no_license
RalfBarkow/strongtalk-2020
3cbf0286b18e3ac48b315509e77215e8ed4c6bcd
b51c02d5e30c0c728fece29037fdcd81f7f5803a
refs/heads/master
2023-03-19T06:22:52.079759
2021-03-14T20:27:14
2021-03-14T20:27:14
null
0
0
null
null
null
null
UTF-8
C++
false
false
8,105
cpp
ByteArrayOopDescriptor.cpp
// // (C) 1994 - 2021, The Strongtalk authors and contributors // Refer to the "COPYRIGHTS" file at the root of this source tree for complete licence and copyright terms // #include "vm/platform/platform.hpp" #include "vm/system/asserts.hpp" #include "vm/system/macros.hpp" #include "vm/memory/util.hpp" #include "vm/recompiler/Recompilation.hpp" #include "vm/code/ProgramCounterDescriptor.hpp" #include "vm/compiler/RecompilationScope.hpp" #include "vm/compiler/Node.hpp" #include "vm/oop/DoubleByteArrayOopDescriptor.hpp" #include "vm/oop/ByteArrayOopDescriptor.hpp" bool ByteArrayOopDescriptor::verify() { bool flag = MemOopDescriptor::verify(); if ( flag ) { std::int32_t l = length(); if ( l < 0 ) { error( "ByteArrayOop 0x{0:x} has negative length", this ); flag = false; } } return flag; } char *ByteArrayOopDescriptor::copy_null_terminated( std::int32_t &Clength ) { // Copy the bytes() part. Always add trailing '\0'. If byte array // contains '\0', these will be escaped in the copy, i.e. "....\0...". // Clength is set to length of the copy (may be longer due to escaping). // Presence of null chars can be detected by comparing Clength to length(). st_assert_byteArray( this, "should be a byte array" ); Clength = length(); char *res = copy_string( (const char *) bytes(), Clength ); if ( strlen( res ) == (std::uint32_t) Clength ) return res; // Simple case, no '\0' in byte array. // Simple case failed ... small_int_t t = length(); // Copy and 'escape' null chars. // small_int_t i; for ( std::size_t i = length() - 1; i >= 0; i-- ) { if ( byte_at( i ) == '\0' ) { t++; } } // t is total length of result string. res = new_resource_array<char>( t + 1 ); res[ t-- ] = '\0'; Clength = t; for ( std::size_t i = length() - 1; i >= 0; i-- ) { if ( byte_at( i ) not_eq '\0' ) { res[ t-- ] = byte_at( i ); } else { res[ t-- ] = '0'; res[ t-- ] = '\\'; } } st_assert( t == -1, "sanity check" ); return res; } char *ByteArrayOopDescriptor::copy_c_heap_null_terminated() { // Copy the bytes() part. Always add trailing '\0'. If byte array // contains '\0', these will be escaped in the copy, i.e. "....\0...". // NOTE: The resulting string is allocated in Cheap st_assert_byteArray( this, "should be a byte array" ); small_int_t t = length(); // Copy and 'escape' null chars. // small_int_t i; for ( std::size_t i = length() - 1; i >= 0; i-- ) { if ( byte_at( i ) == '\0' ) { t++; } } // t is total length of result string. char *res = new_c_heap_array<char>( t + 1 ); res[ t-- ] = '\0'; for ( std::size_t i = length() - 1; i >= 0; i-- ) { if ( byte_at( i ) not_eq '\0' ) { res[ t-- ] = byte_at( i ); } else { res[ t-- ] = '0'; res[ t-- ] = '\\'; } } st_assert( t == -1, "sanity check" ); return res; } bool ByteArrayOopDescriptor::copy_null_terminated( char *buffer, std::int32_t max_length ) { // %not optimized std::int32_t len = length(); bool is_truncated = false; if ( len >= max_length ) { len = max_length - 1; is_truncated = true; } for ( std::size_t i = 0; i < len; i++ ) buffer[ i ] = byte_at( i + 1 ); buffer[ len ] = '\0'; return is_truncated; } void ByteArrayOopDescriptor::bootstrap_object( Bootstrap *bootstrap ) { MemOopDescriptor::bootstrap_object( bootstrap ); bootstrap->read_oop( length_addr() ); for ( std::size_t i = 1; i <= length(); i++ ) { byte_at_put( i, bootstrap->read_uint8_t() ); } } static std::int32_t sub_sign( std::int32_t a, std::int32_t b ) { if ( a < b ) return -1; if ( a > b ) return 1; return 0; } std::int32_t compare_as_bytes( const std::uint8_t *a, const std::uint8_t *b ) { // machine dependent code; little endian code if ( a[ 0 ] - b[ 0 ] ) return sub_sign( a[ 0 ], b[ 0 ] ); if ( a[ 1 ] - b[ 1 ] ) return sub_sign( a[ 1 ], b[ 1 ] ); if ( a[ 2 ] - b[ 2 ] ) return sub_sign( a[ 2 ], b[ 2 ] ); return sub_sign( a[ 3 ], b[ 3 ] ); } std::int32_t ByteArrayOopDescriptor::compare( ByteArrayOop arg ) { // Get the addresses of the length fields const std::uint32_t *a = (std::uint32_t *) length_addr(); const std::uint32_t *b = (std::uint32_t *) arg->length_addr(); // Get the word sizes of the arays std::int32_t a_size = roundTo( SmallIntegerOop( *a++ )->value() * sizeof( char ), sizeof( std::int32_t ) ) / sizeof( std::int32_t ); std::int32_t b_size = roundTo( SmallIntegerOop( *b++ )->value() * sizeof( char ), sizeof( std::int32_t ) ) / sizeof( std::int32_t ); const std::uint32_t *a_end = a + min( a_size, b_size ); while ( a < a_end ) { if ( *b++ not_eq *a++ ) return compare_as_bytes( (const std::uint8_t *) ( a - 1 ), (const std::uint8_t *) ( b - 1 ) ); } return sub_sign( a_size, b_size ); } std::int32_t ByteArrayOopDescriptor::compare_doubleBytes( DoubleByteArrayOop arg ) { // %not optimized std::int32_t s1 = length(); std::int32_t s2 = arg->length(); std::int32_t n = s1 < s2 ? s1 : s2; for ( std::size_t i = 1; i <= n; i++ ) { std::int32_t result = sub_sign( byte_at( i ), arg->doubleByte_at( i ) ); if ( result not_eq 0 ) return result; } return sub_sign( s1, s2 ); } std::int32_t ByteArrayOopDescriptor::hash_value() { std::int32_t len = length(); std::int32_t result; if ( len == 0 ) { result = 1; } else if ( len == 1 ) { result = byte_at( 1 ); } else { std::uint32_t val; val = byte_at( 1 ); val = ( val << 3 ) ^ ( byte_at( 2 ) ^ val ); val = ( val << 3 ) ^ ( byte_at( len ) ^ val ); val = ( val << 3 ) ^ ( byte_at( len - 1 ) ^ val ); val = ( val << 3 ) ^ ( byte_at( len / 2 + 1 ) ^ val ); val = ( val << 3 ) ^ ( len ^ val ); result = MarkOopDescriptor::masked_hash( val ); } return result == 0 ? 1 : result; } const char *ByteArrayOopDescriptor::as_string() { std::int32_t len = length(); char *str = new_resource_array<char>( len + 1 ); for ( std::size_t index = 0; index < len; index++ ) { str[ index ] = byte_at( index + 1 ); } str[ len ] = '\0'; return str; } //const char *ByteArrayOopDescriptor::as_string() { // return as_std_string().c_str(); //} //const std::string &ByteArrayOopDescriptor::as_std_string() { // // std::string s{}; // // for ( std::size_t index = 0; index < length(); index++ ) { // s += byte_at( index + 1 ); // } // s += '\0'; // // return s; //} std::int32_t ByteArrayOopDescriptor::number_of_arguments() const { std::int32_t result = 0; st_assert( length() > 0, "selector should have a positive length" ); // Return 1 if binary selector if ( is_binary() ) return 1; // Return number of colons for ( std::size_t i = 1; i <= length(); i++ ) if ( byte_at( i ) == ':' ) result++; return result; } bool ByteArrayOopDescriptor::is_unary() const { if ( is_binary() ) return false; for ( std::size_t i = 1; i <= length(); i++ ) if ( byte_at( i ) == ':' ) return false; return true; } bool ByteArrayOopDescriptor::is_binary() const { std::uint8_t first = byte_at( 1 ); // special case _, as compiler treats as a letter return first not_eq '_' and ispunct( first ) ? true : false; } bool ByteArrayOopDescriptor::is_keyword() const { if ( is_binary() ) return false; for ( std::size_t i = 1; i <= length(); i++ ) if ( byte_at( i ) == ':' ) return true; return false; }
39851abb51b158a1c8c509839438c6934d786e8e
b511bb6461363cf84afa52189603bd9d1a11ad34
/code/a_codeforces.cpp
7330171ab93500984e4a09ac0afa5359cf7c3222
[]
no_license
masumr/problem_solve
ec0059479425e49cc4c76a107556972e1c545e89
1ad4ec3e27f28f10662c68bbc268eaad9f5a1a9e
refs/heads/master
2021-01-16T19:07:01.198885
2017-08-12T21:21:59
2017-08-12T21:21:59
100,135,794
0
0
null
null
null
null
UTF-8
C++
false
false
210
cpp
a_codeforces.cpp
#include<bits/stdc++.h> using namespace std; int main() { long long a,b,count=0,i,j,sum; cin>>a>>b; sum=a*b; count=sum/5; if(sum%5==4) count+=1; cout<<count<<endl; }
5d28d4250d13f440a46cb42a73d0d10649074fc6
a5f34d9ded886e3161cb9f259c39de5cd489f9b0
/settings/xVFileImportDlgItem.cpp
682fb847fd2db977bb86569e8e2dcc5f1e4a79cb
[]
no_license
CDullin/xVTK
a9cdee0668aec0c4ea80829e9ea0d2bc880aaed3
c18b989284b397b58a8bcf948e4a2d779dea76ac
refs/heads/main
2023-06-27T23:40:52.912622
2021-07-29T09:38:07
2021-07-29T09:38:07
345,925,638
0
0
null
null
null
null
UTF-8
C++
false
false
2,148
cpp
xVFileImportDlgItem.cpp
#include "xVFileImportDlgItem.h" #include "xVTypes.h" #include <QFileDialog> #include <QResizeEvent> #include <QHBoxLayout> xVFileImportDlgItem::xVFileImportDlgItem(QWidget *parent):QWidget(parent) { setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding); setGeometry(0,0,100,20); pLEdit = new QLineEdit(this); pLEdit->setGeometry(0,0,80,20); pLEdit->setAlignment(Qt::AlignRight); pLEdit->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding); pLEdit->setAutoFillBackground(false); pBrowseTB = new QToolButton(this); pBrowseTB->setGeometry(80,0,20,20); pBrowseTB->setText("..."); pBrowseTB->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Expanding); pBrowseTB->setAutoFillBackground(false); pLEdit->setReadOnly(true); connect(pBrowseTB,SIGNAL(clicked()),this,SLOT(browse())); QHBoxLayout *pVBox=new QHBoxLayout(this); pVBox->setContentsMargins(0,0,0,0); pVBox->setSpacing(0); pVBox->addWidget(pLEdit); pVBox->addWidget(pBrowseTB); } void xVFileImportDlgItem::setFileName(const xFileName& fn) { _currentFName = fn; pLEdit->setText(fn._fileName); } xFileName xVFileImportDlgItem::fileInfo() { return _currentFName; } void xVFileImportDlgItem::browse() { QString s; switch (_currentFName._type) { case xFileName::FN_INPUT_FILE: s = QFileDialog::getOpenFileName(0,"chose file",_currentFName._fileName);break; case xFileName::FN_OUTPUT_FILE: s = QFileDialog::getSaveFileName(0,"chose file",_currentFName._fileName);break; case xFileName::FN_INPUT_DIR: s = QFileDialog::getExistingDirectory(0,"chose directory",_currentFName._fileName);break; case xFileName::FN_OUTPUT_DIR: s = QFileDialog::getExistingDirectory(0,"chose directory",_currentFName._fileName);break; } _currentFName._fileName = s; pLEdit->setText(s); emit modified(); } /* void xVFileImportDlgItem::resizeEvent(QResizeEvent *event) { QSize size=event->size(); setGeometry(0,0,size.width(),size.height()); pLEdit->setGeometry(0,0,size.width()-20,size.height()); pBrowseTB->setGeometry(size.width()-20,0,20,size.height()); } */
a5ce7c83ea392413c31eeb25136b7863828f88bb
78241f3f8dc320694aaa2f53a50361d9734cbbc6
/src/libraries/DAQ/Df250EmulatorAlgorithm.h
91c92cc1291ab26f47310286c7c9aaf1a75cd909
[]
no_license
pomm/sim-recon
16c2bb9ede0401e9701eb45e5443bf12f3320be8
bf006cdff4f4ff14bbb1f4777e94b432aaaa6001
refs/heads/master
2020-12-24T16:59:48.926225
2016-04-02T04:57:22
2016-04-02T04:57:22
52,156,483
0
0
null
2016-04-02T04:57:24
2016-02-20T14:10:36
C++
UTF-8
C++
false
false
1,207
h
Df250EmulatorAlgorithm.h
#ifndef _Df250EmulatorAlgorithm_ #define _Df250EmulatorAlgorithm_ #include <JANA/JObject.h> #include <JANA/JFactory.h> #include <JANA/JEventLoop.h> #include <DAQ/Df250WindowRawData.h> #include <DAQ/Df250PulseTime.h> #include <DAQ/Df250PulsePedestal.h> #include <DAQ/Df250PulseIntegral.h> #include <DAQ/Df250Config.h> #include <DAQ/Df250BORConfig.h> using namespace std; using namespace jana; ///////////////////////////////////////////////////////////////// // This implements the base class for the f250 firmware emulation // EmulateFirmware needs to be virtually overwritten by the user //////////////////////////////////////////////////////////////// class Df250EmulatorAlgorithm:public jana::JObject{ public: JOBJECT_PUBLIC(Df250EmulatorAlgorithm); Df250EmulatorAlgorithm(JEventLoop *loop){}; ~Df250EmulatorAlgorithm(){}; // The main emulation routines are overwritten in the inherited classes virtual void EmulateFirmware(const Df250WindowRawData*, Df250PulseTime*, Df250PulsePedestal*, Df250PulseIntegral*) = 0; protected: // Suppress default constructor Df250EmulatorAlgorithm(){}; }; #endif // _Df250EmulatorAlgorithm_factory_
e87065a70fb892d689e809e4eb47ee459503dd3a
05daffa14a85b6892106e313314e57daf65c397e
/Tests/Tests/BoardPieceTests.cpp
d5e1d564b4a5f3b95b47fc826de556261ed76d12
[]
no_license
koscelansky/Matilda
b492f24d311d1dbbdaa90dd24f2d36824ad89933
55a25aeb6114e246ae26815afe209c042541d744
refs/heads/master
2021-01-11T10:04:15.827397
2019-09-15T20:51:04
2019-09-15T20:51:04
78,038,996
0
0
null
null
null
null
UTF-8
C++
false
false
978
cpp
BoardPieceTests.cpp
#include <gtest/gtest.h> #include "../../Matilda/slovak_checkers/board/piece.h" #include <sstream> using namespace SlovakCheckers; TEST(BoardPiece, GetColorFromChar) { ASSERT_EQ(Color::White, detail::GetColorFromChar('W')); ASSERT_EQ(Color::Black, detail::GetColorFromChar('B')); ASSERT_ANY_THROW(detail::GetColorFromChar('X')); ASSERT_ANY_THROW(detail::GetColorFromChar('\0')); ASSERT_ANY_THROW(detail::GetColorFromChar(' ')); } TEST(BoardPiece, OperatorLeftShiftBM) { std::stringstream ss; ss << Piece(Color::Black, Type::Man); ASSERT_EQ("BM", ss.str()); } TEST(BoardPiece, OperatorLeftShiftBK) { std::stringstream ss; ss << Piece(Color::Black, Type::King); ASSERT_EQ("BK", ss.str()); } TEST(BoardPiece, OperatorLeftShiftWM) { std::stringstream ss; ss << Piece(Color::White, Type::Man); ASSERT_EQ("WM", ss.str()); } TEST(BoardPiece, OperatorLeftShiftWK) { std::stringstream ss; ss << Piece(Color::White, Type::King); ASSERT_EQ("WK", ss.str()); }
95a1348384cf12bf9e1bd8ebbfbe55151e2e1db3
1b897030675af8c24522238bf4f998eb8f125abe
/src/core-lib/memory_buffer.test.cpp
4f922350f5e8d89629df790363158ad3cdfa3511
[]
no_license
StarryWisdom/hermes
d040c29b859b0f2b3a554beac4d2d01dd423c69d
6b2ae0126005609a6139e0918d810b1b0223c67a
refs/heads/master
2023-02-16T16:12:07.851112
2020-12-04T17:12:28
2020-12-04T17:12:28
317,638,167
0
0
null
null
null
null
UTF-8
C++
false
false
2,484
cpp
memory_buffer.test.cpp
#include "memory_buffer.h" #include "gtest/gtest.h" // Ideally there would be a few more tests to ensure that front and back arent getting confused at any point class memory_buffer_test :public ::testing::Test { public: std::deque<std::byte> a; ~memory_buffer_test() { EXPECT_EQ(a.empty(),true); } }; TEST_F (memory_buffer_test, front_roundtrip_uint8_order) { buffer::push_front<uint8_t>(a,1); buffer::push_front<uint8_t>(a,2); EXPECT_EQ(buffer::pop_front<uint8_t>(a),2); EXPECT_EQ(buffer::pop_front<uint8_t>(a),1); } TEST_F (memory_buffer_test, front_roundtrip_uint16) { buffer::push_front<uint16_t>(a,300); EXPECT_EQ(buffer::peek_front<uint16_t>(a),300); EXPECT_EQ(buffer::pop_front<uint16_t>(a),300); } TEST_F (memory_buffer_test, back_roundtrip_uint8_order) { buffer::push_back<uint8_t>(a,1); buffer::push_back<uint8_t>(a,2); EXPECT_EQ(buffer::pop_back<uint8_t>(a),2); EXPECT_EQ(buffer::pop_back<uint8_t>(a),1); } TEST_F (memory_buffer_test, back_roundtrip_uint16) { buffer::push_back<uint16_t>(a,300); EXPECT_EQ(buffer::peek_back<uint16_t>(a),300); EXPECT_EQ(buffer::pop_back<uint16_t>(a),300); } TEST_F (memory_buffer_test, back_roundtrip_uint32) { buffer::push_back<uint32_t>(a,300); EXPECT_EQ(buffer::peek_back<uint32_t>(a),300); EXPECT_EQ(buffer::pop_back<uint32_t>(a),300); } TEST_F (memory_buffer_test, interleaved) { buffer::push_back<uint8_t>(a,1); buffer::push_front<uint8_t>(a,2); buffer::push_back<uint8_t>(a,3); EXPECT_EQ(buffer::pop_back<uint8_t>(a),3); EXPECT_EQ(buffer::pop_back<uint8_t>(a),1); EXPECT_EQ(buffer::pop_back<uint8_t>(a),2); } TEST_F (memory_buffer_test, invalid_peek_back) { EXPECT_THROW(buffer::peek_back<uint8_t>(a),std::runtime_error); } TEST_F (memory_buffer_test, pop_front_n) { buffer::push_back<std::byte>(a,std::byte(1)); buffer::push_back<std::byte>(a,std::byte(2)); buffer::push_back<std::byte>(a,std::byte(3)); buffer::push_back<std::byte>(a,std::byte(4)); const auto& b1=buffer::pop_front_n<1>(a); EXPECT_EQ(b1[0],std::byte(1)); const auto& b2=buffer::pop_front_n<3>(a); EXPECT_EQ(b2.size(),3); EXPECT_EQ(b2[0],std::byte(2)); EXPECT_EQ(b2[1],std::byte(3)); EXPECT_EQ(b2[2],std::byte(4)); } TEST_F (memory_buffer_test, read_at) { buffer::push_back<uint16_t>(a,300); buffer::push_back<uint8_t>(a,1); buffer::push_front<uint8_t>(a,2); EXPECT_EQ(buffer::read_at<uint16_t>(a,1),300); EXPECT_EQ(buffer::read_at<uint8_t>(a,0),2); EXPECT_EQ(buffer::read_at<uint8_t>(a,3),1); a.clear(); }
37326e49b7623e50cf1364b3599a2ebee84de278
62c4d2ab5ab97b73e4f9aa364aa9e5a51d66e31d
/1022.cpp
a622d9402f5f2f08b22af76bbf98bcc41d37a3ca
[]
no_license
Evian-Zhang/pat
4bfd7fb8a2b177f2dd37ad0c97e659849f752515
22adb30ddab94afc113e2bed11d396cabd5769c6
refs/heads/master
2022-11-12T11:23:23.769184
2020-07-08T08:37:50
2020-07-08T08:37:50
276,326,783
0
0
null
null
null
null
UTF-8
C++
false
false
2,419
cpp
1022.cpp
#include <cstdio> #include <cstring> #include <iostream> #include <string> #include <set> #include <unordered_map> #include <vector> #include <functional> using namespace std; void insertOrCreate(unordered_map<string, set<string> > *container, string key, string id) { auto pos = container->find(key); if (pos != container->end()) { pos->second.emplace(id); } else { set<string> ids; ids.emplace(id); container->emplace(key, ids); } } void findAndDisplay(unordered_map<string, set<string> > *container, string key) { auto ids = container->find(key); if (ids == container->end()) { printf("\nNot Found"); } else { for (auto id : ids->second) { printf("\n%s", id.c_str()); } } } int main() { unordered_map<string, set<string> > titles, authors, words, publishers, years; int n; scanf("%d", &n); getchar(); for (int i = 0; i < n; i++) { char tmpstr[64]; cin.getline(tmpstr, 64); string id(tmpstr); cin.getline(tmpstr, 64); string title(tmpstr); insertOrCreate(&titles, title, id); cin.getline(tmpstr, 64); string author(tmpstr); insertOrCreate(&authors, author, id); char keywords[64]; cin.getline(keywords, 64); char *keyword = strtok(keywords, " "); while (keyword != NULL) { string word(keyword); insertOrCreate(&words, word, id); keyword = strtok(NULL, " "); } cin.getline(tmpstr, 64); string publisher(tmpstr); insertOrCreate(&publishers, publisher, id); cin.getline(tmpstr, 64); string year(tmpstr); insertOrCreate(&years, year, id); } int m; scanf("%d", &m); for (int i = 0; i < m; i++) { int type; scanf("%d", &type); getchar(); getchar(); char keystr[64]; cin.getline(keystr, 64); string key(keystr); if (i != 0) { printf("\n"); } cout << type << ": " << key; switch (type) { case 1: findAndDisplay(&titles, key); break; case 2: findAndDisplay(&authors, key); break; case 3: findAndDisplay(&words, key); break; case 4: findAndDisplay(&publishers, key); break; case 5: findAndDisplay(&years, key); break; } } return 0; }
09d9576c6988ac492cab7c850ce98c5f7625bdcb
a43da640fc31090930ae9306cd3e7a3dbc2e8559
/engine/src/engine/graphics/LayerRenderer.hpp
b806fb059bb356737a923a1cf2481684c09d1f8b
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
CaptureTheBanana/CaptureTheBanana
e207e54c85dbf315f34fe7af74829257ad759c85
1398bedc80608e502c87b880c5b57d272236f229
refs/heads/master
2020-03-25T03:00:16.419572
2018-08-02T16:16:46
2018-08-02T16:16:46
143,317,798
1
0
null
null
null
null
UTF-8
C++
false
false
1,918
hpp
LayerRenderer.hpp
// This file is part of CaptureTheBanana++. // // Copyright (c) 2018 the CaptureTheBanana++ contributors (see CONTRIBUTORS.md) // This file is licensed under the MIT license; see LICENSE file in the root of this // project for details. #ifndef ENGINE_GRAPHIC_LAYERRENDERER_HPP #define ENGINE_GRAPHIC_LAYERRENDERER_HPP #include <set> #include <tuple> #include <gsl/gsl> namespace ctb { namespace engine { class Camera; class TextureBasedRenderable; /// Class that handles drawing of layers. class LayerRenderer { public: using LayerT = std::tuple<TextureBasedRenderable*, int, bool>; /// Layer id comparator class LayerComparator { public: bool operator()(LayerT a, LayerT b) { return std::get<int>(a) < std::get<int>(b); } }; public: /// \brief Creates a layer renderer with the given camera. /// /// \param camera Camera which sets the viewport - must stay alive until the class is /// finished/killed. explicit LayerRenderer(gsl::not_null<Camera*> camera); /// Destructor virtual ~LayerRenderer(); // Disable copy constructor and copy-assignment. LayerRenderer(const LayerRenderer&) = delete; LayerRenderer& operator=(const LayerRenderer&) = delete; /// \brief Adds a renderable to the given layer /// /// \param renderable Layer/Texture to render /// \param layerId Texture layer id /// \param freeTexture If true, we take ownership of renderable void addRenderable(TextureBasedRenderable* renderable, int layerId, bool freeRenderable); /// Renders each layer starting with layer id 0. void render(); private: /// Pointer to the camera Camera* m_camera; /// List for the layers and information std::multiset<LayerT, LayerComparator> m_renderables; }; // namespace ctb } // namespace engine } // namespace ctb #endif // ENGINE_GRAPHIC_LAYERRENDERER_HPP
ef04f48f4456520b0b58f0faa79e19d8ec3efc28
250e97666c4a919531bf38f3fd56a6ff93987609
/POJ/2773.cpp
0b6757e591c969625f7db3e0b2b8b4bf0b842e60
[ "WTFPL" ]
permissive
claviering/code
ccec3b642056645f5e3df0e6d02aa74ac73e0281
7019d50ff2e390696bc60358d1e39d9112f332e0
refs/heads/master
2021-07-11T13:44:23.211305
2020-06-21T02:46:09
2020-06-21T02:46:09
50,170,145
1
1
null
null
null
null
UTF-8
C++
false
false
410
cpp
2773.cpp
#include <iostream> using namespace std; int main() { int t; cin >> t; int time = 1; while (t--) { int n; cin >> n; int sum = 0; for (int k = 1; k <= n; k++) { int tmp = (1 + k + 1) * (k + 1) / 2; sum += k * tmp; } cout << time << " " << n << " " << sum << endl; time++; } return 0; }
db6a6987b081a58819cd4521b77d65db2300dd82
3f82741c5528b768ff93c75eb69aa880c0fe5b42
/lc421.cpp
fc61e4fcedc4aa05579526bf0367eee3a53ac30b
[]
no_license
Wavator/LC
196d628257f2bb0d8b527895fd9787e9545ab409
b144fd7708cfae331dd3b2f8f7ba38a9f4cd8d94
refs/heads/master
2022-11-30T04:21:24.421981
2020-08-17T15:15:36
2020-08-17T15:15:36
280,210,968
0
0
null
null
null
null
UTF-8
C++
false
false
2,940
cpp
lc421.cpp
// // Created by Zhao on 2020/8/1. // class Solution { public: struct TrieNode { TrieNode * son[2]; } * root; TrieNode * add(TrieNode* x, char c) { if (x->son[c - '0']) { return x->son[c - '0']; } return x->son[c - '0'] = new TrieNode(); } int search_max(const string &val, TrieNode * x) { string mx = ""; for (const auto &c: val) { int now = c == '0'? 1: 0; if (x->son[now]) { mx.push_back('1'); x = x->son[now]; } else { mx.push_back('0'); x = x->son[!now]; } } int ans = 0; reverse(mx.begin(), mx.end()); for (int i = 0; i < mx.size(); ++i) { if (mx[i] == '1') { ans |= (1 << i); } } return ans; } void insert(const string &s, TrieNode* &root) { TrieNode * curr = root; for (auto c: s) { int now = c - '0'; if (curr->son[now]) { curr = curr->son[now]; } else { curr->son[now] = new TrieNode(); curr = curr->son[now]; } } } int findMaximumXOR(vector<int>& nums) { root = new TrieNode(); int mx = *max_element(nums.begin(), nums.end()), length = 1; if (mx) { while (mx >>= 1) ++length; } vector<string> num_string; for (auto &item: nums) { num_string.emplace_back(); while (item) { num_string.back().push_back('0' + (item & 1)); item >>= 1; } while (num_string.back().length() < length) { num_string.back().push_back('0'); } reverse(num_string.back().begin(), num_string.back().end()); } int ans = 0; for (auto&s: num_string) { insert(s, root); ans = max(ans, search_max(s, root)); } return ans; } }; /* 给定一个非空数组,数组中元素为 a0, a1, a2, … , an-1,其中 0 ≤ ai < 2^31 。 找到 ai 和aj 最大的异或 (XOR) 运算结果,其中0 ≤ i,  j < n 。 你能在O(n)的时间解决这个问题吗? 示例: 输入: [3, 10, 5, 25, 2, 8] 输出: 28 解释: 最大的结果是 5 ^ 25 = 28. 使用trie树,新数字进来就是trie树的增加和查询操作。时间复杂度O(32*N),空间复杂度O(32*N) 注意查询的正确性是通过异或的交换律保证的。 若最大异或值是由a^b得到,则无论先放入a,查询b,还是先放入b,查询a,都会得到这个最大异或值。 来源:力扣(LeetCode) 链接:https://leetcode-cn.com/problems/maximum-xor-of-two-numbers-in-an-array 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。 * */
acdf7435a78e01bc29edfe6e019065f9c68abe22
06441e8a6be1671d898261dc61cd9344e17a6cc9
/Ijsfontein/ParticleSystem.cpp
dd961e9382022da6da26b97bfe043db67f1c995c
[]
no_license
ofx/swipe-ios
265debc215a8332a3ecde5181f2bbf86b5f9f8be
10c4e30df95522c53a38f3fcf64032d0608ca086
refs/heads/master
2021-01-10T18:41:11.207985
2012-10-25T12:07:30
2012-10-25T12:07:30
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,750
cpp
ParticleSystem.cpp
// // Particle.cpp // Ijsfontein // // Created by Marlon Etheredge on 5/30/11. // Copyright 2011 ofx. All rights reserved. // #include "ParticleSystem.hpp" #include <QuartzCore/QuartzCore.h> #include <time.h> Particle::Particle( Vector2 center ) : Quad( center ) { m_Active = false; } Particle::~Particle( void ) { // Nothing to free (I do hope so) } void Particle::Render( void ) { if( m_Parent->IsActive() ) { int t = (int) time( NULL ); m_Center.x += cosf( t * rand() ); m_Center.y += sinf( t * rand() ); Vector2 c = m_Parent->GetCenter(); glPushMatrix(); glTranslatef( c.x, c.y, 0.0f ); Quad::Render(); glPopMatrix(); } } ParticleSystem::ParticleSystem( Vector2 center, int radius, unsigned int particles, Texture *texturehandle ) { RenderingEngine *r = RenderingEngine::GetRenderingEngine(); m_CountParticles = particles; m_Center = Vector2( 0.0f, 0.0f ); m_Particles = (Particle**) malloc( sizeof( Particle* ) * particles ); for( int i = 0 ; i < particles ; ++i ) { Vector2 s; s.x = s.y = rand() % 22; float x = (rand() % radius) - (radius / 2); float y = (rand() % radius) - (radius / 2); m_Particles[i] = new Particle( Vector2( x, y ) ); m_Particles[i]->SetTexture( texturehandle ); m_Particles[i]->SetScale( s ); m_Particles[i]->SetParent( this ); r->RegisterDrawable( m_Particles[i] ); } } ParticleSystem::~ParticleSystem( void ) { for( int i = 0 ; i < m_CountParticles ; ++i ) { delete m_Particles[i]; } delete m_Particles; }
bebb4fa192f8887c51bff810b8077e14fe5c397e
f0845adcf4dc99d080a8cdc7c3da9baec9788658
/Prototypes/Lunar DEM/main.cpp
ff776623b8e5ca1f2d8f861b1c41627607718fbb
[]
no_license
SCragg/MSc-Project
e6bd77b887be7274ad32fbd2d52fe1c9baf8a30a
c8eda3e23acac3113a58c99b19207fa985110cde
refs/heads/master
2022-02-14T19:08:07.168017
2019-09-08T21:28:28
2019-09-08T21:28:28
184,462,010
0
0
null
null
null
null
UTF-8
C++
false
false
13,077
cpp
main.cpp
/* Lunar DEM prototype - Sean Cragg 01/05/2019 main.cpp // */ //Linking to libraries #ifdef _DEBUG #pragma comment(lib, "glfw3D.lib") #pragma comment(lib, "glloadD.lib") #else #pragma comment(lib, "glfw3.lib") #pragma comment(lib, "glload.lib") #endif #pragma comment(lib, "opengl32.lib") #pragma comment(lib, "SOIL.lib") /* Include the header to the GLFW wrapper class which also includes the OpenGL extension initialisation*/ #include "wrapper_glfw.h" /* Include GLM core and matrix extensions*/ #include <glm/glm.hpp> #include "glm/gtc/matrix_transform.hpp" #include <glm/gtc/type_ptr.hpp> // Include headers for our objects #include "shader.h" #include "flat_terrain.h" #include "sphere_terrain.h" #include "cube.h" //std lib includes #include <iostream> #include <stack> #include <utility> //Variable Declarations /* Position and view globals */ GLfloat angle_x, angle_inc_x, model_scale; //from lab example GLfloat angle_y, angle_inc_y, angle_z, angle_inc_z; //from lab example GLfloat move_x, move_y, move_z; GLfloat aspect_ratio; // Aspect ratio of the window defined in the reshape callback //Light rotation GLfloat HourAngle; //Angle of light direction, specified in degrees /* Uniforms*/ GLuint ubo_Matrices; //UBO for view, projection, model and normal transformation matrices //Offsets for ubo const GLint offset_projection = 0; const GLint offset_view = 64; const GLint offset_model = 128; const GLint offset_normalmatrix = 192; //Uniforms GLuint lightdirID; GLuint lamb_lightdirID; GLuint therm1_lightdirID, therm1_albedoID, therm1_solarID, therm1_emissID; GLuint therm1_globaltimeID, therm1_colourmodeID; /* Global instances of our objects */ Shader normalShader, cubeShader; vector<Shader> terrainShaders; DEM_terrain *LunarTerrain; Cube aCube; //Flags GLboolean shownormals; GLuint drawmode; GLuint currentterrainshader; using namespace std; using namespace glm; /* This function is called before entering the main rendering loop. Initialisations. */ void init(GLWrapper *glw) { /* Set the view transformation controls to their initial values*/ angle_y = 0; angle_z = 0; angle_x = -90; angle_inc_x = angle_inc_y = angle_inc_z = 0; move_x = 0; move_y = 0; //-10 move_z = -10; //-50 model_scale = .000002f; //.002 for flat terrain aspect_ratio = 1024.f / 768.f; // Initial aspect ratio from window size - from lab examples //hour angle HourAngle = 0; //initial flag values shownormals = false; drawmode = 0; currentterrainshader = 0; //Create Lunar DEM LunarTerrain = new Sphere_terrain(2880, 5760, "..\\..\\DEMs\\2\\lunar_16.dem", 2880*1895.21, 5760 * 1895.21); LunarTerrain->load_DEM(); LunarTerrain->generate_terrain(); LunarTerrain->createObject(); LunarTerrain->setTexture(2001, "..\\..\\Textures\\Thermal Profile 2.txt"); //Create cube aCube.makeCube(); /* Load terrain shaders in to shader vector */ try { terrainShaders.push_back(Shader("Hapke", "..\\..\\shaders\\Hapke.vert", "..\\..\\shaders\\Hapke.frag")); } catch (exception &e) { cout << "Caught exception: " << e.what() << endl; cin.ignore(); exit(0); } try { terrainShaders.push_back(Shader("Lambert", "..\\..\\shaders\\Hapke.vert", "..\\..\\shaders\\Lambert.frag")); } catch (exception &e) { cout << "Caught exception: " << e.what() << endl; cin.ignore(); exit(0); } try { terrainShaders.push_back(Shader("Thermal", "..\\..\\shaders\\Thermal_Texture_Sphere.vert", "..\\..\\shaders\\Thermal_Texture_Sphere.frag")); } catch (exception &e) { cout << "Caught exception: " << e.what() << endl; cin.ignore(); exit(0); } //Load other shaders try { normalShader.LoadShader("..\\..\\shaders\\show_normals.vert", "..\\..\\shaders\\show_normals.frag", "..\\..\\shaders\\show_normals.geom"); normalShader.SetName("Normal"); } catch (exception &e) { cout << "Caught exception: " << e.what() << endl; cin.ignore(); exit(0); } try { cubeShader.LoadShader("..\\..\\shaders\\Basic.vert", "..\\..\\shaders\\Basic.frag"); cubeShader.SetName("Cube"); } catch (exception &e) { cout << "Caught exception: " << e.what() << endl; cin.ignore(); exit(0); } //Uniform buffer setup //get uniform block index for shaders GLuint uniBlock_MatHapke = glGetUniformBlockIndex(terrainShaders[0].ID, "Matrices"); GLuint uniBlock_MatLambert = glGetUniformBlockIndex(terrainShaders[1].ID, "Matrices"); GLuint uniBlock_MatThermal_1 = glGetUniformBlockIndex(terrainShaders[2].ID, "Matrices"); GLuint uniBlock_MatNormals = glGetUniformBlockIndex(normalShader.ID, "Matrices"); GLuint uniBlock_MatCube = glGetUniformBlockIndex(cubeShader.ID, "Matrices"); //then explicitly link shaders uniform block to binding point, 0 for this buffer glUniformBlockBinding(terrainShaders[0].ID, uniBlock_MatHapke, 0); glUniformBlockBinding(terrainShaders[1].ID, uniBlock_MatLambert, 0); glUniformBlockBinding(terrainShaders[2].ID, uniBlock_MatThermal_1, 0); glUniformBlockBinding(normalShader.ID, uniBlock_MatNormals, 0); glUniformBlockBinding(cubeShader.ID, uniBlock_MatCube, 0); //Create matrices uniform buffer object glGenBuffers(1, &ubo_Matrices); glBindBuffer(GL_UNIFORM_BUFFER, ubo_Matrices); glBufferData(GL_UNIFORM_BUFFER, 240, NULL, GL_DYNAMIC_DRAW); //Buffer size of 240 bytes glBindBuffer(GL_UNIFORM_BUFFER, 0); //bind buffer to binding point glBindBufferBase(GL_UNIFORM_BUFFER, 0, ubo_Matrices); /* Define light position uniforms */ lightdirID = glGetUniformLocation(terrainShaders[0].ID, "lightdir"); lamb_lightdirID = glGetUniformLocation(terrainShaders[1].ID, "lightdir"); therm1_lightdirID = glGetUniformLocation(terrainShaders[2].ID, "lightdir"); //Define uniforms for thermal shader therm1_solarID = glGetUniformLocation(terrainShaders[2].ID, "solar_constant"); therm1_emissID = glGetUniformLocation(terrainShaders[2].ID, "emissivity"); therm1_albedoID = glGetUniformLocation(terrainShaders[2].ID, "albedo"); therm1_globaltimeID = glGetUniformLocation(terrainShaders[2].ID, "global_time"); therm1_colourmodeID = glGetUniformLocation(terrainShaders[2].ID, "colourmode"); } /* Called to update the display. Note that this function is called in the event loop in the wrapper class because we registered display as a callback function */ void display(GUI* gui) { /* Define the background colour */ glClearColor(0.0f, 0.0f, 0.0f, 1.0f); /* Clear the colour and frame buffers */ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); /* Enable depth test */ glEnable(GL_DEPTH_TEST); // Projection matrix : 30° Field of View, 4:3 ratio, display range : 0.1 unit <-> 100 units - from lab example mat4 projection = perspective(radians(30.0f), aspect_ratio, 0.1f, 200.0f); //mat4 projection = ortho(-10.0f, 10.0f, -10.0f, 10.0f, -50.0f, 100.0f); // Camera matrix mat4 view = lookAt( vec3(0, 0, 4), // Camera is at (0,0,4), in World Space vec3(0, 0, 0), // looks at the origin vec3(0, 1, 0) // up is positive y. ); view = translate(view, vec3(move_x, move_y, move_z)); // Define light direction using hour angle vec4 lightdirection = rotate(mat4(1.0f), (gui->get_time() * 6.28318530718f) , vec3(0, 0, 1)) * vec4(0, 1, 0, 1); // Send our projection and view uniforms and light position to the shader terrainShaders[gui->get_currentshader()].use(); switch (gui->get_currentshader()) { case 0: glUniform4fv(lightdirID, 1, value_ptr(lightdirection)); break; case 1: glUniform4fv(lamb_lightdirID, 1, value_ptr(lightdirection)); break; case 2: glUniform4fv(therm1_lightdirID, 1, value_ptr(lightdirection)); break; } //Update matrix UBO with projection and view matrices glBindBuffer(GL_UNIFORM_BUFFER, ubo_Matrices); glBufferSubData(GL_UNIFORM_BUFFER, offset_projection, sizeof(mat4), value_ptr(projection)); glBufferSubData(GL_UNIFORM_BUFFER, offset_view, sizeof(mat4), value_ptr(view)); glBindBuffer(GL_UNIFORM_BUFFER, 0); // Define our model transformation in a stack and // push the identity matrix onto the stack stack<mat4> model; model.push(mat4(1.0f)); // Define the normal matrix mat3 normalmatrix; // Define our transformations that apply to terrain model.push(model.top()); { model.top() = translate(model.top(), vec3(0, 0, 0)); model.top() = scale(model.top(), vec3(model_scale, model_scale, model_scale));//scale equally in all axis model.top() = rotate(model.top(), -radians(angle_x), vec3(1, 0, 0)); //rotating in clockwise direction around x-axis model.top() = rotate(model.top(), -radians(angle_y), vec3(0, 1, 0)); //rotating in clockwise direction around y-axis model.top() = rotate(model.top(), -radians(angle_z), vec3(0, 0, 1)); //rotating in clockwise direction around z-axis normalmatrix = transpose(inverse(mat3(view * model.top()))); //Update UBO with model and normal matrices glBindBuffer(GL_UNIFORM_BUFFER, ubo_Matrices); glBufferSubData(GL_UNIFORM_BUFFER, offset_model, sizeof(mat4), &model.top()[0][0]); glBufferSubData(GL_UNIFORM_BUFFER, offset_normalmatrix, sizeof(vec4)*3, value_ptr(mat4(normalmatrix))); glBindBuffer(GL_UNIFORM_BUFFER, 0); //Draw terrain terrainShaders[gui->get_currentshader()].use(); if (gui->get_currentshader() == 2) { //If initial thermal prototype send these //glUniform1f(therm1_albedoID, 0.08); //Albedo of 0.08 //glUniform1f(therm1_emissID, 0.95); //Emissivity of 0.95 //glUniform1f(therm1_solarID, 1370); //Solar Constant 1370 //send time and colourmode to shader glUniform1f(therm1_globaltimeID, gui->get_time()); glUniform1i(therm1_colourmodeID, gui->get_colourmode()); } LunarTerrain->drawTerrain(drawmode); if (shownormals) { normalShader.use(); LunarTerrain->drawTerrain(2); //draw as points } } model.pop(); /* model.push(model.top()); { model.top() = translate(model.top(), vec3(lightx, lighty, lightz)); model.top() = scale(model.top(), vec3(1, 1, 1)); normalmatrix = transpose(inverse(mat3(view * model.top()))); //Update UBO glBindBuffer(GL_UNIFORM_BUFFER, ubo_Matrices); glBufferSubData(GL_UNIFORM_BUFFER, offset_model, sizeof(mat4), &model.top()[0][0]); glBufferSubData(GL_UNIFORM_BUFFER, offset_normalmatrix, sizeof(mat3), &normalmatrix); glBindBuffer(GL_UNIFORM_BUFFER, 0); //draw cube cubeShader.use(); aCube.drawCube(cubeShader); } model.pop(); */ glDisableVertexAttribArray(0); glUseProgram(0); ////////////////Modify our animation variables/////////////////// //taken from class example, spins around the whole model. angle_x += angle_inc_x; angle_y += angle_inc_y; angle_z += angle_inc_z; } /* Called whenever the window is resized. The new window size is given, in pixels. taken from lab examples */ static void reshape(GLFWwindow* window, int w, int h) { glViewport(0, 0, (GLsizei)w, (GLsizei)h); // Store aspect ratio to use for our perspective projection aspect_ratio = float(w) / float(h); } /* change view angle, exit upon ESC taken from lab lab examples*/ static void keyCallback(GLFWwindow* window, int key, int s, int action, int mods) { //Closes if escape is pressed, from lab example if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS) glfwSetWindowShouldClose(window, GL_TRUE); //Controls model rotation and scale, adapted from class example if (key == 'Q') angle_inc_x -= 0.1f; if (key == 'Q' && action == GLFW_RELEASE) angle_inc_x = 0; if (key == 'W') angle_inc_x += 0.1f; if (key == 'W' && action == GLFW_RELEASE) angle_inc_x = 0; if (key == 'E') angle_inc_y -= 0.1f; if (key == 'E' && action == GLFW_RELEASE) angle_inc_y = 0; if (key == 'R') angle_inc_y += 0.1f; if (key == 'R' && action == GLFW_RELEASE) angle_inc_y = 0; if (key == 'T') angle_inc_z -= 0.1f; if (key == 'T' && action == GLFW_RELEASE) angle_inc_z = 0; if (key == 'Y') angle_inc_z += 0.1f; if (key == 'Y' && action == GLFW_RELEASE) angle_inc_z = 0; if (key == 'A') model_scale -= 0.000001f; if (key == 'S') model_scale += 0.000001f; //Moves camera along x, y, z axes if (key == GLFW_KEY_UP) move_y -= 1.0; if (key == GLFW_KEY_DOWN) move_y += 1.0; if (key == GLFW_KEY_LEFT) move_x += 1.0; if (key == GLFW_KEY_RIGHT) move_x -= 1.0; if (key == GLFW_KEY_RIGHT_SHIFT) move_z -= 1.0; if (key == GLFW_KEY_RIGHT_CONTROL) move_z += 1.0; //Shows/hides normal if (key == 'V' && action == GLFW_PRESS) { if (shownormals == false) shownormals = true; else shownormals = false; } //Change drawmode if (key == 'B' && action == GLFW_PRESS) { if (drawmode < 2) drawmode++; else drawmode = 0; } } /* Entry point of program */ int main(int argc, char* argv[]) { GUI *gui = new GUI(terrainShaders); GLWrapper *glw = new GLWrapper(1024, 768, "Lunar DEM", gui); //1024 * 768 if (!ogl_LoadFunctions()) { fprintf(stderr, "ogl_LoadFunctions() failed. Exiting\n"); return 0; } // Register the callback functions glw->setRenderer(display); glw->setKeyCallback(keyCallback); glw->setReshapeCallback(reshape); /* Output the OpenGL vendor and version */ glw->DisplayVersion(); init(glw); GUI::Initialise(glw->getWindow()); glw->eventLoop(); GUI::Cleanup(); delete(glw); return 0; }
ba650b7f00617d6ef9d11683ab474bc2b2b9ae51
427680543c397ce9600908d62152c81cdc3ef46b
/BMR-PRIME/network/src/Client.cpp
7e8f785c556de5d71027cfee12a250515eae1782
[]
no_license
cryptobiu/BMR2016
eaa081f78b93bd93b9f3682b6344bab3792e4920
58d2802a1df34a5a184692d2aaa26dc674518e91
refs/heads/master
2021-01-10T12:41:59.604319
2016-04-14T16:28:47
2016-04-14T16:28:47
53,939,246
1
1
null
null
null
null
UTF-8
C++
false
false
5,497
cpp
Client.cpp
/* * Client.cpp * * Created on: Jan 27, 2016 * Author: bush */ #include "Client.h" #include "common.h" #include "utils.h" #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <arpa/inet.h> #include <sys/types.h> #include <netinet/in.h> #include <sys/socket.h> #include <errno.h> #include <boost/thread.hpp> static void throw_bad_ip(const char* ip) { fprintf(stderr,"Client:: Error: inet_aton - not a valid address? %s\n", ip); throw std::invalid_argument( "bad ip" ); } Client::Client(endpoint_t* endpoints, int numservers, ClientUpdatable* updatable, unsigned int max_message_size) :_numservers(numservers), _max_msg_sz(max_message_size), _updatable(updatable), _new_message(false) { _sockets = new int[_numservers](); // 0 initialized _servers = new struct sockaddr_in[_numservers]; _msg_queues = new Queue<Msg>[_numservers](); _lockqueue = new std::mutex[_numservers]; _queuecheck = new std::condition_variable[_numservers]; _new_message = new bool[_numservers](); memset(_servers, 0, sizeof(_servers)); for (int i=0; i<_numservers; i++) { _sockets[i] = socket(AF_INET, SOCK_STREAM, 0); if(-1 == _sockets[i]) fprintf(stderr,"Client:: Error: socket: \n%s\n",strerror(errno)); _servers[i].sin_family = AF_INET; _servers[i].sin_port = htons(endpoints[i].port); if(0 == inet_aton(endpoints[i].ip.c_str(), (in_addr*)&_servers[i].sin_addr)) throw_bad_ip(endpoints[i].ip.c_str()); } } Client::~Client() { for (int i=0; i<_numservers; i++) close(_sockets[i]); delete[] _sockets; delete[] _servers; delete[] _msg_queues; delete[] _lockqueue; delete[] _queuecheck; delete[] _new_message; } void Client::Connect() { for (int i=0; i<_numservers; i++) new boost::thread(&Client::_send_thread, this, i); new boost::thread(&Client::_connect, this); } void Client::_connect() { boost::thread_group tg; for(int i=0; i<_numservers; i++) { boost::thread* connector = new boost::thread(&Client::_connect_to_server, this, i); tg.add_thread(connector); // usleep(rand()%50000); // prevent too much collisions... TODO: remove } tg.join_all(); _updatable->ConnectedToServers(); } void Client::_connect_to_server(int i) { printf("Client:: connecting to server %d\n",i); char *ip; int port = ntohs(_servers[i].sin_port); ip = inet_ntoa(_servers[i].sin_addr); int error = 0; while (true ) { error = connect(_sockets[i], (struct sockaddr *)&_servers[i], sizeof(struct sockaddr)); if(!error) break; if (errno == 111) { fprintf(stderr,"."); } else { fprintf(stderr,"Client:: Error (%d): connect to %s:%d: \"%s\"\n",errno, ip,port,strerror(errno)); fprintf(stderr,"Client:: socket %d sleeping for %u usecs\n",i, CONNECT_INTERVAL); } usleep(CONNECT_INTERVAL); } printf("\nClient:: connected to %s:%d\n", ip,port); setsockopt(_sockets[i], SOL_SOCKET, SO_SNDBUF, &BUFFER_SIZE, sizeof(BUFFER_SIZE)); } void Client::Send(int id, const char* message, unsigned int len) { Msg new_msg = {message, len}; { std::unique_lock<std::mutex> locker(_lockqueue[id]); // printf ("Client:: queued %u bytes to %d\n", len, id); _msg_queues[id].Enqueue(new_msg); _new_message[id] = true; _queuecheck[id].notify_one(); } } void Client::Broadcast(const char* message, unsigned int len) { for(int i=0;i<_numservers; i++) { std::unique_lock<std::mutex> locker(_lockqueue[i]); Msg new_msg = {message, len}; _msg_queues[i].Enqueue(new_msg); _new_message[i] = true; _queuecheck[i].notify_one(); } } void Client::Broadcast2(const char* message, unsigned int len) { // first server is always the trusted party so we start with i=1 for(int i=1;i<_numservers; i++) { std::unique_lock<std::mutex> locker(_lockqueue[i]); Msg new_msg = {message, len}; _msg_queues[i].Enqueue(new_msg); _new_message[i] = true; _queuecheck[i].notify_one(); } } void Client::_send_thread(int i) { while(true) { { std::unique_lock<std::mutex> locker(_lockqueue[i]); //printf("Client:: waiting for a notification to send to %d\n", i); _queuecheck[i].wait(locker); if (!_new_message[i]) { // printf("Client:: Spurious notification!\n"); continue; } //printf("Client:: notified!!\n"); } while (true) { Msg msg = {0}; { std::unique_lock<std::mutex> locker(_lockqueue[i]); if(_msg_queues[i].Empty()) { //printf("Client:: no more messages in queue\n"); break; // out of the inner while } msg = _msg_queues[i].Dequeue(); } _send_blocking(msg, i); } _new_message[i] = false; } } void Client::_send_blocking(Msg msg, int id) { // printf ("Client:: sending %u bytes to %d\n", msg.len, id); int cur_sent = 0; cur_sent = send(_sockets[id], &msg.len, LENGTH_FIELD, 0); if(LENGTH_FIELD == cur_sent) { unsigned int total_sent = 0; unsigned int remaining = 0; while(total_sent != msg.len) { remaining = (msg.len-total_sent)>_max_msg_sz ? _max_msg_sz : (msg.len-total_sent); cur_sent = send(_sockets[id], msg.msg+total_sent, remaining, 0); //printf("Client:: msg.len=%u, remaining=%u, total_sent=%u, cur_sent = %d\n",msg.len, remaining, total_sent,cur_sent); if(cur_sent == -1) { fprintf(stderr,"Client:: Error: send msg failed: %s\n",strerror(errno)); assert(cur_sent != -1); } total_sent += cur_sent; } } else if (-1 == cur_sent){ fprintf(stderr,"Client:: Error: send header failed: %s\n",strerror(errno)); } }
6ea94118961fa027e347abc4a14996f713c2dc82
acf7398d661bb8c5ca64017fafe34af42ed0b8d7
/zoneserver/GameObjects/CItemService.h
218365e65000b7764cd01fdce040afbb6a728f8c
[]
no_license
luw630/Serverframe
884be88f9e83c0f0cbb3686b033868778db11afc
e8460cc9b5304fae3470b3eed0ea65fccb24c5b8
refs/heads/master
2021-01-10T07:39:08.308979
2016-01-12T03:39:24
2016-01-12T03:39:24
46,545,341
2
0
null
null
null
null
GB18030
C++
false
false
6,824
h
CItemService.h
#pragma once #pragma warning(push) #pragma warning(disable:4996) #include <hash_map> struct SItemBaseData; class SItemFactorData; struct SItemUpdateGradeInfo; struct SItemUpgradeAttribute; struct SItemUpdateQuality; // 装备升品质 struct SEquipLevelUp; // 装备升级 struct SEquipStar; // 装备升星 struct SMaxExtraAttri; // 附加属性最大值 struct SJewelAttribute; // 宝石属性 struct SHuiYuanDanInfo; // 回元丹增加属性配置表 struct SMakeHoleInfo; // 打孔花费 struct SInsertGem; // 镶嵌花费 struct STakeOffGem; // 封洞花费 struct SDefineReset; struct SEquipDecomposition; // 装备分解 struct SEquipSmelting; // 装备熔炼 struct SEquipBestPreviewExtraAttri; // 装备极品预览附加属性 struct SEquipSpiritAttachBodyAttr; // 灵附属性 // 提供对道具相关数据的访问 // 1. 道具基本属性表 // 2. 道具加成属性表 // 3. 道具组CD表 struct SEquipExtraAttriTable { DWORD EquipId; WORD MinNum; WORD MaxNum; int ExtraData[SEquipDataEx::EEA_MAX][3]; DWORD ResetItemID; //需要的重置道具ID BYTE ResetNeedNum; //重置需要的数量 BYTE ResetMoneyType; //需要的钱类型 long ResetNeedMoney; //重置需要的钱 DWORD RefreshItemID; //需要的刷新道具ID BYTE RefreshNeedNum; //刷新需要的数量 BYTE RefreshMoneyType; //刷新的钱类型 long RefreshNeedMoney; //刷新需要的钱 DWORD ExternLockedItemID; //可用锁定石ID byte ExternLockeItemNum; // 锁定一条属性需要锁定石的数量 }; class CItemService { typedef std::hash_map<DWORD, SEquipExtraAttriTable* > EquipExtraAttriTable; typedef std::hash_map<DWORD, SItemBaseData* > ItemBaseData; typedef std::hash_map<DWORD, SItemFactorData*> ItemFactorData; typedef std::hash_map<DWORD, DWORD> ItemGroupCD; typedef std::hash_map<BYTE, SItemUpdateGradeInfo*> ItemUpdateGradeTable; typedef std::hash_map<DWORD, SItemUpgradeAttribute*> ItemUpgradeAttribute; typedef std::hash_map<BYTE, SItemUpdateQuality*> ItemUpdateQuality; // 升品质 typedef std::hash_map<BYTE, SEquipLevelUp*> EquipLevelUp; // 升级 typedef std::hash_map<BYTE, SEquipStar*> EquipStar; // 装备升星 typedef std::hash_map<DWORD, SMaxExtraAttri*> MaxExtraAttri; // 装备最大随机属性值 typedef std::hash_map<DWORD, SJewelAttribute*> JewelAttribute; // 宝石属性值 typedef std::hash_map<DWORD, SHuiYuanDanInfo*> HuiYuanDanInfo; // 回元丹属性配置表 typedef std::hash_map<DWORD, SMakeHoleInfo> MakeHoleInfo; typedef std::hash_map<DWORD, SInsertGem> SInsertGemInfo; typedef std::hash_map<DWORD, STakeOffGem> STakeOffGemInfo; typedef std::hash_map<BYTE, SDefineReset> SDefineResetInfo; typedef std::hash_map<DWORD, SEquipDecomposition*> SEquipDecompositionInfo; typedef std::hash_map<BYTE, SEquipSmelting*> SEquipSmeltingInfo; typedef std::hash_map<BYTE, SEquipBestPreviewExtraAttri*> SEquipBestPreviewExtraAttriInfo; typedef std::hash_map<WORD, SEquipSpiritAttachBodyAttr*> SEquipSpiritAttachBodyAttrInfo; private: CItemService(); public: static CItemService& GetInstance() { static CItemService instance; return instance; } bool Init(); bool ReLoad(); void Clear(); ~CItemService(); DWORD GetItemGroupCDTime(DWORD group) const; const SItemBaseData *GetItemBaseData(DWORD index) const; const SItemFactorData *GetItemFactorData(DWORD index) const; //const SEquipExtraAttriTable *GetExtraAttriTable(DWORD index) const; // 装备附加属性 const SItemUpdateGradeInfo *GetUpgradeInfo(BYTE grade) const; // 装备升阶信息 const SItemUpgradeAttribute *GetUpgradeAttribute(const struct SItemBaseData *pItemData) const; // 装备升阶附加属性 const SItemUpgradeAttribute *GetUpgradeAttribute(DWORD ) const; // 装备升阶附加属性 const SItemUpdateQuality *GetUpdateQuality(BYTE color) const; // 装备升品质 const SEquipLevelUp *GetLevelUpData(BYTE level) const; // 装备升级 const SEquipStar *GetEquipStarData(BYTE num) const; // 装备升星 const SMaxExtraAttri *GetMaxExtraAttri(DWORD index) const; // 装备最大随机属性配置表 const SMaxExtraAttri *GetMaxExtraAttri(const struct SItemBaseData *pItemData, byte byCurGrade) const; // 获取升阶的附加属性上限的读取 const SJewelAttribute *GetJewelAttribute(DWORD index) const; // 宝石的附加属性 const SHuiYuanDanInfo *GetHuiYuanDanInfo(DWORD index) const; // 回元丹增加真气表 const SMakeHoleInfo *GetMakeHoleInfo(DWORD index) const; const SInsertGem *GetInsertGemInfo(DWORD index) const; const STakeOffGem *GetSTakeOffGemInfo(DWORD index) const; const SEquipDecomposition *GetSEquipDecompositionInfo(const struct SItemBaseData *pItemData, byte byStarNum) const; // 获取装备的分解属性 const SEquipSmelting *GetSEquipSmeltingInfo(byte byColor) const; // 获取装备熔炼配置属性 const SEquipBestPreviewExtraAttri *GetSEquipBestPreviewExtraAttri(byte byEquipType) const; // 获取装备极品预览附加属性信息 WORD GetSuitEquipIDbyScrollID(DWORD dwScrollID) const; // 通过卷轴ID查找对应的套装ID const SEquipSpiritAttachBodyAttr *GetSEquipSpiritAttachBodyAttri(WORD wSuitEquipID) const;// 获取灵附套装信息 bool LoadExtraAttri(); long GetRandomNum(BYTE Color,long RandomNum); // 发送信息结构到客户端 BOOL SendItemInfo(DNID dnidClient); bool GetFactorData(DWORD item, WORD &attr,WORD &nvalue,WORD nIndex); private: // 配置道具属性加成 void SetFactorValue(DWORD item, WORD attri, int value, bool IsPre); // 禁止拷贝构造和拷贝赋值 CItemService(CItemService &); CItemService& operator=(CItemService &); private: ItemBaseData m_baseData; // 道具的基本属性 ItemFactorData m_factorData; // 道具的加成属性 ItemGroupCD m_groupCD; // 组CD EquipExtraAttriTable m_EATable; ItemUpdateGradeTable m_gradeTalbe; // 装备升阶信息 ItemUpgradeAttribute m_upgradeAttri; // 装备升阶的附加属性 ItemUpdateQuality m_updateQuality; // 装备升品质 EquipLevelUp m_EquipLevelUp; // 装备升级 EquipStar m_EquipStar; // 装备升星 MaxExtraAttri m_MaxAttri; // 最大随机属性 JewelAttribute m_JewAttri; // 宝石属性 HuiYuanDanInfo m_HYDInfo; // 回元丹信息 MakeHoleInfo m_MakeHoleInfo; SInsertGemInfo m_SInsertGemInfo; STakeOffGemInfo m_STakeOffGemInfo; SDefineResetInfo m_SDefineResetInfo; // SEquipDecompositionInfo m_SEquipDecompositionInfo; // 装备分解配置 SEquipSmeltingInfo m_SEquipSmeltingInfo; // 装备熔炼配置 SEquipBestPreviewExtraAttriInfo m_SEquipBestPreviewExtraAttri; // 装备极品预览附加属性配置 SEquipSpiritAttachBodyAttrInfo m_SEquipSpiritAttachBodyAttri; // 灵附相关的处理 }; #pragma warning(pop)
8b08541b6da02fc8216aae59ff8d5906c4d3bf6a
ab6c0d2c815bfb22ee45c054010f29afcb761eb1
/Perimeter/MathPart.cpp
5a78e6e24b51421f5982d22d36cd9abbb5795560
[ "MIT" ]
permissive
vladfe123/perimeter
eb822047c93ca78eb8db25d2d2ed11dca2db0313
35f0c8946342a2bce1526feabd7c7d4d38f8d1a3
refs/heads/main
2023-06-09T11:35:17.076762
2021-06-26T18:06:22
2021-06-26T18:06:22
375,984,578
0
0
null
null
null
null
UTF-8
C++
false
false
1,517
cpp
MathPart.cpp
#include <iostream> #include "MathPart.h" /* * Calculates distances between neighboring coordinates. * @coordsX - array of coordinates X; * @coordsY - array of coordinates Y; * @sideWidths - resulting array with distances, it should be preallocated; * @am - number of elements; */ void calculateSides(double *coordsX, double *coordsY, double *sideWidths, int am) { bool isLast = false; double xpow = 0, ypow = 0; for (int i = 0; i < am; i++) { isLast = i == (am - 1); if (isLast) { xpow = pow((coordsX[i] - coordsX[0]), 2); ypow = pow((coordsY[i] - coordsY[0]), 2); } else { xpow = pow((coordsX[i + 1] - coordsX[i]), 2); ypow = pow((coordsY[i + 1] - coordsY[i]), 2); } sideWidths[i] = sqrt(xpow + ypow); } } /* * Calculates a sum of array elements. * @items - array of elements; * @n - number of elements in the array; * @returns calculated sum. */ double accumulate(double* items, int n) { int i; double sum = 0; for (i = 0; i < n; i++) { sum += items[i]; } return sum; } /* * Calculates perimeter of a figure defined as coordinates. * @coordsX - array of coordinates X; * @coordsY - array of coordinates Y; * @am - number of elements; * @returns calculated perimeter. */ double calculatePerimeter(double *coordsX, double *coordsY, int am) { double *sideWidths; double perimeter = 0; sideWidths = (double*)malloc(am * sizeof(double)); calculateSides(coordsX, coordsY, sideWidths, am); perimeter = accumulate(sideWidths, am); free(sideWidths); return perimeter; }
4d641f16076b2a5f6554b394d807b6acf8e33d71
78ff1e83c0c254a9e0d7ada51776d263baeb52d4
/GoBang/mainwindow.cpp
45181b38621f79075add128c3155ddc84f463718
[]
no_license
gzr2017/GoBang
ce38c7b5187c1df173fe54e6027bb5c41bcf5955
79ce76633963ed88388789de46ec91bc22653ef2
refs/heads/master
2021-09-01T13:26:08.667918
2017-12-27T07:24:41
2017-12-27T07:24:41
115,482,226
2
1
null
null
null
null
UTF-8
C++
false
false
391
cpp
mainwindow.cpp
#include "mainwindow.h" #include "ui_mainwindow.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); delete this->centralWidget(); PlayView *PV = new PlayView(this); this->setCentralWidget(PV); PV->setFixedHeight(30 * 15 + 210); PV->setFixedWidth(30 * 15 + 80); } MainWindow::~MainWindow() { delete ui; }
2562b1bd095d987a9459ed7fcb195059c1332207
7b9fba3bc9e62ed4a468d41eadae1cbfda67a3c8
/NewRobo+PID/src/OI.h
b5a2c3695fb97468ae182598d99e76a6f84c907b
[]
no_license
fpl786/FRC-Programming-7277
1df128705d1777c35fba8473d94219b8b9d67061
d00202ef5fc1ce556df6b95efd83f273d32d7ef5
refs/heads/master
2021-09-18T20:55:17.285551
2018-07-20T02:47:39
2018-07-20T02:47:39
110,634,980
2
1
null
null
null
null
UTF-8
C++
false
false
1,284
h
OI.h
#ifndef OI_H_ #define OI_H_ //Include files from nessercary libary #include <Buttons/JoystickButton.h> #include <XboxController.h> #include <Joystick.h> //Declare the class for the file class OI { //Public class that can be access by any other file encapsule within the same project public: //Declaration of the class object OI(); //Creating the objects frc::XboxController* GetController(); frc::Joystick* GetJoystick(); //Private class that only accessable by the class itself private: //Mapping the variables to actual button frc::XboxController c_1 { 0 }; frc::Joystick xBoxControllerMap { 0 }; frc::Joystick xBoxControllerMap2 { 1 }; frc::Joystick joystick { 1 }; frc::JoystickButton buttonA {&xBoxControllerMap, 1 }; frc::JoystickButton buttonB {&xBoxControllerMap, 2 }; frc::JoystickButton buttonX {&xBoxControllerMap, 3 }; frc::JoystickButton buttonY {&xBoxControllerMap, 4 }; frc::JoystickButton buttonLb {&xBoxControllerMap, 5 }; frc::JoystickButton buttonRb {&xBoxControllerMap, 6 }; /*configures snes controller frc::Joystick SNES { 1 }; frc::JoystickButton sbutton1 {&SNES, 1 }; frc::JoystickButton sbutton2 {&SNES, 2 }; frc::JoystickButton sbutton3 {&SNES, 9 }; frc::JoystickButton sbutton4 {&SNES, 10 }; */ }; //Ending #endif // OI_H_
4db655a1e510ddd540e2475a8efe67caec696e81
fce23fca95efc8d8396061e61c001decc608bddc
/src/towns/townsdef/util_makeIOLabel.cpp
2af4742fdc422b5c0fbea489aacfca2c9fa08074
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
permissive
captainys/TOWNSEMU
420b156fe7622fb3374ea49d7d0365ec893bde04
ac19237dcd9e8757d46b05bdf712327142cf14e4
refs/heads/master
2023-08-03T17:13:14.940817
2023-07-23T01:45:09
2023-07-23T01:45:09
247,823,654
200
19
BSD-3-Clause
2023-07-27T15:07:46
2020-03-16T21:53:22
C++
UTF-8
C++
false
false
2,805
cpp
util_makeIOLabel.cpp
/* LICENSE>> Copyright 2020 Soji Yamakawa (CaptainYS, http://www.ysflight.com) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. 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. 3. Neither the name of the copyright holder 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. << LICENSE */ #include <string> #include <vector> #include <iostream> #include <fstream> int main(void) { std::ifstream ifp("townsdef.h"); std::ofstream ofp("townsmap.cpp"); std::vector <std::string> text; text.clear(); while(true!=ifp.eof()) { std::string str; std::getline(ifp,str); while(0<str.size() && (str[0]==' ' || str[0]=='\t')) { str.erase(str.begin()); } auto first=str; first.resize(8); if("TOWNSIO_"==first) { for(int i=0; i<str.size(); ++i) { if(str[i]=='=') { str.resize(i); break; } } auto macro=str; auto second=str; second.erase(0,8); std::string line; line.push_back('\t'); line+="ioMap["; line+=macro; line+="]="; line.push_back('\"'); line+=second; line.push_back('\"'); line.push_back(';'); text.push_back(line); } } ofp << "#include <map>" << std::endl; ofp << "#include <string>" << std::endl; ofp << "#include \"townsdef.h\"\n" << std::endl; ofp << "std::map <unsigned int,std::string> FMTownsIOMap(void)" << std::endl; ofp << "{" << std::endl; ofp << "\tstd::map <unsigned int,std::string> ioMap;" << std::endl; for(auto &line : text) { ofp << line << std::endl; } ofp << "\treturn ioMap;" << std::endl; ofp << "}" << std::endl; return 0; }
8a72d3974d45c0832b9c6a40fc8e61b5eca6b8b1
12f2153cce750f245e309370f02ead5609b49d50
/day08 (STL)/ex00/easyfind.hpp
df2ee4b4dba3b7fd20f1e29ab0ad9a83e102f545
[]
no_license
hlombard/Piscine_CPP
e638d082171b0e84ead6444373e2ec57b03da1ff
90ce065d9a1714cdca0551c438c6e491742d0410
refs/heads/master
2023-02-23T16:56:24.722420
2021-01-26T18:52:08
2021-01-26T18:52:08
333,182,153
0
0
null
null
null
null
UTF-8
C++
false
false
475
hpp
easyfind.hpp
#ifndef EASYFIND_HPP # define EASYFIND_HPP #include <list> #include <vector> #include <algorithm> class NotFoundException : public std::exception { const char *what() const throw() { return "Not Found Exception: couldn't find required value"; } }; template <typename T> int easyfind(T & container, int n) { typename T::iterator it = std::find(container.begin(), container.end(), n); if (it == std::end(container)) throw NotFoundException(); return *it; } #endif
406f04cbba17469e48ba4e77e08822a7d40877e5
08ca30164603f31aeadf2fd02cc954ca12772033
/Test/Test.cpp
13286723ef724f4b3acc70a9210c700e115d62ee
[ "Apache-2.0" ]
permissive
linfuqing/ZG
919b6a6d4033f7c92acd32442df88c5f0212565c
96a863bc60ce22fe73d9c1a2b7b7083b392fb625
refs/heads/master
2021-01-11T07:04:33.858639
2017-04-25T01:28:53
2017-04-25T01:28:53
69,326,884
0
0
null
null
null
null
GB18030
C++
false
false
55,249
cpp
Test.cpp
// Test.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" #include "../ZG/RTS.h" int main() { _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | _CRTDBG_LEAK_CHECK_DF); LPZGTILEMAP pMap0; pMap0 = ZGRTSCreateMap(50, 25, 0); ZGRTSSetDistanceToMap(pMap0, 0, 3); ZGRTSSetDistanceToMap(pMap0, 1, 3); ZGRTSSetDistanceToMap(pMap0, 2, 3); ZGRTSSetDistanceToMap(pMap0, 3, 3); ZGRTSSetDistanceToMap(pMap0, 4, 3); ZGRTSSetDistanceToMap(pMap0, 5, 3); ZGRTSSetDistanceToMap(pMap0, 6, 3); ZGRTSSetDistanceToMap(pMap0, 7, 3); ZGRTSSetDistanceToMap(pMap0, 8, 3); ZGRTSSetDistanceToMap(pMap0, 9, 3); ZGRTSSetDistanceToMap(pMap0, 10, 3); ZGRTSSetDistanceToMap(pMap0, 11, 3); ZGRTSSetDistanceToMap(pMap0, 12, 3); ZGRTSSetDistanceToMap(pMap0, 13, 3); ZGRTSSetDistanceToMap(pMap0, 14, 3); ZGRTSSetDistanceToMap(pMap0, 15, 3); ZGRTSSetDistanceToMap(pMap0, 16, 3); ZGRTSSetDistanceToMap(pMap0, 17, 3); ZGRTSSetDistanceToMap(pMap0, 18, 3); ZGRTSSetDistanceToMap(pMap0, 19, 3); ZGRTSSetDistanceToMap(pMap0, 20, 3); ZGRTSSetDistanceToMap(pMap0, 21, 3); ZGRTSSetDistanceToMap(pMap0, 22, 3); ZGRTSSetDistanceToMap(pMap0, 23, 3); ZGRTSSetDistanceToMap(pMap0, 24, 3); ZGRTSSetDistanceToMap(pMap0, 25, 3); ZGRTSSetDistanceToMap(pMap0, 26, 3); ZGRTSSetDistanceToMap(pMap0, 27, 3); ZGRTSSetDistanceToMap(pMap0, 28, 3); ZGRTSSetDistanceToMap(pMap0, 29, 3); ZGRTSSetDistanceToMap(pMap0, 30, 3); ZGRTSSetDistanceToMap(pMap0, 31, 3); ZGRTSSetDistanceToMap(pMap0, 32, 3); ZGRTSSetDistanceToMap(pMap0, 33, 5); ZGRTSSetDistanceToMap(pMap0, 34, 5); ZGRTSSetDistanceToMap(pMap0, 35, 3); ZGRTSSetDistanceToMap(pMap0, 36, 3); ZGRTSSetDistanceToMap(pMap0, 37, 3); ZGRTSSetDistanceToMap(pMap0, 38, 3); ZGRTSSetDistanceToMap(pMap0, 39, 3); ZGRTSSetDistanceToMap(pMap0, 40, 3); ZGRTSSetDistanceToMap(pMap0, 41, 3); ZGRTSSetDistanceToMap(pMap0, 42, 3); ZGRTSSetMap(pMap0, 43, 1); ZGRTSSetDistanceToMap(pMap0, 43, 0); ZGRTSSetMap(pMap0, 44, 1); ZGRTSSetDistanceToMap(pMap0, 44, 0); ZGRTSSetMap(pMap0, 45, 1); ZGRTSSetDistanceToMap(pMap0, 45, 0); ZGRTSSetMap(pMap0, 46, 1); ZGRTSSetDistanceToMap(pMap0, 46, 0); ZGRTSSetMap(pMap0, 47, 1); ZGRTSSetDistanceToMap(pMap0, 47, 0); ZGRTSSetMap(pMap0, 48, 1); ZGRTSSetDistanceToMap(pMap0, 48, 0); ZGRTSSetMap(pMap0, 49, 1); ZGRTSSetDistanceToMap(pMap0, 49, 0); ZGRTSSetDistanceToMap(pMap0, 50, 3); ZGRTSSetDistanceToMap(pMap0, 51, 3); ZGRTSSetDistanceToMap(pMap0, 52, 3); ZGRTSSetDistanceToMap(pMap0, 53, 3); ZGRTSSetDistanceToMap(pMap0, 54, 3); ZGRTSSetDistanceToMap(pMap0, 55, 3); ZGRTSSetDistanceToMap(pMap0, 56, 3); ZGRTSSetDistanceToMap(pMap0, 57, 3); ZGRTSSetDistanceToMap(pMap0, 58, 3); ZGRTSSetDistanceToMap(pMap0, 59, 3); ZGRTSSetDistanceToMap(pMap0, 60, 3); ZGRTSSetDistanceToMap(pMap0, 61, 3); ZGRTSSetDistanceToMap(pMap0, 62, 3); ZGRTSSetDistanceToMap(pMap0, 63, 3); ZGRTSSetDistanceToMap(pMap0, 64, 3); ZGRTSSetDistanceToMap(pMap0, 65, 3); ZGRTSSetDistanceToMap(pMap0, 66, 3); ZGRTSSetDistanceToMap(pMap0, 67, 3); ZGRTSSetDistanceToMap(pMap0, 68, 3); ZGRTSSetDistanceToMap(pMap0, 69, 3); ZGRTSSetDistanceToMap(pMap0, 70, 3); ZGRTSSetDistanceToMap(pMap0, 71, 3); ZGRTSSetDistanceToMap(pMap0, 72, 3); ZGRTSSetMap(pMap0, 73, 1); ZGRTSSetDistanceToMap(pMap0, 73, 0); ZGRTSSetDistanceToMap(pMap0, 74, 3); ZGRTSSetDistanceToMap(pMap0, 75, 3); ZGRTSSetDistanceToMap(pMap0, 76, 3); ZGRTSSetDistanceToMap(pMap0, 77, 3); ZGRTSSetDistanceToMap(pMap0, 78, 3); ZGRTSSetMap(pMap0, 79, 1); ZGRTSSetDistanceToMap(pMap0, 79, 0); ZGRTSSetMap(pMap0, 80, 1); ZGRTSSetDistanceToMap(pMap0, 80, 0); ZGRTSSetMap(pMap0, 81, 1); ZGRTSSetDistanceToMap(pMap0, 81, 0); ZGRTSSetMap(pMap0, 82, 1); ZGRTSSetDistanceToMap(pMap0, 82, 0); ZGRTSSetDistanceToMap(pMap0, 83, 5); ZGRTSSetDistanceToMap(pMap0, 84, 5); ZGRTSSetMap(pMap0, 85, 1); ZGRTSSetDistanceToMap(pMap0, 85, 0); ZGRTSSetMap(pMap0, 86, 1); ZGRTSSetDistanceToMap(pMap0, 86, 0); ZGRTSSetMap(pMap0, 87, 1); ZGRTSSetDistanceToMap(pMap0, 87, 0); ZGRTSSetMap(pMap0, 88, 1); ZGRTSSetDistanceToMap(pMap0, 88, 0); ZGRTSSetDistanceToMap(pMap0, 89, 3); ZGRTSSetDistanceToMap(pMap0, 90, 3); ZGRTSSetDistanceToMap(pMap0, 91, 3); ZGRTSSetDistanceToMap(pMap0, 92, 3); ZGRTSSetMap(pMap0, 93, 1); ZGRTSSetDistanceToMap(pMap0, 93, 0); ZGRTSSetDistanceToMap(pMap0, 94, 3); ZGRTSSetDistanceToMap(pMap0, 95, 3); ZGRTSSetDistanceToMap(pMap0, 96, 3); ZGRTSSetMap(pMap0, 97, 1); ZGRTSSetDistanceToMap(pMap0, 97, 0); ZGRTSSetDistanceToMap(pMap0, 98, 5); ZGRTSSetDistanceToMap(pMap0, 99, 5); ZGRTSSetDistanceToMap(pMap0, 100, 3); ZGRTSSetDistanceToMap(pMap0, 101, 3); ZGRTSSetDistanceToMap(pMap0, 102, 5); ZGRTSSetDistanceToMap(pMap0, 103, 5); ZGRTSSetDistanceToMap(pMap0, 104, 5); ZGRTSSetDistanceToMap(pMap0, 105, 5); ZGRTSSetDistanceToMap(pMap0, 106, 5); ZGRTSSetDistanceToMap(pMap0, 107, 5); ZGRTSSetDistanceToMap(pMap0, 108, 5); ZGRTSSetDistanceToMap(pMap0, 109, 5); ZGRTSSetDistanceToMap(pMap0, 110, 5); ZGRTSSetDistanceToMap(pMap0, 111, 5); ZGRTSSetDistanceToMap(pMap0, 112, 5); ZGRTSSetDistanceToMap(pMap0, 113, 5); ZGRTSSetDistanceToMap(pMap0, 114, 5); ZGRTSSetDistanceToMap(pMap0, 115, 5); ZGRTSSetDistanceToMap(pMap0, 116, 5); ZGRTSSetDistanceToMap(pMap0, 117, 5); ZGRTSSetDistanceToMap(pMap0, 118, 5); ZGRTSSetMap(pMap0, 119, 1); ZGRTSSetDistanceToMap(pMap0, 119, 0); ZGRTSSetMap(pMap0, 120, 1); ZGRTSSetDistanceToMap(pMap0, 120, 0); ZGRTSSetMap(pMap0, 121, 1); ZGRTSSetDistanceToMap(pMap0, 121, 0); ZGRTSSetMap(pMap0, 122, 1); ZGRTSSetDistanceToMap(pMap0, 122, 0); ZGRTSSetMap(pMap0, 123, 1); ZGRTSSetDistanceToMap(pMap0, 123, 0); ZGRTSSetMap(pMap0, 124, 1); ZGRTSSetDistanceToMap(pMap0, 124, 0); ZGRTSSetMap(pMap0, 125, 1); ZGRTSSetDistanceToMap(pMap0, 125, 0); ZGRTSSetMap(pMap0, 126, 1); ZGRTSSetDistanceToMap(pMap0, 126, 0); ZGRTSSetDistanceToMap(pMap0, 127, 3); ZGRTSSetDistanceToMap(pMap0, 128, 3); ZGRTSSetMap(pMap0, 129, 1); ZGRTSSetDistanceToMap(pMap0, 129, 0); ZGRTSSetDistanceToMap(pMap0, 130, 5); ZGRTSSetDistanceToMap(pMap0, 131, 5); ZGRTSSetDistanceToMap(pMap0, 132, 5); ZGRTSSetDistanceToMap(pMap0, 133, 5); ZGRTSSetDistanceToMap(pMap0, 134, 5); ZGRTSSetDistanceToMap(pMap0, 135, 5); ZGRTSSetDistanceToMap(pMap0, 136, 5); ZGRTSSetDistanceToMap(pMap0, 137, 5); ZGRTSSetMap(pMap0, 138, 1); ZGRTSSetDistanceToMap(pMap0, 138, 0); ZGRTSSetDistanceToMap(pMap0, 139, 3); ZGRTSSetDistanceToMap(pMap0, 140, 3); ZGRTSSetDistanceToMap(pMap0, 141, 3); ZGRTSSetDistanceToMap(pMap0, 142, 3); ZGRTSSetMap(pMap0, 143, 1); ZGRTSSetDistanceToMap(pMap0, 143, 0); ZGRTSSetDistanceToMap(pMap0, 144, 3); ZGRTSSetDistanceToMap(pMap0, 145, 3); ZGRTSSetDistanceToMap(pMap0, 146, 3); ZGRTSSetDistanceToMap(pMap0, 147, 3); ZGRTSSetDistanceToMap(pMap0, 148, 5); ZGRTSSetDistanceToMap(pMap0, 149, 5); ZGRTSSetDistanceToMap(pMap0, 150, 3); ZGRTSSetDistanceToMap(pMap0, 151, 3); ZGRTSSetMap(pMap0, 152, 1); ZGRTSSetDistanceToMap(pMap0, 152, 0); ZGRTSSetMap(pMap0, 153, 1); ZGRTSSetDistanceToMap(pMap0, 153, 0); ZGRTSSetMap(pMap0, 154, 1); ZGRTSSetDistanceToMap(pMap0, 154, 0); ZGRTSSetMap(pMap0, 155, 1); ZGRTSSetDistanceToMap(pMap0, 155, 0); ZGRTSSetMap(pMap0, 156, 1); ZGRTSSetDistanceToMap(pMap0, 156, 0); ZGRTSSetMap(pMap0, 157, 1); ZGRTSSetDistanceToMap(pMap0, 157, 0); ZGRTSSetMap(pMap0, 158, 1); ZGRTSSetDistanceToMap(pMap0, 158, 0); ZGRTSSetMap(pMap0, 159, 1); ZGRTSSetDistanceToMap(pMap0, 159, 0); ZGRTSSetMap(pMap0, 160, 1); ZGRTSSetDistanceToMap(pMap0, 160, 0); ZGRTSSetMap(pMap0, 161, 1); ZGRTSSetDistanceToMap(pMap0, 161, 0); ZGRTSSetMap(pMap0, 162, 1); ZGRTSSetDistanceToMap(pMap0, 162, 0); ZGRTSSetMap(pMap0, 163, 1); ZGRTSSetDistanceToMap(pMap0, 163, 0); ZGRTSSetMap(pMap0, 164, 1); ZGRTSSetDistanceToMap(pMap0, 164, 0); ZGRTSSetMap(pMap0, 165, 1); ZGRTSSetDistanceToMap(pMap0, 165, 0); ZGRTSSetDistanceToMap(pMap0, 166, 5); ZGRTSSetMap(pMap0, 167, 1); ZGRTSSetDistanceToMap(pMap0, 167, 0); ZGRTSSetDistanceToMap(pMap0, 168, 3); ZGRTSSetDistanceToMap(pMap0, 169, 3); ZGRTSSetDistanceToMap(pMap0, 170, 3); ZGRTSSetDistanceToMap(pMap0, 171, 3); ZGRTSSetDistanceToMap(pMap0, 172, 3); ZGRTSSetDistanceToMap(pMap0, 173, 3); ZGRTSSetDistanceToMap(pMap0, 174, 3); ZGRTSSetDistanceToMap(pMap0, 175, 3); ZGRTSSetDistanceToMap(pMap0, 176, 3); ZGRTSSetDistanceToMap(pMap0, 177, 3); ZGRTSSetDistanceToMap(pMap0, 178, 3); ZGRTSSetMap(pMap0, 179, 1); ZGRTSSetDistanceToMap(pMap0, 179, 0); ZGRTSSetDistanceToMap(pMap0, 180, 5); ZGRTSSetDistanceToMap(pMap0, 181, 5); ZGRTSSetDistanceToMap(pMap0, 182, 5); ZGRTSSetDistanceToMap(pMap0, 183, 5); ZGRTSSetDistanceToMap(pMap0, 184, 5); ZGRTSSetDistanceToMap(pMap0, 185, 5); ZGRTSSetDistanceToMap(pMap0, 186, 5); ZGRTSSetDistanceToMap(pMap0, 187, 5); ZGRTSSetMap(pMap0, 188, 1); ZGRTSSetDistanceToMap(pMap0, 188, 0); ZGRTSSetDistanceToMap(pMap0, 189, 3); ZGRTSSetDistanceToMap(pMap0, 190, 3); ZGRTSSetDistanceToMap(pMap0, 191, 3); ZGRTSSetDistanceToMap(pMap0, 192, 3); ZGRTSSetMap(pMap0, 193, 1); ZGRTSSetDistanceToMap(pMap0, 193, 0); ZGRTSSetDistanceToMap(pMap0, 194, 3); ZGRTSSetDistanceToMap(pMap0, 195, 3); ZGRTSSetDistanceToMap(pMap0, 196, 3); ZGRTSSetDistanceToMap(pMap0, 197, 3); ZGRTSSetDistanceToMap(pMap0, 198, 5); ZGRTSSetDistanceToMap(pMap0, 199, 5); ZGRTSSetDistanceToMap(pMap0, 200, 3); ZGRTSSetDistanceToMap(pMap0, 201, 3); ZGRTSSetDistanceToMap(pMap0, 202, 3); ZGRTSSetDistanceToMap(pMap0, 203, 3); ZGRTSSetDistanceToMap(pMap0, 204, 3); ZGRTSSetDistanceToMap(pMap0, 205, 3); ZGRTSSetDistanceToMap(pMap0, 206, 3); ZGRTSSetDistanceToMap(pMap0, 207, 3); ZGRTSSetDistanceToMap(pMap0, 208, 3); ZGRTSSetDistanceToMap(pMap0, 209, 3); ZGRTSSetDistanceToMap(pMap0, 210, 3); ZGRTSSetDistanceToMap(pMap0, 211, 3); ZGRTSSetDistanceToMap(pMap0, 212, 3); ZGRTSSetDistanceToMap(pMap0, 213, 3); ZGRTSSetDistanceToMap(pMap0, 214, 3); ZGRTSSetDistanceToMap(pMap0, 215, 3); ZGRTSSetDistanceToMap(pMap0, 216, 5); ZGRTSSetMap(pMap0, 217, 1); ZGRTSSetDistanceToMap(pMap0, 217, 0); ZGRTSSetDistanceToMap(pMap0, 218, 3); ZGRTSSetDistanceToMap(pMap0, 219, 3); ZGRTSSetDistanceToMap(pMap0, 220, 3); ZGRTSSetDistanceToMap(pMap0, 221, 3); ZGRTSSetDistanceToMap(pMap0, 222, 3); ZGRTSSetDistanceToMap(pMap0, 223, 3); ZGRTSSetDistanceToMap(pMap0, 224, 3); ZGRTSSetDistanceToMap(pMap0, 225, 3); ZGRTSSetDistanceToMap(pMap0, 226, 3); ZGRTSSetDistanceToMap(pMap0, 227, 3); ZGRTSSetDistanceToMap(pMap0, 228, 3); ZGRTSSetMap(pMap0, 229, 1); ZGRTSSetDistanceToMap(pMap0, 229, 0); ZGRTSSetDistanceToMap(pMap0, 230, 5); ZGRTSSetDistanceToMap(pMap0, 231, 5); ZGRTSSetDistanceToMap(pMap0, 232, 5); ZGRTSSetDistanceToMap(pMap0, 233, 5); ZGRTSSetDistanceToMap(pMap0, 234, 5); ZGRTSSetDistanceToMap(pMap0, 235, 5); ZGRTSSetDistanceToMap(pMap0, 236, 5); ZGRTSSetDistanceToMap(pMap0, 237, 5); ZGRTSSetMap(pMap0, 238, 1); ZGRTSSetDistanceToMap(pMap0, 238, 0); ZGRTSSetDistanceToMap(pMap0, 239, 3); ZGRTSSetDistanceToMap(pMap0, 240, 3); ZGRTSSetDistanceToMap(pMap0, 241, 3); ZGRTSSetDistanceToMap(pMap0, 242, 3); ZGRTSSetDistanceToMap(pMap0, 243, 5); ZGRTSSetDistanceToMap(pMap0, 244, 3); ZGRTSSetDistanceToMap(pMap0, 245, 3); ZGRTSSetDistanceToMap(pMap0, 246, 3); ZGRTSSetDistanceToMap(pMap0, 247, 3); ZGRTSSetDistanceToMap(pMap0, 248, 5); ZGRTSSetDistanceToMap(pMap0, 249, 5); ZGRTSSetDistanceToMap(pMap0, 250, 3); ZGRTSSetDistanceToMap(pMap0, 251, 3); ZGRTSSetDistanceToMap(pMap0, 252, 3); ZGRTSSetDistanceToMap(pMap0, 253, 3); ZGRTSSetDistanceToMap(pMap0, 254, 3); ZGRTSSetDistanceToMap(pMap0, 255, 3); ZGRTSSetDistanceToMap(pMap0, 256, 3); ZGRTSSetDistanceToMap(pMap0, 257, 3); ZGRTSSetDistanceToMap(pMap0, 258, 3); ZGRTSSetDistanceToMap(pMap0, 259, 3); ZGRTSSetDistanceToMap(pMap0, 260, 3); ZGRTSSetDistanceToMap(pMap0, 261, 3); ZGRTSSetDistanceToMap(pMap0, 262, 3); ZGRTSSetDistanceToMap(pMap0, 263, 3); ZGRTSSetDistanceToMap(pMap0, 264, 3); ZGRTSSetDistanceToMap(pMap0, 265, 3); ZGRTSSetDistanceToMap(pMap0, 266, 5); ZGRTSSetMap(pMap0, 267, 1); ZGRTSSetDistanceToMap(pMap0, 267, 0); ZGRTSSetDistanceToMap(pMap0, 268, 3); ZGRTSSetDistanceToMap(pMap0, 269, 3); ZGRTSSetDistanceToMap(pMap0, 270, 3); ZGRTSSetDistanceToMap(pMap0, 271, 3); ZGRTSSetDistanceToMap(pMap0, 272, 3); ZGRTSSetDistanceToMap(pMap0, 273, 3); ZGRTSSetMap(pMap0, 274, 1); ZGRTSSetDistanceToMap(pMap0, 274, 0); ZGRTSSetMap(pMap0, 275, 1); ZGRTSSetDistanceToMap(pMap0, 275, 0); ZGRTSSetDistanceToMap(pMap0, 276, 5); ZGRTSSetDistanceToMap(pMap0, 277, 5); ZGRTSSetDistanceToMap(pMap0, 278, 5); ZGRTSSetDistanceToMap(pMap0, 279, 5); ZGRTSSetDistanceToMap(pMap0, 280, 5); ZGRTSSetDistanceToMap(pMap0, 281, 5); ZGRTSSetDistanceToMap(pMap0, 282, 5); ZGRTSSetDistanceToMap(pMap0, 283, 5); ZGRTSSetDistanceToMap(pMap0, 284, 5); ZGRTSSetDistanceToMap(pMap0, 285, 5); ZGRTSSetDistanceToMap(pMap0, 286, 5); ZGRTSSetDistanceToMap(pMap0, 287, 5); ZGRTSSetDistanceToMap(pMap0, 288, 3); ZGRTSSetDistanceToMap(pMap0, 289, 3); ZGRTSSetDistanceToMap(pMap0, 290, 3); ZGRTSSetDistanceToMap(pMap0, 291, 3); ZGRTSSetDistanceToMap(pMap0, 292, 3); ZGRTSSetDistanceToMap(pMap0, 293, 5); ZGRTSSetDistanceToMap(pMap0, 294, 3); ZGRTSSetDistanceToMap(pMap0, 295, 3); ZGRTSSetDistanceToMap(pMap0, 296, 3); ZGRTSSetDistanceToMap(pMap0, 297, 3); ZGRTSSetDistanceToMap(pMap0, 298, 5); ZGRTSSetDistanceToMap(pMap0, 299, 5); ZGRTSSetDistanceToMap(pMap0, 300, 3); ZGRTSSetDistanceToMap(pMap0, 301, 3); ZGRTSSetDistanceToMap(pMap0, 302, 3); ZGRTSSetDistanceToMap(pMap0, 303, 3); ZGRTSSetDistanceToMap(pMap0, 304, 3); ZGRTSSetDistanceToMap(pMap0, 305, 3); ZGRTSSetDistanceToMap(pMap0, 306, 3); ZGRTSSetDistanceToMap(pMap0, 307, 3); ZGRTSSetDistanceToMap(pMap0, 308, 3); ZGRTSSetDistanceToMap(pMap0, 309, 3); ZGRTSSetDistanceToMap(pMap0, 310, 3); ZGRTSSetDistanceToMap(pMap0, 311, 3); ZGRTSSetDistanceToMap(pMap0, 312, 3); ZGRTSSetDistanceToMap(pMap0, 313, 3); ZGRTSSetDistanceToMap(pMap0, 314, 3); ZGRTSSetDistanceToMap(pMap0, 315, 3); ZGRTSSetDistanceToMap(pMap0, 316, 5); ZGRTSSetMap(pMap0, 317, 1); ZGRTSSetDistanceToMap(pMap0, 317, 0); ZGRTSSetDistanceToMap(pMap0, 318, 3); ZGRTSSetDistanceToMap(pMap0, 319, 3); ZGRTSSetDistanceToMap(pMap0, 320, 3); ZGRTSSetDistanceToMap(pMap0, 321, 3); ZGRTSSetDistanceToMap(pMap0, 322, 3); ZGRTSSetDistanceToMap(pMap0, 323, 3); ZGRTSSetMap(pMap0, 324, 1); ZGRTSSetDistanceToMap(pMap0, 324, 0); ZGRTSSetMap(pMap0, 325, 1); ZGRTSSetDistanceToMap(pMap0, 325, 0); ZGRTSSetDistanceToMap(pMap0, 326, 5); ZGRTSSetDistanceToMap(pMap0, 327, 5); ZGRTSSetDistanceToMap(pMap0, 328, 5); ZGRTSSetDistanceToMap(pMap0, 329, 5); ZGRTSSetDistanceToMap(pMap0, 330, 5); ZGRTSSetDistanceToMap(pMap0, 331, 5); ZGRTSSetDistanceToMap(pMap0, 332, 5); ZGRTSSetDistanceToMap(pMap0, 333, 5); ZGRTSSetDistanceToMap(pMap0, 334, 5); ZGRTSSetDistanceToMap(pMap0, 335, 5); ZGRTSSetDistanceToMap(pMap0, 336, 5); ZGRTSSetDistanceToMap(pMap0, 337, 5); ZGRTSSetDistanceToMap(pMap0, 338, 3); ZGRTSSetDistanceToMap(pMap0, 339, 5); ZGRTSSetDistanceToMap(pMap0, 340, 3); ZGRTSSetDistanceToMap(pMap0, 341, 3); ZGRTSSetDistanceToMap(pMap0, 342, 3); ZGRTSSetDistanceToMap(pMap0, 343, 5); ZGRTSSetDistanceToMap(pMap0, 344, 3); ZGRTSSetDistanceToMap(pMap0, 345, 3); ZGRTSSetDistanceToMap(pMap0, 346, 3); ZGRTSSetDistanceToMap(pMap0, 347, 3); ZGRTSSetDistanceToMap(pMap0, 348, 5); ZGRTSSetDistanceToMap(pMap0, 349, 5); ZGRTSSetDistanceToMap(pMap0, 350, 3); ZGRTSSetDistanceToMap(pMap0, 351, 3); ZGRTSSetDistanceToMap(pMap0, 352, 3); ZGRTSSetDistanceToMap(pMap0, 353, 3); ZGRTSSetDistanceToMap(pMap0, 354, 3); ZGRTSSetDistanceToMap(pMap0, 355, 3); ZGRTSSetDistanceToMap(pMap0, 356, 3); ZGRTSSetDistanceToMap(pMap0, 357, 3); ZGRTSSetDistanceToMap(pMap0, 358, 3); ZGRTSSetDistanceToMap(pMap0, 359, 3); ZGRTSSetDistanceToMap(pMap0, 360, 3); ZGRTSSetDistanceToMap(pMap0, 361, 3); ZGRTSSetDistanceToMap(pMap0, 362, 3); ZGRTSSetDistanceToMap(pMap0, 363, 3); ZGRTSSetDistanceToMap(pMap0, 364, 3); ZGRTSSetDistanceToMap(pMap0, 365, 3); ZGRTSSetDistanceToMap(pMap0, 366, 5); ZGRTSSetMap(pMap0, 367, 1); ZGRTSSetDistanceToMap(pMap0, 367, 0); ZGRTSSetDistanceToMap(pMap0, 368, 3); ZGRTSSetDistanceToMap(pMap0, 369, 3); ZGRTSSetDistanceToMap(pMap0, 370, 3); ZGRTSSetDistanceToMap(pMap0, 371, 3); ZGRTSSetDistanceToMap(pMap0, 372, 3); ZGRTSSetDistanceToMap(pMap0, 373, 3); ZGRTSSetMap(pMap0, 374, 1); ZGRTSSetDistanceToMap(pMap0, 374, 0); ZGRTSSetMap(pMap0, 375, 1); ZGRTSSetDistanceToMap(pMap0, 375, 0); ZGRTSSetDistanceToMap(pMap0, 376, 3); ZGRTSSetMap(pMap0, 377, 1); ZGRTSSetDistanceToMap(pMap0, 377, 0); ZGRTSSetDistanceToMap(pMap0, 378, 5); ZGRTSSetMap(pMap0, 379, 1); ZGRTSSetDistanceToMap(pMap0, 379, 0); ZGRTSSetDistanceToMap(pMap0, 380, 5); ZGRTSSetDistanceToMap(pMap0, 381, 5); ZGRTSSetDistanceToMap(pMap0, 382, 5); ZGRTSSetDistanceToMap(pMap0, 383, 5); ZGRTSSetDistanceToMap(pMap0, 384, 5); ZGRTSSetDistanceToMap(pMap0, 385, 5); ZGRTSSetDistanceToMap(pMap0, 386, 5); ZGRTSSetDistanceToMap(pMap0, 387, 5); ZGRTSSetMap(pMap0, 388, 1); ZGRTSSetDistanceToMap(pMap0, 388, 0); ZGRTSSetDistanceToMap(pMap0, 389, 5); ZGRTSSetDistanceToMap(pMap0, 390, 3); ZGRTSSetDistanceToMap(pMap0, 391, 3); ZGRTSSetDistanceToMap(pMap0, 392, 3); ZGRTSSetDistanceToMap(pMap0, 393, 5); ZGRTSSetDistanceToMap(pMap0, 394, 3); ZGRTSSetDistanceToMap(pMap0, 395, 3); ZGRTSSetDistanceToMap(pMap0, 396, 3); ZGRTSSetDistanceToMap(pMap0, 397, 3); ZGRTSSetDistanceToMap(pMap0, 398, 5); ZGRTSSetDistanceToMap(pMap0, 399, 5); ZGRTSSetDistanceToMap(pMap0, 400, 3); ZGRTSSetDistanceToMap(pMap0, 401, 3); ZGRTSSetDistanceToMap(pMap0, 402, 3); ZGRTSSetDistanceToMap(pMap0, 403, 3); ZGRTSSetDistanceToMap(pMap0, 404, 3); ZGRTSSetDistanceToMap(pMap0, 405, 3); ZGRTSSetDistanceToMap(pMap0, 406, 3); ZGRTSSetDistanceToMap(pMap0, 407, 3); ZGRTSSetDistanceToMap(pMap0, 408, 3); ZGRTSSetDistanceToMap(pMap0, 409, 3); ZGRTSSetDistanceToMap(pMap0, 410, 3); ZGRTSSetDistanceToMap(pMap0, 411, 3); ZGRTSSetDistanceToMap(pMap0, 412, 3); ZGRTSSetDistanceToMap(pMap0, 413, 3); ZGRTSSetDistanceToMap(pMap0, 414, 3); ZGRTSSetDistanceToMap(pMap0, 415, 3); ZGRTSSetDistanceToMap(pMap0, 416, 5); ZGRTSSetMap(pMap0, 417, 1); ZGRTSSetDistanceToMap(pMap0, 417, 0); ZGRTSSetDistanceToMap(pMap0, 418, 3); ZGRTSSetDistanceToMap(pMap0, 419, 3); ZGRTSSetDistanceToMap(pMap0, 420, 3); ZGRTSSetDistanceToMap(pMap0, 421, 3); ZGRTSSetDistanceToMap(pMap0, 422, 3); ZGRTSSetDistanceToMap(pMap0, 423, 3); ZGRTSSetMap(pMap0, 424, 1); ZGRTSSetDistanceToMap(pMap0, 424, 0); ZGRTSSetMap(pMap0, 425, 1); ZGRTSSetDistanceToMap(pMap0, 425, 0); ZGRTSSetDistanceToMap(pMap0, 426, 3); ZGRTSSetMap(pMap0, 427, 1); ZGRTSSetDistanceToMap(pMap0, 427, 0); ZGRTSSetDistanceToMap(pMap0, 428, 5); ZGRTSSetMap(pMap0, 429, 1); ZGRTSSetDistanceToMap(pMap0, 429, 0); ZGRTSSetDistanceToMap(pMap0, 430, 5); ZGRTSSetDistanceToMap(pMap0, 431, 5); ZGRTSSetDistanceToMap(pMap0, 432, 5); ZGRTSSetDistanceToMap(pMap0, 433, 5); ZGRTSSetDistanceToMap(pMap0, 434, 5); ZGRTSSetDistanceToMap(pMap0, 435, 5); ZGRTSSetDistanceToMap(pMap0, 436, 5); ZGRTSSetDistanceToMap(pMap0, 437, 5); ZGRTSSetMap(pMap0, 438, 1); ZGRTSSetDistanceToMap(pMap0, 438, 0); ZGRTSSetDistanceToMap(pMap0, 439, 3); ZGRTSSetDistanceToMap(pMap0, 440, 3); ZGRTSSetDistanceToMap(pMap0, 441, 3); ZGRTSSetDistanceToMap(pMap0, 442, 3); ZGRTSSetDistanceToMap(pMap0, 443, 5); ZGRTSSetDistanceToMap(pMap0, 444, 3); ZGRTSSetDistanceToMap(pMap0, 445, 3); ZGRTSSetDistanceToMap(pMap0, 446, 3); ZGRTSSetDistanceToMap(pMap0, 447, 3); ZGRTSSetDistanceToMap(pMap0, 448, 5); ZGRTSSetDistanceToMap(pMap0, 449, 5); ZGRTSSetDistanceToMap(pMap0, 450, 3); ZGRTSSetDistanceToMap(pMap0, 451, 3); ZGRTSSetDistanceToMap(pMap0, 452, 5); ZGRTSSetDistanceToMap(pMap0, 453, 5); ZGRTSSetDistanceToMap(pMap0, 454, 5); ZGRTSSetDistanceToMap(pMap0, 455, 5); ZGRTSSetDistanceToMap(pMap0, 456, 5); ZGRTSSetDistanceToMap(pMap0, 457, 5); ZGRTSSetDistanceToMap(pMap0, 458, 5); ZGRTSSetDistanceToMap(pMap0, 459, 5); ZGRTSSetDistanceToMap(pMap0, 460, 5); ZGRTSSetDistanceToMap(pMap0, 461, 5); ZGRTSSetDistanceToMap(pMap0, 462, 5); ZGRTSSetDistanceToMap(pMap0, 463, 5); ZGRTSSetDistanceToMap(pMap0, 464, 5); ZGRTSSetDistanceToMap(pMap0, 465, 5); ZGRTSSetDistanceToMap(pMap0, 466, 5); ZGRTSSetMap(pMap0, 467, 1); ZGRTSSetDistanceToMap(pMap0, 467, 0); ZGRTSSetMap(pMap0, 468, 1); ZGRTSSetDistanceToMap(pMap0, 468, 0); ZGRTSSetMap(pMap0, 469, 1); ZGRTSSetDistanceToMap(pMap0, 469, 0); ZGRTSSetMap(pMap0, 470, 1); ZGRTSSetDistanceToMap(pMap0, 470, 0); ZGRTSSetMap(pMap0, 471, 1); ZGRTSSetDistanceToMap(pMap0, 471, 0); ZGRTSSetMap(pMap0, 472, 1); ZGRTSSetDistanceToMap(pMap0, 472, 0); ZGRTSSetMap(pMap0, 473, 1); ZGRTSSetDistanceToMap(pMap0, 473, 0); ZGRTSSetMap(pMap0, 474, 1); ZGRTSSetDistanceToMap(pMap0, 474, 0); ZGRTSSetMap(pMap0, 475, 1); ZGRTSSetDistanceToMap(pMap0, 475, 0); ZGRTSSetDistanceToMap(pMap0, 476, 3); ZGRTSSetMap(pMap0, 477, 1); ZGRTSSetDistanceToMap(pMap0, 477, 0); ZGRTSSetDistanceToMap(pMap0, 478, 5); ZGRTSSetMap(pMap0, 479, 1); ZGRTSSetDistanceToMap(pMap0, 479, 0); ZGRTSSetDistanceToMap(pMap0, 480, 5); ZGRTSSetDistanceToMap(pMap0, 481, 5); ZGRTSSetDistanceToMap(pMap0, 482, 5); ZGRTSSetDistanceToMap(pMap0, 483, 5); ZGRTSSetDistanceToMap(pMap0, 484, 5); ZGRTSSetDistanceToMap(pMap0, 485, 5); ZGRTSSetDistanceToMap(pMap0, 486, 5); ZGRTSSetDistanceToMap(pMap0, 487, 5); ZGRTSSetMap(pMap0, 488, 1); ZGRTSSetDistanceToMap(pMap0, 488, 0); ZGRTSSetDistanceToMap(pMap0, 489, 5); ZGRTSSetDistanceToMap(pMap0, 490, 3); ZGRTSSetDistanceToMap(pMap0, 491, 3); ZGRTSSetDistanceToMap(pMap0, 492, 3); ZGRTSSetDistanceToMap(pMap0, 493, 5); ZGRTSSetDistanceToMap(pMap0, 494, 3); ZGRTSSetDistanceToMap(pMap0, 495, 3); ZGRTSSetDistanceToMap(pMap0, 496, 3); ZGRTSSetDistanceToMap(pMap0, 497, 3); ZGRTSSetDistanceToMap(pMap0, 498, 5); ZGRTSSetDistanceToMap(pMap0, 499, 5); ZGRTSSetDistanceToMap(pMap0, 500, 3); ZGRTSSetDistanceToMap(pMap0, 501, 3); ZGRTSSetMap(pMap0, 502, 1); ZGRTSSetDistanceToMap(pMap0, 502, 0); ZGRTSSetDistanceToMap(pMap0, 503, 3); ZGRTSSetDistanceToMap(pMap0, 504, 3); ZGRTSSetDistanceToMap(pMap0, 505, 3); ZGRTSSetDistanceToMap(pMap0, 506, 3); ZGRTSSetDistanceToMap(pMap0, 507, 3); ZGRTSSetDistanceToMap(pMap0, 508, 3); ZGRTSSetDistanceToMap(pMap0, 509, 3); ZGRTSSetDistanceToMap(pMap0, 510, 3); ZGRTSSetDistanceToMap(pMap0, 511, 3); ZGRTSSetDistanceToMap(pMap0, 512, 3); ZGRTSSetDistanceToMap(pMap0, 513, 3); ZGRTSSetDistanceToMap(pMap0, 514, 3); ZGRTSSetDistanceToMap(pMap0, 515, 3); ZGRTSSetDistanceToMap(pMap0, 516, 3); ZGRTSSetDistanceToMap(pMap0, 517, 3); ZGRTSSetDistanceToMap(pMap0, 518, 3); ZGRTSSetDistanceToMap(pMap0, 519, 3); ZGRTSSetDistanceToMap(pMap0, 520, 3); ZGRTSSetDistanceToMap(pMap0, 521, 3); ZGRTSSetDistanceToMap(pMap0, 522, 3); ZGRTSSetDistanceToMap(pMap0, 523, 3); ZGRTSSetDistanceToMap(pMap0, 524, 3); ZGRTSSetDistanceToMap(pMap0, 525, 3); ZGRTSSetDistanceToMap(pMap0, 526, 3); ZGRTSSetDistanceToMap(pMap0, 527, 3); ZGRTSSetDistanceToMap(pMap0, 528, 5); ZGRTSSetMap(pMap0, 529, 1); ZGRTSSetDistanceToMap(pMap0, 529, 0); ZGRTSSetMap(pMap0, 530, 1); ZGRTSSetDistanceToMap(pMap0, 530, 0); ZGRTSSetMap(pMap0, 531, 1); ZGRTSSetDistanceToMap(pMap0, 531, 0); ZGRTSSetMap(pMap0, 532, 1); ZGRTSSetDistanceToMap(pMap0, 532, 0); ZGRTSSetDistanceToMap(pMap0, 533, 3); ZGRTSSetDistanceToMap(pMap0, 534, 3); ZGRTSSetMap(pMap0, 535, 1); ZGRTSSetDistanceToMap(pMap0, 535, 0); ZGRTSSetMap(pMap0, 536, 1); ZGRTSSetDistanceToMap(pMap0, 536, 0); ZGRTSSetMap(pMap0, 537, 1); ZGRTSSetDistanceToMap(pMap0, 537, 0); ZGRTSSetMap(pMap0, 538, 1); ZGRTSSetDistanceToMap(pMap0, 538, 0); ZGRTSSetDistanceToMap(pMap0, 539, 3); ZGRTSSetDistanceToMap(pMap0, 540, 3); ZGRTSSetDistanceToMap(pMap0, 541, 3); ZGRTSSetDistanceToMap(pMap0, 542, 3); ZGRTSSetDistanceToMap(pMap0, 543, 5); ZGRTSSetDistanceToMap(pMap0, 544, 3); ZGRTSSetDistanceToMap(pMap0, 545, 3); ZGRTSSetDistanceToMap(pMap0, 546, 3); ZGRTSSetDistanceToMap(pMap0, 547, 3); ZGRTSSetDistanceToMap(pMap0, 548, 5); ZGRTSSetDistanceToMap(pMap0, 549, 5); ZGRTSSetDistanceToMap(pMap0, 550, 3); ZGRTSSetDistanceToMap(pMap0, 551, 3); ZGRTSSetMap(pMap0, 552, 1); ZGRTSSetDistanceToMap(pMap0, 552, 0); ZGRTSSetMap(pMap0, 553, 1); ZGRTSSetDistanceToMap(pMap0, 553, 0); ZGRTSSetMap(pMap0, 554, 1); ZGRTSSetDistanceToMap(pMap0, 554, 0); ZGRTSSetMap(pMap0, 555, 1); ZGRTSSetDistanceToMap(pMap0, 555, 0); ZGRTSSetDistanceToMap(pMap0, 556, 3); ZGRTSSetDistanceToMap(pMap0, 557, 3); ZGRTSSetDistanceToMap(pMap0, 558, 3); ZGRTSSetDistanceToMap(pMap0, 559, 3); ZGRTSSetDistanceToMap(pMap0, 560, 3); ZGRTSSetDistanceToMap(pMap0, 561, 3); ZGRTSSetDistanceToMap(pMap0, 562, 3); ZGRTSSetDistanceToMap(pMap0, 563, 3); ZGRTSSetDistanceToMap(pMap0, 564, 3); ZGRTSSetDistanceToMap(pMap0, 565, 3); ZGRTSSetDistanceToMap(pMap0, 566, 3); ZGRTSSetDistanceToMap(pMap0, 567, 3); ZGRTSSetDistanceToMap(pMap0, 568, 3); ZGRTSSetDistanceToMap(pMap0, 569, 3); ZGRTSSetDistanceToMap(pMap0, 570, 3); ZGRTSSetDistanceToMap(pMap0, 571, 3); ZGRTSSetDistanceToMap(pMap0, 572, 3); ZGRTSSetDistanceToMap(pMap0, 573, 3); ZGRTSSetDistanceToMap(pMap0, 574, 3); ZGRTSSetDistanceToMap(pMap0, 575, 3); ZGRTSSetDistanceToMap(pMap0, 576, 3); ZGRTSSetDistanceToMap(pMap0, 577, 3); ZGRTSSetMap(pMap0, 578, 1); ZGRTSSetDistanceToMap(pMap0, 578, 0); ZGRTSSetDistanceToMap(pMap0, 579, 5); ZGRTSSetDistanceToMap(pMap0, 580, 5); ZGRTSSetDistanceToMap(pMap0, 581, 5); ZGRTSSetDistanceToMap(pMap0, 582, 5); ZGRTSSetDistanceToMap(pMap0, 583, 5); ZGRTSSetDistanceToMap(pMap0, 584, 3); ZGRTSSetMap(pMap0, 585, 1); ZGRTSSetDistanceToMap(pMap0, 585, 0); ZGRTSSetMap(pMap0, 586, 1); ZGRTSSetDistanceToMap(pMap0, 586, 0); ZGRTSSetMap(pMap0, 587, 1); ZGRTSSetDistanceToMap(pMap0, 587, 0); ZGRTSSetDistanceToMap(pMap0, 588, 5); ZGRTSSetDistanceToMap(pMap0, 589, 5); ZGRTSSetDistanceToMap(pMap0, 590, 5); ZGRTSSetDistanceToMap(pMap0, 591, 3); ZGRTSSetDistanceToMap(pMap0, 592, 3); ZGRTSSetDistanceToMap(pMap0, 593, 5); ZGRTSSetDistanceToMap(pMap0, 594, 3); ZGRTSSetDistanceToMap(pMap0, 595, 3); ZGRTSSetDistanceToMap(pMap0, 596, 3); ZGRTSSetDistanceToMap(pMap0, 597, 3); ZGRTSSetDistanceToMap(pMap0, 598, 5); ZGRTSSetDistanceToMap(pMap0, 599, 5); ZGRTSSetDistanceToMap(pMap0, 600, 3); ZGRTSSetDistanceToMap(pMap0, 601, 3); ZGRTSSetMap(pMap0, 602, 1); ZGRTSSetDistanceToMap(pMap0, 602, 0); ZGRTSSetDistanceToMap(pMap0, 603, 3); ZGRTSSetDistanceToMap(pMap0, 604, 3); ZGRTSSetDistanceToMap(pMap0, 605, 3); ZGRTSSetDistanceToMap(pMap0, 606, 3); ZGRTSSetDistanceToMap(pMap0, 607, 3); ZGRTSSetDistanceToMap(pMap0, 608, 3); ZGRTSSetDistanceToMap(pMap0, 609, 3); ZGRTSSetDistanceToMap(pMap0, 610, 5); ZGRTSSetDistanceToMap(pMap0, 611, 3); ZGRTSSetDistanceToMap(pMap0, 612, 3); ZGRTSSetDistanceToMap(pMap0, 613, 3); ZGRTSSetDistanceToMap(pMap0, 614, 3); ZGRTSSetDistanceToMap(pMap0, 615, 3); ZGRTSSetDistanceToMap(pMap0, 616, 3); ZGRTSSetDistanceToMap(pMap0, 617, 3); ZGRTSSetDistanceToMap(pMap0, 618, 3); ZGRTSSetDistanceToMap(pMap0, 619, 3); ZGRTSSetMap(pMap0, 620, 1); ZGRTSSetDistanceToMap(pMap0, 620, 0); ZGRTSSetDistanceToMap(pMap0, 621, 5); ZGRTSSetDistanceToMap(pMap0, 622, 5); ZGRTSSetDistanceToMap(pMap0, 623, 3); ZGRTSSetMap(pMap0, 624, 1); ZGRTSSetDistanceToMap(pMap0, 624, 0); ZGRTSSetDistanceToMap(pMap0, 625, 3); ZGRTSSetDistanceToMap(pMap0, 626, 3); ZGRTSSetDistanceToMap(pMap0, 627, 3); ZGRTSSetDistanceToMap(pMap0, 628, 3); ZGRTSSetDistanceToMap(pMap0, 629, 3); ZGRTSSetDistanceToMap(pMap0, 630, 3); ZGRTSSetDistanceToMap(pMap0, 631, 3); ZGRTSSetDistanceToMap(pMap0, 632, 3); ZGRTSSetDistanceToMap(pMap0, 633, 5); ZGRTSSetDistanceToMap(pMap0, 634, 3); ZGRTSSetDistanceToMap(pMap0, 635, 3); ZGRTSSetDistanceToMap(pMap0, 636, 3); ZGRTSSetDistanceToMap(pMap0, 637, 3); ZGRTSSetDistanceToMap(pMap0, 638, 5); ZGRTSSetDistanceToMap(pMap0, 639, 5); ZGRTSSetDistanceToMap(pMap0, 640, 5); ZGRTSSetDistanceToMap(pMap0, 641, 3); ZGRTSSetDistanceToMap(pMap0, 642, 3); ZGRTSSetDistanceToMap(pMap0, 643, 5); ZGRTSSetDistanceToMap(pMap0, 644, 3); ZGRTSSetDistanceToMap(pMap0, 645, 3); ZGRTSSetDistanceToMap(pMap0, 646, 3); ZGRTSSetDistanceToMap(pMap0, 647, 3); ZGRTSSetDistanceToMap(pMap0, 648, 5); ZGRTSSetDistanceToMap(pMap0, 649, 5); ZGRTSSetDistanceToMap(pMap0, 650, 3); ZGRTSSetDistanceToMap(pMap0, 651, 3); ZGRTSSetMap(pMap0, 652, 1); ZGRTSSetDistanceToMap(pMap0, 652, 0); ZGRTSSetDistanceToMap(pMap0, 653, 3); ZGRTSSetDistanceToMap(pMap0, 654, 3); ZGRTSSetDistanceToMap(pMap0, 655, 3); ZGRTSSetDistanceToMap(pMap0, 656, 3); ZGRTSSetDistanceToMap(pMap0, 657, 3); ZGRTSSetDistanceToMap(pMap0, 658, 3); ZGRTSSetDistanceToMap(pMap0, 659, 3); ZGRTSSetDistanceToMap(pMap0, 660, 5); ZGRTSSetDistanceToMap(pMap0, 661, 3); ZGRTSSetDistanceToMap(pMap0, 662, 3); ZGRTSSetDistanceToMap(pMap0, 663, 3); ZGRTSSetDistanceToMap(pMap0, 664, 3); ZGRTSSetDistanceToMap(pMap0, 665, 3); ZGRTSSetDistanceToMap(pMap0, 666, 3); ZGRTSSetDistanceToMap(pMap0, 667, 3); ZGRTSSetDistanceToMap(pMap0, 668, 3); ZGRTSSetDistanceToMap(pMap0, 669, 3); ZGRTSSetDistanceToMap(pMap0, 670, 5); ZGRTSSetDistanceToMap(pMap0, 671, 5); ZGRTSSetDistanceToMap(pMap0, 672, 5); ZGRTSSetDistanceToMap(pMap0, 673, 3); ZGRTSSetDistanceToMap(pMap0, 674, 3); ZGRTSSetDistanceToMap(pMap0, 675, 3); ZGRTSSetDistanceToMap(pMap0, 676, 3); ZGRTSSetDistanceToMap(pMap0, 677, 3); ZGRTSSetDistanceToMap(pMap0, 678, 3); ZGRTSSetMap(pMap0, 679, 1); ZGRTSSetDistanceToMap(pMap0, 679, 0); ZGRTSSetDistanceToMap(pMap0, 680, 3); ZGRTSSetMap(pMap0, 681, 1); ZGRTSSetDistanceToMap(pMap0, 681, 0); ZGRTSSetMap(pMap0, 682, 1); ZGRTSSetDistanceToMap(pMap0, 682, 0); ZGRTSSetMap(pMap0, 683, 1); ZGRTSSetDistanceToMap(pMap0, 683, 0); ZGRTSSetDistanceToMap(pMap0, 684, 3); ZGRTSSetDistanceToMap(pMap0, 685, 3); ZGRTSSetDistanceToMap(pMap0, 686, 3); ZGRTSSetDistanceToMap(pMap0, 687, 3); ZGRTSSetDistanceToMap(pMap0, 688, 5); ZGRTSSetDistanceToMap(pMap0, 689, 5); ZGRTSSetDistanceToMap(pMap0, 690, 5); ZGRTSSetDistanceToMap(pMap0, 691, 3); ZGRTSSetDistanceToMap(pMap0, 692, 3); ZGRTSSetDistanceToMap(pMap0, 693, 5); ZGRTSSetDistanceToMap(pMap0, 694, 3); ZGRTSSetDistanceToMap(pMap0, 695, 3); ZGRTSSetDistanceToMap(pMap0, 696, 3); ZGRTSSetDistanceToMap(pMap0, 697, 3); ZGRTSSetDistanceToMap(pMap0, 698, 5); ZGRTSSetDistanceToMap(pMap0, 699, 5); ZGRTSSetDistanceToMap(pMap0, 700, 3); ZGRTSSetDistanceToMap(pMap0, 701, 3); ZGRTSSetMap(pMap0, 702, 1); ZGRTSSetDistanceToMap(pMap0, 702, 0); ZGRTSSetDistanceToMap(pMap0, 703, 3); ZGRTSSetDistanceToMap(pMap0, 704, 3); ZGRTSSetDistanceToMap(pMap0, 705, 3); ZGRTSSetDistanceToMap(pMap0, 706, 3); ZGRTSSetDistanceToMap(pMap0, 707, 3); ZGRTSSetDistanceToMap(pMap0, 708, 3); ZGRTSSetDistanceToMap(pMap0, 709, 3); ZGRTSSetDistanceToMap(pMap0, 710, 5); ZGRTSSetDistanceToMap(pMap0, 711, 3); ZGRTSSetDistanceToMap(pMap0, 712, 3); ZGRTSSetDistanceToMap(pMap0, 713, 3); ZGRTSSetDistanceToMap(pMap0, 714, 3); ZGRTSSetDistanceToMap(pMap0, 715, 3); ZGRTSSetDistanceToMap(pMap0, 716, 3); ZGRTSSetDistanceToMap(pMap0, 717, 3); ZGRTSSetDistanceToMap(pMap0, 718, 3); ZGRTSSetDistanceToMap(pMap0, 719, 3); ZGRTSSetDistanceToMap(pMap0, 720, 5); ZGRTSSetDistanceToMap(pMap0, 721, 5); ZGRTSSetDistanceToMap(pMap0, 722, 5); ZGRTSSetDistanceToMap(pMap0, 723, 3); ZGRTSSetDistanceToMap(pMap0, 724, 3); ZGRTSSetDistanceToMap(pMap0, 725, 3); ZGRTSSetDistanceToMap(pMap0, 726, 3); ZGRTSSetDistanceToMap(pMap0, 727, 3); ZGRTSSetMap(pMap0, 728, 1); ZGRTSSetDistanceToMap(pMap0, 728, 0); ZGRTSSetDistanceToMap(pMap0, 729, 3); ZGRTSSetDistanceToMap(pMap0, 730, 5); ZGRTSSetMap(pMap0, 731, 1); ZGRTSSetDistanceToMap(pMap0, 731, 0); ZGRTSSetMap(pMap0, 732, 1); ZGRTSSetDistanceToMap(pMap0, 732, 0); ZGRTSSetMap(pMap0, 733, 1); ZGRTSSetDistanceToMap(pMap0, 733, 0); ZGRTSSetDistanceToMap(pMap0, 734, 3); ZGRTSSetDistanceToMap(pMap0, 735, 3); ZGRTSSetDistanceToMap(pMap0, 736, 3); ZGRTSSetDistanceToMap(pMap0, 737, 3); ZGRTSSetDistanceToMap(pMap0, 738, 5); ZGRTSSetDistanceToMap(pMap0, 739, 5); ZGRTSSetDistanceToMap(pMap0, 740, 5); ZGRTSSetDistanceToMap(pMap0, 741, 3); ZGRTSSetDistanceToMap(pMap0, 742, 3); ZGRTSSetDistanceToMap(pMap0, 743, 5); ZGRTSSetDistanceToMap(pMap0, 744, 3); ZGRTSSetDistanceToMap(pMap0, 745, 3); ZGRTSSetDistanceToMap(pMap0, 746, 3); ZGRTSSetDistanceToMap(pMap0, 747, 3); ZGRTSSetDistanceToMap(pMap0, 748, 5); ZGRTSSetDistanceToMap(pMap0, 749, 5); ZGRTSSetDistanceToMap(pMap0, 750, 3); ZGRTSSetDistanceToMap(pMap0, 751, 3); ZGRTSSetMap(pMap0, 752, 1); ZGRTSSetDistanceToMap(pMap0, 752, 0); ZGRTSSetDistanceToMap(pMap0, 753, 3); ZGRTSSetDistanceToMap(pMap0, 754, 3); ZGRTSSetDistanceToMap(pMap0, 755, 3); ZGRTSSetDistanceToMap(pMap0, 756, 3); ZGRTSSetDistanceToMap(pMap0, 757, 3); ZGRTSSetDistanceToMap(pMap0, 758, 3); ZGRTSSetDistanceToMap(pMap0, 759, 3); ZGRTSSetDistanceToMap(pMap0, 760, 5); ZGRTSSetDistanceToMap(pMap0, 761, 3); ZGRTSSetDistanceToMap(pMap0, 762, 3); ZGRTSSetDistanceToMap(pMap0, 763, 3); ZGRTSSetDistanceToMap(pMap0, 764, 3); ZGRTSSetDistanceToMap(pMap0, 765, 3); ZGRTSSetDistanceToMap(pMap0, 766, 3); ZGRTSSetDistanceToMap(pMap0, 767, 3); ZGRTSSetDistanceToMap(pMap0, 768, 3); ZGRTSSetDistanceToMap(pMap0, 769, 3); ZGRTSSetDistanceToMap(pMap0, 770, 5); ZGRTSSetDistanceToMap(pMap0, 771, 5); ZGRTSSetDistanceToMap(pMap0, 772, 5); ZGRTSSetDistanceToMap(pMap0, 773, 3); ZGRTSSetDistanceToMap(pMap0, 774, 3); ZGRTSSetDistanceToMap(pMap0, 775, 3); ZGRTSSetDistanceToMap(pMap0, 776, 3); ZGRTSSetMap(pMap0, 777, 1); ZGRTSSetDistanceToMap(pMap0, 777, 0); ZGRTSSetDistanceToMap(pMap0, 778, 3); ZGRTSSetDistanceToMap(pMap0, 779, 3); ZGRTSSetDistanceToMap(pMap0, 780, 3); ZGRTSSetDistanceToMap(pMap0, 781, 3); ZGRTSSetMap(pMap0, 782, 1); ZGRTSSetDistanceToMap(pMap0, 782, 0); ZGRTSSetMap(pMap0, 783, 1); ZGRTSSetDistanceToMap(pMap0, 783, 0); ZGRTSSetDistanceToMap(pMap0, 784, 3); ZGRTSSetDistanceToMap(pMap0, 785, 3); ZGRTSSetDistanceToMap(pMap0, 786, 3); ZGRTSSetMap(pMap0, 787, 1); ZGRTSSetDistanceToMap(pMap0, 787, 0); ZGRTSSetDistanceToMap(pMap0, 788, 5); ZGRTSSetDistanceToMap(pMap0, 789, 5); ZGRTSSetDistanceToMap(pMap0, 790, 5); ZGRTSSetDistanceToMap(pMap0, 791, 3); ZGRTSSetDistanceToMap(pMap0, 792, 3); ZGRTSSetDistanceToMap(pMap0, 793, 5); ZGRTSSetDistanceToMap(pMap0, 794, 3); ZGRTSSetDistanceToMap(pMap0, 795, 3); ZGRTSSetDistanceToMap(pMap0, 796, 3); ZGRTSSetDistanceToMap(pMap0, 797, 3); ZGRTSSetDistanceToMap(pMap0, 798, 5); ZGRTSSetDistanceToMap(pMap0, 799, 5); ZGRTSSetDistanceToMap(pMap0, 800, 3); ZGRTSSetDistanceToMap(pMap0, 801, 3); ZGRTSSetMap(pMap0, 802, 1); ZGRTSSetDistanceToMap(pMap0, 802, 0); ZGRTSSetDistanceToMap(pMap0, 803, 3); ZGRTSSetDistanceToMap(pMap0, 804, 3); ZGRTSSetDistanceToMap(pMap0, 805, 3); ZGRTSSetDistanceToMap(pMap0, 806, 3); ZGRTSSetDistanceToMap(pMap0, 807, 3); ZGRTSSetDistanceToMap(pMap0, 808, 3); ZGRTSSetDistanceToMap(pMap0, 809, 3); ZGRTSSetDistanceToMap(pMap0, 810, 5); ZGRTSSetDistanceToMap(pMap0, 811, 3); ZGRTSSetDistanceToMap(pMap0, 812, 3); ZGRTSSetDistanceToMap(pMap0, 813, 3); ZGRTSSetDistanceToMap(pMap0, 814, 3); ZGRTSSetDistanceToMap(pMap0, 815, 3); ZGRTSSetDistanceToMap(pMap0, 816, 3); ZGRTSSetDistanceToMap(pMap0, 817, 3); ZGRTSSetDistanceToMap(pMap0, 818, 3); ZGRTSSetDistanceToMap(pMap0, 819, 3); ZGRTSSetDistanceToMap(pMap0, 820, 5); ZGRTSSetDistanceToMap(pMap0, 821, 5); ZGRTSSetDistanceToMap(pMap0, 822, 5); ZGRTSSetDistanceToMap(pMap0, 823, 3); ZGRTSSetDistanceToMap(pMap0, 824, 3); ZGRTSSetDistanceToMap(pMap0, 825, 3); ZGRTSSetMap(pMap0, 826, 1); ZGRTSSetDistanceToMap(pMap0, 826, 0); ZGRTSSetDistanceToMap(pMap0, 827, 3); ZGRTSSetDistanceToMap(pMap0, 828, 3); ZGRTSSetDistanceToMap(pMap0, 829, 5); ZGRTSSetDistanceToMap(pMap0, 830, 5); ZGRTSSetDistanceToMap(pMap0, 831, 3); ZGRTSSetMap(pMap0, 832, 1); ZGRTSSetDistanceToMap(pMap0, 832, 0); ZGRTSSetMap(pMap0, 833, 1); ZGRTSSetDistanceToMap(pMap0, 833, 0); ZGRTSSetMap(pMap0, 834, 1); ZGRTSSetDistanceToMap(pMap0, 834, 0); ZGRTSSetDistanceToMap(pMap0, 835, 3); ZGRTSSetDistanceToMap(pMap0, 836, 3); ZGRTSSetMap(pMap0, 837, 1); ZGRTSSetDistanceToMap(pMap0, 837, 0); ZGRTSSetMap(pMap0, 838, 1); ZGRTSSetDistanceToMap(pMap0, 838, 0); ZGRTSSetMap(pMap0, 839, 1); ZGRTSSetDistanceToMap(pMap0, 839, 0); ZGRTSSetMap(pMap0, 840, 1); ZGRTSSetDistanceToMap(pMap0, 840, 0); ZGRTSSetDistanceToMap(pMap0, 841, 3); ZGRTSSetDistanceToMap(pMap0, 842, 3); ZGRTSSetDistanceToMap(pMap0, 843, 5); ZGRTSSetDistanceToMap(pMap0, 844, 3); ZGRTSSetDistanceToMap(pMap0, 845, 3); ZGRTSSetDistanceToMap(pMap0, 846, 3); ZGRTSSetDistanceToMap(pMap0, 847, 3); ZGRTSSetDistanceToMap(pMap0, 848, 5); ZGRTSSetDistanceToMap(pMap0, 849, 5); ZGRTSSetDistanceToMap(pMap0, 850, 3); ZGRTSSetDistanceToMap(pMap0, 851, 3); ZGRTSSetMap(pMap0, 852, 1); ZGRTSSetDistanceToMap(pMap0, 852, 0); ZGRTSSetDistanceToMap(pMap0, 853, 5); ZGRTSSetDistanceToMap(pMap0, 854, 5); ZGRTSSetDistanceToMap(pMap0, 855, 5); ZGRTSSetDistanceToMap(pMap0, 856, 5); ZGRTSSetDistanceToMap(pMap0, 857, 5); ZGRTSSetDistanceToMap(pMap0, 858, 5); ZGRTSSetDistanceToMap(pMap0, 859, 5); ZGRTSSetDistanceToMap(pMap0, 860, 5); ZGRTSSetDistanceToMap(pMap0, 861, 3); ZGRTSSetDistanceToMap(pMap0, 862, 3); ZGRTSSetDistanceToMap(pMap0, 863, 3); ZGRTSSetDistanceToMap(pMap0, 864, 3); ZGRTSSetDistanceToMap(pMap0, 865, 3); ZGRTSSetDistanceToMap(pMap0, 866, 3); ZGRTSSetDistanceToMap(pMap0, 867, 3); ZGRTSSetDistanceToMap(pMap0, 868, 3); ZGRTSSetDistanceToMap(pMap0, 869, 3); ZGRTSSetDistanceToMap(pMap0, 870, 5); ZGRTSSetDistanceToMap(pMap0, 871, 5); ZGRTSSetDistanceToMap(pMap0, 872, 5); ZGRTSSetDistanceToMap(pMap0, 873, 3); ZGRTSSetDistanceToMap(pMap0, 874, 3); ZGRTSSetDistanceToMap(pMap0, 875, 3); ZGRTSSetDistanceToMap(pMap0, 876, 3); ZGRTSSetDistanceToMap(pMap0, 877, 3); ZGRTSSetDistanceToMap(pMap0, 878, 5); ZGRTSSetDistanceToMap(pMap0, 879, 3); ZGRTSSetDistanceToMap(pMap0, 880, 3); ZGRTSSetDistanceToMap(pMap0, 881, 5); ZGRTSSetDistanceToMap(pMap0, 882, 5); ZGRTSSetDistanceToMap(pMap0, 883, 5); ZGRTSSetDistanceToMap(pMap0, 884, 5); ZGRTSSetDistanceToMap(pMap0, 885, 5); ZGRTSSetDistanceToMap(pMap0, 886, 5); ZGRTSSetDistanceToMap(pMap0, 887, 5); ZGRTSSetDistanceToMap(pMap0, 888, 5); ZGRTSSetDistanceToMap(pMap0, 889, 5); ZGRTSSetDistanceToMap(pMap0, 890, 5); ZGRTSSetDistanceToMap(pMap0, 891, 3); ZGRTSSetDistanceToMap(pMap0, 892, 3); ZGRTSSetDistanceToMap(pMap0, 893, 5); ZGRTSSetDistanceToMap(pMap0, 894, 3); ZGRTSSetDistanceToMap(pMap0, 895, 3); ZGRTSSetDistanceToMap(pMap0, 896, 3); ZGRTSSetDistanceToMap(pMap0, 897, 3); ZGRTSSetDistanceToMap(pMap0, 898, 5); ZGRTSSetDistanceToMap(pMap0, 899, 5); ZGRTSSetDistanceToMap(pMap0, 900, 3); ZGRTSSetDistanceToMap(pMap0, 901, 3); ZGRTSSetMap(pMap0, 902, 1); ZGRTSSetDistanceToMap(pMap0, 902, 0); ZGRTSSetDistanceToMap(pMap0, 903, 5); ZGRTSSetDistanceToMap(pMap0, 904, 5); ZGRTSSetDistanceToMap(pMap0, 905, 5); ZGRTSSetDistanceToMap(pMap0, 906, 5); ZGRTSSetDistanceToMap(pMap0, 907, 5); ZGRTSSetDistanceToMap(pMap0, 908, 5); ZGRTSSetDistanceToMap(pMap0, 909, 5); ZGRTSSetDistanceToMap(pMap0, 910, 5); ZGRTSSetDistanceToMap(pMap0, 911, 3); ZGRTSSetDistanceToMap(pMap0, 912, 3); ZGRTSSetDistanceToMap(pMap0, 913, 3); ZGRTSSetDistanceToMap(pMap0, 914, 3); ZGRTSSetDistanceToMap(pMap0, 915, 3); ZGRTSSetDistanceToMap(pMap0, 916, 3); ZGRTSSetDistanceToMap(pMap0, 917, 3); ZGRTSSetDistanceToMap(pMap0, 918, 3); ZGRTSSetDistanceToMap(pMap0, 919, 3); ZGRTSSetDistanceToMap(pMap0, 920, 5); ZGRTSSetDistanceToMap(pMap0, 921, 5); ZGRTSSetDistanceToMap(pMap0, 922, 5); ZGRTSSetDistanceToMap(pMap0, 923, 3); ZGRTSSetDistanceToMap(pMap0, 924, 3); ZGRTSSetDistanceToMap(pMap0, 925, 3); ZGRTSSetDistanceToMap(pMap0, 926, 3); ZGRTSSetDistanceToMap(pMap0, 927, 3); ZGRTSSetDistanceToMap(pMap0, 928, 3); ZGRTSSetDistanceToMap(pMap0, 929, 5); ZGRTSSetDistanceToMap(pMap0, 930, 3); ZGRTSSetMap(pMap0, 931, 1); ZGRTSSetDistanceToMap(pMap0, 931, 0); ZGRTSSetDistanceToMap(pMap0, 932, 5); ZGRTSSetDistanceToMap(pMap0, 933, 5); ZGRTSSetDistanceToMap(pMap0, 934, 5); ZGRTSSetDistanceToMap(pMap0, 935, 5); ZGRTSSetDistanceToMap(pMap0, 936, 5); ZGRTSSetDistanceToMap(pMap0, 937, 5); ZGRTSSetDistanceToMap(pMap0, 938, 5); ZGRTSSetDistanceToMap(pMap0, 939, 5); ZGRTSSetDistanceToMap(pMap0, 940, 5); ZGRTSSetDistanceToMap(pMap0, 941, 3); ZGRTSSetDistanceToMap(pMap0, 942, 3); ZGRTSSetDistanceToMap(pMap0, 943, 5); ZGRTSSetDistanceToMap(pMap0, 944, 3); ZGRTSSetDistanceToMap(pMap0, 945, 3); ZGRTSSetDistanceToMap(pMap0, 946, 3); ZGRTSSetDistanceToMap(pMap0, 947, 3); ZGRTSSetDistanceToMap(pMap0, 948, 5); ZGRTSSetDistanceToMap(pMap0, 949, 5); ZGRTSSetDistanceToMap(pMap0, 950, 3); ZGRTSSetDistanceToMap(pMap0, 951, 3); ZGRTSSetMap(pMap0, 952, 1); ZGRTSSetDistanceToMap(pMap0, 952, 0); ZGRTSSetDistanceToMap(pMap0, 953, 5); ZGRTSSetDistanceToMap(pMap0, 954, 5); ZGRTSSetDistanceToMap(pMap0, 955, 5); ZGRTSSetDistanceToMap(pMap0, 956, 5); ZGRTSSetDistanceToMap(pMap0, 957, 5); ZGRTSSetDistanceToMap(pMap0, 958, 5); ZGRTSSetDistanceToMap(pMap0, 959, 5); ZGRTSSetDistanceToMap(pMap0, 960, 5); ZGRTSSetDistanceToMap(pMap0, 961, 3); ZGRTSSetDistanceToMap(pMap0, 962, 3); ZGRTSSetDistanceToMap(pMap0, 963, 3); ZGRTSSetDistanceToMap(pMap0, 964, 3); ZGRTSSetDistanceToMap(pMap0, 965, 3); ZGRTSSetDistanceToMap(pMap0, 966, 3); ZGRTSSetDistanceToMap(pMap0, 967, 3); ZGRTSSetDistanceToMap(pMap0, 968, 3); ZGRTSSetDistanceToMap(pMap0, 969, 3); ZGRTSSetDistanceToMap(pMap0, 970, 5); ZGRTSSetDistanceToMap(pMap0, 971, 5); ZGRTSSetDistanceToMap(pMap0, 972, 5); ZGRTSSetDistanceToMap(pMap0, 973, 3); ZGRTSSetDistanceToMap(pMap0, 974, 3); ZGRTSSetDistanceToMap(pMap0, 975, 5); ZGRTSSetDistanceToMap(pMap0, 976, 3); ZGRTSSetDistanceToMap(pMap0, 977, 5); ZGRTSSetDistanceToMap(pMap0, 978, 5); ZGRTSSetDistanceToMap(pMap0, 979, 3); ZGRTSSetMap(pMap0, 980, 1); ZGRTSSetDistanceToMap(pMap0, 980, 0); ZGRTSSetDistanceToMap(pMap0, 981, 5); ZGRTSSetDistanceToMap(pMap0, 982, 5); ZGRTSSetDistanceToMap(pMap0, 983, 5); ZGRTSSetDistanceToMap(pMap0, 984, 5); ZGRTSSetDistanceToMap(pMap0, 985, 5); ZGRTSSetDistanceToMap(pMap0, 986, 5); ZGRTSSetDistanceToMap(pMap0, 987, 5); ZGRTSSetDistanceToMap(pMap0, 988, 5); ZGRTSSetDistanceToMap(pMap0, 989, 5); ZGRTSSetDistanceToMap(pMap0, 990, 5); ZGRTSSetDistanceToMap(pMap0, 991, 3); ZGRTSSetDistanceToMap(pMap0, 992, 3); ZGRTSSetDistanceToMap(pMap0, 993, 5); ZGRTSSetDistanceToMap(pMap0, 994, 5); ZGRTSSetDistanceToMap(pMap0, 995, 5); ZGRTSSetDistanceToMap(pMap0, 996, 5); ZGRTSSetDistanceToMap(pMap0, 997, 5); ZGRTSSetDistanceToMap(pMap0, 998, 5); ZGRTSSetDistanceToMap(pMap0, 999, 5); ZGRTSSetDistanceToMap(pMap0, 1000, 3); ZGRTSSetDistanceToMap(pMap0, 1001, 3); ZGRTSSetMap(pMap0, 1002, 1); ZGRTSSetDistanceToMap(pMap0, 1002, 0); ZGRTSSetDistanceToMap(pMap0, 1003, 5); ZGRTSSetDistanceToMap(pMap0, 1004, 5); ZGRTSSetDistanceToMap(pMap0, 1005, 5); ZGRTSSetDistanceToMap(pMap0, 1006, 5); ZGRTSSetDistanceToMap(pMap0, 1007, 5); ZGRTSSetDistanceToMap(pMap0, 1008, 5); ZGRTSSetDistanceToMap(pMap0, 1009, 5); ZGRTSSetDistanceToMap(pMap0, 1010, 5); ZGRTSSetDistanceToMap(pMap0, 1011, 3); ZGRTSSetDistanceToMap(pMap0, 1012, 3); ZGRTSSetDistanceToMap(pMap0, 1013, 3); ZGRTSSetDistanceToMap(pMap0, 1014, 3); ZGRTSSetDistanceToMap(pMap0, 1015, 3); ZGRTSSetDistanceToMap(pMap0, 1016, 3); ZGRTSSetDistanceToMap(pMap0, 1017, 3); ZGRTSSetDistanceToMap(pMap0, 1018, 3); ZGRTSSetDistanceToMap(pMap0, 1019, 3); ZGRTSSetDistanceToMap(pMap0, 1020, 5); ZGRTSSetDistanceToMap(pMap0, 1021, 5); ZGRTSSetDistanceToMap(pMap0, 1022, 5); ZGRTSSetMap(pMap0, 1023, 1); ZGRTSSetDistanceToMap(pMap0, 1023, 0); ZGRTSSetMap(pMap0, 1024, 1); ZGRTSSetDistanceToMap(pMap0, 1024, 0); ZGRTSSetDistanceToMap(pMap0, 1025, 3); ZGRTSSetDistanceToMap(pMap0, 1026, 5); ZGRTSSetDistanceToMap(pMap0, 1027, 3); ZGRTSSetDistanceToMap(pMap0, 1028, 5); ZGRTSSetMap(pMap0, 1029, 1); ZGRTSSetDistanceToMap(pMap0, 1029, 0); ZGRTSSetDistanceToMap(pMap0, 1030, 5); ZGRTSSetDistanceToMap(pMap0, 1031, 5); ZGRTSSetDistanceToMap(pMap0, 1032, 3); ZGRTSSetDistanceToMap(pMap0, 1033, 3); ZGRTSSetDistanceToMap(pMap0, 1034, 3); ZGRTSSetDistanceToMap(pMap0, 1035, 3); ZGRTSSetDistanceToMap(pMap0, 1036, 3); ZGRTSSetDistanceToMap(pMap0, 1037, 3); ZGRTSSetDistanceToMap(pMap0, 1038, 3); ZGRTSSetDistanceToMap(pMap0, 1039, 3); ZGRTSSetDistanceToMap(pMap0, 1040, 3); ZGRTSSetDistanceToMap(pMap0, 1041, 3); ZGRTSSetDistanceToMap(pMap0, 1042, 3); ZGRTSSetDistanceToMap(pMap0, 1043, 3); ZGRTSSetDistanceToMap(pMap0, 1044, 3); ZGRTSSetDistanceToMap(pMap0, 1045, 3); ZGRTSSetDistanceToMap(pMap0, 1046, 3); ZGRTSSetDistanceToMap(pMap0, 1047, 3); ZGRTSSetDistanceToMap(pMap0, 1048, 5); ZGRTSSetDistanceToMap(pMap0, 1049, 5); ZGRTSSetDistanceToMap(pMap0, 1050, 3); ZGRTSSetDistanceToMap(pMap0, 1051, 3); ZGRTSSetDistanceToMap(pMap0, 1052, 3); ZGRTSSetDistanceToMap(pMap0, 1053, 3); ZGRTSSetDistanceToMap(pMap0, 1054, 3); ZGRTSSetDistanceToMap(pMap0, 1055, 3); ZGRTSSetDistanceToMap(pMap0, 1056, 3); ZGRTSSetDistanceToMap(pMap0, 1057, 3); ZGRTSSetDistanceToMap(pMap0, 1058, 3); ZGRTSSetDistanceToMap(pMap0, 1059, 3); ZGRTSSetDistanceToMap(pMap0, 1060, 3); ZGRTSSetDistanceToMap(pMap0, 1061, 3); ZGRTSSetDistanceToMap(pMap0, 1062, 3); ZGRTSSetDistanceToMap(pMap0, 1063, 3); ZGRTSSetDistanceToMap(pMap0, 1064, 3); ZGRTSSetDistanceToMap(pMap0, 1065, 3); ZGRTSSetMap(pMap0, 1066, 1); ZGRTSSetDistanceToMap(pMap0, 1066, 0); ZGRTSSetMap(pMap0, 1067, 1); ZGRTSSetDistanceToMap(pMap0, 1067, 0); ZGRTSSetMap(pMap0, 1068, 1); ZGRTSSetDistanceToMap(pMap0, 1068, 0); ZGRTSSetMap(pMap0, 1069, 1); ZGRTSSetDistanceToMap(pMap0, 1069, 0); ZGRTSSetMap(pMap0, 1070, 1); ZGRTSSetDistanceToMap(pMap0, 1070, 0); ZGRTSSetDistanceToMap(pMap0, 1071, 5); ZGRTSSetDistanceToMap(pMap0, 1072, 5); ZGRTSSetMap(pMap0, 1073, 1); ZGRTSSetDistanceToMap(pMap0, 1073, 0); ZGRTSSetMap(pMap0, 1074, 1); ZGRTSSetDistanceToMap(pMap0, 1074, 0); ZGRTSSetDistanceToMap(pMap0, 1075, 3); ZGRTSSetDistanceToMap(pMap0, 1076, 3); ZGRTSSetMap(pMap0, 1077, 1); ZGRTSSetDistanceToMap(pMap0, 1077, 0); ZGRTSSetMap(pMap0, 1078, 1); ZGRTSSetDistanceToMap(pMap0, 1078, 0); ZGRTSSetDistanceToMap(pMap0, 1079, 5); ZGRTSSetDistanceToMap(pMap0, 1080, 5); ZGRTSSetDistanceToMap(pMap0, 1081, 5); ZGRTSSetDistanceToMap(pMap0, 1082, 3); ZGRTSSetDistanceToMap(pMap0, 1083, 3); ZGRTSSetDistanceToMap(pMap0, 1084, 3); ZGRTSSetDistanceToMap(pMap0, 1085, 3); ZGRTSSetDistanceToMap(pMap0, 1086, 3); ZGRTSSetDistanceToMap(pMap0, 1087, 3); ZGRTSSetDistanceToMap(pMap0, 1088, 3); ZGRTSSetDistanceToMap(pMap0, 1089, 3); ZGRTSSetDistanceToMap(pMap0, 1090, 3); ZGRTSSetDistanceToMap(pMap0, 1091, 3); ZGRTSSetDistanceToMap(pMap0, 1092, 3); ZGRTSSetDistanceToMap(pMap0, 1093, 3); ZGRTSSetDistanceToMap(pMap0, 1094, 3); ZGRTSSetDistanceToMap(pMap0, 1095, 3); ZGRTSSetDistanceToMap(pMap0, 1096, 3); ZGRTSSetDistanceToMap(pMap0, 1097, 3); ZGRTSSetDistanceToMap(pMap0, 1098, 5); ZGRTSSetDistanceToMap(pMap0, 1099, 5); ZGRTSSetDistanceToMap(pMap0, 1100, 3); ZGRTSSetDistanceToMap(pMap0, 1101, 3); ZGRTSSetDistanceToMap(pMap0, 1102, 3); ZGRTSSetDistanceToMap(pMap0, 1103, 3); ZGRTSSetDistanceToMap(pMap0, 1104, 3); ZGRTSSetDistanceToMap(pMap0, 1105, 3); ZGRTSSetDistanceToMap(pMap0, 1106, 3); ZGRTSSetDistanceToMap(pMap0, 1107, 3); ZGRTSSetDistanceToMap(pMap0, 1108, 3); ZGRTSSetDistanceToMap(pMap0, 1109, 3); ZGRTSSetDistanceToMap(pMap0, 1110, 3); ZGRTSSetDistanceToMap(pMap0, 1111, 3); ZGRTSSetDistanceToMap(pMap0, 1112, 3); ZGRTSSetDistanceToMap(pMap0, 1113, 3); ZGRTSSetDistanceToMap(pMap0, 1114, 3); ZGRTSSetDistanceToMap(pMap0, 1115, 3); ZGRTSSetDistanceToMap(pMap0, 1116, 3); ZGRTSSetDistanceToMap(pMap0, 1117, 3); ZGRTSSetDistanceToMap(pMap0, 1118, 3); ZGRTSSetDistanceToMap(pMap0, 1119, 3); ZGRTSSetDistanceToMap(pMap0, 1120, 3); ZGRTSSetDistanceToMap(pMap0, 1121, 3); ZGRTSSetDistanceToMap(pMap0, 1122, 3); ZGRTSSetDistanceToMap(pMap0, 1123, 3); ZGRTSSetDistanceToMap(pMap0, 1124, 3); ZGRTSSetDistanceToMap(pMap0, 1125, 3); ZGRTSSetDistanceToMap(pMap0, 1126, 3); ZGRTSSetDistanceToMap(pMap0, 1127, 3); ZGRTSSetDistanceToMap(pMap0, 1128, 3); ZGRTSSetDistanceToMap(pMap0, 1129, 3); ZGRTSSetDistanceToMap(pMap0, 1130, 3); ZGRTSSetDistanceToMap(pMap0, 1131, 3); ZGRTSSetDistanceToMap(pMap0, 1132, 3); ZGRTSSetDistanceToMap(pMap0, 1133, 3); ZGRTSSetDistanceToMap(pMap0, 1134, 3); ZGRTSSetDistanceToMap(pMap0, 1135, 3); ZGRTSSetDistanceToMap(pMap0, 1136, 3); ZGRTSSetDistanceToMap(pMap0, 1137, 3); ZGRTSSetDistanceToMap(pMap0, 1138, 3); ZGRTSSetDistanceToMap(pMap0, 1139, 3); ZGRTSSetDistanceToMap(pMap0, 1140, 3); ZGRTSSetDistanceToMap(pMap0, 1141, 3); ZGRTSSetDistanceToMap(pMap0, 1142, 3); ZGRTSSetDistanceToMap(pMap0, 1143, 3); ZGRTSSetDistanceToMap(pMap0, 1144, 3); ZGRTSSetDistanceToMap(pMap0, 1145, 3); ZGRTSSetDistanceToMap(pMap0, 1146, 3); ZGRTSSetDistanceToMap(pMap0, 1147, 3); ZGRTSSetDistanceToMap(pMap0, 1148, 5); ZGRTSSetDistanceToMap(pMap0, 1149, 5); ZGRTSSetDistanceToMap(pMap0, 1150, 3); ZGRTSSetDistanceToMap(pMap0, 1151, 3); ZGRTSSetDistanceToMap(pMap0, 1152, 3); ZGRTSSetDistanceToMap(pMap0, 1153, 3); ZGRTSSetDistanceToMap(pMap0, 1154, 3); ZGRTSSetDistanceToMap(pMap0, 1155, 3); ZGRTSSetDistanceToMap(pMap0, 1156, 3); ZGRTSSetDistanceToMap(pMap0, 1157, 3); ZGRTSSetDistanceToMap(pMap0, 1158, 3); ZGRTSSetDistanceToMap(pMap0, 1159, 3); ZGRTSSetDistanceToMap(pMap0, 1160, 3); ZGRTSSetDistanceToMap(pMap0, 1161, 3); ZGRTSSetDistanceToMap(pMap0, 1162, 3); ZGRTSSetDistanceToMap(pMap0, 1163, 3); ZGRTSSetDistanceToMap(pMap0, 1164, 3); ZGRTSSetDistanceToMap(pMap0, 1165, 3); ZGRTSSetDistanceToMap(pMap0, 1166, 3); ZGRTSSetDistanceToMap(pMap0, 1167, 3); ZGRTSSetDistanceToMap(pMap0, 1168, 3); ZGRTSSetDistanceToMap(pMap0, 1169, 3); ZGRTSSetDistanceToMap(pMap0, 1170, 3); ZGRTSSetDistanceToMap(pMap0, 1171, 3); ZGRTSSetDistanceToMap(pMap0, 1172, 3); ZGRTSSetDistanceToMap(pMap0, 1173, 3); ZGRTSSetDistanceToMap(pMap0, 1174, 3); ZGRTSSetDistanceToMap(pMap0, 1175, 3); ZGRTSSetDistanceToMap(pMap0, 1176, 3); ZGRTSSetDistanceToMap(pMap0, 1177, 3); ZGRTSSetDistanceToMap(pMap0, 1178, 3); ZGRTSSetDistanceToMap(pMap0, 1179, 3); ZGRTSSetDistanceToMap(pMap0, 1180, 3); ZGRTSSetDistanceToMap(pMap0, 1181, 3); ZGRTSSetDistanceToMap(pMap0, 1182, 3); ZGRTSSetDistanceToMap(pMap0, 1183, 3); ZGRTSSetDistanceToMap(pMap0, 1184, 3); ZGRTSSetDistanceToMap(pMap0, 1185, 3); ZGRTSSetDistanceToMap(pMap0, 1186, 3); ZGRTSSetDistanceToMap(pMap0, 1187, 3); ZGRTSSetDistanceToMap(pMap0, 1188, 3); ZGRTSSetDistanceToMap(pMap0, 1189, 3); ZGRTSSetDistanceToMap(pMap0, 1190, 3); ZGRTSSetDistanceToMap(pMap0, 1191, 3); ZGRTSSetDistanceToMap(pMap0, 1192, 3); ZGRTSSetDistanceToMap(pMap0, 1193, 3); ZGRTSSetDistanceToMap(pMap0, 1194, 3); ZGRTSSetDistanceToMap(pMap0, 1195, 3); ZGRTSSetDistanceToMap(pMap0, 1196, 3); ZGRTSSetDistanceToMap(pMap0, 1197, 3); ZGRTSSetDistanceToMap(pMap0, 1198, 5); ZGRTSSetDistanceToMap(pMap0, 1199, 5); ZGRTSSetDistanceToMap(pMap0, 1200, 3); ZGRTSSetDistanceToMap(pMap0, 1201, 3); ZGRTSSetDistanceToMap(pMap0, 1202, 3); ZGRTSSetDistanceToMap(pMap0, 1203, 3); ZGRTSSetDistanceToMap(pMap0, 1204, 3); ZGRTSSetDistanceToMap(pMap0, 1205, 3); ZGRTSSetDistanceToMap(pMap0, 1206, 3); ZGRTSSetDistanceToMap(pMap0, 1207, 3); ZGRTSSetDistanceToMap(pMap0, 1208, 3); ZGRTSSetDistanceToMap(pMap0, 1209, 3); ZGRTSSetDistanceToMap(pMap0, 1210, 3); ZGRTSSetDistanceToMap(pMap0, 1211, 3); ZGRTSSetDistanceToMap(pMap0, 1212, 3); ZGRTSSetDistanceToMap(pMap0, 1213, 3); ZGRTSSetDistanceToMap(pMap0, 1214, 3); ZGRTSSetDistanceToMap(pMap0, 1215, 3); ZGRTSSetDistanceToMap(pMap0, 1216, 3); ZGRTSSetDistanceToMap(pMap0, 1217, 3); ZGRTSSetDistanceToMap(pMap0, 1218, 3); ZGRTSSetDistanceToMap(pMap0, 1219, 3); ZGRTSSetDistanceToMap(pMap0, 1220, 3); ZGRTSSetDistanceToMap(pMap0, 1221, 3); ZGRTSSetDistanceToMap(pMap0, 1222, 3); ZGRTSSetDistanceToMap(pMap0, 1223, 3); ZGRTSSetDistanceToMap(pMap0, 1224, 3); ZGRTSSetDistanceToMap(pMap0, 1225, 3); ZGRTSSetDistanceToMap(pMap0, 1226, 3); ZGRTSSetDistanceToMap(pMap0, 1227, 3); ZGRTSSetDistanceToMap(pMap0, 1228, 3); ZGRTSSetDistanceToMap(pMap0, 1229, 3); ZGRTSSetDistanceToMap(pMap0, 1230, 3); ZGRTSSetDistanceToMap(pMap0, 1231, 3); ZGRTSSetMap(pMap0, 1232, 1); ZGRTSSetDistanceToMap(pMap0, 1232, 0); ZGRTSSetMap(pMap0, 1233, 1); ZGRTSSetDistanceToMap(pMap0, 1233, 0); ZGRTSSetMap(pMap0, 1234, 1); ZGRTSSetDistanceToMap(pMap0, 1234, 0); ZGRTSSetMap(pMap0, 1235, 1); ZGRTSSetDistanceToMap(pMap0, 1235, 0); ZGRTSSetMap(pMap0, 1236, 1); ZGRTSSetDistanceToMap(pMap0, 1236, 0); ZGRTSSetMap(pMap0, 1237, 1); ZGRTSSetDistanceToMap(pMap0, 1237, 0); ZGRTSSetMap(pMap0, 1238, 1); ZGRTSSetDistanceToMap(pMap0, 1238, 0); ZGRTSSetMap(pMap0, 1239, 1); ZGRTSSetDistanceToMap(pMap0, 1239, 0); ZGRTSSetMap(pMap0, 1240, 1); ZGRTSSetDistanceToMap(pMap0, 1240, 0); ZGRTSSetMap(pMap0, 1241, 1); ZGRTSSetDistanceToMap(pMap0, 1241, 0); ZGRTSSetMap(pMap0, 1242, 1); ZGRTSSetDistanceToMap(pMap0, 1242, 0); ZGRTSSetMap(pMap0, 1243, 1); ZGRTSSetDistanceToMap(pMap0, 1243, 0); ZGRTSSetMap(pMap0, 1244, 1); ZGRTSSetDistanceToMap(pMap0, 1244, 0); ZGRTSSetMap(pMap0, 1245, 1); ZGRTSSetDistanceToMap(pMap0, 1245, 0); ZGRTSSetMap(pMap0, 1246, 1); ZGRTSSetDistanceToMap(pMap0, 1246, 0); ZGRTSSetDistanceToMap(pMap0, 1247, 5); ZGRTSSetDistanceToMap(pMap0, 1248, 5); ZGRTSSetDistanceToMap(pMap0, 1249, 5); LPZGTILEMANAGER pManager0; pManager0 = ZGRTSCreateManager(2048); LPZGTILEMANAGEROBJECT pObject0; pObject0 = ZGRTSCreateObject(1, 1, 0); LPZGTILEOBJECTACTION pAction0; pAction0 = ZGRTSCreateActionActive(1, 0, 2); ZGRTSSetEvaluationToActionActive(pAction0, 10); ZGRTSSetMinEvaluationToActionActive(pAction0, 10); ZGRTSSetMaxEvaluationToActionActive(pAction0, 100); ZGRTSSetMaxDistanceToActionActive(pAction0, 50); ZGRTSSetMaxDepthToActionActive(pAction0, 10); ZGRTSSetSearchLabelToActionActive(pAction0, 3); ZGRTSSetSetLabelToActionActive(pAction0, 3); ZGRTSSetChildToAction(pAction0, pAction0, 0); LPZGTILEOBJECTACTION pAction1; pAction1 = ZGRTSCreateActionNormal(2); ZGRTSSetRangeToActionNormal(pAction1, 10); ZGRTSSetChildToAction(pAction1, pAction0, 0); ZGRTSSetChildToAction(pAction1, pAction1, 1); ZGRTSSetChildToAction(pAction0, pAction1, 1); ZGRTSSetActionToObject(pObject0, pAction0); ZGRTSSetCampToObject(pObject0, 0); ZGRTSSetLabelToObject(pObject0, 2); ZGRTSSetAttributeToObject(pObject0, 3, 100); ZGRTSSetAttributeToObject(pObject0, 0, 1000); ZGRTSSetAttributeToObject(pObject0, 1, 1500); ZGRTSSetAttributeToObject(pObject0, 2, 10); ZGRTSSetDistanceToObject(pObject0, 100); ZGRTSSetRangeToObject(pObject0, 100); ZGRTSSetAttributeToObject(pObject0, 4, 10); ZGRTSSetAttributeToObject(pObject0, 5, 10); ZGRTSSetAttributeToObject(pObject0, 6, 0); ZGRTSSetAttributeToObject(pObject0, 7, 0); ZGRTSUnsetObjectFromMap(pObject0); ZGRTSSetObjectToMap(pObject0, pMap0, 1010); return _CrtDumpMemoryLeaks(); }
ff79fbaa21ee3b37daf0bf9d03dca4e5d9f2c9d5
445471228bda5944592d9cf1052a387152064188
/2015/islands.cpp
91d08baf42c5600bab6684ba3fbe5553347bf77c
[]
no_license
geekpradd/IOITC-2017
a169e46906f624c88205be70936c146930bc2c66
1bbe32e604c8751c5f628da282bbdf35b3b87576
refs/heads/master
2021-01-23T18:59:45.977834
2017-04-15T10:26:12
2017-04-15T10:26:12
83,007,227
3
0
null
null
null
null
UTF-8
C++
false
false
1,314
cpp
islands.cpp
#include <bits/stdc++.h> #define ii pair<int, int> #define edge pair<int, pair<int, int> > #define vi vector<int> using namespace std; // DSU is giving errors. class DSU { private: vi rank, p, s; public: DSU(int N) { rank.assign(N+1, 0); p.assign(N+1, 0); s.assign(N+1, 1); for (int i=1; i<=N; ++i) p[i] = i; } int find(int i){ return ( p[i] == i ? i : (p[i] = find(p[i]))); } int is_same(int i, int j){ return find(i) == find(j); } void unionSet(int i, int j){ if (!is_same(i, j)){ int x = find(i), y = find(j); if (rank[x] > rank[y]) { p[y] = x; s[x] += s[y]; } else { p[x] = y; s[y] += s[x]; if (rank[x] == rank[y]){ rank[y]++; } } } } int size(int i){ return s[find(i)]; } }; signed main(){ int n; cin >> n; vector<edge> e(n-1); for (int i=0; i<n-1; ++i){ int a, b, c; cin >> a >> b >> c; edge cur = edge((-1)*c, ii(a, b)); e[i] = cur; } sort(e.begin(), e.end()); DSU set_union(n); int cost = 0; for (int i=0; i<n-1; ++i){ int weight = (-1)*e[i].first; int a = e[i].second.first, b = e[i].second.second; cost += weight * set_union.size(a) * set_union.size(b); set_union.unionSet(a, b); } cout << cost << endl; return 0; }
508df24a6e66d401313f9e5048cabf625e165c19
644ff46287e3d50e278dc1f1fed35643c7dc32e0
/src/convergence/NetworkStateProbe.hpp
2e70c1a31a88912cf2c319c5e7776db7282aed32
[]
no_license
openwns/wifimac
107a4b2bb794c33294846574109b7f35d6b88621
22fda3f1df5294833a0bcada6ddd3e0cadc7501f
refs/heads/master
2021-01-20T13:48:06.377662
2014-06-29T23:25:19
2014-06-29T23:25:19
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,306
hpp
NetworkStateProbe.hpp
/****************************************************************************** * WiFiMac * * This file is part of openWNS (open Wireless Network Simulator) * _____________________________________________________________________________ * * Copyright (C) 2004-2007 * Chair of Communication Networks (ComNets) * Kopernikusstr. 16, D-52074 Aachen, Germany * phone: ++49-241-80-27910, * fax: ++49-241-80-22242 * email: info@openwns.org * www: http://www.openwns.org * _____________________________________________________________________________ * * openWNS is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License version 2 as published by the * Free Software Foundation; * * openWNS 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 Lesser General Public License for more * details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * ******************************************************************************/ #ifndef WIFIMAC_CONVERGENCE_NETWORKSTATEPROBE_HPP #define WIFIMAC_CONVERGENCE_NETWORKSTATEPROBE_HPP #include <WIFIMAC/convergence/TxDurationSetter.hpp> #include <WNS/ldk/fu/Plain.hpp> #include <WNS/ldk/Processor.hpp> #include <WNS/ldk/Command.hpp> #include <WNS/logger/Logger.hpp> #include <WNS/ldk/probe/Probe.hpp> #include <WNS/probe/bus/ContextCollector.hpp> #include <WNS/probe/bus/ContextProvider.hpp> #include <WNS/events/CanTimeout.hpp> namespace wifimac { namespace convergence { class NetworkStateProbeCommand : public wns::ldk::EmptyCommand { }; /** * @brief Probing the network state from a local point of view */ class NetworkStateProbe: public wns::ldk::fu::Plain<NetworkStateProbe, NetworkStateProbeCommand>, public wns::ldk::Processor<NetworkStateProbe>, public wns::ldk::probe::Probe, public wns::events::CanTimeout { public: NetworkStateProbe(wns::ldk::fun::FUN* fun, const wns::pyconfig::View& config); virtual ~NetworkStateProbe(); private: /** @brief Processor Interface Implementation */ void processIncoming(const wns::ldk::CompoundPtr& compound); void processOutgoing(const wns::ldk::CompoundPtr& compound); /** * @brief canTimeoutInterface to probe tx frames at the end of the * transmission */ void onTimeout(); wns::logger::Logger logger; /** @brief Name of the command that holds the frame duration */ std::string txDurationProviderCommandName; /** @brief Probe the (local) network state */ wns::probe::bus::ContextCollectorPtr localNetworkState; /** @brief Distinguish Rx and Tx */ wns::probe::bus::contextprovider::Variable* isTx; wns::ldk::CompoundPtr curTxCompound; wns::simulator::Time curFrameTxDuration; }; } // ns convergence } // ns wifimac #endif //WIFIMAC_CONVERGENCER_NETWORKSTATEPROBE_HPP
4d333a920f1ab6e88f4cf0736ccba29fba0497d7
1f11848326c7336ec9cbe503753f44bac6321d1e
/b557.cpp
0e1745b5b90e110c5e63c470f855f58614ad46d3
[]
no_license
zxkyjimmy/zerojudge
7b70a937111961da1a84e981adb85eba2d221c5b
c1b2609cb873f64356bf855646e47bafda5be49b
refs/heads/master
2020-04-14T06:56:31.247239
2016-09-26T14:12:50
2016-09-26T14:12:50
68,006,172
0
0
null
null
null
null
UTF-8
C++
false
false
1,233
cpp
b557.cpp
#include <iostream> using namespace std; constexpr int a[52] = { 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48, 51, 54, 57, 60, 5, 10, 15, 20, 25, 30, 35, 7, 14, 21, 28, 8, 16, 24, 32, 40, 9, 18, 11, 12, 24, 13, 16, 20, 40, 60, 28, 33, 36, 39, 48, 65 }; constexpr int b[52] = { 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 68, 72, 76, 80, 12, 24, 36, 48, 60, 72, 84, 24, 48, 72, 96, 15, 30, 45, 60, 75, 40, 80, 60, 35, 70, 84, 63, 21, 42, 63, 45, 56, 77, 80, 55, 72 }; constexpr int c[52] = { 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95,100, 13, 26, 39, 52, 65, 78, 91, 25, 50, 75,100, 17, 34, 51, 68, 85, 41, 82, 61, 37, 74, 85, 65, 29, 58, 87, 53, 65, 85, 89, 73, 97 }; int main() { int t, n, d, result; cin >> t; while(t--) { cin >> n; int num[101] = {0}; while(n--) { cin >> d; num[d]++; } result = 0; for(int i = 0; i < 52; i++) { result += num[a[i]]*num[b[i]]*num[c[i]]; } cout << result << endl; } return 0; }
2ac9bc6aaa26d01ac90e39e70fd7d9c0804cd42b
5148fa0353d516be3ea0d7cc47020e807293e20d
/Mixed Defect Distribution Table 4/pattern_for_table4.cpp
c36a97618b7edc71d1d3cf8ae183508279ff8577
[]
no_license
daku5768/Pre-Bond-TSV-s-Defects
84fda301f2aeb245ceb10183646e55bdf9d47cc3
6c958b7e65e9c0d79d4b9e3b27fa46baaa933a34
refs/heads/master
2022-12-19T10:37:49.301308
2020-09-20T02:36:39
2020-09-20T02:36:39
296,985,985
0
0
null
null
null
null
UTF-8
C++
false
false
2,375
cpp
pattern_for_table4.cpp
#include<bits/stdc++.h> using namespace std; int rm,clus; vector<vector<int> >v; void get(int n) { int cases=10; while(cases--) { int r=n/4,c=4; v.clear(); v.resize(r,vector<int>(c,1)); int u=rand()%n; int x=u/4,y=u%4; v[x][y]=0; deque<pair<int,int> >q; q.push_front({x,y}); int i=0; while(i<clus-1) { pair<int,int>zz=q.front(); q.pop_front(); q.push_back(zz); x=zz.first; y=zz.second; int dx[4]={1,-1,0,0}; int dy[4]={0,0,1,-1}; int d1=rand()%4; int i1=x+dx[d1]; int j1=y+dy[d1]; if(i1>=0&&j1>=0&&i1<r&&j1<c&&v[i1][j1]==1) { v[i1][j1]=0; bool l=true,r=true,u=true,d=true; if(j1-1<0) l=false; else if(v[i1][j1-1]==0) l=false; if(j1+1>=c) r=false; else if(v[i1][j1+1]==0) r=false; if(i1-1<0) u=false; else if(v[i1-1][j1]==0) u=false; if(i1+1>=r) d=false; else if(v[i1+1][j1]==0) d=false; if(l||r||u||d) q.push_back({i1,j1}); i+=1; } } i=0; while(i<rm) { int f=rand()%n; int i1=f/4; int j1=f%4; if(v[i1][j1]==0) continue; bool up=true,down=true,left=true,right=true; if(i1-1>=0&&v[i1-1][j1]==0) up=false; if(i1+1<r&&v[i1+1][j1]==0) down=false; if(j1-1>=0&&v[i1][j1-1]==0) left=false; if(j1+1<c&&v[i1][j1+1]==0) right=false; if(up&&down&&left&&right) { v[i1][j1]=0; i+=1; } } for(i=0;i<r;i++) { for(int j=0;j<c;j++) cout<<v[i][j]<<" "; cout<<endl; } cout<<"----------------------"<<endl; v.clear(); } } int main() { int n; cout<<"Enter total no of tsv's"<<endl; cin>>n; cout<<"Enter no of tsv in random defects"<<endl; cin>>rm; cout<<"Enter no of tsvs in clutered defects"<<endl; cin>>clus; srand(time(NULL)); get(n); }
b3c19c93ce9301e9fea2ed0714eaeb806bff3f1f
21cfdb72128ed53059928711a11e41604d1e7955
/src/NoiseModifier.h
220cd37195ca6932fbf4e7171fde4c2f77acafdb
[]
no_license
Saqoosha/BokehParticles
ed03f5fd3b8f730f4924df0ea8f52f27a7e4cedf
4b811ef3a5aec4af60e18331ab48c8d957782553
refs/heads/master
2021-01-01T17:01:11.294014
2012-11-08T03:34:40
2012-11-08T03:34:40
4,388,795
9
0
null
null
null
null
UTF-8
C++
false
false
1,425
h
NoiseModifier.h
// // NoiseModifier.h // Particles3 // // Created by Saqoosha on 12/05/06. // Copyright (c) 2012 Saqoosha. All rights reserved. // #pragma once #include "SPK.h" #include "MSAPerlin.h" namespace SPK { class NoiseModifier : public Modifier { SPK_IMPLEMENT_REGISTERABLE(NoiseModifier) public: NoiseModifier() : Modifier(ALWAYS | INSIDE_ZONE | OUTSIDE_ZONE, ALWAYS, false, false), size_(100), scroll_speed_(1), power_(20) { perlin_ = new MSA::Perlin(); }; static inline NoiseModifier* create() { NoiseModifier* obj = new NoiseModifier(); registerObject(obj); return obj; }; float get_size() { return size_; }; void set_size(float size) { size_ = size; }; float get_scroll_speed() { return scroll_speed_; }; void set_scroll_speed(float scroll_speed) { scroll_speed_ = scroll_speed; }; float get_power() { return power_; }; void set_power(float power) { power_ = power; }; protected: MSA::Perlin *perlin_; private: void modify(Particle& particle,float deltaTime) const { Vector3D pos = particle.position() / size_; float p = ofGetElapsedTimef() / 20. * scroll_speed_;; float fx = perlin_->get(p, pos.y, pos.z); float fy = perlin_->get(pos.x, p, pos.z); float fz = perlin_->get(pos.x, pos.y, p); particle.velocity() += Vector3D(fx, fy, fz) * power_; }; float size_; float scroll_speed_; float power_; }; }
44d0190911ee610250c570fe2e833deccc68da25
f0dd69ad489452be667e1a2e5595f61c1824b495
/projects/biogears/libBiogears/src/io/cdm/EngineConfiguration.h
eea7c66a861a1c973690515477b26efbb66d80e8
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
BioGearsEngine/core
0944a4e3fc8fb74c18cc1738497ee83870f5283c
24283f78756c2dc615d8819f38dc01fd86434c28
refs/heads/trunk
2023-09-01T01:29:53.662872
2023-07-18T19:37:37
2023-07-18T19:37:37
132,644,612
54
54
Apache-2.0
2023-09-05T14:25:47
2018-05-08T17:47:30
C++
UTF-8
C++
false
false
4,510
h
EngineConfiguration.h
/************************************************************************************** Copyright 2019 Applied Research Associates, Inc. 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. **************************************************************************************/ #pragma once #include <memory> #include "biogears/cdm/CommonDataModel.h" #include <biogears/exports.h> #include <biogears/schema/cdm/EngineConfiguration.hxx> #include <type_traits> namespace biogears { class PhysiologyEngineConfiguration; class PhysiologyEngineStabilization; class PhysiologyEngineTimedStabilization; class PhysiologyEngineTimedConditionStabilization; class PhysiologyEngineDynamicStabilization; class PhysiologyEngineDynamicStabilizationCriteria; class PhysiologyEngineTimedStabilizationCriteria; #define CDM_ENGINE_CONFIGURATION_UNMARSHAL_HELPER(xsd, func) \ if (m_##func) { \ xsd.func(std::make_unique<std::remove_reference<decltype(xsd.func())>::type>()); \ io::Property::UnMarshall(*m_##func, xsd.func()); \ } namespace io { class BIOGEARS_PRIVATE_API EngineConfiguration { public: //template <typename SE, typename XSD> option template <typename SE, typename XSD> static void Marshall(xsd::cxx::tree::optional<XSD> const& option_in, SE& out); template <typename SE, typename XSD> static void UnMarshall(const SE& in, xsd::cxx::tree::optional<XSD>& option_out); //class PhysiologyEngineConfiguration static void Marshall(const CDM::PhysiologyEngineConfigurationData& in, PhysiologyEngineConfiguration& out); static void UnMarshall(const PhysiologyEngineConfiguration& in, CDM::PhysiologyEngineConfigurationData& out); //class PhysiologyEngineStabilization static void Marshall(const CDM::PhysiologyEngineStabilizationData& in, PhysiologyEngineStabilization& out); static void UnMarshall(const PhysiologyEngineStabilization& in, CDM::PhysiologyEngineStabilizationData& out); //class PhysiologyEngineTimedStabilization static void Marshall(const CDM::PhysiologyEngineTimedStabilizationData& in, PhysiologyEngineTimedStabilization& out); static void UnMarshall(const PhysiologyEngineTimedStabilization& in, CDM::PhysiologyEngineTimedStabilizationData& out); //class PhysiologyEngineTimedConditionStabilization static void Marshall(const CDM::PhysiologyEngineTimedConditionStabilizationData& in, PhysiologyEngineTimedStabilizationCriteria& out); static void UnMarshall(const PhysiologyEngineTimedStabilizationCriteria& in, CDM::PhysiologyEngineTimedConditionStabilizationData& out); //class PhysiologyEngineDynamicStabilization static void Marshall(const CDM::PhysiologyEngineDynamicStabilizationData& in, PhysiologyEngineDynamicStabilization& out); static void UnMarshall(const PhysiologyEngineDynamicStabilization& in, CDM::PhysiologyEngineDynamicStabilizationData& out); //class PhysiologyEngineDynamicStabilizationCriteria static void Marshall(const CDM::PhysiologyEngineDynamicStabilizationCriteriaData& in, PhysiologyEngineDynamicStabilizationCriteria& out); static void UnMarshall(const PhysiologyEngineDynamicStabilizationCriteria& in, CDM::PhysiologyEngineDynamicStabilizationCriteriaData& out); }; //---------------------------------------------------------------------------------- template <typename SE, typename XSD> void EngineConfiguration::Marshall(xsd::cxx::tree::optional<XSD> const& option_in, SE& out) { if (!option_in.present()) { out.Clear(); } else { Marshall(option_in.get(), out); } } //---------------------------------------------------------------------------------- template <typename SE, typename XSD> void EngineConfiguration::UnMarshall(const SE& in, xsd::cxx::tree::optional<XSD>& option_out) { auto item = std::make_unique<XSD>(); UnMarshall(in, *item); option_out.set(*item); } } // Namespace IO } //Namespace Biogears
e20487d75f60381e4ce9cb1136b986557005ec8d
db52cc233dde8e10ac8046d285b4029435e8b812
/Paramecia.cpp
67a327aa3304d3fa5aa290b1a3729284e5ffb012
[]
no_license
Andrew22674/AndreV-examen2
d3d9cffb7b544e65a9f9f3f3d0cd3c7d8b26a391
82bfe8cdc7a0d2a2b491e39389d3a68f6ac09c4f
refs/heads/master
2021-01-23T03:35:12.446573
2017-03-25T01:18:18
2017-03-25T01:18:18
86,103,648
0
0
null
null
null
null
UTF-8
C++
false
false
256
cpp
Paramecia.cpp
#include "Paramecia.h" Paramecia::Paramecia(){ } Paramecia::Paramecia(string nombre, string descripcion) : FrutaDD(nombre){ this -> descripcion = descripcion; } string Paramecia::getDescripcion(){ return descripcion; } Paramecia::~Paramecia(){ }
df0bd519893c40f4666829238556f5a84a33a168
11972db1e18c6ded35989769bc7dc2b3faa04477
/task2/task2.cc
3f810ce08526836dbfbe0eed53a09038bfd28091
[]
no_license
swordfeng/algorithm-pj
985f7e7b8d9b89b4df076343c3fb7e2d0f9dcddc
a6764ee77249cdc16df2ba644aae40bbb3199a16
refs/heads/master
2021-01-21T14:34:02.531260
2017-06-24T15:42:44
2017-06-24T15:42:44
95,306,374
0
0
null
null
null
null
UTF-8
C++
false
false
9,256
cc
task2.cc
#include <cstdio> #include <iostream> #include <string> #include <vector> #include <memory> #include <unordered_map> using namespace std; enum OP { INS = 0, SUB = 1, DEL = 2 }; const int NODELEN = 10000; struct Log; extern const shared_ptr<Log> nil; struct Log { OP op; int x; char c; shared_ptr<Log> last; Log(): x(0), c(0), last(nil) {} Log(OP op, int x, char c, shared_ptr<Log> last): op(op), x(x), c(c), last(last) {} void print(); void doo(vector<string> &list); }; const shared_ptr<Log> nil = make_shared<Log>(); const Log *LOG_NIL = nil.get(); void Log::print() { if (this != LOG_NIL) { last->print(); switch (op) { case INS: printf("INS %d %c\n", x, c); break; case SUB: printf("SUB %d %c\n", x, c); break; case DEL: printf("DEL %d\n", x); break; } } } void Log::doo(vector<string> &list) { if (this == LOG_NIL) return; string &orig = list[x]; switch (op) { case INS: orig = string(1, c) + orig; break; case SUB: orig[orig.size()-1] = c; break; case DEL: orig.pop_back(); break; } last->doo(list); } vector<string> conv(string s) { vector<string> r(s.size()+1); for (int i = 0; i < s.size(); i++) r[i] = string(1, s[i]); return r; } string unconv(vector<string> r) { string s; for (string &ss : r) s += ss; return s; } shared_ptr<Log> ins(int x, char c, shared_ptr<Log> last) { return make_shared<Log>(INS, x, c, last); } shared_ptr<Log> sub(int x, char c, shared_ptr<Log> last) { return make_shared<Log>(SUB, x, c, last); } shared_ptr<Log> del(int x, shared_ptr<Log> last) { return make_shared<Log>(DEL, x, 0, last); } struct PreWorkState { shared_ptr<Log> log; int times; }; void updatePreWork(int j, int i); struct Node { shared_ptr<Log> log; int times; // prework vector<PreWorkState> preWork; }; string a; vector<int> graph[NODELEN], prevgraph[NODELEN]; string s[NODELEN]; int n; int k; Node nodes[NODELEN], newnodes[NODELEN]; int doWork() { vector<int> nodeseq(n), nodeseqNext, pending, pendingNext; nodeseqNext.reserve(n); pending.reserve(n); pendingNext.reserve(n); vector<bool> marked(n); // init for (int j = 0; j < n; j++) { nodeseq[j] = j; nodes[j].preWork.resize(k + 1); updatePreWork(j, 0); nodes[j].times = nodes[j].preWork[k].times; nodes[j].log = nodes[j].preWork[k].log; newnodes[j].times = -1; } // work for (int i = 1; i <= a.size(); i++) { if (i % 100 == 0) fprintf(stderr, "%d\n", i); int pn = nodes[nodeseq[0]].times; for (int j : nodeseq) { // flush queue int p = nodes[j].times; if (p > pn + 1) { nodeseqNext.insert(nodeseqNext.end(), pending.begin(), pending.end()); pending.resize(0); nodeseqNext.insert(nodeseqNext.end(), pendingNext.begin(), pendingNext.end()); pendingNext.resize(0); } else if (p == pn + 1) { nodeseqNext.insert(nodeseqNext.end(), pending.begin(), pending.end()); swap(pending, pendingNext); pendingNext.resize(0); } pn = p; // prework updatePreWork(j, i); if (nodes[j].preWork.size() > 0) { if (newnodes[j].times == -1 || nodes[j].preWork[k].times < newnodes[j].times) { newnodes[j].times = nodes[j].preWork[k].times; newnodes[j].log = nodes[j].preWork[k].log; } if (nodes[j].preWork[k].times == i - k) { // must DEL (i-k) times and this is the real time, so all ops are DEL // then we confirm that more operations are all DEL, so we do not need them nodes[j].preWork.resize(0); nodes[j].preWork.shrink_to_fit(); } } // del if (newnodes[j].times == -1 || nodes[j].times + 1 <= newnodes[j].times) { newnodes[j].times = nodes[j].times + 1; newnodes[j].log = del(i-1, nodes[j].log); } // same if (a[i-1] == s[j][k-1]) { for (int l : prevgraph[j]) { if (nodes[l].times < newnodes[j].times) { newnodes[j].times = nodes[l].times; newnodes[j].log = nodes[l].log; } } } else { // sub for (int l : prevgraph[j]) { if (nodes[l].times + 1 < newnodes[j].times) { newnodes[j].times = nodes[l].times + 1; newnodes[j].log = sub(i-1, s[j][k-1], nodes[l].log); } } } // add node back to seq if (newnodes[j].times < p) { // max is (p-1), or it must be incorrect nodeseqNext.push_back(j); } else if (newnodes[j].times == p) { pending.push_back(j); } else { // newnodes[j].times == p + 1 pendingNext.push_back(j); } } // save back! nodeseq.resize(0); nodeseq.insert(nodeseq.end(), nodeseqNext.begin(), nodeseqNext.end()); nodeseq.insert(nodeseq.end(), pending.begin(), pending.end()); nodeseq.insert(nodeseq.end(), pendingNext.begin(), pendingNext.end()); nodeseqNext.resize(0); pending.resize(0); pendingNext.resize(0); int pseq = 0; auto pend = pending.begin(); for (int j = 0; j < n; j++) marked[j] = false; while (pseq < n) { while (pseq < n && marked[nodeseq[pseq]]) pseq++; if (pseq == n) break; int j = nodeseq[pseq]; if (pend != pending.end() && newnodes[*pend].times < newnodes[j].times) { j = *pend++; } else { pseq++; } nodeseqNext.push_back(j); // ins // it must be correct beacuse all nodes that has less than p dist has already been processed for (int g : graph[j]) { if (newnodes[j].times + 1 < newnodes[g].times) { newnodes[g].times = newnodes[j].times + 1; newnodes[g].log = ins(i, s[g][k-1], newnodes[j].log); pending.push_back(g); marked[g] = true; } } } // save back! nodeseq.resize(0); nodeseq.insert(nodeseq.end(), nodeseqNext.begin(), nodeseqNext.end()); nodeseq.insert(nodeseq.end(), pend, pending.end()); nodeseqNext.resize(0); pending.resize(0); for (int j = 0; j < n; j++) { nodes[j].times = newnodes[j].times; nodes[j].log = newnodes[j].log; newnodes[j].times = -1; newnodes[j].log = nil; } } return nodeseq[0]; } void updatePreWork(int j, int i) { if (nodes[j].preWork.size() == 0) { return; } auto &preWork = nodes[j].preWork; if (i == 0) { preWork[0].times = 0; preWork[0].log = nil; for (int t = 1; t <= k; t++) { preWork[t].times = preWork[t-1].times + 1; preWork[t].log = ins(0, s[j][t-1], preWork[t-1].log); } } else { for (int t = k; t > 0; t--) { if (a[i-1] == s[j][t-1]) { preWork[t].times = preWork[t-1].times; preWork[t].log = preWork[t-1].log; } else if (preWork[t-1].times <= preWork[t].times) { preWork[t].times = preWork[t-1].times + 1; preWork[t].log = sub(i-1, s[j][t-1], preWork[t-1].log); } else { preWork[t].times++; preWork[t].log = del(i-1, preWork[t].log); } } preWork[0].times++; preWork[0].log = del(i-1, preWork[0].log); for (int t = 1; t <= k; t++) { if (preWork[t-1].times + 1 <= preWork[t].times) { preWork[t].times = preWork[t-1].times + 1; preWork[t].log = ins(i, s[j][t-1], preWork[t-1].log); } } } } void addEdge(int i, int j); void makeGraph(); int main() { cin >> a >> n; for (int i = 0; i < n; i++) { cin >> s[i]; } k = s[0].size(); makeGraph(); int j = doWork(); auto list = conv(a); nodes[j].log->doo(list); printf("%s\n", unconv(list).c_str()); printf("%d\n", nodes[j].times); nodes[j].log->print(); return 0; } void makeGraph() { unordered_map<string, vector<int>> t; for (int i = 0; i < n; i++) { string key = s[i].substr(0, k-1); t[key].push_back(i); } for (int i = 0; i < n; i++) { string key = s[i].substr(1); for (int j : t[key]) { addEdge(i, j); } } } void addEdge(int i, int j) { graph[i].push_back(j); prevgraph[j].push_back(i); }
9313abdbf0cd4db56b49cdefa880dabd960bc6f5
6691bd2a31b68a2edd899ab74f130b85680efd6c
/sound.cpp
856f5b97a97822fdef625b50b7fd106d9d398c89
[]
no_license
Suzuki01/RhythmGame
301f82defc736ee6249dfaa126771a45354177db
abe1c6c04008a6b99656e0a9ff3164caecf930ae
refs/heads/master
2020-06-18T15:08:18.154305
2019-09-08T04:42:00
2019-09-08T04:42:00
196,341,507
1
0
null
2019-09-08T04:42:00
2019-07-11T07:21:47
C++
SHIFT_JIS
C++
false
false
3,645
cpp
sound.cpp
#include "main.h" #include "sound.h" LPBYTE Sound::m_lpWaveData = NULL; HWAVEOUT Sound::m_hwo = NULL; WAVEHDR Sound::m_wh = { 0 }; WAVEFORMATEX Sound::m_wf = { 0 }; float Sound::m_dwSecond = 0; float time = 0; MMTIME Sound::m_mmt = { 0 }; int Sound::m_bpm = 0; int Sound::m_playLength = 0; typedef struct { char* song; int bpm; }SongData; SongData data[] = { {{"asset/sound/kurumiwari_ningyou.wav"},144 }, {{"asset/sound/tengokuto_jigoku.wav"},83}, }; BOOL Sound::Init(int id) { DWORD dwDataSize; m_bpm = data[id].bpm; if (!ReadWaveFile((LPTSTR)TEXT(data[id].song), &m_wf, &m_lpWaveData, &dwDataSize)) return -1; if (waveOutOpen(&m_hwo, WAVE_MAPPER, &m_wf, 0, 0, CALLBACK_NULL) != MMSYSERR_NOERROR) { MessageBox(NULL, TEXT("WAVEデバイスのオープンに失敗しました。"), NULL, MB_ICONWARNING); return -1; } //waveOutSetVolume(m_hwo,900); m_wh.lpData = (LPSTR)m_lpWaveData; m_wh.dwBufferLength = dwDataSize; m_wh.dwFlags = 0; waveOutPrepareHeader(m_hwo, &m_wh, sizeof(WAVEHDR)); m_playLength = m_wh.dwBufferLength / m_wf.nBlockAlign; } void Sound::UnInit() { if (m_hwo != NULL) { waveOutReset(m_hwo); waveOutUnprepareHeader(m_hwo, &m_wh, sizeof(WAVEHDR)); waveOutClose(m_hwo); } if (m_lpWaveData != NULL) HeapFree(GetProcessHeap(), 0, m_lpWaveData); } void Sound::Update() { m_mmt.wType = TIME_SAMPLES; waveOutGetPosition(m_hwo, &m_mmt, sizeof(MMTIME)); // m_dwSecond = (float)m_mmt.u.cb / (float)m_wf.nSamplesPerSec; //cb今流してるサンプリングデータの番号 wf.nSam 一秒間に何サンプリング } BOOL Sound::ReadWaveFile(LPTSTR lpszFileName, LPWAVEFORMATEX lpwf, LPBYTE* lplpData, LPDWORD lpdwDataSize) { HMMIO hmmio; MMCKINFO mmckRiff; MMCKINFO mmckFmt; MMCKINFO mmckData; LPBYTE lpData; hmmio = mmioOpen(lpszFileName, NULL, MMIO_READ); if (hmmio == NULL) { MessageBox(NULL, TEXT("ファイルのオープンに失敗しました。"), NULL, MB_ICONWARNING); return FALSE; } mmckRiff.fccType = mmioStringToFOURCC(TEXT("WAVE"), 0); if (mmioDescend(hmmio, &mmckRiff, NULL, MMIO_FINDRIFF) != MMSYSERR_NOERROR) { MessageBox(NULL, TEXT("WAVEファイルではありません。"), NULL, MB_ICONWARNING); mmioClose(hmmio, 0); return FALSE; } mmckFmt.ckid = mmioStringToFOURCC(TEXT("fmt "), 0); if (mmioDescend(hmmio, &mmckFmt, NULL, MMIO_FINDCHUNK) != MMSYSERR_NOERROR) { mmioClose(hmmio, 0); return FALSE; } mmioRead(hmmio, (HPSTR)lpwf, mmckFmt.cksize); mmioAscend(hmmio, &mmckFmt, 0); if (lpwf->wFormatTag != WAVE_FORMAT_PCM) { MessageBox(NULL, TEXT("PCMデータではありません。"), NULL, MB_ICONWARNING); mmioClose(hmmio, 0); return FALSE; } mmckData.ckid = mmioStringToFOURCC(TEXT("data"), 0); if (mmioDescend(hmmio, &mmckData, NULL, MMIO_FINDCHUNK) != MMSYSERR_NOERROR) { mmioClose(hmmio, 0); return FALSE; } lpData = (LPBYTE)HeapAlloc(GetProcessHeap(), 0, mmckData.cksize); mmioRead(hmmio, (HPSTR)lpData, mmckData.cksize); mmioAscend(hmmio, &mmckData, 0); mmioAscend(hmmio, &mmckRiff, 0); mmioClose(hmmio, 0); *lplpData = lpData; *lpdwDataSize = mmckData.cksize; return TRUE; } void Sound::Start() { waveOutWrite(m_hwo, &m_wh, sizeof(WAVEHDR)); } float Sound::GetTime() { return m_dwSecond; } int Sound::GetSamplingNumber() { return (int)m_mmt.u.cb; } DWORD Sound::GetCurrentSamplingPerSec() { return m_wf.nSamplesPerSec; } float Sound::GetCurrentBeats() { return (float)m_mmt.u.cb / ((float)m_wf.nSamplesPerSec * 60.0f / (float)m_bpm); } void Sound::Reset() { waveOutRestart(m_hwo); waveOutReset(m_hwo); } int Sound::GetSongSize() { return m_playLength; }
736a4ea0591d61dc60036f99c15daf873a6e796a
d7b7dcec797f3294b1de671d1f84e354c93a1308
/blast/include/shared/NvFoundation/Nv.h
14ea7ab8b9df3eb8c0947643e3e0bb7ad6afb546
[ "BSD-3-Clause" ]
permissive
NVIDIA-Omniverse/PhysX
c93ed4287a57d51fda56798b5fae8aaa65cdfa13
e8c8deb2d548dc635db4f61083ea0e745c0102a0
refs/heads/main
2023-08-16T14:46:51.919670
2023-07-25T17:22:31
2023-07-25T17:22:31
545,381,143
1,814
216
BSD-3-Clause
2023-08-28T19:47:10
2022-10-04T09:07:32
C++
UTF-8
C++
false
false
2,601
h
Nv.h
// 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 NVIDIA CORPORATION 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 ''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 OWNER 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. // // Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. // Copyright (c) 2004-2023 AGEIA Technologies, Inc. All rights reserved. // Copyright (c) 2001-2023 NovodeX AG. All rights reserved. #ifndef NV_NVFOUNDATION_NV_H #define NV_NVFOUNDATION_NV_H /** \addtogroup foundation @{ */ #include "NvSimpleTypes.h" /** files to always include */ #include <string.h> #include <stdlib.h> #if !NV_DOXYGEN namespace nvidia { #endif class NvAllocatorCallback; class NvErrorCallback; struct NvErrorCode; class NvAssertHandler; class NvInputStream; class NvInputData; class NvOutputStream; class NvVec2; class NvVec3; class NvVec4; class NvMat33; class NvMat44; class NvPlane; class NvQuat; class NvTransform; class NvBounds3; /** enum for empty constructor tag*/ enum NvEMPTY { NvEmpty }; /** enum for zero constructor tag for vectors and matrices */ enum NvZERO { NvZero }; /** enum for identity constructor flag for quaternions, transforms, and matrices */ enum NvIDENTITY { NvIdentity }; #if !NV_DOXYGEN } // namespace nvidia #endif /** @} */ #endif // #ifndef NV_NVFOUNDATION_NV_H
4006821b84236fd5e65ce6182e3a5df79b5cd070
8a7573fb9cb0d0ec2d6feb61dce607a991016a4c
/src/Color.h
f7cda00e0a2f6b2867559341b392f1ce67186669
[]
no_license
iwasz/led-table
50325c132bfc2b367405392e38b1b9a8a50649dd
ad126fefd7789c9197de39be17af9a1a22e188e9
refs/heads/master
2021-05-20T11:53:28.028261
2020-12-28T17:45:08
2020-12-28T17:45:08
252,284,167
2
0
null
null
null
null
UTF-8
C++
false
false
2,003
h
Color.h
/**************************************************************************** * * * Author : lukasz.iwaszkiewicz@gmail.com * * ~~~~~~~~ * * License : see COPYING file for details. * * ~~~~~~~~~ * ****************************************************************************/ #pragma once #ifdef WITH_EMULATOR #include <SFML/Graphics.hpp> #endif #include <cstdint> namespace le { struct Color { uint8_t r{}; uint8_t g{}; uint8_t b{}; #ifdef WITH_EMULATOR operator ::sf::Color () const { return {r, g, b}; } #endif }; inline Color fromBGR565 (uint16_t c) { c = __builtin_bswap16 (c); // return {uint8_t ((c >> 11) << 3), uint8_t (((c & 0x11111100000) >> 5) << 2), uint8_t ((c & 0b11111) << 3)}; // return {uint8_t (((c >> 11) & 0b11111) << 3), uint8_t (((c >> 5) & 0x111111) << 2), uint8_t ((c & 0b11111) << 3)}; return {uint8_t (((c >> 11) & 0b11111) << 3), uint8_t (((c >> 5) & 0x111111) << 2), uint8_t ((c & 0b11111) << 3)}; } static constexpr Color BLACK{0, 0, 0}; static constexpr Color WHITE{255, 255, 255}; static constexpr Color LIGHT_GRAY{224, 224, 224}; static constexpr Color GRAY{128, 128, 128}; static constexpr Color DARK_GRAY{64, 64, 64}; static constexpr Color RED{255, 0, 0}; static constexpr Color PINK{255, 96, 208}; static constexpr Color PURPLE{160, 32, 255}; static constexpr Color LIGHT_BLUE{80, 208, 255}; static constexpr Color BLUE{0, 0, 255}; static constexpr Color LIGHT_GREEN{96, 255, 128}; static constexpr Color GREEN{0, 255, 0}; static constexpr Color YELLOW{255, 224, 32}; static constexpr Color ORANGE{255, 160, 16}; static constexpr Color BROWN{160, 128, 96}; static constexpr Color PALE_PINK{255, 208, 160}; } // namespace le
6d8870df0c5afdcc2ed8a2a1ccf8158ad5a60f6f
6fcb0b20e79076e550310b3577ef7098db00aebe
/OpenCL/CLGoL.hpp
cf57e394a74d2ce456858cdf9507faa00474da84
[]
no_license
PalomaPG/GPU-T2
908a8894d79c4f6d2eeb127c1b4457253184d096
38d8504b2885a8f1b2470176184699ed1b7f2146
refs/heads/master
2021-09-09T18:33:08.261247
2018-03-18T22:27:05
2018-03-18T22:27:05
125,772,761
0
0
null
null
null
null
UTF-8
C++
false
false
689
hpp
CLGoL.hpp
#define __CL_ENABLE_EXCEPTIONS #include <cstdlib> #include <ctime> #include <cstdio> #include <CL/cl.hpp> #include <iostream> #include <fstream> #include <vector> #include <math.h> using namespace std; class CLGoL { private: int* grid; size_t bytes; cl::Buffer inputGrid; cl::Buffer outputGrid; cl::Buffer d_width; cl::Buffer d_height; cl_int err; // Enqueue kernel cl::CommandQueue queue; cl::Kernel kernel; cl::Event event; int width; int height; public: CLGoL(const int w, const int h); ~CLGoL(); void readMemory(); void writeMemory(); void randomInit(const double probability = 0.4); void iterate(); int organismAt(const int x, const int y); };
7bf5d7070f86bb8cdb22f264e82e3f5402bd67a6
7f2255fd0fce35a14556dda32ff06113c83b2e88
/洛谷/P1569(2).cpp
b6c0040e6e3f6c669d47e1fb71890868ba556a8d
[]
no_license
cordercorder/ProgrammingCompetionCareer
c54e2c35c64a1a5fd45fc1e86ddfe5b72ab0cb01
acc27440d3a9643d06bfbfc130958b1a38970f0a
refs/heads/master
2023-08-16T18:21:27.520885
2023-08-13T15:13:44
2023-08-13T15:13:44
225,124,408
3
0
null
null
null
null
UTF-8
C++
false
false
2,354
cpp
P1569(2).cpp
#include<bits/stdc++.h> using namespace std; #define FC ios::sync_with_stdio(false),cin.tie(0),cout.tie(0) #define deb(args...) std::cerr<<"DEBUG------"<<'\n';std::cerr<<#args<<"------>";err(args) void err(){ std::cerr<<'\n'<<"END OF DEBUG"<<'\n'<<'\n'; } template<typename T,typename... Args> void err(T a,Args... args){ std::cerr<<a<<", "; err(args...); } template<template<typename...> class T,typename t,typename... Args> void err(T<t> a, Args... args){ for(auto x: a){ std::cerr<<x<<", "; } err(args...); } const long double PI=acos(-1.0); const long double eps=1e-6; using ll=long long; using ull=unsigned long long; using pii=pair<int,int>; /*head------[@cordercorder]*/ const int maxn=1010; const int inf=(int)1e9; int a[maxn],n,sum[maxn],f[maxn]; int T[maxn<<2]; void create(int rt,int l,int r){ T[rt]=-inf; if(l==r){ return ; } int mid=(l+r)>>1; create(rt<<1,l,mid); create(rt<<1|1,mid+1,r); } int query(int rt,int l,int r,int L,int R){ if(l==L&&R==r) return T[rt]; int mid=(l+r)>>1; if(R<=mid) return query(rt<<1,l,mid,L,R); else if(L>mid) return query(rt<<1|1,mid+1,r,L,R); else return max(query(rt<<1,l,mid,L,mid),query(rt<<1|1,mid+1,r,mid+1,R)); } void upd(int rt,int l,int r,int pos,int val){ if(l==r){ T[rt]=val; return ; } int mid=(l+r)>>1; if(pos<=mid) upd(rt<<1,l,mid,pos,val); else upd(rt<<1|1,mid+1,r,pos,val); T[rt]=max(T[rt<<1],T[rt<<1|1]); } void solve(){ vector<int> id; id.push_back(0); for(int i=1;i<=n;i++){ sum[i]=sum[i-1]+a[i]; id.push_back(sum[i]); } if(sum[n]<0){ puts("Impossible"); return ; } create(1,1,n+1); sort(id.begin(),id.end()); id.erase(unique(id.begin(),id.end()),id.end()); int pos,tmp; pos=lower_bound(id.begin(),id.end(),0)-id.begin()+1; upd(1,1,n+1,pos,0); for(int i=1;i<=n;i++){ pos=lower_bound(id.begin(),id.end(),sum[i])-id.begin()+1; tmp=query(1,1,n+1,1,pos); if(tmp==-inf) continue; f[i]=tmp+1; upd(1,1,n+1,pos,f[i]); } printf("%d\n",f[n]); } int main(void){ scanf("%d",&n); for(int i=1;i<=n;i++){ scanf("%d",&a[i]); } solve(); return 0; }
49713aff30ca9f78f6201c108c86b8a589b14b64
d07a66c8eee1a518275870967b02c88e6fb3f918
/Roguelike/Game/Floor.h
f3c45a01ccf2840beec75d3fe4ea270e3241fd84
[]
no_license
Troy8878/RougeBot
ce6f6cbe7d0268e787415b0e2fab328ab438fa5a
bb6dc18f435b8976f2a039b479a39f630fd87af1
refs/heads/master
2022-07-09T16:36:28.134837
2019-06-21T10:40:04
2019-06-21T10:40:04
192,719,590
0
0
null
2022-06-22T21:09:57
2019-06-19T11:31:50
C
WINDOWS-1252
C++
false
false
2,895
h
Floor.h
/********************************* * Floor.h * Avi Whitten-Vile * Created 2014/09/08 * Copyright © 2014 DigiPen Institute of Technology, All Rights Reserved *********************************/ #pragma once #include "Engine/Common.h" enum class TileType { Floor = 0, Wall = 1, Enemy = 2, BorkWall = 3, PlayerStart = 4, ItemSpawn = 5, Stairs = 6, }; // The generator pattern is designed for ruby interfaces. __interface Generator { mrb_value Generate(mrb_state *mrb, mrb_value options); }; class RoomGenerator final : public Generator { public: mrb_value Generate(mrb_state *mrb, mrb_value options) override; private: struct GEN_RECT { size_t left, top, right, bottom; PROPERTY(get = _Area) size_t area; GEN_RECT RandomSubrect(double approxarea); template <typename TileAtFunc> void CarveMap(TileAtFunc&& TileAt); size_t _Area() const { return (right - left) * (bottom - top); } }; mrb_int Width; mrb_int Height; mrb_int WidthMin, WidthMax; mrb_int HeightMin, HeightMax; PROPERTY(get = _RandWidth) size_t RandWidth; PROPERTY(get = _RandHeight) size_t RandHeight; size_t MapTiles; mrb_int *Map; inline mrb_int &TileAt(size_t x, size_t y) { return *(Map + (y * Width) + x); } mrb_int PlayerX, PlayerY; mrb_bool MapBroken = false; void MakeMap(); void MakeRow(const GEN_RECT rect); void MakeRoom(const GEN_RECT rect); void MakeHorizHalls(const GEN_RECT rect); void MakeVertHalls(); bool MakeHorizHall(size_t y); bool MakeVertHall(size_t x); void FillUnaccessable(); void RandomizePlayer(); void RandomizeItems(); void VerifyMap(); size_t _RandWidth(); size_t _RandHeight(); }; class PrefabGenerator final : public Generator { public: mrb_value Generate(mrb_state *mrb, mrb_value options) override; private: mrb_int Level; mrb_int Width, Height; mrb_int PlayerX, PlayerY; mrb_int StairX, StairY; size_t MapTiles; std::unique_ptr<mrb_int[]> Map; mrb_bool IsDungeon = false; std::string DungeonName; std::vector<std::tuple<TileType, size_t, size_t, json::value>> Entities; inline mrb_int &TileAt(size_t x, size_t y) { return Map[(y * Width) + x]; } void ParseOptions(mrb_state *mrb, mrb_value options); void MakeSpawn(size_t x, size_t y); void MakeStairs(size_t x, size_t y); void MakeRoom(size_t x, size_t y); void MakeRoom(json::value room, size_t x, size_t y); void MakeRect(json::value room, size_t x, size_t y, size_t width, size_t height); void MakeBarriers(); mrb_value MakeContext(size_t x, size_t y); }; class FloorDoOverException : public basic_exception { public: FloorDoOverException() : basic_exception("YOU BAD MAP GENERATOR! DO IT AGAIN!") { } };
3f189115846fb21eaafb8911dd5b332963945e4c
7cbb524646ae781e5e69e22583ca424cd401c5a6
/src/components/character/Character.h
0f580e4ed6e6280d61cfee71d5c51bd2a104eccc
[]
no_license
gokadin/2d-game-engine
be55aba534142573032cfe579f263ed639f84e21
230a7b4d97684e46691ddeae77899e1425d86082
refs/heads/master
2020-07-03T18:43:47.373472
2017-04-28T02:43:18
2017-04-28T21:47:52
202,006,571
1
0
null
null
null
null
UTF-8
C++
false
false
1,590
h
Character.h
#ifndef SFMLDEMO_CHARACTER_H #define SFMLDEMO_CHARACTER_H #include "../../core/GameComponent.h" #include "../../utils/observable/Observer.h" #include "../../data/definitions/character/CharacterStats.h" #include "../../data/definitions/character/CharacterState.h" #include "../../data/definitions/character/CharacterGraphics.h" #include "../../animations/character/CharacterAnimations.h" #include "../../skills/Skill.h" #include "../../rendering/renderers/character/CharacterRenderer.h" #include "equipment/EquipmentManager.h" #include "../../common/MortalEntity.h" #include "../../utils/observable/ChildObserver.h" class Character : public GameComponent, public MortalEntity, public Observer, public Observable, public ChildObserver { public: Character(); ~Character(); void update(); void draw(sf::RenderWindow *window); void handleEvent(std::shared_ptr<Event> event); void handleChildEvent(std::shared_ptr<Event> event); inline CharacterStats *stats() { return m_stats; } inline CharacterState *state() { return m_state; } inline CharacterGraphics *graphics() { return m_graphics; } inline EquipmentManager *equipmentManager() { return m_equipmentManager; } void inflictDamage(int damage); private: CharacterStats *m_stats; CharacterState *m_state; EquipmentManager *m_equipmentManager; CharacterGraphics *m_graphics; CharacterAnimations *m_animations; CharacterRenderer *m_renderer; // updater void castSpell(Skill *skill); void handleMonsterDied(Monster *monster); }; #endif //SFMLDEMO_CHARACTER_H
b211fb1e237d102c15491e832a9478a26f159788
4409155c91fae0eb00654a97e6557d620e02fa73
/c_model/jpeg_bit_buffer.h
63471baf1a010ee1bd3093f94c3b63370e233b95
[ "Apache-2.0" ]
permissive
TomHuangsrc/core_jpeg
8d6ee1c6e0549ee953c7e00f18302ef4a45a9d68
bb03cce45d0b7459d395486e9e1db3de1b416bd2
refs/heads/main
2023-01-14T13:54:31.977796
2020-10-26T23:44:18
2020-10-26T23:44:18
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,331
h
jpeg_bit_buffer.h
#ifndef JPEG_BIT_BUFFER_H #define JPEG_BIT_BUFFER_H #include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <string.h> #include <assert.h> #define dprintf #ifndef TEST_HOOKS_BITBUFFER #define TEST_HOOKS_BITBUFFER(x) #endif #ifndef TEST_HOOKS_BITBUFFER_DECL #define TEST_HOOKS_BITBUFFER_DECL #endif //----------------------------------------------------------------------------- // jpeg_bit_buffer: //----------------------------------------------------------------------------- class jpeg_bit_buffer { public: jpeg_bit_buffer() { m_buffer = NULL; reset(-1); } void reset(int max_size = -1) { if (m_buffer) { delete [] m_buffer; m_buffer = NULL; } if (max_size <= 0) m_max_size = 1 << 20; else m_max_size = max_size; m_buffer = new uint8_t[m_max_size]; memset(m_buffer, 0, m_max_size); m_wr_offset = 0; m_last = 0; m_rd_offset = 0; } // Push byte into stream (return false if marker found) bool push(uint8_t b) { uint8_t last = m_last; // Skip padding if (last == 0xFF && b == 0x00) ; // Marker found else if (last == 0xFF && b != 0x00) { m_wr_offset--; return false; } // Push byte into buffer else { assert(m_wr_offset < m_max_size); m_buffer[m_wr_offset++] = b; } m_last = b; return true; } // Read upto 32-bit (aligned to MSB) uint32_t read_word(void) { if (eof()) return 0; int byte = m_rd_offset / 8; int bit = m_rd_offset % 8; // 0 - 7 uint64_t w = 0; for (int x=0;x<5;x++) { w |= m_buffer[byte+x]; w <<= 8; } w <<= bit; return w >> 16; } void advance(int bits) { TEST_HOOKS_BITBUFFER(bits); m_rd_offset += bits; } bool eof(void) { return (((m_rd_offset+7) / 8) >= m_wr_offset); } TEST_HOOKS_BITBUFFER_DECL; private: uint8_t *m_buffer; uint8_t m_last; int m_max_size; int m_wr_offset; int m_rd_offset; // in bits }; #endif
0acae7637d87c002eb910c491fa199b548a5cee9
a3d6556180e74af7b555f8d47d3fea55b94bcbda
/ios/chrome/browser/ui/omnibox/omnibox_ui_features.cc
e7009346d26129cf88070cf90254f49e02a9d0e2
[ "BSD-3-Clause" ]
permissive
chromium/chromium
aaa9eda10115b50b0616d2f1aed5ef35d1d779d6
a401d6cf4f7bf0e2d2e964c512ebb923c3d8832c
refs/heads/main
2023-08-24T00:35:12.585945
2023-08-23T22:01:11
2023-08-23T22:01:11
120,360,765
17,408
7,102
BSD-3-Clause
2023-09-10T23:44:27
2018-02-05T20:55:32
null
UTF-8
C++
false
false
1,515
cc
omnibox_ui_features.cc
// Copyright 2022 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #import "ios/chrome/browser/ui/omnibox/omnibox_ui_features.h" #include "base/metrics/field_trial_params.h" #import "ios/chrome/browser/shared/public/features/features.h" #import "ui/base/device_form_factor.h" BASE_FEATURE(kEnableSuggestionsScrollingOnIPad, "EnableSuggestionsScrollingOnIPad", base::FEATURE_ENABLED_BY_DEFAULT); BASE_FEATURE(kEnablePopoutOmniboxIpad, "EnablePopoutOmniboxIpad", base::FEATURE_DISABLED_BY_DEFAULT); BASE_FEATURE(kOmniboxKeyboardPasteButton, "OmniboxKeyboardPasteButton", base::FEATURE_DISABLED_BY_DEFAULT); BASE_FEATURE(kOmniboxMultilineSearchSuggest, "OmniboxMultilineSearchSuggest", base::FEATURE_ENABLED_BY_DEFAULT); // Tail suggest is triggered server side. BASE_FEATURE(kOmniboxTailSuggest, "OmniboxTailSuggest", base::FEATURE_ENABLED_BY_DEFAULT); BASE_FEATURE(kOmniboxSuggestionsRTLImprovements, "OmniboxSuggestionsRTLImprovements", base::FEATURE_DISABLED_BY_DEFAULT); BASE_FEATURE(kOmniboxLockIconEnabled, "OmniboxLockIconEnabled", base::FEATURE_DISABLED_BY_DEFAULT); bool IsIpadPopoutOmniboxEnabled() { return base::FeatureList::IsEnabled(kEnablePopoutOmniboxIpad) && ui::GetDeviceFormFactor() == ui::DEVICE_FORM_FACTOR_TABLET; }
ef7e19f50f0fa485f83b45501575374d89d74cf5
45f6d9c5347cc343bb6726ae9afbaa09b89c6e52
/snake/src/world.cpp
ce35ab2757a390fb5335d11042798876d8f5df2c
[]
no_license
babjank/objektno-programiranje
cc9d57e825e84146a3bc9195cb99dfbd31197cf9
27b367f4a774b073d0956e4b504c7b2959b74178
refs/heads/master
2020-05-21T11:51:06.942237
2019-05-10T19:30:18
2019-05-10T19:30:18
186,040,486
0
0
null
null
null
null
UTF-8
C++
false
false
1,674
cpp
world.cpp
#include "world.h" #include <ctime> #include <random> // Implementacija klase World dolazi ovdje. World::World(sf::Vector2i windowSize) { mBlockSize = 20; mWindowSize = windowSize; mBounds[0].setSize({windowSize.x,mBlockSize}); mBounds[0].setFillColor(sf::Color::White); mBounds[1].setSize({mBlockSize,windowSize.y}); mBounds[1].setFillColor(sf::Color::White); mBounds[2].setSize({windowSize.x,mBlockSize}); mBounds[2].setPosition(0,windowSize.y-mBlockSize); mBounds[2].setFillColor(sf::Color::White); mBounds[3].setSize({mBlockSize,windowSize.y}); mBounds[3].setPosition(windowSize.x-mBlockSize,0); mBounds[3].setFillColor(sf::Color::White); mApple.setRadius(mBlockSize/2); mApple.setPosition(200,200); mApple.setFillColor(sf::Color::Red); } void World::respawnApple() { int bb=(mWindowSize.x-2*mBlockSize)/mBlockSize; sf::Vector2f vect(mBlockSize+rand()%bb*mBlockSize,mBlockSize+rand()%bb*mBlockSize); mApple.setPosition(vect); } void World::update(Snake &snake) { if((mApple.getPosition().x/mBlockSize)==snake.getPosition().x && (mApple.getPosition().y/mBlockSize)==snake.getPosition().y ){ snake.extend(); snake.increaseScore(); respawnApple(); } if(snake.getPosition().x==0 || snake.getPosition().x==(mWindowSize.x/mBlockSize -1) || snake.getPosition().y==0 || snake.getPosition().y==(mWindowSize.x/mBlockSize -1)){ snake.lose(); snake.reset(); respawnApple(); } } void World::draw(sf::RenderTarget& target, sf::RenderStates states) const{ for(int i=0; i<4; ++i) target.draw(mBounds[i]); target.draw(mApple); }
79829f0da8b83a0ce39aeb0a4313d31d9e353df5
99af592d6bd5eed0f6c1ae0d89ab97f70010a7e3
/Piece.h
38393780ddcf2c3479cddf463b7e77e5160f95b9
[ "MIT" ]
permissive
STaylorT/Chess-Project
e887316a286ba89060a5017cd5aa4c81a1120cb4
f9caedacf3fd1fb0476e94bb5e0b7138c2929ea1
refs/heads/main
2023-07-03T15:23:08.823060
2021-07-16T04:39:54
2021-07-16T04:39:54
373,389,521
0
0
null
null
null
null
UTF-8
C++
false
false
707
h
Piece.h
#ifndef PIECE_H #define PIECE_H #include <string> class Piece { private: std::string name; std::string color; std::string square; int file; int rank; public: Piece(); Piece(std::string myName, std::string myColor); Piece(std::string myName, std::string myColor, std::string mySquare); Piece(std::string myName, std::string myColor, int myFile, int myRank); void setColor(std::string myColor); void setName(std::string myName); void setSquare(std::string mySquare); void setRank(int myRank); void setFile(int myFile); std::string getColor(); std::string getName(); std::string getSquare(); int getRank(); int getFile(); }; #endif
8b8a8d23e1aa85b3fd22544ffe0fd74c53130279
6f874ccb136d411c8ec7f4faf806a108ffc76837
/code/Windows-classic-samples/Samples/Win7Samples/winui/helpapisample/cpp/helpapisample_cpp/HelpAPISample_CPP.cpp
d990fc392e2daa91bd199c2a58c92561c15bab4f
[ "MIT" ]
permissive
JetAr/ZDoc
c0f97a8ad8fd1f6a40e687b886f6c25bb89b6435
e81a3adc354ec33345e9a3303f381dcb1b02c19d
refs/heads/master
2022-07-26T23:06:12.021611
2021-07-11T13:45:57
2021-07-11T13:45:57
33,112,803
8
8
null
null
null
null
UTF-8
C++
false
false
3,401
cpp
HelpAPISample_CPP.cpp
#include "stdafx.h" #include "stdio.h" #include <iostream> #import "C:\Program Files\Microsoft SDKs\Windows\v1.0\Lib\hxhelppaneproxy.tlb" named_guids no_namespace exclude("GUID") exclude("IUnknown") char strSrch[128]; char strTopicDisp[128]; char strTopicToc[128]; int _tmain(int argc, _TCHAR* argv[]) { std::cout << "Please enter a value (1-4)\n"; std::cout << " 1: DisplaySearchResults\n"; std::cout << " 2: DisplayTask\n"; std::cout << " 3: DisplayContents (TOC root)\n"; std::cout << " 4: DisplayContents (specific task)\n"; std::cout << ">"; std::cin >> argc; CoInitialize(NULL); IHxHelpPane* pHelpPane = NULL; HRESULT hr = ::CoCreateInstance(CLSID_HxHelpPane, NULL, CLSCTX_ALL, IID_IHxHelpPane, reinterpret_cast<void**>(&pHelpPane)); if(FAILED(hr)) { std::cout << "Can't create HelpPaneProxy object. HR=0x%X\n", hr; return -1; } if (argc == 1) try { // (1) Function: Display search results // Parameter: any word or words that exist in registered help contents std::cout << "Please enter a search keyword: "; std:: cin >> strSrch; hr = pHelpPane->DisplaySearchResults(strSrch); } catch(_com_error &err) { std::cout << "COM Error Code = " << err.Error(); std::cout << "COM Error Desc = " << err.ErrorMessage() << "\n"; } else if (argc == 2) try { // (2) Function: Display a registered topic under Windows namespace // Parameter: url with valid help protocol and registered topic id // such as: mshelp://Windows/?id=004630d0-9241-4842-9d3f-2a0c5825ef14 std::cout << "Please enter a topic ID: "; std:: cin >> strTopicDisp; hr = pHelpPane->DisplayTask(strTopicDisp); } catch(_com_error &err) { std::cout << "COM Error Code = " << err.Error(); std::cout << "COM Error Desc = " << err.ErrorMessage() << "\n"; std::cout << "Please enter a valid URI."; } else if (argc == 3) try { // (3) Function: Display the root TOC (Table of content) // Parameter: NULL or empty string std::cout << "Displaying the TOC root."; hr = pHelpPane->DisplayContents(""); } catch(_com_error &err) { std::cout << "COM Error Code = " << err.Error(); std::cout << "COM Error Desc = " << err.ErrorMessage() << "\n"; } else if (argc == 4) try { // (4) Function: Display a TOC (Table of content) page // Parameter: url with valid help protocol and authoried toc id // such as mshelp://Windows/?id=004630d0-9241-4842-9d3f-2a0c5825ef14 std::cout << "Please enter a toc ID: "; std:: cin >> strTopicToc; hr = pHelpPane->DisplayContents(strTopicToc); } catch(_com_error &err) { std::cout << "COM Error Code = " << err.Error(); std::cout << "COM Error Desc = " << err.ErrorMessage() << "\n"; std::cout << "Please enter a valid URI."; } else { std::cout << "Please enter a valid value (1-4)."; return -1; } CoUninitialize(); return 0; }
3a70a89cc2b16f23d11141c3337271333355c887
fc271461967df0a862ac6cde7d69ceb4662c4339
/Project3/Project3/Maze.cpp
8e2a2d33d5de76ef8ed284bd2b1b9cb1cfd95fc8
[]
no_license
joonaoikarinen/Maze
f58867cc7eb5f17a8fa2667b78cc5cef25df48e0
10cfac58929b86fbcc3e21fe64efc60a929b977b
refs/heads/master
2021-05-15T10:34:29.011395
2017-10-24T22:26:10
2017-10-24T22:26:10
108,190,096
0
0
null
null
null
null
UTF-8
C++
false
false
5,157
cpp
Maze.cpp
#include "Maze.hpp" #include <iostream> Maze::Maze(int width, int height, int collumns, int rows, sf::RenderWindow* window, int startX, int startY, int goalX, int goalY) : width(width), height(height), collumns(collumns), rows(rows), window(window), _startX(startX), _startY(startY), _goalX(goalX), _goalY(goalY) { srand(time(0)); _cellsToGoal = 0; Init(sf::Vector2f(_startX, _startY), sf::Vector2f(_goalX, _goalY)); } Maze::~Maze() { //std::cout << "Maze class destroyed successfully" << std::endl; } void Maze::Init(sf::Vector2f startPos, sf::Vector2f endPos) { completedGeneration = false; cells.clear(); stack.clear(); int size = (int)(width / collumns); for (int x = 0; x < collumns; x++) { for (int y = 0; y < rows; y++) { cells.push_back(new MazeCell(x, y, size, window)); if (sf::Vector2f(x, y) == startPos) { cells[cells.size() - 1]->inStart = true; } else if (sf::Vector2f(x, y) == endPos) { cells[cells.size() - 1]->inEnd = true; } } } currentCell = cells[0]; stack.push_back(currentCell); } void Maze::Draw() { if (!completedGeneration) { int it = 0; while (it < GenerationStepSpeed) { it++; currentCell->isVisited = true; currentCell->inStack = true; MazeCell* nextCell = GetRandomNeighbor(currentCell); if (nextCell != nullptr) { RemoveWalls(currentCell, nextCell); currentCell = nextCell; stack.push_back(currentCell); } else { if (stack.size() > 1) { stack[stack.size() - 1]->inStack = false; stack.pop_back(); currentCell = stack[stack.size() - 1]; } if (stack.size() == 1) { stack[stack.size() - 1]->inStack = false; stack.clear(); completedGeneration = true; it = GenerationStepSpeed; } } static int allowOnce = 0; if (currentCell->inEnd == true)allowOnce++; if (currentCell->inEnd == true && allowOnce >= 1) { for (int xz = 0; stack.size() > xz; xz++) { stack.at(xz)->onPath = true; } } } } for (int i = 0; i < cells.size(); i++) { cells[i]->Draw(); } } void Maze::OwnRemoveWalls() { if (!completedGeneration) { int it = 0; while (it < GenerationStepSpeed) { it++; currentCell->isVisited = true; currentCell->inStack = true; MazeCell* nextCell = GetRandomNeighbor(currentCell); if (nextCell != nullptr) { RemoveWalls(currentCell, nextCell); currentCell = nextCell; stack.push_back(currentCell); } else { if (stack.size() > 1) { stack[stack.size() - 1]->inStack = false; stack.pop_back(); currentCell = stack[stack.size() - 1]; } if (stack.size() == 1) { stack[stack.size() - 1]->inStack = false; stack.clear(); completedGeneration = true; it = GenerationStepSpeed; } } static int allowOnce = 0; if (currentCell->inEnd == true)allowOnce++; if (currentCell->inEnd == true && allowOnce >= 1) { for (int xz = 0; stack.size() > xz; xz++) { stack.at(xz)->onPath = true; } } } } } void Maze::RemoveWalls(MazeCell* cell1, MazeCell* cell2) { if (cell1->GetCollumn() == cell2->GetCollumn() + 1) { cell1->leftWall = false; cell2->rightWall = false; } else if (cell1->GetCollumn() == cell2->GetCollumn() - 1) { cell1->rightWall = false; cell2->leftWall = false; } else if (cell1->GetRow() == cell2->GetRow() + 1) { cell1->topWall = false; cell2->bottomWall = false; } else if (cell1->GetRow() == cell2->GetRow() - 1) { cell1->bottomWall = false; cell2->topWall = false; } } MazeCell* Maze::GetRandomNeighbor(MazeCell* cell) { std::vector<MazeCell*> availableNeighbors; int cellsSize = cells.size(); //Right int index = GetMazeCellIndexByPosition(cell->GetCollumn() + 1, cell->GetRow()); if (index < cellsSize && index != -1) { if (!cells[index]->isVisited) { availableNeighbors.push_back(cells[index]); } } //Left index = GetMazeCellIndexByPosition(cell->GetCollumn() - 1, cell->GetRow()); if (index < cellsSize && index != -1) { if (!cells[index]->isVisited) { availableNeighbors.push_back(cells[index]); } } //Bottom index = GetMazeCellIndexByPosition(cell->GetCollumn(), cell->GetRow() + 1); if (index < cellsSize && index != -1) { if (!cells[index]->isVisited) { availableNeighbors.push_back(cells[index]); } } //Top index = GetMazeCellIndexByPosition(cell->GetCollumn(), cell->GetRow() - 1); if (index < cellsSize && index != -1) { if (!cells[index]->isVisited) { availableNeighbors.push_back(cells[index]); } } if (availableNeighbors.size() > 0) { return availableNeighbors[(int)(rand() % availableNeighbors.size())]; } else { return nullptr; } } int Maze::GetMazeCellIndexByPosition(int x, int y) { if (x < 0 || y < 0 || x > collumns - 1 || y > rows - 1) { return -1; } return y + (x * collumns); // weasel.. } int Maze::CellsToGoal() { for (int xx = 0; xx < collumns; xx++) { for (int yy = 0; yy < rows; yy++) { int tempIndex = GetMazeCellIndexByPosition(xx, yy); if (cells[tempIndex]->onPath == true) { _cellsToGoal++; } } } return _cellsToGoal; }
3c28e650e7f10a76837e2b3ecb9e154ed96b1ac7
32646702d121c3deaf5a25571175587e6922c263
/src/PlayScene.cpp
e57eb71bda28fbac3157d235477d9152a790cae7
[]
no_license
CTHamma/GAME3001_A1_HuynhKenny
025c3d77eb9eb75328cd793c811319f82ee2aa5c
d58d65e3c660a0e11b36c5fde31eb01f7ba1e1fc
refs/heads/main
2023-02-25T09:33:12.243787
2021-02-03T04:42:57
2021-02-03T04:42:57
334,600,309
0
0
null
null
null
null
UTF-8
C++
false
false
8,347
cpp
PlayScene.cpp
#include "PlayScene.h" #include "Game.h" #include "EventManager.h" #include "SoundManager.h" // required for IMGUI #include "imgui.h" #include "imgui_sdl.h" #include "Renderer.h" #include "Util.h" PlayScene::PlayScene() { PlayScene::start(); // Background Music SoundManager::Instance().load("../Assets/audio/The Inconceptual One.mp3", "BGM", SOUND_MUSIC); SoundManager::Instance().playMusic("BGM", -1, 0); SoundManager::Instance().setMusicVolume(32); } PlayScene::~PlayScene() = default; void PlayScene::draw() { if(EventManager::Instance().isIMGUIActive()) { GUI_Function(); } drawDisplayList(); SDL_SetRenderDrawColor(Renderer::Instance()->getRenderer(), 0, 0, 0, 0); } void PlayScene::update() { updateDisplayList(); CollisionManager::AABBCheck(m_pSpaceShip, m_pObstacle); CollisionManager::AABBCheck(m_pSpaceShip, m_pTarget); if (CollisionManager::lineRectCheck(m_pSpaceShip->m_leftWhisker.Start(), m_pSpaceShip->m_leftWhisker.End(), (m_pObstacle->getTransform()->position - glm::vec2(25.0f, 12.5f)), 300.0f, 250.0f)) { m_pSpaceShip->getRigidBody()->velocity.y += 0.2f; m_pSpaceShip->setRotation(135); } if (CollisionManager::lineRectCheck(m_pSpaceShip->m_centreWhisker.Start(), m_pSpaceShip->m_centreWhisker.End(), (m_pObstacle->getTransform()->position - glm::vec2(25.0f, 12.5f)), 300.0f, 250.0f)) { m_pSpaceShip->setMaxSpeed(2.0f); } if (CollisionManager::lineRectCheck(m_pSpaceShip->m_rightWhisker.Start(), m_pSpaceShip->m_rightWhisker.End(), (m_pObstacle->getTransform()->position - glm::vec2(25.0f, 12.5f)), 300.0f, 250.0f)) { m_pSpaceShip->getRigidBody()->velocity.y -= 0.2f; m_pSpaceShip->setRotation(45); } } void PlayScene::clean() { removeAllChildren(); } void PlayScene::handleEvents() { EventManager::Instance().update(); // Escape if (EventManager::Instance().isKeyDown(SDL_SCANCODE_ESCAPE)) { TheGame::Instance()->quit(); SoundManager::Instance().stopMusic(0); } // Back to Start if (EventManager::Instance().isKeyDown(SDL_SCANCODE_LEFT)) { TheGame::Instance()->changeSceneState(START_SCENE); SoundManager::Instance().stopMusic(0); } // Go to End if (EventManager::Instance().isKeyDown(SDL_SCANCODE_RIGHT)) { TheGame::Instance()->changeSceneState(END_SCENE); SoundManager::Instance().stopMusic(0); } // Clear Screen if (EventManager::Instance().isKeyDown(SDL_SCANCODE_0)) { m_pTarget->setEnabled(false); m_pObstacle->setEnabled(false); m_pObstacle->getTransform()->position = glm::vec2(-1000.0f, -1000.0f); m_pSpaceShip->setEnabled(false); m_pSpaceShip->setIsNear(false); m_pSpaceShip->getRigidBody()->velocity = glm::vec2(0.0f, 0.0f); m_pSpaceShip->setRotation(0.0f); } // Seek if (EventManager::Instance().isKeyDown(SDL_SCANCODE_1)) { m_pTarget->setEnabled(true); m_pTarget->getTransform()->position = glm::vec2(700.0f, 300.0f); m_pObstacle->setEnabled(false); m_pObstacle->getTransform()->position = glm::vec2(-1000.0f, -1000.0f); m_pSpaceShip->setChase(true); m_pSpaceShip->setEnabled(true); m_pSpaceShip->setIsNear(false); m_pSpaceShip->getTransform()->position = glm::vec2(100.0f, 300.0f); m_pSpaceShip->setDestination(m_pTarget->getTransform()->position); m_pSpaceShip->setMaxSpeed(10.0f); } // Flee if (EventManager::Instance().isKeyDown(SDL_SCANCODE_2)) { m_pTarget->setEnabled(true); m_pTarget->getTransform()->position = glm::vec2(400.0f, 350.0f); m_pObstacle->setEnabled(false); m_pObstacle->getTransform()->position = glm::vec2(-1000.0f, -1000.0f); m_pSpaceShip->setChase(false); m_pSpaceShip->setEnabled(true); m_pSpaceShip->setIsNear(false); m_pSpaceShip->getTransform()->position = glm::vec2(450.0f, 400.0f); m_pSpaceShip->setDestination(m_pTarget->getTransform()->position); m_pSpaceShip->setMaxSpeed(10.0f); } // Arrive if (EventManager::Instance().isKeyDown(SDL_SCANCODE_3)) { m_pTarget->setEnabled(true); m_pTarget->getTransform()->position = glm::vec2(700.0f, 300.0f); m_pObstacle->setEnabled(false); m_pObstacle->getTransform()->position = glm::vec2(-1000.0f, -1000.0f); m_pSpaceShip->setChase(true); m_pSpaceShip->setEnabled(true); m_pSpaceShip->setIsNear(true); m_pSpaceShip->getTransform()->position = glm::vec2(100.0f, 300.0f); m_pSpaceShip->setDestination(m_pTarget->getTransform()->position); m_pSpaceShip->setMaxSpeed(10.0f); } // Collsion Avoidance if (EventManager::Instance().isKeyDown(SDL_SCANCODE_4)) { m_pTarget->setEnabled(true); m_pTarget->getTransform()->position = glm::vec2(700.0f, 300.0f); m_pObstacle->setEnabled(true); m_pObstacle->getTransform()->position = glm::vec2(300.0f, 250.0f); m_pSpaceShip->setChase(true); m_pSpaceShip->setEnabled(true); m_pSpaceShip->setIsNear(false); m_pSpaceShip->getTransform()->position = glm::vec2(100.0f, 300.0f); m_pSpaceShip->setDestination(m_pTarget->getTransform()->position); m_pSpaceShip->setMaxSpeed(10.0f); } } void PlayScene::start() { // Set GUI Title m_guiTitle = "Play Scene"; m_pTarget = new Target(); addChild(m_pTarget); m_pObstacle = new Obstacle(); addChild(m_pObstacle); // instantiating spaceship m_pSpaceShip = new SpaceShip(); addChild(m_pSpaceShip); // Instructions display on screen for user input const SDL_Color white = { 255, 255, 255, 255 }; m_p0Label = new Label("Press 0 to Refresh and Clear All Behaviour", "Consolas", 25, white, glm::vec2(400.0f, 25.0f)); m_p0Label->setParent(this); addChild(m_p0Label); m_p1Label = new Label("Press 1 to Test Seeking Behaviour", "Consolas", 25, white, glm::vec2(400.0f, 50.0f)); m_p1Label->setParent(this); addChild(m_p1Label); m_p2Label = new Label("Press 2 to Test Fleeing Behaviour", "Consolas", 25, white, glm::vec2(400.0f, 75.0f)); m_p2Label->setParent(this); addChild(m_p2Label); m_p3Label = new Label("Press 3 to Test Arrival Behaviour", "Consolas", 25, white, glm::vec2(400.0f, 100.0f)); m_p3Label->setParent(this); addChild(m_p3Label); m_p4Label = new Label("Press 4 to Test Obstacle Avoidance", "Consolas", 25, white, glm::vec2(400.0f, 125.0f)); m_p4Label->setParent(this); addChild(m_p4Label); m_pLeftArrow = new Label("<-- START", "Consolas", 20, white, glm::vec2(60.0f, 580.0f)); m_pLeftArrow->setParent(this); addChild(m_pLeftArrow); m_pRightArrow = new Label("END -->", "Consolas", 20, white, glm::vec2(750.0f, 580.0f)); m_pRightArrow->setParent(this); addChild(m_pRightArrow); } void PlayScene::GUI_Function() const { // Always open with a NewFrame ImGui::NewFrame(); // See examples by uncommenting the following - also look at imgui_demo.cpp in the IMGUI filter //ImGui::ShowDemoWindow(); ImGui::Begin("GAME3001 - Lab 2", NULL, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_MenuBar); static float speed = 10.0f; if(ImGui::SliderFloat("MaxSpeed", &speed, 0.0f, 100.0f)) { m_pSpaceShip->setMaxSpeed(speed); } static float acceleration_rate = 2.0f; if(ImGui::SliderFloat("Acceleration Rate", &acceleration_rate, 0.0f, 50.0f)) { m_pSpaceShip->setAccelerationRate(acceleration_rate); } static float angleInRadians = m_pSpaceShip->getRotation(); if(ImGui::SliderAngle("Orientation Angle", &angleInRadians)) { m_pSpaceShip->setRotation(angleInRadians * Util::Rad2Deg); } static float turn_rate = 5.0f; if(ImGui::SliderFloat("Turn Rate", &turn_rate, 0.0f, 20.0f)) { m_pSpaceShip->setTurnRate(turn_rate); } if(ImGui::Button("Start")) { m_pSpaceShip->setEnabled(true); } ImGui::SameLine(); if (ImGui::Button("Reset")) { m_pSpaceShip->getTransform()->position = glm::vec2(100.0f, 100.0f); m_pSpaceShip->setEnabled(false); m_pSpaceShip->getRigidBody()->velocity = glm::vec2(0.0f, 0.0f); m_pSpaceShip->setRotation(0.0f); // set Angle to 0 degrees turn_rate = 5.0f; acceleration_rate = 2.0f; speed = 10.0f; angleInRadians = m_pSpaceShip->getRotation(); } ImGui::Separator(); static float targetPosition[2] = { m_pTarget->getTransform()->position.x, m_pTarget->getTransform()->position.y}; if(ImGui::SliderFloat2("Target", targetPosition, 0.0f, 800.0f)) { m_pTarget->getTransform()->position = glm::vec2(targetPosition[0], targetPosition[1]); m_pSpaceShip->setDestination(m_pTarget->getTransform()->position); } ImGui::End(); // Don't Remove this ImGui::Render(); ImGuiSDL::Render(ImGui::GetDrawData()); ImGui::StyleColorsDark(); }
571d60ce7144be51595ba3fc37bbac5ef1585f49
282f567373766261ef56e3b8824b58e107584f94
/OJ/OpenJudge/1.11 编程基础之二分查找/1.11-01 1.cpp
397daced4ebc78a50cb31977807a0759945fdcee
[]
no_license
yhzhm/Practice
27aff56652122d64d7879f15aa41e2550240bb06
9114447ed3346614a7c633f51917069da6aa17f7
refs/heads/master
2022-10-19T01:15:10.517149
2022-09-29T09:04:38
2022-09-29T09:04:38
121,328,943
0
0
null
null
null
null
UTF-8
C++
false
false
598
cpp
1.11-01 1.cpp
// Created by Hz Yang on 2018.04 #include <bits/stdc++.h> using namespace std; int main() { int n, m, x, l, r, mid; cin >> n; int a[n]; for (int i = 0; i < n; ++i) { cin >> a[i]; } cin >> m; for (int i = 0; i < m; ++i) { cin >> x; if (a[0] > x) {cout << a[0] << endl; continue;} if (a[n - 1] < x) {cout << a[n - 1] << endl; continue;} l = 0; r = n - 1; while (l < r) { mid = (l + r) / 2; if (a[mid] >= x) r = mid; else l = mid + 1; } if (a[l] == x) {cout << a[l] << endl; continue;} else cout << (a[l] - x < x - a[l - 1] ? a[l] : a[l - 1]) << endl; } return 0; }
75e7b570cbfdfdc33868b661bc9e8ded3e57573b
3ad4c3f42cb9594e74134789ec158940b8273323
/Generator/src/generator.cpp
5bdd9186a9b631b547771d21263b21f638d9acf4
[]
no_license
aChosenUndead/Saruman
27c2ed4eb479978d0cf4fa3855451098f557b58b
8a5750fddab4834d3f53102ae231a304b76e9b09
refs/heads/master
2020-12-14T08:52:08.611899
2017-06-27T04:51:42
2017-06-27T04:51:42
95,518,489
0
0
null
null
null
null
UTF-8
C++
false
false
1,265
cpp
generator.cpp
/** * @file * Generator library functions "generator.cpp" */ #include <iostream> #include <cstdlib> #include <ctime> #include "generator.h" #include "monster.h" SarumanGrimoire::SarumanGrimoire() { //Weak monsterList.push_back(new Mage ( "Frodo", 190, 110, 40, 40, 50, 'm', 1)); monsterList.push_back(new Mage ("Samwise", 210, 120, 50, 50, 50, 'm', 1)); monsterList.push_back(new Beast ("Boromir", 600, 130, 40, 30, 30, 'b', 1)); monsterList.push_back(new Beast ("Smeagol", 400, 190, 50, 40, 30, 'b', 1)); monsterList.push_back(new Winged( "Merry", 290, 90, 30, 50, 70, 'w', 1)); monsterList.push_back(new Winged( "Pippin", 250, 90, 20, 50, 70, 'w', 1)); //Average monsterList.push_back(new Mage ("Aragorn", 210, 150, 50, 50, 50, 'm', 1)); monsterList.push_back(new Beast ( "Gimli", 400, 200, 50, 40, 30, 'b', 1)); monsterList.push_back(new Winged("Legolas", 250, 100, 20, 50, 70, 'w', 1)); //Strong monsterList.push_back(new Mage("Gandalf", 220, 250, 60, 60, 50, 'm', 1)); } Monster* SarumanGrimoire::getRandomMonster() { srand(time(0)); int limit = 1 + (rand() % 10); std::list<Monster*>::iterator it; it = monsterList.begin(); it = std::next(it, limit-1); return *it; }
e0d0165f4f799d3d63af341fc5a58f14b72175e6
7204bc6eaf937ebc1e1b8e8c50bdee7599577631
/Practica_Fuego/src/Logic/WhiteBars.cpp
5156dec459a3860803c60920999389007a1eba4c
[]
no_license
rebo95/VideogamesDevelopment4Consloes
049eb9677a75b0046f3316b8baed13e0dc7603ec
2d199f23618c3e0912a1146acd78d6078fd6ca67
refs/heads/master
2022-04-10T04:16:31.031365
2020-04-04T16:54:23
2020-04-04T16:54:23
247,066,840
0
0
null
null
null
null
UTF-8
C++
false
false
2,465
cpp
WhiteBars.cpp
#include "WhiteBars.h" #include "../Renderer/PC/RendererPC.h" WhiteBars::WhiteBars() { num_bars_horizontal = 1 + Renderer::getWidth() / (BAR_WIDHT + BAR_INTER_SPACE); num_bars_vertical = 1 + (Renderer::getHeight() - 150) / (BAR_HEIHGT + BAR_INTER_SPACE); } WhiteBars::~WhiteBars() { } void WhiteBars::render() { for (int i = 0; i < num_bars_vertical; i++) { for (int j = 0; j < num_bars_horizontal; j++) { drawBar(offset_ + j * (BAR_WIDHT + BAR_INTER_SPACE), BAR_INTER_SPACE + i * (BAR_HEIHGT + BAR_INTER_SPACE)); } } } void WhiteBars::render(int delta) { for (int i = 0; i < num_bars_vertical; i++) { for (int j = 0; j < num_bars_horizontal; j++) { drawBar(offset_ + j * (BAR_WIDHT + BAR_INTER_SPACE), BAR_INTER_SPACE + i * (BAR_HEIHGT + BAR_INTER_SPACE), delta); } } } void WhiteBars::drawBar(int x, int y) { for (int i = 0; i < BAR_HEIHGT; i++) { for (int j = 0; j < BAR_WIDHT; j++) { if (x + j > num_bars_horizontal * (BAR_WIDHT + BAR_INTER_SPACE)) { Renderer::putPixel(x + j - (num_bars_horizontal * (BAR_WIDHT + BAR_INTER_SPACE)), y + i, 0x00ffffff); } else { Renderer::putPixel(x + j, y + i, 0x00ffffff); } } } } void WhiteBars::drawBar(int x, int y, int delta) { for (int i = 0; i < BAR_HEIHGT; i++) { //pintamos el fragmento de blanco nuevo que se tiene que pintar for (int j = BAR_WIDHT - delta; j < BAR_WIDHT; j++) { // en el anterior frame la barra estaba en - delta, esto es, el final de la barra estaba en BAR_WIDHT - delta if (x + j > num_bars_horizontal * (BAR_WIDHT + BAR_INTER_SPACE)) { Renderer::putPixel(x + j - (num_bars_horizontal * (BAR_WIDHT + BAR_INTER_SPACE)), y + i, 0x00ffffff); } else { Renderer::putPixel(x + j, y + i, 0x00ffffff); } } //pintamos de negro el fragmento que tenemos que borrar for (int j = - delta; j < 0; j++) { //en el frame anterior el principo de la barra estaba en -d, ahora tenemos que poner en negro desde el ppio de la anterior //hasta el principio de la que se va a pintar en este frame, es decir, hasta el 0 de este frame if (x + j > num_bars_horizontal * (BAR_WIDHT + BAR_INTER_SPACE)) { Renderer::putPixel(x + j - (num_bars_horizontal * (BAR_WIDHT + BAR_INTER_SPACE)), y + i, 0xff000000); } else { Renderer::putPixel(x + j, y + i, 0xff000000); } } } } void WhiteBars::update() { offset_+= barsVel; if (offset_ > num_bars_horizontal * (BAR_WIDHT + BAR_INTER_SPACE)) offset_ = 0; }
1a62c2f166e1815809dc2ea12c9351c4627c455a
ea8800119a2b5d3f0e7bb1dc9f43959cf61be1c6
/练习03/game.h
74013be0ebbaeb47a0d711126d5d3127cf524ebf
[]
no_license
yang-er/DesignPattern
bf501b2c505763f2144adff98227a1112adbfdea
84741b5e8272caf89c1113135e2a4096daa4e3f5
refs/heads/master
2021-02-13T01:27:19.548514
2020-03-03T13:51:57
2020-03-03T13:51:57
244,649,093
1
0
null
null
null
null
UTF-8
C++
false
false
802
h
game.h
///====================================================================== /// Project: Richer01 /// FileName: game.h /// Desc: /// Author: Chen Wei /// History: ///====================================================================== #ifndef GAME_H #define GAME_H class Menu; class Map; //class MenuMgr; class Game { public: static Game* getGame(); static void releaseGame(); private: static Game* game; private: Game() { } Game(const Game&); Game& operator=(const Game&); public: void init(); void run(); void term(); public: void setCurMenu(int menuID); Map * getCurMap() { return curMap;} //private: void createMap(); private: Menu* curMenu = nullptr; //MenuMgr* mnuMgr = nullptr; Map* curMap = nullptr; }; #endif // GAME_H
01b10595d182a24ec77c1a03f21fe14180ed8ed7
484986a89d782232c58073eaa278a0b5e49baa62
/.svn/pristine/01/01b10595d182a24ec77c1a03f21fe14180ed8ed7.svn-base
387c9c662b3834a80a5378be0a91901643021b7c
[]
no_license
1005491398/Code
2f43a3dc408e17a851568b583400f366b5c27a9c
241416548c5e7d77b0ca652344e3a88d0b9939f6
refs/heads/master
2016-09-01T16:31:17.521584
2016-03-10T06:46:11
2016-03-10T06:46:11
53,562,079
0
0
null
null
null
null
UTF-8
C++
false
false
2,081
01b10595d182a24ec77c1a03f21fe14180ed8ed7.svn-base
#include <iostream> #include <stdio.h> #include <map> #include <vector> const int xCount = 10; const int yCount = 10; int map[xCount][yCount] = { {0,0,0,0,0,0,0,0,0,0}, {0,1,1,1,1,1,1,1,1,0}, {0,1,0,0,0,0,0,0,0,0}, {0,1,0,0,0,0,0,0,0,0}, {0,1,0,0,0,0,0,0,0,0}, {0,1,0,0,0,0,0,0,0,0}, {0,1,0,0,0,0,0,0,0,0}, {0,1,0,0,0,0,0,0,0,0}, {0,1,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0}, }; class Vec2 { public: int x, y, f, g, h; Vec2(int _x, int _y):x(_x), y(_y), g(0) {} ~Vec2() {} void setGHF(int _g, int _h) { g = _g, h = _h; f = g+h; } std::string toString() const { return std::to_string(x) + "_" + std::to_string(y); } bool equal(const Vec2 a) const { return a.x == x && a.y == y; } }; std::vector<Vec2> open; std::map<std::string, Vec2> close; int getG(const Vec2 pre) { return pre.g+1; } int getH(const Vec2 &a, const Vec2 &goal) { return abs(a.x-goal.x) + abs(a.y-goal.y); } bool chkPoint(int x, int y, const Vec2 &goal) { Vec2 point(x, y); auto key = point.toString(); if ((close.find(key)) == close.end()) { close.insert(std::pair<std::string, Vec2> (key, point)); point.setGHF(getG(point), getH(point, goal)); open.push_back(point); } else { } } void setPoint(const Vec2 &point, const Vec2 &goal) { int x = point.x; int y = point.y; int u = x+1; int d = x-1; int l = y-1; int r = y+1; if (u>0 && map[u][y]!=0) chkPoint(u, y, goal); if (d<xCount && map[d][y]!=0) chkPoint(d, y, goal); if (l>0 && map[x][l]!=0) chkPoint(x, l, goal); if (r<yCount && map[x][r]!=0) chkPoint(x, r, goal); } void hello(const Vec2 &start, const Vec2 &goal) { open.push_back(start); while (!open.empty()) { int minf = 100000, index = 0, i = 0; for (auto tmp : open) { if (minf>tmp.f) { minf = tmp.f; index = i; } i++; } Vec2 nowPoint = open[index]; open[index] = open.back(); open.pop_back(); if (goal.equal(nowPoint)) return; else { setPoint(nowPoint, goal); } } } int main(int argc, char *argv[]) { printf("Hello, CT. Welcome to CodeRunner!"); hello(Vec2(0, 0), Vec2(9, 9)); }
dd8606c86e8d761e636d372fb0de54823bc89e7f
cc7661edca4d5fb2fc226bd6605a533f50a2fb63
/Assembly-CSharp/Preset.h
5114fc8093156e3fbcdca3a69f5ca2db1576fe23
[ "MIT" ]
permissive
g91/Rust-C-SDK
698e5b573285d5793250099b59f5453c3c4599eb
d1cce1133191263cba5583c43a8d42d8d65c21b0
refs/heads/master
2020-03-27T05:49:01.747456
2017-08-23T09:07:35
2017-08-23T09:07:35
146,053,940
1
0
null
2018-08-25T01:13:44
2018-08-25T01:13:44
null
UTF-8
C++
false
false
643
h
Preset.h
#pragma once namespace Smaa { class Preset : public Object // 0x0 { public: bool DiagDetection; // 0x10 (size: 0x1, flags: 0x6, type: 0x2) bool CornerDetection; // 0x11 (size: 0x1, flags: 0x6, type: 0x2) float Threshold; // 0x14 (size: 0x4, flags: 0x6, type: 0xc) float DepthThreshold; // 0x18 (size: 0x4, flags: 0x6, type: 0xc) int MaxSearchSteps; // 0x1c (size: 0x4, flags: 0x6, type: 0x8) int MaxSearchStepsDiag; // 0x20 (size: 0x4, flags: 0x6, type: 0x8) int CornerRounding; // 0x24 (size: 0x4, flags: 0x6, type: 0x8) float LocalContrastAdaptationFactor; // 0x28 (size: 0x4, flags: 0x6, type: 0xc) }; // size = 0x30 }
dfa54dce37c5a4632f39a7bcea0e56bd536aaf7b
172753217ce1ebe11a324797718c324ff9592a12
/test/test.cpp
651e54021f0c9b02a8e35557e326d6886ea500d5
[ "MIT" ]
permissive
RajeshNagaiya/monarch_linked_lists
6a9f43dbb41cf98d99764e2eb95c80f51e23171d
56898d8abb54bcfbbc5523d14ebcb06c86befc9b
refs/heads/main
2023-03-05T11:04:37.710967
2021-02-12T10:51:00
2021-02-12T10:51:00
338,289,311
0
0
MIT
2021-02-12T10:51:00
2021-02-12T10:40:16
C++
UTF-8
C++
false
false
1,223
cpp
test.cpp
#include <iostream> #include "stdlib.h" #include "lists.h" #define MAX_INPUT 2 void test_push_front_stub(monarch::Lists& list, const std::string (&input_list)[MAX_INPUT]) { size_t input_list_len = sizeof(input_list) / sizeof(input_list[0]); for (int i = 0; i < input_list_len; i++) { list.push_front(input_list[i]); } } void test_push_back_stub(monarch::Lists& list, const std::string (&input_list)[MAX_INPUT]) { size_t input_list_len = sizeof(input_list) / sizeof(input_list[0]); for (int i = 0; i < input_list_len; i++) { list.push_back(input_list[i]); } } void test_clear_list(monarch::Lists& list) { size_t list_size = list.lists_length(); for (int i = 0; i < list_size; i++) { list.pop_front(); } } void test_append_middle_node(monarch::Lists& list) { list.pushNodeAfterMiddle("middle"); list.printList(); } int main() { std::cout << "Sample linked lists program" << std::endl; std::string input_list[MAX_INPUT] = { "item_one", "item_two" }; monarch::Lists list; test_push_front_stub(list, input_list); test_push_back_stub(list, input_list); test_append_middle_node(list); test_clear_list(list); return 1; }
ba1d8515f77b52e80d4493411c24dbc59fbda185
a3d6556180e74af7b555f8d47d3fea55b94bcbda
/components/user_notes/user_notes_features.h
8c640d8c3beb49274b3f6cec4706af176ae37144
[ "BSD-3-Clause" ]
permissive
chromium/chromium
aaa9eda10115b50b0616d2f1aed5ef35d1d779d6
a401d6cf4f7bf0e2d2e964c512ebb923c3d8832c
refs/heads/main
2023-08-24T00:35:12.585945
2023-08-23T22:01:11
2023-08-23T22:01:11
120,360,765
17,408
7,102
BSD-3-Clause
2023-09-10T23:44:27
2018-02-05T20:55:32
null
UTF-8
C++
false
false
576
h
user_notes_features.h
// Copyright 2022 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef COMPONENTS_USER_NOTES_USER_NOTES_FEATURES_H_ #define COMPONENTS_USER_NOTES_USER_NOTES_FEATURES_H_ #include "base/feature_list.h" namespace user_notes { // Feature controlling the User Notes feature on desktop platforms. BASE_DECLARE_FEATURE(kUserNotes); // Returns true if the User Notes feature is enabled. bool IsUserNotesEnabled(); } // namespace user_notes #endif // COMPONENTS_USER_NOTES_USER_NOTES_FEATURES_H_
bc65004f2dd3ab4994fb839eadaddc6719178f73
1cb93ce35651d1352587b50f9f3be94d6053d94a
/services/oboeservice/AAudioServiceStreamMMAP.cpp
57dc1ab26ef0e32dea161dd7644a432cc9328bca
[ "LicenseRef-scancode-unicode", "Apache-2.0" ]
permissive
LineageOS/android_frameworks_av
7a685135784cd7dfad88c524acb7044cab188db5
be311717b151597a000cf3435812c56f915f2f4c
refs/heads/lineage-19.1
2023-07-25T06:37:24.324351
2023-05-11T00:26:30
2023-07-07T12:58:22
75,639,894
26
628
NOASSERTION
2022-10-02T20:13:57
2016-12-05T15:41:27
C++
UTF-8
C++
false
false
7,625
cpp
AAudioServiceStreamMMAP.cpp
/* * Copyright (C) 2017 The Android Open Source Project * * 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. */ #define LOG_TAG "AAudioServiceStreamMMAP" //#define LOG_NDEBUG 0 #include <utils/Log.h> #include <atomic> #include <inttypes.h> #include <iomanip> #include <iostream> #include <stdint.h> #include <utils/String16.h> #include <media/nbaio/AudioStreamOutSink.h> #include <media/MmapStreamInterface.h> #include "binding/AudioEndpointParcelable.h" #include "utility/AAudioUtilities.h" #include "AAudioServiceEndpointMMAP.h" #include "AAudioServiceStreamBase.h" #include "AAudioServiceStreamMMAP.h" #include "SharedMemoryProxy.h" using android::base::unique_fd; using namespace android; using namespace aaudio; /** * Service Stream that uses an MMAP buffer. */ AAudioServiceStreamMMAP::AAudioServiceStreamMMAP(android::AAudioService &aAudioService, bool inService) : AAudioServiceStreamBase(aAudioService) , mInService(inService) { } // Open stream on HAL and pass information about the shared memory buffer back to the client. aaudio_result_t AAudioServiceStreamMMAP::open(const aaudio::AAudioStreamRequest &request) { sp<AAudioServiceStreamMMAP> keep(this); if (request.getConstantConfiguration().getSharingMode() != AAUDIO_SHARING_MODE_EXCLUSIVE) { ALOGE("%s() sharingMode mismatch %d", __func__, request.getConstantConfiguration().getSharingMode()); return AAUDIO_ERROR_INTERNAL; } aaudio_result_t result = AAudioServiceStreamBase::open(request); if (result != AAUDIO_OK) { return result; } sp<AAudioServiceEndpoint> endpoint = mServiceEndpointWeak.promote(); if (endpoint == nullptr) { ALOGE("%s() has no endpoint", __func__); return AAUDIO_ERROR_INVALID_STATE; } result = endpoint->registerStream(keep); if (result != AAUDIO_OK) { return result; } setState(AAUDIO_STREAM_STATE_OPEN); return AAUDIO_OK; } // Start the flow of data. aaudio_result_t AAudioServiceStreamMMAP::startDevice() { aaudio_result_t result = AAudioServiceStreamBase::startDevice(); if (!mInService && result == AAUDIO_OK) { // Note that this can sometimes take 200 to 300 msec for a cold start! result = startClient(mMmapClient, nullptr /*const audio_attributes_t* */, &mClientHandle); } return result; } // Stop the flow of data such that start() can resume with loss of data. aaudio_result_t AAudioServiceStreamMMAP::pause_l() { if (!isRunning()) { return AAUDIO_OK; } aaudio_result_t result = AAudioServiceStreamBase::pause_l(); // TODO put before base::pause()? if (!mInService) { (void) stopClient(mClientHandle); } return result; } aaudio_result_t AAudioServiceStreamMMAP::stop_l() { if (!isRunning()) { return AAUDIO_OK; } aaudio_result_t result = AAudioServiceStreamBase::stop_l(); // TODO put before base::stop()? if (!mInService) { (void) stopClient(mClientHandle); } return result; } aaudio_result_t AAudioServiceStreamMMAP::startClient(const android::AudioClient& client, const audio_attributes_t *attr, audio_port_handle_t *clientHandle) { sp<AAudioServiceEndpoint> endpoint = mServiceEndpointWeak.promote(); if (endpoint == nullptr) { ALOGE("%s() has no endpoint", __func__); return AAUDIO_ERROR_INVALID_STATE; } // Start the client on behalf of the application. Generate a new porthandle. aaudio_result_t result = endpoint->startClient(client, attr, clientHandle); return result; } aaudio_result_t AAudioServiceStreamMMAP::stopClient(audio_port_handle_t clientHandle) { sp<AAudioServiceEndpoint> endpoint = mServiceEndpointWeak.promote(); if (endpoint == nullptr) { ALOGE("%s() has no endpoint", __func__); return AAUDIO_ERROR_INVALID_STATE; } aaudio_result_t result = endpoint->stopClient(clientHandle); return result; } // Get free-running DSP or DMA hardware position from the HAL. aaudio_result_t AAudioServiceStreamMMAP::getFreeRunningPosition(int64_t *positionFrames, int64_t *timeNanos) { sp<AAudioServiceEndpoint> endpoint = mServiceEndpointWeak.promote(); if (endpoint == nullptr) { ALOGE("%s() has no endpoint", __func__); return AAUDIO_ERROR_INVALID_STATE; } sp<AAudioServiceEndpointMMAP> serviceEndpointMMAP = static_cast<AAudioServiceEndpointMMAP *>(endpoint.get()); aaudio_result_t result = serviceEndpointMMAP->getFreeRunningPosition(positionFrames, timeNanos); if (result == AAUDIO_OK) { Timestamp timestamp(*positionFrames, *timeNanos); mAtomicStreamTimestamp.write(timestamp); *positionFrames = timestamp.getPosition(); *timeNanos = timestamp.getNanoseconds(); } else if (result != AAUDIO_ERROR_UNAVAILABLE) { disconnect(); } return result; } // Get timestamp from presentation position. // If it fails, get timestamp that was written by getFreeRunningPosition() aaudio_result_t AAudioServiceStreamMMAP::getHardwareTimestamp(int64_t *positionFrames, int64_t *timeNanos) { sp<AAudioServiceEndpoint> endpoint = mServiceEndpointWeak.promote(); if (endpoint == nullptr) { ALOGE("%s() has no endpoint", __func__); return AAUDIO_ERROR_INVALID_STATE; } sp<AAudioServiceEndpointMMAP> serviceEndpointMMAP = static_cast<AAudioServiceEndpointMMAP *>(endpoint.get()); // Disable this code temporarily because the HAL is not returning // a useful result. #if 0 uint64_t position; if (serviceEndpointMMAP->getExternalPosition(&position, timeNanos) == AAUDIO_OK) { ALOGD("%s() getExternalPosition() says pos = %" PRIi64 ", time = %" PRIi64, __func__, position, *timeNanos); *positionFrames = (int64_t) position; return AAUDIO_OK; } else #endif if (mAtomicStreamTimestamp.isValid()) { Timestamp timestamp = mAtomicStreamTimestamp.read(); *positionFrames = timestamp.getPosition(); *timeNanos = timestamp.getNanoseconds() + serviceEndpointMMAP->getHardwareTimeOffsetNanos(); return AAUDIO_OK; } else { return AAUDIO_ERROR_UNAVAILABLE; } } // Get an immutable description of the data queue from the HAL. aaudio_result_t AAudioServiceStreamMMAP::getAudioDataDescription( AudioEndpointParcelable &parcelable) { sp<AAudioServiceEndpoint> endpoint = mServiceEndpointWeak.promote(); if (endpoint == nullptr) { ALOGE("%s() has no endpoint", __func__); return AAUDIO_ERROR_INVALID_STATE; } sp<AAudioServiceEndpointMMAP> serviceEndpointMMAP = static_cast<AAudioServiceEndpointMMAP *>(endpoint.get()); return serviceEndpointMMAP->getDownDataDescription(parcelable); }
b3b495df67c812cd9c5877b2a61bf950e6603b23
76f0efb245ff0013e0428ee7636e72dc288832ab
/out/Default/gen/services/shell/public/interfaces/service_manager.mojom.cc
599594e0307486e04e4a6cef415b1f12a2cafbd2
[]
no_license
dckristiono/chromium
e8845d2a8754f39e0ca1d3d3d44d01231957367c
8ad7c1bd5778bfda3347cf6b30ef60d3e4d7c0b9
refs/heads/master
2020-04-22T02:34:41.775069
2016-08-24T14:05:09
2016-08-24T14:05:09
66,465,243
0
2
null
null
null
null
UTF-8
C++
false
false
26,694
cc
service_manager.mojom.cc
// Copyright 2013 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. #if defined(__clang__) #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wunused-private-field" #elif defined(_MSC_VER) #pragma warning(push) #pragma warning(disable:4056) #pragma warning(disable:4065) #pragma warning(disable:4756) #endif #include "services/shell/public/interfaces/service_manager.mojom.h" #include <math.h> #include <stdint.h> #include <utility> #include "base/logging.h" #include "base/trace_event/trace_event.h" #include "mojo/public/cpp/bindings/lib/message_builder.h" #include "mojo/public/cpp/bindings/lib/serialization_util.h" #include "mojo/public/cpp/bindings/lib/validate_params.h" #include "mojo/public/cpp/bindings/lib/validation_context.h" #include "mojo/public/cpp/bindings/lib/validation_errors.h" #include "mojo/public/interfaces/bindings/interface_control_messages.mojom.h" #include "services/shell/public/cpp/capabilities_struct_traits.h" #include "ipc/ipc_message_utils.h" #include "services/shell/public/cpp/identity_struct_traits.h" #include "mojo/common/common_custom_types_struct_traits.h" namespace shell { namespace mojom { namespace { class ServiceManagerListener_OnInit_ParamsDataView { public: ServiceManagerListener_OnInit_ParamsDataView() {} ServiceManagerListener_OnInit_ParamsDataView( internal::ServiceManagerListener_OnInit_Params_Data* data, mojo::internal::SerializationContext* context) : data_(data), context_(context) {} bool is_null() const { return !data_; } inline void GetRunningServicesDataView( mojo::ArrayDataView<ServiceInfoDataView>* output); template <typename UserType> bool ReadRunningServices(UserType* output) { auto pointer = data_->running_services.Get(); return mojo::internal::Deserialize<mojo::Array<::shell::mojom::ServiceInfoPtr>>( pointer, output, context_); } private: internal::ServiceManagerListener_OnInit_Params_Data* data_ = nullptr; mojo::internal::SerializationContext* context_ = nullptr; }; inline void ServiceManagerListener_OnInit_ParamsDataView::GetRunningServicesDataView( mojo::ArrayDataView<ServiceInfoDataView>* output) { auto pointer = data_->running_services.Get(); *output = mojo::ArrayDataView<ServiceInfoDataView>(pointer, context_); } class ServiceManagerListener_OnServiceCreated_ParamsDataView { public: ServiceManagerListener_OnServiceCreated_ParamsDataView() {} ServiceManagerListener_OnServiceCreated_ParamsDataView( internal::ServiceManagerListener_OnServiceCreated_Params_Data* data, mojo::internal::SerializationContext* context) : data_(data), context_(context) {} bool is_null() const { return !data_; } inline void GetServiceDataView( ServiceInfoDataView* output); template <typename UserType> bool ReadService(UserType* output) { auto pointer = data_->service.Get(); return mojo::internal::Deserialize<::shell::mojom::ServiceInfoPtr>( pointer, output, context_); } private: internal::ServiceManagerListener_OnServiceCreated_Params_Data* data_ = nullptr; mojo::internal::SerializationContext* context_ = nullptr; }; inline void ServiceManagerListener_OnServiceCreated_ParamsDataView::GetServiceDataView( ServiceInfoDataView* output) { auto pointer = data_->service.Get(); *output = ServiceInfoDataView(pointer, context_); } class ServiceManagerListener_OnServiceStarted_ParamsDataView { public: ServiceManagerListener_OnServiceStarted_ParamsDataView() {} ServiceManagerListener_OnServiceStarted_ParamsDataView( internal::ServiceManagerListener_OnServiceStarted_Params_Data* data, mojo::internal::SerializationContext* context) : data_(data), context_(context) {} bool is_null() const { return !data_; } inline void GetIdentityDataView( ::shell::mojom::IdentityDataView* output); template <typename UserType> bool ReadIdentity(UserType* output) { auto pointer = data_->identity.Get(); return mojo::internal::Deserialize<::shell::mojom::IdentityPtr>( pointer, output, context_); } uint32_t pid() const { return data_->pid; } private: internal::ServiceManagerListener_OnServiceStarted_Params_Data* data_ = nullptr; mojo::internal::SerializationContext* context_ = nullptr; }; inline void ServiceManagerListener_OnServiceStarted_ParamsDataView::GetIdentityDataView( ::shell::mojom::IdentityDataView* output) { auto pointer = data_->identity.Get(); *output = ::shell::mojom::IdentityDataView(pointer, context_); } class ServiceManagerListener_OnServiceStopped_ParamsDataView { public: ServiceManagerListener_OnServiceStopped_ParamsDataView() {} ServiceManagerListener_OnServiceStopped_ParamsDataView( internal::ServiceManagerListener_OnServiceStopped_Params_Data* data, mojo::internal::SerializationContext* context) : data_(data), context_(context) {} bool is_null() const { return !data_; } inline void GetIdentityDataView( ::shell::mojom::IdentityDataView* output); template <typename UserType> bool ReadIdentity(UserType* output) { auto pointer = data_->identity.Get(); return mojo::internal::Deserialize<::shell::mojom::IdentityPtr>( pointer, output, context_); } private: internal::ServiceManagerListener_OnServiceStopped_Params_Data* data_ = nullptr; mojo::internal::SerializationContext* context_ = nullptr; }; inline void ServiceManagerListener_OnServiceStopped_ParamsDataView::GetIdentityDataView( ::shell::mojom::IdentityDataView* output) { auto pointer = data_->identity.Get(); *output = ::shell::mojom::IdentityDataView(pointer, context_); } class ServiceManager_AddListener_ParamsDataView { public: ServiceManager_AddListener_ParamsDataView() {} ServiceManager_AddListener_ParamsDataView( internal::ServiceManager_AddListener_Params_Data* data, mojo::internal::SerializationContext* context) : data_(data), context_(context) {} bool is_null() const { return !data_; } ServiceManagerListenerPtr TakeListener() { ServiceManagerListenerPtr result; bool ret = mojo::internal::Deserialize<::shell::mojom::ServiceManagerListenerPtr>( &data_->listener, &result, context_); DCHECK(ret); return result; } private: internal::ServiceManager_AddListener_Params_Data* data_ = nullptr; mojo::internal::SerializationContext* context_ = nullptr; }; } // namespace// static ServiceInfoPtr ServiceInfo::New() { ServiceInfoPtr rv; mojo::internal::StructHelper<ServiceInfo>::Initialize(&rv); return rv; } ServiceInfo::ServiceInfo() : id(), identity(), pid() { } ServiceInfo::~ServiceInfo() { } const char ServiceManagerListener::Name_[] = "shell::mojom::ServiceManagerListener"; const uint32_t ServiceManagerListener::Version_; ServiceManagerListenerProxy::ServiceManagerListenerProxy(mojo::MessageReceiverWithResponder* receiver) : ControlMessageProxy(receiver) { } void ServiceManagerListenerProxy::OnInit( std::vector<ServiceInfoPtr> in_running_services) { size_t size = sizeof(::shell::mojom::internal::ServiceManagerListener_OnInit_Params_Data); size += mojo::internal::PrepareToSerialize<mojo::Array<::shell::mojom::ServiceInfoPtr>>( in_running_services, &serialization_context_); mojo::internal::MessageBuilder builder(internal::kServiceManagerListener_OnInit_Name, size); auto params = ::shell::mojom::internal::ServiceManagerListener_OnInit_Params_Data::New(builder.buffer()); ALLOW_UNUSED_LOCAL(params); typename decltype(params->running_services)::BaseType* running_services_ptr; const mojo::internal::ContainerValidateParams running_services_validate_params( 0, false, nullptr); mojo::internal::Serialize<mojo::Array<::shell::mojom::ServiceInfoPtr>>( in_running_services, builder.buffer(), &running_services_ptr, &running_services_validate_params, &serialization_context_); params->running_services.Set(running_services_ptr); MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( params->running_services.is_null(), mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, "null running_services in ServiceManagerListener.OnInit request"); (&serialization_context_)->handles.Swap( builder.message()->mutable_handles()); bool ok = receiver_->Accept(builder.message()); // This return value may be ignored as !ok implies the Connector has // encountered an error, which will be visible through other means. ALLOW_UNUSED_LOCAL(ok); } void ServiceManagerListenerProxy::OnServiceCreated( ServiceInfoPtr in_service) { size_t size = sizeof(::shell::mojom::internal::ServiceManagerListener_OnServiceCreated_Params_Data); size += mojo::internal::PrepareToSerialize<::shell::mojom::ServiceInfoPtr>( in_service, &serialization_context_); mojo::internal::MessageBuilder builder(internal::kServiceManagerListener_OnServiceCreated_Name, size); auto params = ::shell::mojom::internal::ServiceManagerListener_OnServiceCreated_Params_Data::New(builder.buffer()); ALLOW_UNUSED_LOCAL(params); typename decltype(params->service)::BaseType* service_ptr; mojo::internal::Serialize<::shell::mojom::ServiceInfoPtr>( in_service, builder.buffer(), &service_ptr, &serialization_context_); params->service.Set(service_ptr); MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( params->service.is_null(), mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, "null service in ServiceManagerListener.OnServiceCreated request"); (&serialization_context_)->handles.Swap( builder.message()->mutable_handles()); bool ok = receiver_->Accept(builder.message()); // This return value may be ignored as !ok implies the Connector has // encountered an error, which will be visible through other means. ALLOW_UNUSED_LOCAL(ok); } void ServiceManagerListenerProxy::OnServiceStarted( const ::shell::Identity& in_identity, uint32_t in_pid) { size_t size = sizeof(::shell::mojom::internal::ServiceManagerListener_OnServiceStarted_Params_Data); size += mojo::internal::PrepareToSerialize<::shell::mojom::IdentityPtr>( in_identity, &serialization_context_); mojo::internal::MessageBuilder builder(internal::kServiceManagerListener_OnServiceStarted_Name, size); auto params = ::shell::mojom::internal::ServiceManagerListener_OnServiceStarted_Params_Data::New(builder.buffer()); ALLOW_UNUSED_LOCAL(params); typename decltype(params->identity)::BaseType* identity_ptr; mojo::internal::Serialize<::shell::mojom::IdentityPtr>( in_identity, builder.buffer(), &identity_ptr, &serialization_context_); params->identity.Set(identity_ptr); MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( params->identity.is_null(), mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, "null identity in ServiceManagerListener.OnServiceStarted request"); params->pid = in_pid; (&serialization_context_)->handles.Swap( builder.message()->mutable_handles()); bool ok = receiver_->Accept(builder.message()); // This return value may be ignored as !ok implies the Connector has // encountered an error, which will be visible through other means. ALLOW_UNUSED_LOCAL(ok); } void ServiceManagerListenerProxy::OnServiceStopped( const ::shell::Identity& in_identity) { size_t size = sizeof(::shell::mojom::internal::ServiceManagerListener_OnServiceStopped_Params_Data); size += mojo::internal::PrepareToSerialize<::shell::mojom::IdentityPtr>( in_identity, &serialization_context_); mojo::internal::MessageBuilder builder(internal::kServiceManagerListener_OnServiceStopped_Name, size); auto params = ::shell::mojom::internal::ServiceManagerListener_OnServiceStopped_Params_Data::New(builder.buffer()); ALLOW_UNUSED_LOCAL(params); typename decltype(params->identity)::BaseType* identity_ptr; mojo::internal::Serialize<::shell::mojom::IdentityPtr>( in_identity, builder.buffer(), &identity_ptr, &serialization_context_); params->identity.Set(identity_ptr); MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( params->identity.is_null(), mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, "null identity in ServiceManagerListener.OnServiceStopped request"); (&serialization_context_)->handles.Swap( builder.message()->mutable_handles()); bool ok = receiver_->Accept(builder.message()); // This return value may be ignored as !ok implies the Connector has // encountered an error, which will be visible through other means. ALLOW_UNUSED_LOCAL(ok); } ServiceManagerListenerStub::ServiceManagerListenerStub() : sink_(nullptr), control_message_handler_(ServiceManagerListener::Version_) { } ServiceManagerListenerStub::~ServiceManagerListenerStub() {} bool ServiceManagerListenerStub::Accept(mojo::Message* message) { if (mojo::internal::ControlMessageHandler::IsControlMessage(message)) return control_message_handler_.Accept(message); switch (message->header()->name) { case internal::kServiceManagerListener_OnInit_Name: { internal::ServiceManagerListener_OnInit_Params_Data* params = reinterpret_cast<internal::ServiceManagerListener_OnInit_Params_Data*>( message->mutable_payload()); (&serialization_context_)->handles.Swap((message)->mutable_handles()); bool success = true; std::vector<ServiceInfoPtr> p_running_services{}; ServiceManagerListener_OnInit_ParamsDataView input_data_view(params, &serialization_context_); if (!input_data_view.ReadRunningServices(&p_running_services)) success = false; if (!success) { ReportValidationErrorForMessage( message, mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, "ServiceManagerListener::OnInit deserializer"); return false; } // A null |sink_| means no implementation was bound. assert(sink_); TRACE_EVENT0("mojom", "ServiceManagerListener::OnInit"); mojo::internal::MessageDispatchContext context(message); sink_->OnInit( std::move(p_running_services)); return true; } case internal::kServiceManagerListener_OnServiceCreated_Name: { internal::ServiceManagerListener_OnServiceCreated_Params_Data* params = reinterpret_cast<internal::ServiceManagerListener_OnServiceCreated_Params_Data*>( message->mutable_payload()); (&serialization_context_)->handles.Swap((message)->mutable_handles()); bool success = true; ServiceInfoPtr p_service{}; ServiceManagerListener_OnServiceCreated_ParamsDataView input_data_view(params, &serialization_context_); if (!input_data_view.ReadService(&p_service)) success = false; if (!success) { ReportValidationErrorForMessage( message, mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, "ServiceManagerListener::OnServiceCreated deserializer"); return false; } // A null |sink_| means no implementation was bound. assert(sink_); TRACE_EVENT0("mojom", "ServiceManagerListener::OnServiceCreated"); mojo::internal::MessageDispatchContext context(message); sink_->OnServiceCreated( std::move(p_service)); return true; } case internal::kServiceManagerListener_OnServiceStarted_Name: { internal::ServiceManagerListener_OnServiceStarted_Params_Data* params = reinterpret_cast<internal::ServiceManagerListener_OnServiceStarted_Params_Data*>( message->mutable_payload()); (&serialization_context_)->handles.Swap((message)->mutable_handles()); bool success = true; ::shell::Identity p_identity{}; uint32_t p_pid{}; ServiceManagerListener_OnServiceStarted_ParamsDataView input_data_view(params, &serialization_context_); if (!input_data_view.ReadIdentity(&p_identity)) success = false; p_pid = input_data_view.pid(); if (!success) { ReportValidationErrorForMessage( message, mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, "ServiceManagerListener::OnServiceStarted deserializer"); return false; } // A null |sink_| means no implementation was bound. assert(sink_); TRACE_EVENT0("mojom", "ServiceManagerListener::OnServiceStarted"); mojo::internal::MessageDispatchContext context(message); sink_->OnServiceStarted( std::move(p_identity), std::move(p_pid)); return true; } case internal::kServiceManagerListener_OnServiceStopped_Name: { internal::ServiceManagerListener_OnServiceStopped_Params_Data* params = reinterpret_cast<internal::ServiceManagerListener_OnServiceStopped_Params_Data*>( message->mutable_payload()); (&serialization_context_)->handles.Swap((message)->mutable_handles()); bool success = true; ::shell::Identity p_identity{}; ServiceManagerListener_OnServiceStopped_ParamsDataView input_data_view(params, &serialization_context_); if (!input_data_view.ReadIdentity(&p_identity)) success = false; if (!success) { ReportValidationErrorForMessage( message, mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, "ServiceManagerListener::OnServiceStopped deserializer"); return false; } // A null |sink_| means no implementation was bound. assert(sink_); TRACE_EVENT0("mojom", "ServiceManagerListener::OnServiceStopped"); mojo::internal::MessageDispatchContext context(message); sink_->OnServiceStopped( std::move(p_identity)); return true; } } return false; } bool ServiceManagerListenerStub::AcceptWithResponder( mojo::Message* message, mojo::MessageReceiverWithStatus* responder) { if (mojo::internal::ControlMessageHandler::IsControlMessage(message)) return control_message_handler_.AcceptWithResponder(message, responder); switch (message->header()->name) { case internal::kServiceManagerListener_OnInit_Name: { break; } case internal::kServiceManagerListener_OnServiceCreated_Name: { break; } case internal::kServiceManagerListener_OnServiceStarted_Name: { break; } case internal::kServiceManagerListener_OnServiceStopped_Name: { break; } } return false; } ServiceManagerListenerRequestValidator::ServiceManagerListenerRequestValidator( mojo::MessageReceiver* sink) : MessageFilter(sink) { } bool ServiceManagerListenerRequestValidator::Accept(mojo::Message* message) { assert(sink_); mojo::internal::ValidationContext validation_context( message->data(), message->data_num_bytes(), message->handles()->size(), message, "ServiceManagerListener RequestValidator"); if (mojo::internal::ControlMessageHandler::IsControlMessage(message)) { if (!mojo::internal::ValidateControlRequest(message, &validation_context)) return false; return sink_->Accept(message); } switch (message->header()->name) { case internal::kServiceManagerListener_OnInit_Name: { if (!mojo::internal::ValidateMessageIsRequestWithoutResponse( message, &validation_context)) { return false; } if (!mojo::internal::ValidateMessagePayload< internal::ServiceManagerListener_OnInit_Params_Data>( message, &validation_context)) { return false; } return sink_->Accept(message); } case internal::kServiceManagerListener_OnServiceCreated_Name: { if (!mojo::internal::ValidateMessageIsRequestWithoutResponse( message, &validation_context)) { return false; } if (!mojo::internal::ValidateMessagePayload< internal::ServiceManagerListener_OnServiceCreated_Params_Data>( message, &validation_context)) { return false; } return sink_->Accept(message); } case internal::kServiceManagerListener_OnServiceStarted_Name: { if (!mojo::internal::ValidateMessageIsRequestWithoutResponse( message, &validation_context)) { return false; } if (!mojo::internal::ValidateMessagePayload< internal::ServiceManagerListener_OnServiceStarted_Params_Data>( message, &validation_context)) { return false; } return sink_->Accept(message); } case internal::kServiceManagerListener_OnServiceStopped_Name: { if (!mojo::internal::ValidateMessageIsRequestWithoutResponse( message, &validation_context)) { return false; } if (!mojo::internal::ValidateMessagePayload< internal::ServiceManagerListener_OnServiceStopped_Params_Data>( message, &validation_context)) { return false; } return sink_->Accept(message); } default: break; } // Unrecognized message. ReportValidationError( &validation_context, mojo::internal::VALIDATION_ERROR_MESSAGE_HEADER_UNKNOWN_METHOD); return false; } const char ServiceManager::Name_[] = "shell::mojom::ServiceManager"; const uint32_t ServiceManager::Version_; ServiceManagerProxy::ServiceManagerProxy(mojo::MessageReceiverWithResponder* receiver) : ControlMessageProxy(receiver) { } void ServiceManagerProxy::AddListener( ServiceManagerListenerPtr in_listener) { size_t size = sizeof(::shell::mojom::internal::ServiceManager_AddListener_Params_Data); mojo::internal::MessageBuilder builder(internal::kServiceManager_AddListener_Name, size); auto params = ::shell::mojom::internal::ServiceManager_AddListener_Params_Data::New(builder.buffer()); ALLOW_UNUSED_LOCAL(params); mojo::internal::Serialize<::shell::mojom::ServiceManagerListenerPtr>( in_listener, &params->listener, &serialization_context_); MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( !mojo::internal::IsHandleOrInterfaceValid(params->listener), mojo::internal::VALIDATION_ERROR_UNEXPECTED_INVALID_HANDLE, "invalid listener in ServiceManager.AddListener request"); (&serialization_context_)->handles.Swap( builder.message()->mutable_handles()); bool ok = receiver_->Accept(builder.message()); // This return value may be ignored as !ok implies the Connector has // encountered an error, which will be visible through other means. ALLOW_UNUSED_LOCAL(ok); } ServiceManagerStub::ServiceManagerStub() : sink_(nullptr), control_message_handler_(ServiceManager::Version_) { } ServiceManagerStub::~ServiceManagerStub() {} bool ServiceManagerStub::Accept(mojo::Message* message) { if (mojo::internal::ControlMessageHandler::IsControlMessage(message)) return control_message_handler_.Accept(message); switch (message->header()->name) { case internal::kServiceManager_AddListener_Name: { internal::ServiceManager_AddListener_Params_Data* params = reinterpret_cast<internal::ServiceManager_AddListener_Params_Data*>( message->mutable_payload()); (&serialization_context_)->handles.Swap((message)->mutable_handles()); bool success = true; ServiceManagerListenerPtr p_listener{}; ServiceManager_AddListener_ParamsDataView input_data_view(params, &serialization_context_); p_listener = input_data_view.TakeListener(); if (!success) { ReportValidationErrorForMessage( message, mojo::internal::VALIDATION_ERROR_DESERIALIZATION_FAILED, "ServiceManager::AddListener deserializer"); return false; } // A null |sink_| means no implementation was bound. assert(sink_); TRACE_EVENT0("mojom", "ServiceManager::AddListener"); mojo::internal::MessageDispatchContext context(message); sink_->AddListener( std::move(p_listener)); return true; } } return false; } bool ServiceManagerStub::AcceptWithResponder( mojo::Message* message, mojo::MessageReceiverWithStatus* responder) { if (mojo::internal::ControlMessageHandler::IsControlMessage(message)) return control_message_handler_.AcceptWithResponder(message, responder); switch (message->header()->name) { case internal::kServiceManager_AddListener_Name: { break; } } return false; } ServiceManagerRequestValidator::ServiceManagerRequestValidator( mojo::MessageReceiver* sink) : MessageFilter(sink) { } bool ServiceManagerRequestValidator::Accept(mojo::Message* message) { assert(sink_); mojo::internal::ValidationContext validation_context( message->data(), message->data_num_bytes(), message->handles()->size(), message, "ServiceManager RequestValidator"); if (mojo::internal::ControlMessageHandler::IsControlMessage(message)) { if (!mojo::internal::ValidateControlRequest(message, &validation_context)) return false; return sink_->Accept(message); } switch (message->header()->name) { case internal::kServiceManager_AddListener_Name: { if (!mojo::internal::ValidateMessageIsRequestWithoutResponse( message, &validation_context)) { return false; } if (!mojo::internal::ValidateMessagePayload< internal::ServiceManager_AddListener_Params_Data>( message, &validation_context)) { return false; } return sink_->Accept(message); } default: break; } // Unrecognized message. ReportValidationError( &validation_context, mojo::internal::VALIDATION_ERROR_MESSAGE_HEADER_UNKNOWN_METHOD); return false; } } // namespace mojom } // namespace shell namespace mojo { // static bool StructTraits<::shell::mojom::ServiceInfo, ::shell::mojom::ServiceInfoPtr>::Read( ::shell::mojom::ServiceInfoDataView input, ::shell::mojom::ServiceInfoPtr* output) { bool success = true; ::shell::mojom::ServiceInfoPtr result(::shell::mojom::ServiceInfo::New()); result->id = input.id(); if (!input.ReadIdentity(&result->identity)) success = false; result->pid = input.pid(); *output = std::move(result); return success; } } // namespace mojo #if defined(__clang__) #pragma clang diagnostic pop #elif defined(_MSC_VER) #pragma warning(pop) #endif
44f6c3fd87e04646e2051fcbc6ebaf516655067f
4d82dd572db1a012c6296481023db9bf4db7513a
/flow_graph/flow_graph/fg_strategy.h
1ef9055c2388ac046345b11dd8cb90fad36a193e
[]
no_license
zhangjiamin/flow_graph
0dfff1eb8e9e8aed33e342c4500aad149e8fde82
9db80c5670605dbe7a3eb78c8559b6a42d70504a
refs/heads/master
2021-01-23T22:24:05.765277
2017-10-02T09:21:24
2017-10-02T09:21:24
102,932,377
0
0
null
null
null
null
UTF-8
C++
false
false
2,250
h
fg_strategy.h
#ifndef __FLOW_GRAPH_STRATEGY_H #define __FLOW_GRAPH_STRATEGY_H template <typename _Generator, typename _OutputChannel> struct base_source_strategy { typedef _Generator generator_type; typedef _OutputChannel output_channel_type; }; template <typename _Generator, typename _OutputChannel> struct normal_source_strategy: public base_source_strategy<_Generator, _OutputChannel> { public: void operator()(generator_type& generator, vector<output_channel_type*>& channels) { typename generator_type::output_data_type data; data = generator(); for(int i=0;i<channels.size();++i) { channels[i]->write(data); } } }; template <typename _Consumer, typename _InputChannel> struct base_sink_strategy { typedef _Consumer consumer_type; typedef _InputChannel input_channel_type; }; template <typename _Consumer, typename _InputChannel> struct normal_sink_strategy: public base_sink_strategy<_Consumer, _InputChannel> { public: void operator()(consumer_type& consumer, vector<input_channel_type*>& channels) { bool result = false; input_channel_type::data_type data; for(int i=0;i<channels.size();++i) { result = channels[i]->read(data); if(result) { consumer(data); } } } }; template <typename _InputChannel, typename _Transformer, typename _OutputChannel> struct base_filter_strategy { typedef _InputChannel input_channel_type; typedef _Transformer transformer_type; typedef _OutputChannel output_channel_type; }; template <typename _InputChannel, typename _Transformer, typename _OutputChannel> struct normal_filter_strategy: public base_filter_strategy<_InputChannel, _Transformer, _OutputChannel> { public: void operator()(vector<input_channel_type*>& input_channels, transformer_type& transformer, vector<output_channel_type*>& output_channels) { bool result = false; typename input_channel_type::data_type input_data; typename output_channel_type::data_type output_data; for(int j=0;j<input_channels.size();++j) { result = input_channels[j]->read(input_data); if(result) { output_data = transformer(input_data); for(int i=0;i<output_channels.size();++i) { output_channels[i]->write(output_data); } } } } }; #endif /* __FLOW_GRAPH_STRATEGY_H */
078b5d16650ec3f701fffd33e746ea778b57483c
68f51dec0a05162e687da24b5ba4f1b8fc7d5fb8
/src/serial_util.cpp
e0367f1bc08de476e55da7eac9b0d0ec3d37ffe2
[]
no_license
tearitco/VastSpace
d4a1059d4ad2359ee7818e6980762195def7c5e0
36313c3d1defe2c44dedd7eef8a2be4b735f99f7
refs/heads/master
2022-04-25T18:12:11.086174
2019-11-16T05:15:39
2019-11-16T05:15:39
null
0
0
null
null
null
null
UTF-8
C++
false
false
13,286
cpp
serial_util.cpp
#include "serial_util.h" extern "C"{ #include <clib/rseq.h> } #include <sstream> #include <stdlib.h> #include <string.h> #include <stdint.h> // Exact-width integer types using namespace std; SerializeStream &StdSerializeStream::operator<<(const Vec3d &v){ base << "("; *this << v[0] << v[1] << v[2]; base << ")"; return *this; } SerializeStream &StdSerializeStream::operator<<(const Quatd &v){ base << "("; *this << v.i() << v.j() << v.k() << v.re(); base << ")"; return *this; } SerializeStream &StdSerializeStream::operator<<(const struct ::random_sequence &rs){ base << "("; for(int i = 0; i < sizeof rs; i++) *this << ((unsigned char*)&rs)[i]; base << ")"; return *this; } SerializeStream &StdSerializeStream::operator<<(char a){ base << a << " "; return *this; } SerializeStream &StdSerializeStream::operator<<(unsigned char a){ base << a << " "; return *this; } SerializeStream &StdSerializeStream::operator<<(short a){ base << a << " "; return *this; } SerializeStream &StdSerializeStream::operator<<(unsigned short a){ base << a << " "; return *this; } SerializeStream &StdSerializeStream::operator<<(int a){ base << a << " "; return *this; } SerializeStream &StdSerializeStream::operator<<(unsigned a){ base << a << " "; return *this; } SerializeStream &StdSerializeStream::operator<<(long a){ base << a << " "; return *this; } SerializeStream &StdSerializeStream::operator<<(unsigned long a){ base << a << " "; return *this; } SerializeStream &StdSerializeStream::operator<<(bool a){ base << (int)a << " "; return *this; } SerializeStream &StdSerializeStream::operator<<(float a){ base << a << " "; return *this; } SerializeStream &StdSerializeStream::operator<<(double a){ base << a << " "; return *this; } SerializeStream &StdSerializeStream::operator<<(const char *a){ base.put('"'); for(; *a; a++){ if(*a == '"' || *a == '\\') base.put('\\'); base.put(*a); } base.put('"'); return *this; } SerializeStream &StdSerializeStream::operator<<(const Serializable *p){ if(p) base << p->getid()/*sc->map[p]*/ << " "; else base << Serializable::Id(0) << " "; return *this; } class StdSerializeSubStream : public StdSerializeStream{ StdSerializeStream &parent; std::ostringstream src; public: StdSerializeSubStream(StdSerializeStream &aparent) : parent(aparent), src(), StdSerializeStream(src, aparent.sc){} ~StdSerializeSubStream(); }; StdSerializeSubStream::~StdSerializeSubStream(){ unsigned len = unsigned(src.str().length()); parent << len; parent.base << src.str(); } StdSerializeStream::~StdSerializeStream(){ } SerializeStream *StdSerializeStream::substream(Serializable::Id id){ StdSerializeSubStream *ret = new StdSerializeSubStream(*this); *ret << id; return ret; } void StdSerializeStream::join(tt *o){ base << std::endl; } BinSerializeStream::~BinSerializeStream(){ ::free(buf); } template<typename T> inline SerializeStream &BinSerializeStream::write(T a){ buf = (unsigned char*)::realloc(buf, size += sizeof a); *(T*)&buf[size - sizeof a] = a; return *this; } // Fixes #37 Binary serialized stream cares about exact size of the variable. // We'll use C99 standard's exact-width integer types to explicitly specify // the size of output variable size. SerializeStream &BinSerializeStream::operator <<(char a){return write(a);} ///< Char is always 1 byte wide. SerializeStream &BinSerializeStream::operator <<(unsigned char a){return write(a);} ///< Unsigned char is always 1 byte wide. SerializeStream &BinSerializeStream::operator <<(short a){return write((int16_t)a);} SerializeStream &BinSerializeStream::operator <<(unsigned short a){return write((uint16_t)a);} SerializeStream &BinSerializeStream::operator <<(int a){return write((int32_t)a);} SerializeStream &BinSerializeStream::operator <<(unsigned a){return write((uint32_t)a);} SerializeStream &BinSerializeStream::operator <<(long a){return write((int32_t)a);} SerializeStream &BinSerializeStream::operator <<(unsigned long a){return write((uint32_t)a);} SerializeStream &BinSerializeStream::operator <<(bool a){return write(a);} SerializeStream &BinSerializeStream::operator <<(float a){return write(a);} SerializeStream &BinSerializeStream::operator <<(double a){return write(a);} SerializeStream &BinSerializeStream::operator <<(const char *a){ size_t len = ::strlen(a) + 1; buf = (unsigned char*)::realloc(buf, size += len); ::memcpy(&buf[size - len], a, len); return *this; } SerializeStream &BinSerializeStream::operator<<(const std::string &a){ size_t len = a.length() + 1; buf = (unsigned char*)::realloc(buf, size += len); ::memcpy(&buf[size - len], a.c_str(), len); return *this; } SerializeStream &BinSerializeStream::operator <<(const Serializable *p){ if(p) return write(p->getid()/*sc->map[p]*/); else return write(Serializable::Id(0)); } SerializeStream &BinSerializeStream::operator<<(const Vec3d &v){ return *this << v[0] << v[1] << v[2]; } SerializeStream &BinSerializeStream::operator<<(const Quatd &v){ return *this << v.i() << v.j() << v.k() << v.re(); } SerializeStream &BinSerializeStream::operator<<(const struct ::random_sequence &rs){ for(int i = 0; i < sizeof rs; i++) *this << ((unsigned char*)&rs)[i]; return *this; } SerializeStream &BinSerializeStream::write(const BinSerializeStream &o){ buf = (unsigned char*)::realloc(buf, size += o.size); ::memcpy(&buf[size - o.size], o.buf, o.size); return *this; } SerializeStream *BinSerializeStream::substream(Serializable::Id id){ BinSerializeStream *ret = new BinSerializeStream(sc); return ret; } void BinSerializeStream::join(tt *o){ *this << (unsigned)((BinSerializeStream*)o)->size; write(*(BinSerializeStream*)o); } class StdUnserializeSubStream : public StdUnserializeStream{ std::istringstream src; public: StdUnserializeSubStream(std::string &s, StdUnserializeStream &aparent) : src(s), StdUnserializeStream(src, aparent.usc){} }; UnserializeStream &StdUnserializeStream::consume(const char *cstr){ size_t len = ::strlen(cstr); for(size_t i = 0; i < len; i++){ char c = base.get(); if(c != cstr[i]) throw FormatException(); } return *this; } bool StdUnserializeStream::eof()const{ return base.eof(); } bool StdUnserializeStream::fail()const{ return base.fail(); } UnserializeStream &StdUnserializeStream::read(char *s, std::streamsize size){ base.read(s, size); return *this; } UnserializeStream &StdUnserializeStream::operator>>(char &a){ base >> a; if(!fail()) consume(" "); return *this; } UnserializeStream &StdUnserializeStream::operator>>(unsigned char &a){ base >> a; if(!fail()) consume(" "); return *this; } UnserializeStream &StdUnserializeStream::operator>>(short &a){ base.operator>>(a); if(!fail()) consume(" "); return *this; } UnserializeStream &StdUnserializeStream::operator>>(unsigned short &a){ base.operator>>(a); if(!fail()) consume(" "); return *this; } UnserializeStream &StdUnserializeStream::operator>>(int &a){ base.operator>>(a); if(!fail()) consume(" "); return *this; } UnserializeStream &StdUnserializeStream::operator>>(unsigned &a){ base.operator>>(a); if(!fail()) consume(" "); return *this; } UnserializeStream &StdUnserializeStream::operator>>(long &a){ base.operator>>(a); if(!fail()) consume(" "); return *this; } UnserializeStream &StdUnserializeStream::operator>>(unsigned long &a){ base.operator>>(a); if(!fail()) consume(" "); return *this; } UnserializeStream &StdUnserializeStream::operator>>(bool &a){ int i; base.operator>>(i); if(!fail()) consume(" "); a = !!i; return *this; } UnserializeStream &StdUnserializeStream::operator>>(float &a){ base.operator>>(a); if(!fail()) consume(" "); return *this; } UnserializeStream &StdUnserializeStream::operator>>(double &a){ base.operator>>(a); if(!fail()) consume(" "); return *this; } UnserializeStream &StdUnserializeStream::operator>>(const char *cstr){ // eat until the first double-quote while(char c = base.get()) if(c == '"') break; else if(c == -1) return *this; consume(cstr); // eat the terminating double-quote if(base.get() != '"') throw FormatException(); return *this; } UnserializeStream &StdUnserializeStream::operator>>(random_sequence &rs){ consume("("); for(int i = 0; i < sizeof rs; i++) *this >> ((unsigned char*)&rs)[i]; consume(")"); return *this; } UnserializeStream &StdUnserializeStream::operator>>(Vec3d &v){ consume("("); *this >> v[0] >> v[1] >> v[2]; consume(")"); return *this; } UnserializeStream &StdUnserializeStream::operator>>(Quatd &v){ consume("("); *this >> v.i() >> v.j() >> v.k() >> v.re(); consume(")"); return *this; } UnserializeStream &StdUnserializeStream::operator >>(cpplib::dstring &a){ // eat until the first double-quote while(char c = base.get()) if(c == '"') break; else if(c == -1) return *this; do{ char c = base.get(); if(c == '\\') c = base.get(); else if(c == '"') break; a << c; }while(true); return *this; } UnserializeStream &StdUnserializeStream::operator >>(gltestp::dstring &a){ // eat until the first double-quote while(char c = base.get()) if(c == '"') break; else if(c == -1) return *this; do{ char c = base.get(); if(c == '\\') c = base.get(); else if(c == '"') break; a << c; }while(true); return *this; } UnserializeStream *StdUnserializeStream::substream(size_t size){ char *buf = new char[size+1]; base.read(buf, size); std::string str(buf, size); delete[] buf; StdUnserializeStream *ret = new StdUnserializeSubStream(str, *this); return ret; } template<typename T> UnserializeStream &BinUnserializeStream::read(T &a){ if(size < sizeof a) throw InputShortageException(); ::memcpy(&a, src, sizeof a); src += sizeof a; size -= sizeof a; return *this; } BinUnserializeStream::BinUnserializeStream(const unsigned char *asrc, size_t asize, UnserializeContext *ausc) : src(asrc), size(asize), tt(ausc){ } UnserializeStream &BinUnserializeStream::read(char *s, std::streamsize ssize){ if(size < (size_t)ssize) throw InputShortageException(); ::memcpy(s, src, ssize); src += ssize; size -= ssize; return *this; } // Refs #37 We'd have to care about variable sizes in unserialization stream, // too. But now, these methods are only called in Windows client, which means // interpreted by VC9's IL32P64 rule. bool BinUnserializeStream::eof()const{return !size;} bool BinUnserializeStream::fail()const{return !size;} UnserializeStream &BinUnserializeStream::operator>>(char &a){return read(a);} UnserializeStream &BinUnserializeStream::operator>>(unsigned char &a){return read(a);} UnserializeStream &BinUnserializeStream::operator>>(short &a){return read(a);} UnserializeStream &BinUnserializeStream::operator>>(unsigned short &a){return read(a);} UnserializeStream &BinUnserializeStream::operator>>(int &a){return read(a);} UnserializeStream &BinUnserializeStream::operator>>(unsigned &a){return read(a);} UnserializeStream &BinUnserializeStream::operator>>(long &a){return read(a);} UnserializeStream &BinUnserializeStream::operator>>(unsigned long &a){return read(a);} UnserializeStream &BinUnserializeStream::operator>>(bool &a){return read(a);} UnserializeStream &BinUnserializeStream::operator>>(float &a){return read(a);} UnserializeStream &BinUnserializeStream::operator>>(double &a){return read(a);} UnserializeStream &BinUnserializeStream::operator>>(random_sequence &rs){ for(int i = 0; i < sizeof rs; i++) *this >> ((unsigned char*)&rs)[i]; return *this; } UnserializeStream &BinUnserializeStream::operator>>(Vec3d &v){ *this >> v[0] >> v[1] >> v[2]; return *this; } UnserializeStream &BinUnserializeStream::operator>>(Quatd &v){ *this >> v.i() >> v.j() >> v.k() >> v.re(); return *this; } UnserializeStream &BinUnserializeStream::operator>>(const char *a){ size_t len = ::strlen(a) + 1; if(size < len) throw InputShortageException(); if(::strncmp(reinterpret_cast<const char*>(src), a, len)) throw FormatException(); src += len; size -= len; return *this; } UnserializeStream &BinUnserializeStream::operator>>(cpplib::dstring &a){ // We must clear the string here or it will expand everytime call is made, // which is not straightforward behavior compared to the operator>>()s for the other types. a = ""; char c; while(c = get()){ if(c == -1) throw InputShortageException(); a << c; } return *this; } UnserializeStream &BinUnserializeStream::operator>>(gltestp::dstring &a){ // We must clear the string here or it will expand everytime call is made, // which is not straightforward behavior compared to the operator>>()s for the other types. a = ""; char c; while(c = get()){ if(c == -1) throw InputShortageException(); a << c; } return *this; } UnserializeStream *BinUnserializeStream::substream(size_t size){ const unsigned char *retsrc = src; // advance pointers src += size; this->size -= size; return new BinUnserializeStream(retsrc, size, usc); } char BinUnserializeStream::get(){ if(size == 0) return -1; // EOF size--; return *src++; } char *strnewdup(const char *src, size_t len){ char *ret = new char[len + 1]; ::strncpy(ret, src, len + 1); ret[len] = '\0'; return ret; } char *strmdup(const char *src, size_t len){ char *ret = (char*)malloc(len + 1); ::strncpy(ret, src, len + 1); ret[len] = '\0'; return ret; }
3c31e30cb51fe193f9bec41354a9ee354d6fd3e5
42cf0705c33e7e6ca6a8e61c69a3ee2109f12c31
/TestSFML/Settings.cpp
5a66f3c4cf8b2720f27cf883a8870aa007ca1ed9
[]
no_license
Emblemaa/Crazy-Road-Crossing
2eb5e37d998a39193c49e08f81444c5ac784fb20
5fe0fc3e0169f17cb4c87540e56053e675d38902
refs/heads/master
2023-04-17T07:53:20.275846
2021-04-29T08:33:48
2021-04-29T08:33:48
362,746,055
0
0
null
null
null
null
UTF-8
C++
false
false
509
cpp
Settings.cpp
#include "Settings.h" // PROJECT - CLASS - SETTINGS FUNCTION Settings::Settings() { } Settings::Settings(sf::Texture* tx) { /*panel.setTexture(tx[6]); panel.setPosition(550, 210); sf::Vector2f panel_pos = panel.getPosition(); panel.setScale(4, 4);*/ panel.setTexture(tx[6]); panel.setOrigin(tx[6].getSize().x / 2, 0); panel.setScale(3, 3); panel.setPosition(WINDOW_WIDTH / 2, (WINDOW_HEIGHT - tx[6].getSize().y * 3) / 2); sf::Vector2f panel_pos = panel.getPosition(); } Settings::~Settings() {}