git repos / blockattack-game

blame: source/code/BlockGame.hpp

normal view · raw

89c4a3a6 sago007 2008-08-29 14:32 1
/*
c53e6443 sago007 2012-04-17 11:04 2
===========================================================================
c53e6443 sago007 2012-04-17 11:04 3
blockattack - Block Attack - Rise of the Blocks
c53e6443 sago007 2012-04-17 11:04 4
Copyright (C) 2005-2012 Poul Sander
c53e6443 sago007 2012-04-17 11:04 5
c53e6443 sago007 2012-04-17 11:04 6
This program is free software: you can redistribute it and/or modify
c53e6443 sago007 2012-04-17 11:04 7
it under the terms of the GNU General Public License as published by
c53e6443 sago007 2012-04-17 11:04 8
the Free Software Foundation, either version 2 of the License, or
c53e6443 sago007 2012-04-17 11:04 9
(at your option) any later version.
c53e6443 sago007 2012-04-17 11:04 10
c53e6443 sago007 2012-04-17 11:04 11
This program is distributed in the hope that it will be useful,
c53e6443 sago007 2012-04-17 11:04 12
but WITHOUT ANY WARRANTY; without even the implied warranty of
c53e6443 sago007 2012-04-17 11:04 13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
c53e6443 sago007 2012-04-17 11:04 14
GNU General Public License for more details.
c53e6443 sago007 2012-04-17 11:04 15
c53e6443 sago007 2012-04-17 11:04 16
You should have received a copy of the GNU General Public License
c53e6443 sago007 2012-04-17 11:04 17
along with this program.  If not, see http://www.gnu.org/licenses/
c53e6443 sago007 2012-04-17 11:04 18
c53e6443 sago007 2012-04-17 11:04 19
Source information and contacts persons can be found at
021de090 sago007 2015-12-30 18:56 20
http://blockattack.net
c53e6443 sago007 2012-04-17 11:04 21
===========================================================================
c53e6443 sago007 2012-04-17 11:04 22
*/
89c4a3a6 sago007 2008-08-29 14:32 23
17916a2e sago007 2010-11-07 11:26 24
#ifndef BLOCKGAME_HPP
17916a2e sago007 2010-11-07 11:26 25
#define BLOCKGAME_HPP 1
17916a2e sago007 2010-11-07 11:26 26
32c9b349 sago007 2008-11-20 18:14 27
#include "stats.h"
32c9b349 sago007 2008-11-20 18:14 28
#include "common.h"
17916a2e sago007 2010-11-07 11:26 29
17916a2e sago007 2010-11-07 11:26 30
#define NUMBEROFCHAINS 100
69862ef6 sago007 2015-08-22 17:24 31
#define BLOCKWAIT 100000
69862ef6 sago007 2015-08-22 17:24 32
#define BLOCKHANG 1000
32c9b349 sago007 2008-11-20 18:14 33
6c9b4cd7 sago007 2012-05-01 19:34 34
#define ACTION_UPDATE 0
6c9b4cd7 sago007 2012-05-01 19:34 35
#define ACTION_MOVECURSOR 1
6c9b4cd7 sago007 2012-05-01 19:34 36
#define ACTION_MOVECURSORTO 2
6c9b4cd7 sago007 2012-05-01 19:34 37
#define ACTION_SWITCH 3
6c9b4cd7 sago007 2012-05-01 19:34 38
#define ACTION_PUSH 4
6c9b4cd7 sago007 2012-05-01 19:34 39
#define ACTION_CREATEGARBAGE 5
6c9b4cd7 sago007 2012-05-01 19:34 40
#define ACTION_CREATEGRAYGARBAGE 6
6c9b4cd7 sago007 2012-05-01 19:34 41
#define ACTION_GAMEOVER 7
6c9b4cd7 sago007 2012-05-01 19:34 42
#define ACTION_WIN 8
6c9b4cd7 sago007 2012-05-01 19:34 43
#define ACTION_DRAW 9
6c9b4cd7 sago007 2012-05-01 19:34 44
#define ACTION_GAMESPEED 10
6c9b4cd7 sago007 2012-05-01 19:34 45
#define ACTION_HANDICAP 11
6c9b4cd7 sago007 2012-05-01 19:34 46
#define ACTION_NEW 12
6c9b4cd7 sago007 2012-05-01 19:34 47
#define ACTION_NEWTT 13
6c9b4cd7 sago007 2012-05-01 19:34 48
#define ACTION_NEWVS 14
6c9b4cd7 sago007 2012-05-01 19:34 49
#define ACTION_STARTBLOCKS 15
6c9b4cd7 sago007 2012-05-01 19:34 50
#define ACTION_NOP 16
6c9b4cd7 sago007 2012-05-01 19:34 51
a1072daf sago007 2016-02-20 12:47 52
enum stageButton {SBdontShow, SBstageClear, SBpuzzleMode};
a1072daf sago007 2016-02-20 12:47 53
a1072daf sago007 2016-02-20 12:47 54
extern stageButton stageButtonStatus;
a1072daf sago007 2016-02-20 12:47 55
a1072daf sago007 2016-02-20 12:47 56
//This is the size of the blocks. They are always 50. The internal logic calculates it that way
a1072daf sago007 2016-02-20 12:47 57
const int bsize = 50;
a1072daf sago007 2016-02-20 12:47 58
5159dd90 sago007 2016-02-21 15:50 59
/**
5159dd90 sago007 2016-02-21 15:50 60
 * This struct defines the start conditions of the game
5159dd90 sago007 2016-02-21 15:50 61
 */
