Skip to content

Commit 9b51c27

Browse files
committed
GROOVIE: pente whitespace fixes
1 parent 07ad07c commit 9b51c27

File tree

1 file changed

+19
-51
lines changed

1 file changed

+19
-51
lines changed

engines/groovie/logic/pente.cpp

Lines changed: 19 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020
*
2121
*/
2222

23-
#include <limits.h>
24-
#include "groovie/groovie.h"
2523
#include "groovie/logic/pente.h"
2624
#include "common/stack.h"
25+
#include "groovie/groovie.h"
26+
#include <limits.h>
2727

2828
namespace Groovie {
2929

@@ -50,18 +50,14 @@ struct penteTable {
5050
uint16 linesCounter;
5151
uint16 linesTable[20][15][21];
5252
byte numAdjacentPieces[20][15];
53-
byte calcTouchingPieces;// the deepest level of AI recursion sets this to 0, and then sets it back to 1 when returning
53+
byte calcTouchingPieces; // the deepest level of AI recursion sets this to 0, and then sets it back to 1 when returning
5454
};
5555

56-
57-
void PenteGame::penteSub02Frees(penteTable *table)
58-
{
56+
void PenteGame::penteSub02Frees(penteTable *table) {
5957
delete table;
6058
}
6159

62-
63-
void PenteGame::penteSub05BuildLookupTable(penteTable *table)
64-
{
60+
void PenteGame::penteSub05BuildLookupTable(penteTable *table) {
6561
uint16 *puVar1;
6662
uint _width;
6763
uint uVar4;
@@ -182,11 +178,7 @@ void PenteGame::penteSub05BuildLookupTable(penteTable *table)
182178
table->linesCounter = lines_counter;
183179
}
184180

185-
186-
187-
188-
penteTable *PenteGame::penteSub01Init(byte width, byte height, byte length)
189-
{
181+
penteTable *PenteGame::penteSub01Init(byte width, byte height, byte length) {
190182
penteTable *table;
191183
byte bVar5;
192184
uint16 _height;
@@ -212,13 +204,11 @@ penteTable *PenteGame::penteSub01Init(byte width, byte height, byte length)
212204
return table;
213205
}
214206

215-
216207
uint &getPlayerTable(penteTable *table, bool staufTurn, pentePlayerTable *&pt) {
217208
pt = staufTurn ? &table->stauf : &table->player;
218209
return staufTurn ? table->staufScore : table->playerScore;
219210
}
220211

221-
222212
void penteScoringLine(penteTable *table, uint16 lineIndex, bool stauf_turn, bool revert) {
223213
pentePlayerTable *playerTable;
224214
uint &score = getPlayerTable(table, stauf_turn, playerTable);
@@ -294,15 +284,14 @@ void penteTouchingPieces(penteTable *table, byte moveX, byte moveY, bool revert)
294284
}
295285

296286
for (; y <= endY; y++) {
297-
if(revert)
287+
if (revert)
298288
table->numAdjacentPieces[x][y]--;
299289
else
300290
table->numAdjacentPieces[x][y]++;
301291
}
302292
}
303293
}
304294

305-
306295
void PenteGame::penteSub03Scoring(penteTable *table, byte move_y, byte move_x, bool stauf_turn) {
307296
table->boardState[move_x][move_y] = stauf_turn ? 88 : 79;
308297
uint16 lines = table->linesTable[move_x][move_y][0];
@@ -319,7 +308,6 @@ void PenteGame::penteSub03Scoring(penteTable *table, byte move_y, byte move_x, b
319308
table->moveCounter++;
320309
}
321310

322-
323311
void PenteGame::penteSub07RevertScore(penteTable *table, byte y, byte x) {
324312
bool stauf_turn = table->boardState[x][y] == 88;
325313
table->boardState[x][y] = 0;
@@ -336,7 +324,6 @@ void PenteGame::penteSub07RevertScore(penteTable *table, byte y, byte x) {
336324
}
337325
}
338326

339-
340327
byte PenteGame::penteScoreCaptureSingle(penteTable *table, byte x, byte y, int slopeX, int slopeY) {
341328
byte x1 = x + slopeX;
342329
byte y1 = y + slopeY;
@@ -381,13 +368,11 @@ Slope slopes[] = {{1, 0},
381368
{0, -1},
382369
{1, -1}};
383370

384-
uint PenteGame::penteSub04ScoreCapture(penteTable *table, byte y, byte x)
385-
{
371+
uint PenteGame::penteSub04ScoreCapture(penteTable *table, byte y, byte x) {
386372
byte bitMask = 0;
387373
bool isStauf = table->boardState[x][y] == 88;
388374

389-
390-
for (const Slope &slope : slopes ) {
375+
for (const Slope &slope : slopes) {
391376
bitMask <<= 1;
392377
bitMask |= penteScoreCaptureSingle(table, x, y, slope.x, slope.y);
393378
}
@@ -408,9 +393,6 @@ uint PenteGame::penteSub04ScoreCapture(penteTable *table, byte y, byte x)
408393
return bitMask;
409394
}
410395

411-
412-
413-
414396
void PenteGame::penteSub08MaybeAnimateCapture(short move, byte *bitMaskG, short *param_3, short *param_4)
415397

416398
{
@@ -472,11 +454,7 @@ void PenteGame::penteSub08MaybeAnimateCapture(short move, byte *bitMaskG, short
472454
return;
473455
}
474456

475-
476-
477-
478-
void PenteGame::penteSub11RevertCapture(penteTable *table, byte y, byte x, byte bitMask)
479-
{
457+
void PenteGame::penteSub11RevertCapture(penteTable *table, byte y, byte x, byte bitMask) {
480458
bool isPlayer = table->boardState[x][y] == 79;
481459
for (int i = bitMask; i; i >>= 1) {
482460
if ((i & 1) == 0)
@@ -504,11 +482,7 @@ void PenteGame::penteSub11RevertCapture(penteTable *table, byte y, byte x, byte
504482
}
505483
}
506484

507-
508-
509-
510-
int PenteGame::penteSub10AiRecurse(penteTable *table_1, char depth, int parent_score)
511-
{
485+
int PenteGame::penteSub10AiRecurse(penteTable *table_1, char depth, int parent_score) {
512486
int iVar2;
513487
int iVar3;
514488
int iVar4;
@@ -582,7 +556,8 @@ int PenteGame::penteSub10AiRecurse(penteTable *table_1, char depth, int parent_s
582556
}
583557

584558
uint16 uVar6;
585-
for (uVar6 = 1; uVar6 < local_970[1]; uVar6 = uVar6 * 3 + 1) {}
559+
for (uVar6 = 1; uVar6 < local_970[1]; uVar6 = uVar6 * 3 + 1) {
560+
}
586561

587562
while (2 < (short)uVar6) {
588563
uVar6 = (short)uVar6 / 3;
@@ -649,11 +624,7 @@ int PenteGame::penteSub10AiRecurse(penteTable *table_1, char depth, int parent_s
649624
return -best_score;
650625
}
651626

652-
653-
654-
655-
uint PenteGame::penteSub09Ai(uint y_1, int param_2, int param_3, penteTable *table_4, byte depth)
656-
{
627+
uint PenteGame::penteSub09Ai(uint y_1, int param_2, int param_3, penteTable *table_4, byte depth) {
657628
bool bVar1;
658629
uint uVar2;
659630
int iVar3;
@@ -746,7 +717,6 @@ uint PenteGame::penteSub09Ai(uint y_1, int param_2, int param_3, penteTable *tab
746717
return y_1 & 0xffff0000 | (uint)uVar5;
747718
}
748719

749-
750720
int varsMoveToXY(byte var0, byte var1, byte var2, byte &x, byte &y) {
751721
int move = ((char)var0 * 10 + (short)(char)var1) * 10 + (short)(char)var2;
752722
x = (byte)(move / 15);
@@ -770,8 +740,7 @@ void moveXYToVars(uint x, uint y, byte &var0, byte &var1, byte &var2) {
770740
moveToVars(move, var0, var1, var2);
771741
}
772742

773-
void PenteGame::penteOp(byte *vars)
774-
{
743+
void PenteGame::penteOp(byte *vars) {
775744
uint16 uVar1;
776745
int iVar2;
777746
uint uVar3;
@@ -827,14 +796,14 @@ void PenteGame::penteOp(byte *vars)
827796
}
828797
if ((int)game_state_table->playerScore < WIN_SCORE) {
829798
uVar3 = game_state_table->staufScore;
830-
vars[5] = 2;// Stauf wins
799+
vars[5] = 2; // Stauf wins
831800
if ((int)uVar3 < WIN_SCORE) {
832-
vars[5] = 4;// player wins because the board is full?
801+
vars[5] = 4; // player wins because the board is full?
833802
}
834803
goto DEALLOC;
835804
}
836805
}
837-
vars[5] = 3;// player wins
806+
vars[5] = 3; // player wins
838807
DEALLOC:
839808
penteSub02Frees(game_state_table);
840809
game_state_table = (penteTable *)0x0;
@@ -885,7 +854,6 @@ void PenteGame::penteOp(byte *vars)
885854
moveXYToVars(globalX, globalY, vars[0], vars[1], vars[2]);
886855
}
887856

888-
889857
PenteGame::PenteGame() : _random("PenteGame") {
890858
global1 = -1;
891859
game_state_table = NULL;
@@ -1025,4 +993,4 @@ void PenteGame::testGame(uint32 seed, Common::Array<int> moves, bool playerWin)
1025993
warning("finished PenteGame::testGame(%u, %u, %d)", seed, moves.size(), (int)playerWin);
1026994
}
1027995

1028-
} // End of Groovie namespace
996+
} // namespace Groovie

0 commit comments

Comments
 (0)