- Main Page
- Classes
- Files

# Muele.h

    00001 /*
    00002 * Neural Networks Tearm Project
    00003 * Martin Johne
    00004 * 04.10.2006
    00005 */
    00006
    00007 #pragma once
    00008
    00009 #include <irrlicht.h>
    00010 #include "IrrConsole/console.h"
    00011 #include "Symmetry.h"
    00012
    00013 using namespace irr;
    00014
    00015
    00016 #define EMTY_FIELD                       0
    00017 #define PLAYER_1                         1
    00018 #define PLAYER_2                         2
    00019 #define PLAYER_TYPE_HUMAN        0
    00020 #define PLAYER_TYPE_AINN         1
    00021 #define PLAYER_TYPE_AILT         2
    00022
    00023 // definition of id values for GUI elements
    00024 // menu ID's
    00025 #define ID_MENU_GAME_QUIT                       50
    00026 #define ID_MENU_GAME_PREFERENCES        51
    00027 #define ID_MENU_AI_COMPETITION          52
    00028 #define ID_MENU_AI_NN_SETUP                     53
    00029 #define ID_MENU_HELP                            54
    00030
    00031 // gerneric ID's
    00032 #define ID_BUTTON_GENERAL_CLOSE         55
    00033
    00034 // preferences window id's
    00035 #define ID_EDIT_X                                       60
    00036 #define ID_EDIT_Y                                       61
    00037 #define ID_EDIT_Z                                       62
    00038 #define ID_CHECK_HUMAN1                         63
    00039 #define ID_CHECK_HUMAN2                         64
    00040 #define ID_CHECK_AINN1                          65
    00041 #define ID_CHECK_AINN2                          66
    00042 #define ID_CHECK_AILT1                          67
    00043 #define ID_CHECK_AILT2                          68
    00044 #define ID_BUTTON_NNSETUP                       69
    00045 #define ID_BUTTON_CLOSE_PREF            70
    00046 #define ID_BUTTON_AICOMPETITION         71
    00047 #define ID_EDIT_CONNECT                         73
    00048 #define ID_BUTTON_SET                           74
    00049
    00050 // AI competition window id's
    00051 #define ID_CHECK_WEAKEN1                        80
    00052 #define ID_CHECK_WEAKEN2                        81
    00053 #define ID_BUTTON_START_COMPETITION     82
    00054 #define ID_BUTTON_CLOSE_COMP            84
    00055
    00056 // Neural Network window id's
    00057 #define ID_BUTTON_CLOSE_NN                      90
    00058 #define ID_BUTTON_START_TRAINING        91
    00059 #define ID_BUTTON_STOP_TRAINING         92
    00060 #define ID_BUTTON_CONTINUE_TRAINING     93
    00061 #define ID_BUTTON_LOAD_NET                      95
    00062 #define ID_BUTTON_SAVE_NET                      96
    00063 #define ID_BUTTON_SAVE_DEFAULT          97
    00064 #define ID_BUTTON_LOAD_DEFAULT          98
    00065 #define ID_BUTTON_TRAIN_SURE            99
    00066 #define ID_CHECK_LARGE_VECTOR           100
    00067 #define ID_BUTTON_SAVE_NOW                      101
    00068 #define ID_EDIT_FILE_NAME                       102
    00069 #define ID_BUTTON_SAVE_DEFAULT_NOW  103
    00070
    00071 #define FIELD_VALUE(P_BOARD, X, Y, Z) P_BOARD[(Z) * boardFieldCountPlain + (Y) * boardSizeX + (X)]
    00072
    00073 // advance declarations
    00074 class CPreferencesWindow;
    00075 class CAICompetitionWindow;
    00076 class CLookUpTable;
    00077 class CNeuralNetwork;
    00078 class CNeuralNetworkWindow;
    00079
    00081
    00084 class CMuele : public IEventReceiver, public IC_Console
    00085 {
    00086 public:
    00087
    00088         // constructor and destructor
    00089
    00090         CMuele();
    00091         ~CMuele();
    00092
    00093         // methods
    00094
    00096         void resetBoard(bool keepNeuralNetwork);
    00098         void restartBoard();
    00100         bool OnEvent(SEvent event);
    00102         gui::IGUIWindow* createWindow(int sizeX, int sizeY, wchar_t *name);
    00104         gui::IGUIWindow* createInformationWindow(int sizeX, int sizeY, wchar_t *name, wchar_t *text);
    00106         int run(char *argv[]);
    00107
    00108
    00109         // variables
    00110
    00111         CPreferencesWindow              *pPreferencesWindow;
    00112         CAICompetitionWindow    *pAICompetitionWindow;
    00113         CLookUpTable                    *pLookUpTable;
    00114         CNeuralNetwork                  *pNeuralNetwork;
    00115         CSymmetry                               *pSymmetry;
    00116         CNeuralNetworkWindow    *pNeuralNetworkWindow;
    00117
    00118         char actualPlayer, lastPlayer;
    00119         char actualPlayerType, lastPlayerType;
    00120         char *pBoard;
    00121         int  winFieldCount;
    00122         int  boardSizeX, boardSizeY, boardSizeZ;
    00123         int  boardFieldCount, boardFieldCountPlain;
    00124         int  gameFinished;
    00125         char playerOneType, playerTwoType;
    00126         bool trainingRunning;
    00127
    00128         video::IVideoDriver  *pDriver;
    00129         gui::IGUIEnvironment *pGuiEnv;
    00130         scene::ISceneManager *pSmgr;
    00131
    00132 private:
    00133
    00134         // methods
    00135
    00136         void switchActualPlayer(int moveOfActualPlayer);
    00137         core::position2d<s32> getScreenCoordinatesFrom3DPosition(core::vector3df pos3d);
    00138
    00139         // variables
    00140
    00141         f32  boardFieldDistance;
    00142         f32  halfBoardWidthX, halfBoardWidthY;
    00143         int  selectedCylinder;
    00144         int  winFieldCountTimesX;
    00145         int  moveNumber;
    00146
    00147         char *pWinnerBoard;
    00148         int *pMoveHistory;
    00149
    00150         video::SMaterial materialCylinder;
    00151         video::SMaterial materialSphere[3];
    00152         video::SMaterial materialSphereWon[3];
    00153 };
    00154