5159dd90 sago007 2016-02-21 15:50 62
struct BlockGameStartInfo {
5159dd90 sago007 2016-02-21 15:50 63
	unsigned int ticks = 0;
5159dd90 sago007 2016-02-21 15:50 64
	bool timeTrial = false;
b256fda5 sago007 2016-02-21 16:21 65
	///True means a stage clear game will be started. level must be set too.
b1fe2ae5 sago007 2016-02-21 16:01 66
	bool stageClear = false;
b256fda5 sago007 2016-02-21 16:21 67
	///True if puzzle mode. level must be set too.
b256fda5 sago007 2016-02-21 16:21 68
	bool puzzleMode = false;
b1fe2ae5 sago007 2016-02-21 16:01 69
	int level = 0;
1e5aff60 sago007 2016-02-21 18:23 70
	bool AI = false;
1e5aff60 sago007 2016-02-21 18:23 71
	bool vsMode = false;
1e5aff60 sago007 2016-02-21 18:23 72
};
1e5aff60 sago007 2016-02-21 18:23 73
1e5aff60 sago007 2016-02-21 18:23 74
struct GarbageStruct {
1e5aff60 sago007 2016-02-21 18:23 75
	bool greyGarbage = false;
1e5aff60 sago007 2016-02-21 18:23 76
	int width = 6;
1e5aff60 sago007 2016-02-21 18:23 77
	int height = 1;
5159dd90 sago007 2016-02-21 15:50 78
};
5159dd90 sago007 2016-02-21 15:50 79
89c4a3a6 sago007 2008-08-29 14:32 80
////////////////////////////////////////////////////////////////////////////////
89c4a3a6 sago007 2008-08-29 14:32 81
//The BloackGame class represents a board, score, time etc. for a single player/
89c4a3a6 sago007 2008-08-29 14:32 82
////////////////////////////////////////////////////////////////////////////////
c53e6443 sago007 2012-04-17 11:04 83
class BlockGame
c53e6443 sago007 2012-04-17 11:04 84
{
89c4a3a6 sago007 2008-08-29 14:32 85
private:
c53e6443 sago007 2012-04-17 11:04 86
	int prevTowerHeight;
c53e6443 sago007 2012-04-17 11:04 87
	bool bGarbageFallLeft;
a1072daf sago007 2016-02-20 12:47 88
	bool singlePuzzle = false;
89c4a3a6 sago007 2008-08-29 14:32 89
63c773dd sago007 2016-01-24 11:47 90
	int nextGarbageNumber;
63c773dd sago007 2016-01-24 11:47 91
	int pushedPixelAt;
63c773dd sago007 2016-01-24 11:47 92
	int nrPushedPixel, nrFellDown;
63c773dd sago007 2016-01-24 11:47 93
	unsigned int nrStops;
c53e6443 sago007 2012-04-17 11:04 94
	bool garbageToBeCleared[7][30];
63c773dd sago007 2016-01-24 11:47 95
	unsigned int lastAImove;
89c4a3a6 sago007 2008-08-29 14:32 96
63c773dd sago007 2016-01-24 11:47 97
	int AI_LineOffset; //how many lines have changed since command
63c773dd sago007 2016-01-24 11:47 98
	int hangTicks;    //How many times have hang been decreased?
c53e6443 sago007 2012-04-17 11:04 99
	//int the two following index 0 may NOT be used (what the fuck did I meen?)
63c773dd sago007 2016-01-24 11:47 100
	int chainSize[NUMBEROFCHAINS]; //Contains the chains
c53e6443 sago007 2012-04-17 11:04 101
	bool chainUsed[NUMBEROFCHAINS];   //True if the chain is used
89c4a3a6 sago007 2008-08-29 14:32 102
63c773dd sago007 2016-01-24 11:47 103
	unsigned int nextRandomNumber;
fde1f2dd sago007 2016-02-21 15:24 104
	int Level; //Only used in stageClear and puzzle (not implemented)
89c4a3a6 sago007 2008-08-29 14:32 105
63c773dd sago007 2016-01-24 11:47 106
	int rand2();
c53e6443 sago007 2012-04-17 11:04 107
	int firstUnusedChain();
89c4a3a6 sago007 2008-08-29 14:32 108
e1290bdf sago007 2010-10-25 19:56 109
//public:
6b1dc7a6 sago007 2010-11-08 21:03 110
protected:
c53e6443 sago007 2012-04-17 11:04 111
	int lastCounter;
63c773dd sago007 2016-01-24 11:47 112
	std::string strHolder;
c53e6443 sago007 2012-04-17 11:04 113
	bool bDraw;
c53e6443 sago007 2012-04-17 11:04 114
	unsigned int ticks;
80b830cd sago007 2012-08-19 17:51 115
	unsigned int gameStartedAt;
80b830cd sago007 2012-08-19 17:51 116
	unsigned int gameEndedAfter;		//How long did the game last?
c53e6443 sago007 2012-04-17 11:04 117
	int linesCleared;
c53e6443 sago007 2012-04-17 11:04 118
	int TowerHeight;
c53e6443 sago007 2012-04-17 11:04 119
	BlockGame *garbageTarget;
63c773dd sago007 2016-01-24 11:47 120
	int board[7][30];
c53e6443 sago007 2012-04-17 11:04 121
	int stop;
c53e6443 sago007 2012-04-17 11:04 122
	int speedLevel;
c53e6443 sago007 2012-04-17 11:04 123
	int pixels;
c53e6443 sago007 2012-04-17 11:04 124
	int MovesLeft;
c53e6443 sago007 2012-04-17 11:04 125
	bool timetrial, stageClear, vsMode, puzzleMode;
c53e6443 sago007 2012-04-17 11:04 126
	int stageClearLimit; //stores number of lines user must clear to win
c53e6443 sago007 2012-04-17 11:04 127
	int combo;
c53e6443 sago007 2012-04-17 11:04 128
	int chain;
c53e6443 sago007 2012-04-17 11:04 129
	int cursorx; //stores cursor position
c53e6443 sago007 2012-04-17 11:04 130
	int cursory; // -||-
c53e6443 sago007 2012-04-17 11:04 131
	double speed, baseSpeed; //factor for speed. Lower value = faster gameplay
63c773dd sago007 2016-01-24 11:47 132
	int score;
c53e6443 sago007 2012-04-17 11:04 133
	bool bGameOver;
c53e6443 sago007 2012-04-17 11:04 134
	bool hasWonTheGame;
c53e6443 sago007 2012-04-17 11:04 135
	int AI_MoveSpeed;   //How often will the computer move? milliseconds
c53e6443 sago007 2012-04-17 11:04 136
	bool AI_Enabled;
c53e6443 sago007 2012-04-17 11:04 137
63c773dd sago007 2016-01-24 11:47 138
	int handicap;
c53e6443 sago007 2012-04-17 11:04 139
c53e6443 sago007 2012-04-17 11:04 140
c53e6443 sago007 2012-04-17 11:04 141
	int AIlineToClear;
c53e6443 sago007 2012-04-17 11:04 142
c53e6443 sago007 2012-04-17 11:04 143
	short AIstatus;   //Status flags:
c53e6443 sago007 2012-04-17 11:04 144
	//0: nothing, 2: clear tower, 3: clear horisontal, 4: clear vertical
c53e6443 sago007 2012-04-17 11:04 145
	//1: make more lines, 5: make 2 lines, 6: make 1 line
6b1dc7a6 sago007 2010-11-08 21:03 146
e1290bdf sago007 2010-10-25 19:56 147
public:
c53e6443 sago007 2012-04-17 11:04 148
8f632c05 sago007 2015-08-22 16:21 149
	std::string name;
c53e6443 sago007 2012-04-17 11:04 150
0f031889 sago007 2012-05-01 19:57 151
public:
c53e6443 sago007 2012-04-17 11:04 152
	//Constructor
c53e6443 sago007 2012-04-17 11:04 153
	BlockGame();
c53e6443 sago007 2012-04-17 11:04 154
c53e6443 sago007 2012-04-17 11:04 155
	//Deconstructor, never really used... game used to crash when called, cause of the way sBoard was created
c53e6443 sago007 2012-04-17 11:04 156
	//It should work now and can be used if we want to assign more players in network games that we need to free later
c53e6443 sago007 2012-04-17 11:04 157
	~BlockGame();
c53e6443 sago007 2012-04-17 11:04 158
63c773dd sago007 2016-01-24 11:47 159
	void setGameSpeed(int globalSpeedLevel);
63c773dd sago007 2016-01-24 11:47 160
	void setHandicap(int globalHandicap);
c53e6443 sago007 2012-04-17 11:04 161
	//Set the move speed of the AI based on the aiLevel parameter
c53e6443 sago007 2012-04-17 11:04 162
	//Also enables AI
63c773dd sago007 2016-01-24 11:47 163
	void setAIlevel(int aiLevel);
63c773dd sago007 2016-01-24 11:47 164
	int getAIlevel()  const;
229e212d sago007 2015-08-22 17:14 165
	
313ecd1b sago007 2015-08-22 20:38 166
	virtual void AddText(int x, int y, const std::string& text, int time) const  {}
313ecd1b sago007 2015-08-22 20:38 167
	virtual void AddBall(int x, int y, bool right, int color) const  {}
313ecd1b sago007 2015-08-22 20:38 168
	virtual void AddExplosion(int x, int y) const  {}
313ecd1b sago007 2015-08-22 20:38 169
	virtual void PlayerWonEvent() const  {}
027b5cfd sago007 2015-08-23 14:27 170
	virtual void DrawEvent() const {}
313ecd1b sago007 2015-08-22 20:38 171
	virtual void BlockPopEvent() const  {}
313ecd1b sago007 2015-08-22 20:38 172
	virtual void LongChainDoneEvent() const  {}
313ecd1b sago007 2015-08-22 20:38 173
	virtual void TimeTrialEndEvent() const  {}
313ecd1b sago007 2015-08-22 20:38 174
	virtual void EndlessHighscoreEvent() const  {}
229e212d sago007 2015-08-22 17:14 175
	
027b5cfd sago007 2015-08-23 14:27 176
	int GetScore() const;
027b5cfd sago007 2015-08-23 14:27 177
	int GetHandicap() const;
027b5cfd sago007 2015-08-23 14:27 178
	bool isGameOver() const;
63c773dd sago007 2016-01-24 11:47 179
	int GetGameStartedAt() const;
63c773dd sago007 2016-01-24 11:47 180
	int GetGameEndedAt() const;
027b5cfd sago007 2015-08-23 14:27 181
	bool isTimeTrial() const;
027b5cfd sago007 2015-08-23 14:27 182
	bool isStageClear() const;
027b5cfd sago007 2015-08-23 14:27 183
	bool isVsMode() const;
027b5cfd sago007 2015-08-23 14:27 184
	bool isPuzzleMode() const;
027b5cfd sago007 2015-08-23 14:27 185
	int GetLinesCleared() const;
027b5cfd sago007 2015-08-23 14:27 186
	int GetStageClearLimit() const;
027b5cfd sago007 2015-08-23 14:27 187
	int GetChains() const;
027b5cfd sago007 2015-08-23 14:27 188
	int GetPixels() const;
027b5cfd sago007 2015-08-23 14:27 189
	int GetSpeedLevel() const;
027b5cfd sago007 2015-08-23 14:27 190
	int GetTowerHeight() const;
027b5cfd sago007 2015-08-23 14:27 191
	int GetCursorX() const;
027b5cfd sago007 2015-08-23 14:27 192
	int GetCursorY() const;
c53e6443 sago007 2012-04-17 11:04 193
	void MoveCursorTo(int x, int y);
027b5cfd sago007 2015-08-23 14:27 194
	bool GetIsWinner() const;
5159dd90 sago007 2016-02-21 15:50 195
	void NewGame(const BlockGameStartInfo &s);
63c773dd sago007 2016-01-24 11:47 196
	void putStartBlocks(int n);
0f031889 sago007 2012-05-01 19:57 197
	//Creates garbage using a given wide and height
0f031889 sago007 2012-05-01 19:57 198
	bool CreateGarbage(int wide, int height);
0f031889 sago007 2012-05-01 19:57 199
	//Creates garbage using a given wide and height
0f031889 sago007 2012-05-01 19:57 200
	bool CreateGreyGarbage();
0f031889 sago007 2012-05-01 19:57 201
	//prints "Game Over" and ends game
0f031889 sago007 2012-05-01 19:57 202
	void SetGameOver();
6b5b6bf4 sago007 2016-02-21 15:30 203
	bool GetAIenabled() const;
6b5b6bf4 sago007 2016-02-21 15:30 204
	bool IsNearDeath() const;
0f031889 sago007 2012-05-01 19:57 205
	//Moves the cursor, receaves N,S,E or W as a char an moves as desired
0f031889 sago007 2012-05-01 19:57 206
	void MoveCursor(char way);
0f031889 sago007 2012-05-01 19:57 207
	//switches the two blocks at the cursor position, unless game over
0f031889 sago007 2012-05-01 19:57 208
	void SwitchAtCursor();
0f031889 sago007 2012-05-01 19:57 209
	//Generates a new line and moves the field one block up (restart puzzle mode)
0f031889 sago007 2012-05-01 19:57 210
	void PushLine();
80b830cd sago007 2012-08-19 17:51 211
	void Update(unsigned int newtick);
63c773dd sago007 2016-01-24 11:47 212
	void PerformAction(unsigned int tick, int action, std::string param);
07383b8f sago007 2012-05-11 21:00 213
	/**
b4f1d3cf sago007 2012-08-20 21:28 214
	 *
b4f1d3cf sago007 2012-08-20 21:28 215
	 * @param tick Tick of the action
b4f1d3cf sago007 2012-08-20 21:28 216
	 * @param action The action
b4f1d3cf sago007 2012-08-20 21:28 217
	 * @param param Params.
b4f1d3cf sago007 2012-08-20 21:28 218
	 * @return 1 if an action was selected
b4f1d3cf sago007 2012-08-20 21:28 219
	 */
63c773dd sago007 2016-01-24 11:47 220
	int GotAction(unsigned int &tick, int &action, std::string &param);
c53e6443 sago007 2012-04-17 11:04 221
	//Prints "winner" and ends game
c53e6443 sago007 2012-04-17 11:04 222
	void setPlayerWon();
c53e6443 sago007 2012-04-17 11:04 223
	//void SetGameOver();
c53e6443 sago007 2012-04-17 11:04 224
	//Prints "draw" and ends the game
c53e6443 sago007 2012-04-17 11:04 225
	void setDraw();
a1072daf sago007 2016-02-20 12:47 226
    void setSinglePuzzle(bool singlePuzzle);
a1072daf sago007 2016-02-20 12:47 227
    bool isSinglePuzzle() const;
fde1f2dd sago007 2016-02-21 15:24 228
    int getLevel() const;
1e5aff60 sago007 2016-02-21 18:23 229
    void setGarbageTarget(BlockGame* garbageTarget);
1e5aff60 sago007 2016-02-21 18:23 230
    BlockGame* getGarbageTarget() const;
e1290bdf sago007 2010-10-25 19:56 231
private:
5159dd90 sago007 2016-02-21 15:50 232
	void NewGame(unsigned int ticks);
c53e6443 sago007 2012-04-17 11:04 233
	//Test if LineNr is an empty line, returns false otherwise.
ca486238 sago007 2015-08-23 15:12 234
	bool LineEmpty(int lineNr) const;
c53e6443 sago007 2012-04-17 11:04 235
	//Test if the entire board is empty (used for Puzzles)
ca486238 sago007 2015-08-23 15:12 236
	bool BoardEmpty() const;
c53e6443 sago007 2012-04-17 11:04 237
	//Anything that the user can't move? In that case Game Over cannot occur
ca486238 sago007 2015-08-23 15:12 238
	bool hasStaticContent() const;
c53e6443 sago007 2012-04-17 11:04 239
	void putStartBlocks();
c53e6443 sago007 2012-04-17 11:04 240
	//decreases hang for all hanging blocks and wait for waiting blocks
c53e6443 sago007 2012-04-17 11:04 241
	void ReduceStuff();
c53e6443 sago007 2012-04-17 11:04 242
	//Clears garbage, must take one the lower left corner!
c53e6443 sago007 2012-04-17 11:04 243
	int GarbageClearer(int x, int y, int number, bool aLineToClear, int chain);
c53e6443 sago007 2012-04-17 11:04 244
	//Marks garbage that must be cleared
c53e6443 sago007 2012-04-17 11:04 245
	int GarbageMarker(int x, int y);
c53e6443 sago007 2012-04-17 11:04 246
	int FirstGarbageMarker(int x, int y);
c53e6443 sago007 2012-04-17 11:04 247
	//Clear Blocks if 3 or more is alligned (naive implemented)
c53e6443 sago007 2012-04-17 11:04 248
	void ClearBlocks();
c53e6443 sago007 2012-04-17 11:04 249
	//Moves all peaces a spot down if possible
c53e6443 sago007 2012-04-17 11:04 250
	int FallBlock(int x, int y, int number);
c53e6443 sago007 2012-04-17 11:04 251
	//Makes all Garbage fall one spot
c53e6443 sago007 2012-04-17 11:04 252
	void GarbageFall();
c53e6443 sago007 2012-04-17 11:04 253
	//Makes the blocks fall (it doesn't test time, this must be done before hand)
c53e6443 sago007 2012-04-17 11:04 254
	void FallDown();
c53e6443 sago007 2012-04-17 11:04 255
	//Pushes a single pixel, so it appears to scrool
c53e6443 sago007 2012-04-17 11:04 256
	void PushPixels();
c53e6443 sago007 2012-04-17 11:04 257
	//See how high the tower is, saved in integer TowerHeight
c53e6443 sago007 2012-04-17 11:04 258
	void FindTowerHeight();
89c4a3a6 sago007 2008-08-29 14:32 259
///////////////////////////////////////////////////////////////////////////
89c4a3a6 sago007 2008-08-29 14:32 260
/////////////////////////// AI starts here! ///////////////////////////////
89c4a3a6 sago007 2008-08-29 14:32 261
///////////////////////////////////////////////////////////////////////////
c53e6443 sago007 2012-04-17 11:04 262
	//First the helpet functions:
c53e6443 sago007 2012-04-17 11:04 263
	int nrOfType(int line, int type);
c53e6443 sago007 2012-04-17 11:04 264
	int AIcolorToClear;
c53e6443 sago007 2012-04-17 11:04 265
	//See if a combo can be made in this line
c53e6443 sago007 2012-04-17 11:04 266
	int horiInLine(int line);
c53e6443 sago007 2012-04-17 11:04 267
	bool horiClearPossible();
c53e6443 sago007 2012-04-17 11:04 268
	//the Line Has Unmoveable Objects witch might stall the AI
c53e6443 sago007 2012-04-17 11:04 269
	bool lineHasGarbage(int line);
c53e6443 sago007 2012-04-17 11:04 270
	//Types 0..6 in line
c53e6443 sago007 2012-04-17 11:04 271
	int nrOfRealTypes(int line);
c53e6443 sago007 2012-04-17 11:04 272
	//See if there is a tower
c53e6443 sago007 2012-04-17 11:04 273
	bool ThereIsATower();
c53e6443 sago007 2012-04-17 11:04 274
	double firstInLine1(int line);
c53e6443 sago007 2012-04-17 11:04 275
	//returns the first coordinate of the block of type
c53e6443 sago007 2012-04-17 11:04 276
	double firstInLine(int line, int type);
c53e6443 sago007 2012-04-17 11:04 277
	//There in the line shall we move
c53e6443 sago007 2012-04-17 11:04 278
	int closestTo(int line, int place);
c53e6443 sago007 2012-04-17 11:04 279
	//The AI will remove a tower
c53e6443 sago007 2012-04-17 11:04 280
	void AI_ClearTower();
c53e6443 sago007 2012-04-17 11:04 281
	//The AI will try to clear block horisontally
c53e6443 sago007 2012-04-17 11:04 282
	void AI_ClearHori();
c53e6443 sago007 2012-04-17 11:04 283
	//Test if vertical clear is possible
c53e6443 sago007 2012-04-17 11:04 284
	bool veriClearPossible();
c53e6443 sago007 2012-04-17 11:04 285
	//There in the line shall we move
c53e6443 sago007 2012-04-17 11:04 286
	int closestTo(int line, int type, int place);
c53e6443 sago007 2012-04-17 11:04 287
	//The AI will try to clear blocks vertically
c53e6443 sago007 2012-04-17 11:04 288
	void AI_ClearVertical();
c53e6443 sago007 2012-04-17 11:04 289
	bool firstLineCreated;
c53e6443 sago007 2012-04-17 11:04 290
	void AI_Move();
89c4a3a6 sago007 2008-08-29 14:32 291
//////////////////////////////////////////////////////////////////////////
89c4a3a6 sago007 2008-08-29 14:32 292
///////////////////////////// AI ends here! //////////////////////////////
a1072daf sago007 2016-02-20 12:47 293
////////
a1072daf sago007 2016-02-20 12:47 294
//////////////////////////////////////////////////////////////////
89c4a3a6 sago007 2008-08-29 14:32 295
79d3c1d3 sago007 2012-05-05 15:54 296
	void PushLineInternal();
c53e6443 sago007 2012-04-17 11:04 297
	//Updates evrything, if not called nothing happends
c53e6443 sago007 2012-04-17 11:04 298
	void Update();
80b830cd sago007 2012-08-19 17:51 299
	void UpdateInternal(unsigned int newtick);
17916a2e sago007 2010-11-07 11:26 300
};
fde1f2dd sago007 2016-02-21 15:24 301
c1785ec5 sago007 2016-02-21 16:07 302
//Play the next level
c1785ec5 sago007 2016-02-21 16:07 303
void nextLevel(BlockGame& g, unsigned int ticks);
fde1f2dd sago007 2016-02-21 15:24 304
//Replay the current level
fde1f2dd sago007 2016-02-21 15:24 305
void retryLevel(BlockGame& g, unsigned int ticks);
17916a2e sago007 2010-11-07 11:26 306
17916a2e sago007 2010-11-07 11:26 307
#endif
1970-01-01 00:00 308