Nerdery and models |
[Jun. 6th, 2006|02:56 pm]
Sam Barham
|
One of the guys in my bible study group got married a wee while ago, and another friend asked him if he was going to open source his wedding. So he turned up a few weeks later with the source code to said wedding. And its open source, so I can stick it here too :)
So, the source code required to execute a wedding is ... (Warning for coders. He used incorrect c++ deliberately to make it more readable for non-coders)
/* The source code to my wedding. Please do not notify me of errors in the code. Copyright (C) 2006 Hadyn Youens
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 for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.*/
// Includes #include "stdafx.h" #include "wedding.h" #include "mydatetime.h" #include "money.h" #include "_money.h" #include "__money.h" #include "___money.h" #include "guests.h" #include "music.h" #include "components.h" #include "gifts.h" #include "honeymoon.h" #include "weather.h" #include "bride.h" #include "bridegroom.h" #include "backup.h"
// Defines #define MAX_GIFTS 10000 #define COST_OF_RINGS 25000 #define NUM_GUESTS 3000
int _tmain(int argc, _TCHAR* argv[]) { // Wedding date date dday = new date(4,2,2006); // Bank account balance double my_bal = bank.myaccount.getbalance(); // Create bride Bride bride = new Bride(); // Create groom Bridegroom groom = new Bridegroom();
// Organise the wedding while (today() != dday) { my_bal = mybal - 100;
if (not_complete("honeymoon") && rand() < 0.5) {get_honeymoon();} if (not_complete("rings") && rand() < 0.5) {get_rings();} if (not_complete("church") && rand() < 0.6) {get_church();} if (not_complete("pastor") && rand() < 0.8) {get_pastor();} if (not_complete("photographer") && rand() < 0.7) {get_photographer();} if (not_complete("music") && rand() < 0.4) {get_music();} if (not_complete("bridal_party") && rand() < 0.8) {get_friends();} if (not_complete("suits") && rand() < 0.6) {get_suits();} if (not_complete("dress") && rand() < 0.7) {get_dress();} if (not_complete("food") && rand() < 0.9) {get_food();} if (not_complete("reception") && rand() < 0.5) {get_reception();} if (not_complete("cars") && rand() < 0.5) {get_cars();} if (not_complete("invitations") && rand() < 0.8) {get_invitations();}
bride.setStresslevel(bride.getStresslevel() * 10); groom.setStresslevel(groom.getStresslevel() + 1); } // Create guests Guest guests[NUM_GUESTS];
for (int i=0; i++; i[ Error: Irreparable invalid markup ('<num_guests)>') in entry. Owner must fix manually. Raw contents below.] One of the guys in my bible study group got married a wee while ago, and another friend asked him if he was going to open source his wedding. So he turned up a few weeks later with the source code to said wedding. And its open source, so I can stick it here too :)
So, the source code required to execute a wedding is ... (Warning for coders. He used incorrect c++ deliberately to make it more readable for non-coders)
/* The source code to my wedding. Please do not notify me of errors in the code. Copyright (C) 2006 Hadyn Youens
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 for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.*/
// Includes #include "stdafx.h" #include "wedding.h" #include "mydatetime.h" #include "money.h" #include "_money.h" #include "__money.h" #include "___money.h" #include "guests.h" #include "music.h" #include "components.h" #include "gifts.h" #include "honeymoon.h" #include "weather.h" #include "bride.h" #include "bridegroom.h" #include "backup.h"
// Defines #define MAX_GIFTS 10000 #define COST_OF_RINGS 25000 #define NUM_GUESTS 3000
int _tmain(int argc, _TCHAR* argv[]) { // Wedding date date dday = new date(4,2,2006); // Bank account balance double my_bal = bank.myaccount.getbalance(); // Create bride Bride bride = new Bride(); // Create groom Bridegroom groom = new Bridegroom();
// Organise the wedding while (today() != dday) { my_bal = mybal - 100;
if (not_complete("honeymoon") && rand() < 0.5) {get_honeymoon();} if (not_complete("rings") && rand() < 0.5) {get_rings();} if (not_complete("church") && rand() < 0.6) {get_church();} if (not_complete("pastor") && rand() < 0.8) {get_pastor();} if (not_complete("photographer") && rand() < 0.7) {get_photographer();} if (not_complete("music") && rand() < 0.4) {get_music();} if (not_complete("bridal_party") && rand() < 0.8) {get_friends();} if (not_complete("suits") && rand() < 0.6) {get_suits();} if (not_complete("dress") && rand() < 0.7) {get_dress();} if (not_complete("food") && rand() < 0.9) {get_food();} if (not_complete("reception") && rand() < 0.5) {get_reception();} if (not_complete("cars") && rand() < 0.5) {get_cars();} if (not_complete("invitations") && rand() < 0.8) {get_invitations();}
bride.setStresslevel(bride.getStresslevel() * 10); groom.setStresslevel(groom.getStresslevel() + 1); } // Create guests Guest guests[NUM_GUESTS];
for (int i=0; i++; i<NUM_GUESTS) { guests[i] = new Guest(); }
bride.setStresslevel(bride.getStresslevel() * 10); groom.setStresslevel(groom.getStresslevel() - 20);
// Remove any guests without gifts for (int i=0; i++; i<NUM_GUESTS) { if (guests[i].gift == NULL) { delete guests[i]; } }
// Check to see if there are any guests left int anyleft; for (int i=0; i++; i<NUM_GUESTS) { if (guests[i].gift != NULL) { anyleft++; } } // If there are no guests left, create a rent a crowd if (anyleft == 0) { People rent_a_crowd = new People(3000); anyleft = 3000; mybal = mybal - 500; }
// Start the groom groom.execute(); // Wait for the bride char tmp; cout << "Press enter when the bride arrives..." << endl; cin >> tmp;
music(0); // Start the first instance of the music bride.execute(); // Start bride tears(); // Start tears smile(); // Smile pastor(0); // Start the first instance of the pastor music(1); // Start the second instance of the music pastor(1); // Start the second instance of the pastor
// If the bride doesn't say "I do", get out of there if (bride.getResponse() != "I do") { tears(); exit(false); }
// If the best man doesn't have the ring, remove him // and promote the groomsman if (groom.bestman.get_rings() == NULL) { delete groom.bestman; groom.bestman = groom.groomsman[0]; groom.setStresslevel(groom.getStresslevel() + 2); groom.getBackupRing(); }else { rings(); }
kiss(groom, bride); // Start the kiss bride.blush(); // Start the brides blush smile(); // Start the smiles
// Begin the photographs photos(photographer); photos(guests); bride.setStesslevel(bride.getStesslevel() + 3); groom.setStesslevel(groom.getStesslevel() + 30);
// Remove all guests with an inappropriate speech for (int i=0; i++; i<anyleft) { if (guests[i].inappropriateSpeech) { delete guests[i]; } }
reception(); // Start reception speeches(); // Start the speeches
// Remove the drunks for (int i=0; i++; i<anyleft) { if (guests[i].getBloodAlcoholLevel() > 80) { delete guests[i]; } }
// Get rid of everyone else delete groom.bestman; delete [] groom.groomsman; delete [] bride.bridesmaid; delete [] guests;
// No money left if (mybal > 0) { mybal = 0; }
// Time for the honeymoon exit(HONEYMOON); }
In other news, I went to a WARMACHINE tournament on Sunday, where I won first place, and the painting prize too!!!!! You can see a (crappy, blurry) picture of the winning model <a href="http://forums.privateerpress.com/index.php?showtopic=82226">here</a>. Not only that, but for approximately 22 hours I had no unpainted models, which hasn't happened since I started painting about 15 years ago. It was a slightly weird feeling, so I went and spent some of my tounament winnings on new figures. |
|