Hello community,

here is the log from the commit of package knavalbattle for openSUSE:Factory 
checked in at 2013-12-19 13:18:57
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/knavalbattle (Old)
 and      /work/SRC/openSUSE:Factory/.knavalbattle.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "knavalbattle"

Changes:
--------
--- /work/SRC/openSUSE:Factory/knavalbattle/knavalbattle.changes        
2013-12-11 14:36:05.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.knavalbattle.new/knavalbattle.changes   
2013-12-19 13:19:02.000000000 +0100
@@ -1,0 +2,7 @@
+Sat Dec 14 18:30:01 UTC 2013 - [email protected]
+
+- Update to 4.12.0
+   * KDE 4.12.0  release
+   * See http://www.kde.org/announcements/4.12.php
+
+-------------------------------------------------------------------

Old:
----
  knavalbattle-4.11.97.tar.xz

New:
----
  knavalbattle-4.12.0.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ knavalbattle.spec ++++++
--- /var/tmp/diff_new_pack.7NW1Kx/_old  2013-12-19 13:19:03.000000000 +0100
+++ /var/tmp/diff_new_pack.7NW1Kx/_new  2013-12-19 13:19:03.000000000 +0100
@@ -23,7 +23,7 @@
 License:        GPL-2.0+
 Group:          Amusements/Games/Board/Other
 Url:            http://www.kde.org
-Version:        4.11.97
+Version:        4.12.0
 Release:        0
 Source0:        knavalbattle-%{version}.tar.xz
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build

++++++ knavalbattle-4.11.97.tar.xz -> knavalbattle-4.12.0.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/knavalbattle-4.11.97/src/ai/ai.cpp 
new/knavalbattle-4.12.0/src/ai/ai.cpp
--- old/knavalbattle-4.11.97/src/ai/ai.cpp      2013-11-24 07:40:56.000000000 
+0100
+++ new/knavalbattle-4.12.0/src/ai/ai.cpp       2013-11-28 20:12:01.000000000 
+0100
@@ -15,3 +15,15 @@
 {
 }
 
+Coord AI::desperateMove() const
+{
+    Sea::Player opp = Sea::opponent(m_player);
+    for (int i = 0; i < m_sea->size().x; i++)
+    for (int j = 0; j < m_sea->size().y; j++) {
+        if (m_sea->at(opp, Coord(i,j)).free()) {
+            return Coord(i,j);
+        }
+    }
+    return Coord::invalid();
+}
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/knavalbattle-4.11.97/src/ai/ai.h 
new/knavalbattle-4.12.0/src/ai/ai.h
--- old/knavalbattle-4.11.97/src/ai/ai.h        2013-11-24 07:40:56.000000000 
+0100
+++ new/knavalbattle-4.12.0/src/ai/ai.h 2013-11-28 20:12:01.000000000 +0100
@@ -23,6 +23,7 @@
     virtual Coord getMove() = 0;
     virtual void setShips() = 0;
     virtual void notify(Sea::Player player, const Coord& c, const HitInfo& 
hit) = 0;
+    Coord desperateMove() const;
 };
 
 #endif // AI__AI_H
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/knavalbattle-4.11.97/src/ai/dummyai.cpp 
new/knavalbattle-4.12.0/src/ai/dummyai.cpp
--- old/knavalbattle-4.11.97/src/ai/dummyai.cpp 2013-11-24 07:40:56.000000000 
+0100
+++ new/knavalbattle-4.12.0/src/ai/dummyai.cpp  2013-11-28 20:12:01.000000000 
+0100
@@ -31,9 +31,8 @@
                 return c;
             }
         }
-        kDebug() << "Could not find a valid move for DummyAI";
-  }
-  return Coord::invalid();
+    }
+    return desperateMove();
 }
 
 void DummyAI::setShips()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/knavalbattle-4.11.97/src/ai/smartai.cpp 
new/knavalbattle-4.12.0/src/ai/smartai.cpp
--- old/knavalbattle-4.11.97/src/ai/smartai.cpp 2013-11-24 07:40:56.000000000 
+0100
+++ new/knavalbattle-4.12.0/src/ai/smartai.cpp  2013-11-28 20:12:01.000000000 
+0100
@@ -300,10 +300,16 @@
     if (m_strategy.get() &&
         m_sea->turn() == m_player &&
         m_sea->status() == Sea::PLAYING) {
-        return m_strategy->getMove();
+        Coord move = m_strategy->getMove();
+        if ( move == Coord::invalid() ) {
+            return desperateMove();
+        }
+        else {
+            return move;
+        }
     }
     else {
-        return Coord::invalid();
+        return desperateMove();
     }
 }
 

-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to