dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Win32 Application - Help With Math

  1. #1
    Join Date
    Oct 2011
    Posts
    0

    Win32 Application - Help With Math

    Hello, I'm currently working on a *** Game Predictor. I thought it was a pretty cool idea for a beginner.... Anyways, I'm kind of a noob and would really appreciate it if somebody can help me out with the math part of the code.


    Code:
    #define _WIN32_WINNT  0x0500
    #include <windows.h>
    #include <Wincon.h>
    #include <cstdlib>
    #include <iostream>
    
    using namespace std;
    
    int main(int argc, char *argv[])
    { 
        //Data Table
        int iTeam1apy;
        int iTeam2apy;
        int iTeam1ary;
        int iTeam2ary;
        int iTeam1aya;
        int iTeam2aya;
        double dTeam1as;
        double dTeam2as;
        double dTeam1ai;
        double dTeam2ai;
        int iTeam1lp;
        int iTeam2lp;
        int iTeam1wl;
        int iTeam2wl;
        double dTeam1line;
        double dTeam2line;
        double dTeam1 = 10.0; // Home Team Gets 10.0 Points Advantage
        double dTeam2;
        double dTeam1p;
        double dteam2p;
        double dTotal;
        
        //Full Screen Mode    
        HWND hWnd = GetConsoleWindow();
        ShowWindow(hWnd,SW_SHOWMAXIMIZED);
        
        //Title & Color
        system("title *** Game Predictor BETA Handicapping Software");
        system("color E2");
        
        //Instructions
        cout << "Loading *** Predictor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . \n";
        system("PAUSE");
        system("cls");
        cout << "Instructions: \n \n";
        cout << "Enter all the data needed to predict the game. \n \n";
        cout << "Offensive- Average Passing Yards Per Game \n \n";
        cout << "Offensive- Average Rushing Yards Per Game \n \n";
        cout << "Defensive- Average Yards Against Per Game \n \n";
        cout << "Defensive- Average Sacks Per Game (If less than 1, devide the number of sacks by the number of games played)\n \n";
        cout << "Defensive- Average Interceptions Per Game (If less than 1, devide the number of interceptions by the number of games played)\n \n";
        cout << "Team- League Position \n \n";
        cout << "Team- Win/Lose Streak (Must be more than 3 games) \n \n";
        cout << "Sport Book- Enter the lines from your sports book \n \n";
        system("pause");
        system("cls");
        
        //The Home Team
        cout << "Please Enter The Data For The Home Team. \n";
        cout << "Home Team Average Passing Yards Per Game? \n";
        cin >> iTeam1apy;
        cout << "\n";
        cout << "Home Team Average Rushing Yards Per Game? \n";
        cin >> iTeam1ary;
        cout << "\n";
        cout << "Home Team Average Yards Against Per Game? \n";
        cin >> iTeam1aya;
        cout << "\n";
        cout << "Home Team Average Sacks Per Game? \n";
        cin >> dTeam1as;
        cout << "\n";
        cout << "Home Team Average Interceptions Per Game? \n";
        cin >> dTeam1ai;
        cout << "\n";
        cout << "Home Team League Position? \n";
        cin >> iTeam1lp;
        cout << "\n";
        cout << "Home Team Win/Lose Streak? (Must Be Greater Than 3) \n";
        cin >> iTeam1wl;
        cout << "\n";
        cout << "Home Team Sports Book Odds, Money Line? (E.g.: 1.85) \n";
        cin >> dTeam1line;
        cout << "\n";
        system("pause");
        system("cls");
        
        // The Away Team
        cout << "Please Enter The Data For The Away Team. \n";
        cout << "Away Team Average Passing Yards Per Game? \n";
        cin >> iTeam2apy;
        cout << "\n";
        cout << "Away Team Average Rushing Yards Per Game? \n";
        cin >> iTeam2ary;
        cout << "\n";
        cout << "Away Team Average Yards Against Per Game? \n";
        cin >> iTeam2aya;
        cout << "\n";
        cout << "Away Team Average Sacks Per Game? \n";
        cin >> dTeam2as;
        cout << "\n";
        cout << "Away Team Average Interceptions Per Game? \n";
        cin >> dTeam2ai;
        cout << "\n";
        cout << "Away Team League Position? \n";
        cin >> iTeam2lp;
        cout << "\n";
        cout << "Away Team Win/Lose Streak? (Must Be Greater Than 3) \n";
        cin >> iTeam2wl;
        cout << "\n";
        cout << "Away Team Sports Book Odds, Money Line? (E.g.: 1.85) \n";
        cin >> dTeam2line;
        cout << "\n";
        system("pause");
        system("cls");
        cout << "CALCULATING ODDS .....\n";
        system("pause");
        system("CLS");
        
        // The Math
        // Scoring System:
        // Average Passing Yards = +0.5 Points Per Yard
        // Average Passing Yards = +1.0 Points Per Yard
        // Average Yards Against = -1.5 Points per Yard
        // Average Sacks = +5.0 Points Per Sack
        // Average Interceptions = +5.0 Points Per Interception 
        // League Rank = (1) 50.0 Points; (2) 40.0 Points; (3) 30.0 Points; (4) 20.0 Points ...
        // Win / Lose Streak = (3) +/- 20.0 Points; (4) +/- 25.0 Points; (5) +/- 30.0 Points ...
        // 
        // Sport Book odds : If dTeam1line < dTeam2line then dTeam1 + 10.0 Points 
        //                   If dTeam2line < dTeam1line then dTeam1 - 10.0 Points
        //
        // Comparing The Teams: If dTeam1 > dTeam2 then dTeam1 Wins
        //                      If dTeam2 > dTeam1 then dTeam2 Wins
        //
        // Calculate % for each team: dTeam1 + dTeam2 = dTotal 
        //                           dTotal / dTeam1 = dTeam1p
        //                           dTotal / dTeam2 = dTeam2p
        //
        // Display Winning Team and Percentage.
     
        //The End       
        system("pause");
        return EXIT_SUCCESS;
    }
    PS: I don't know if this is making any sence to you gurus, I'm a noob.. :S
    Thanks Very Much.
    Kind Regards
    - Mat P.

  2. #2
    Join Date
    Apr 2008
    Posts
    726

    Re: Win32 Application - Help With Math

    well, you have all the numbers, and you spelt out all of the maths, so just code it up.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)