[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/games/backgammon
From: Dmitry Vladimirovich Chernov <diman4ik.chernov () gmail ! com>
Date: 2013-02-15 18:21:04
Message-ID: 20130215182104.45D04AC873 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1340212 by dmitryvchernov:
bugfix
M +1 -0 games/backgammon/backgammon_local.cpp
M +3 -3 games/backgammon/backgammon_ruleset.cpp
M +1 -0 games/backgammon/backgammongame.cpp
M +2 -2 games/backgammon/fibs/backgammon_fibs.cpp
M +10 -0 test/test_backgammon_ruleset.cpp
M +1 -0 test/test_backgammon_ruleset.h
--- trunk/playground/games/backgammon/games/backgammon/backgammon_local.cpp #1340211:1340212
@@ -123,6 +123,7 @@
break;
case BackgammonGame::Commit:
{
+ resetDice();
Board::hideDice();
emit( moveFinished("") );
--- trunk/playground/games/backgammon/games/backgammon/backgammon_ruleset.cpp #1340211:1340212
@@ -45,7 +45,7 @@
else if( dir == IPlayer::negative )
bar_ind = BackgammonGame::bar_ind_negative;
- if( canTake( field, dir, BackgammonGame::bar_ind_positive ) )
+ if( canTake( field, dir, bar_ind ) )
return getMoves( field, dir, dice, bar_ind ).size() > 0;
// loop throw all cells
@@ -294,7 +294,7 @@
summ += field[ BackgammonGame::thrown_ind_positive ];
- return summ == 15;
+ return summ == -15;
}
else if( dir == IPlayer::negative )
{
@@ -306,7 +306,7 @@
summ += field[ BackgammonGame::thrown_ind_negative ];
- return summ == -15;
+ return summ == 15;
}
return false;
--- trunk/playground/games/backgammon/games/backgammon/backgammongame.cpp #1340211:1340212
@@ -584,6 +584,7 @@
{
m_dice.push_back( dice1 );
m_dice.push_back( dice1 );
+ m_diceEqual = true;
}
emit( diceRolled( dice1, dice2 ) );
--- trunk/playground/games/backgammon/games/backgammon/fibs/backgammon_fibs.cpp #1340211:1340212
@@ -936,8 +936,8 @@
switchToState(Roll);
emit( clientStateChanged(commited) );
}
- default:
- Q_ASSERT_X(false,"processUIEvent", "Incorrect game state reached");
+ /*default:
+ Q_ASSERT_X(false,"processUIEvent", "Incorrect game state reached");*/
}
}
--- trunk/playground/games/backgammon/test/test_backgammon_ruleset.cpp #1340211:1340212
@@ -158,4 +158,14 @@
QVERIFY( used.size() == 3 );
}
+void TestBackgammonRuleset::testCanThrow()
+{
+ const QVector<int> field =
+ { 0, 1, 4, 3, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, -3, -5, 0, -2, -1, -1, -1, 0, 0, 0, 0 };
+
+ const QVector<int> dice = { 6, 6, 6 };
+
+ QVERIFY( BackgammonRuleset::canThrow( field, IPlayer::negative ) );
+}
+
QTEST_MAIN( TestBackgammonRuleset )
--- trunk/playground/games/backgammon/test/test_backgammon_ruleset.h #1340211:1340212
@@ -35,6 +35,7 @@
void testCanMove();
void testUsedDie();
void testGotMoves();
+ void testCanThrow();
};
#endif
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic