Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 7341)
+++ trunk/MagicSoft/Mars/Changelog	(revision 7342)
@@ -18,4 +18,35 @@
 
                                                  -*-*- END OF LINE -*-*-
+ 2005/09/06 Thomas Bretz
+
+   * Makefile.conf.general:
+     - added libASImage
+
+   * mgeom/MGeomCam.[h,cc]:
+     - clone the whole container in any case not only if it is 
+       different from MGeomCam
+     - unified the non-default and default constructor
+
+   * mgeom/MGeomPix.[h,cc]:
+     - initialize neighbors with empty values in constructor
+     - added some more default arguments
+
+   * mhist/MHCamera.[h,cc]:
+     - implemented new Draw-options "nopal", "abscontent"
+     - implemented more accurate handling of transparency
+     - new flags kNoScale and kNoUnused
+     - changed private stuff to protected
+
+   * mtools/Makefile, mtools/ToolsLinkDef.h:
+     - added new "tool" MagicJam
+
+   * mtools/MagicJam.[h,cc]:
+     - added
+
+   * mtools/jam/*.jam:
+     - games for Magic Jam
+
+
+
  2005/08/29 Daniela Dorner
 
Index: trunk/MagicSoft/Mars/Makefile.conf.general
===================================================================
--- trunk/MagicSoft/Mars/Makefile.conf.general	(revision 7341)
+++ trunk/MagicSoft/Mars/Makefile.conf.general	(revision 7342)
@@ -4,6 +4,6 @@
 
 ROOTVER    =  `root-config --version`
-ROOTLIBS   =  `root-config --libs` -lMinuit -lHistPainter -lThread
-ROOTGLIBS  =  `root-config --glibs` -lMinuit -lHistPainter -lThread
+ROOTLIBS   =  `root-config --libs` -lASImage -lMinuit -lHistPainter -lThread
+ROOTGLIBS  =  `root-config --glibs` -lASImage -lMinuit -lHistPainter -lThread
 ROOTCFLAGS =  `root-config --cflags`
 
Index: trunk/MagicSoft/Mars/NEWS
===================================================================
--- trunk/MagicSoft/Mars/NEWS	(revision 7341)
+++ trunk/MagicSoft/Mars/NEWS	(revision 7342)
@@ -5,4 +5,7 @@
    * general: added new tutorial macro macros/tutorials/threshold.C:
      how to calculate the threshold
+
+   * general: added a new game. Start it from the interpreter with
+        MagicJam j;
 
 
Index: trunk/MagicSoft/Mars/mgeom/MGeomCam.cc
===================================================================
--- trunk/MagicSoft/Mars/mgeom/MGeomCam.cc	(revision 7341)
+++ trunk/MagicSoft/Mars/mgeom/MGeomCam.cc	(revision 7342)
@@ -68,12 +68,12 @@
 //
 // Default Constructor
-//
+/*
 MGeomCam::MGeomCam()
-    : fNumPixels(0), fCamDist(0), fConvMm2Deg(0), /*fPixels(1000),*/ fMaxRadius(1), fMinRadius(1)
+    : fNumPixels(0), fCamDist(0), fConvMm2Deg(0),  fMaxRadius(1), fMinRadius(1)
 {
     fName  = "MGeomCam";
     fTitle = "Storage container for a camera geometry";
 }
-
+*/
 // --------------------------------------------------------------------------
 //
@@ -313,5 +313,5 @@
 TObject *MGeomCam::Clone(const char *newname) const
 {
-    if (IsA()==MGeomCam::Class())
+    //if (IsA()==MGeomCam::Class())
     {
         MGeomCam *cam = new MGeomCam(fNumPixels, fCamDist);
Index: trunk/MagicSoft/Mars/mgeom/MGeomCam.h
===================================================================
--- trunk/MagicSoft/Mars/mgeom/MGeomCam.h	(revision 7341)
+++ trunk/MagicSoft/Mars/mgeom/MGeomCam.h	(revision 7342)
@@ -43,6 +43,6 @@
 
 public:
-    MGeomCam();
-    MGeomCam(UInt_t npix, Float_t dist, const char *name=NULL, const char *title=NULL);
+    //MGeomCam();
+    MGeomCam(UInt_t npix=0, Float_t dist=1, const char *name=NULL, const char *title=NULL);
 
     virtual TObject *Clone(const char *newname=NULL) const;
Index: trunk/MagicSoft/Mars/mgeom/MGeomPix.cc
===================================================================
--- trunk/MagicSoft/Mars/mgeom/MGeomPix.cc	(revision 7341)
+++ trunk/MagicSoft/Mars/mgeom/MGeomPix.cc	(revision 7342)
@@ -76,4 +76,5 @@
     //  default constructor
     Set(x, y, r, s, a);
+    SetNeighbors();
 }
 
Index: trunk/MagicSoft/Mars/mgeom/MGeomPix.h
===================================================================
--- trunk/MagicSoft/Mars/mgeom/MGeomPix.h	(revision 7341)
+++ trunk/MagicSoft/Mars/mgeom/MGeomPix.h	(revision 7342)
@@ -32,5 +32,5 @@
 
 public:
-    MGeomPix(Float_t x=0, Float_t y=0, Float_t d=0, UInt_t s=0, UInt_t aidx=0);
+    MGeomPix(Float_t x=0, Float_t y=0, Float_t d=1, UInt_t s=0, UInt_t aidx=0);
 
     void Copy(TObject &obj) const
@@ -50,5 +50,5 @@
     void Print(Option_t *opt=NULL) const;
 
-    void Set(Float_t x, Float_t y, Float_t d, UInt_t s=0, UInt_t aidx=0) { fX=x; fY=y; fD=d; fA=d*d*gsTan60/2; fSector=s; fAidx=aidx; }
+    void Set(Float_t x, Float_t y, Float_t d=1, UInt_t s=0, UInt_t aidx=0) { fX=x; fY=y; fD=d; fA=d*d*gsTan60/2; fSector=s; fAidx=aidx; }
 
     void SetNeighbors(Short_t i0=-1, Short_t i1=-1, Short_t i2=-1,
Index: trunk/MagicSoft/Mars/mhist/MHCamera.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHCamera.cc	(revision 7341)
+++ trunk/MagicSoft/Mars/mhist/MHCamera.cc	(revision 7342)
@@ -93,4 +93,6 @@
 void MHCamera::Init()
 {
+    Sumw2();
+
     UseCurrentStyle();
 
@@ -164,6 +166,4 @@
     //Rebuild();
 
-    Sumw2(); // necessary?
-
     if (fGeomCam)
         delete fGeomCam;
@@ -893,5 +893,5 @@
     for (Int_t i=0; i<fNcells-2; i++)
     {
-        hex.SetFillStyle(issame ? 0 : 1001);
+        hex.SetFillStyle(issame || (IsTransparent() && !IsUsed(i)) ? 0 : 1001);
 
         if (!issame)
@@ -912,10 +912,10 @@
 
         Float_t x = pix.GetX()*conv/(fAbberation+1);
-
         Float_t y = pix.GetY()*conv/(fAbberation+1);
         Float_t d = pix.GetD()*conv;
 
         if (!isbox)
-            hex.PaintHexagon(x, y, d);
+            if (IsUsed(i) || !TestBit(kNoUnused))
+                hex.PaintHexagon(x, y, d);
         else
             if (IsUsed(i) && !TMath::IsNaN(fArray[i+1]))
@@ -985,4 +985,5 @@
         opt.ReplaceAll("pixelindex", "");
         opt.ReplaceAll("sectorindex", "");
+        opt.ReplaceAll("abscontent", "");
         opt.ReplaceAll("content", "");
         opt.ReplaceAll("proj", "");
@@ -990,4 +991,5 @@
         opt.ReplaceAll("pal1", "");
         opt.ReplaceAll("pal2", "");
+        opt.ReplaceAll("nopal", "");
         TH1D::Paint(opt);
         return;
@@ -1027,8 +1029,9 @@
     }
 
-    const Bool_t pal1 = opt.Contains("pal1");
-    const Bool_t pal2 = opt.Contains("pal2");
-
-    if (!pal1 && !pal2)
+    const Bool_t pal1  = opt.Contains("pal1");
+    const Bool_t pal2  = opt.Contains("pal2");
+    const Bool_t nopal = opt.Contains("nopal");
+
+    if (!pal1 && !pal2 && !nopal)
         SetPrettyPalette();
 
@@ -1046,9 +1049,28 @@
 
     if (opt.Contains("pixelindex"))
+    {
         PaintIndices(0);
+        return;
+    }
     if (opt.Contains("sectorindex"))
+    {
         PaintIndices(1);
+        return;
+    }
+    if (opt.Contains("abscontent"))
+    {
+        PaintIndices(3);
+        return;
+    }
     if (opt.Contains("content"))
+    {
         PaintIndices(2);
+        return;
+    }
+    if (opt.Contains("pixelentries"))
+    {
+        PaintIndices(4);
+        return;
+    }
 }
 
@@ -1198,5 +1220,7 @@
         case 0: num += i; break;
         case 1: num += h.GetSector(); break;
-        case 2: num += (Int_t)((fArray[i+1]-min)/(max-min)); break;
+        case 2: num += TMath::Nint((fArray[i+1]-min)/(max-min)); break;
+        case 3: num += TMath::Nint(fArray[i+1]); break;
+        case 4: num += fBinEntries[i+1]; break;
         }
 
@@ -1557,6 +1581,8 @@
     {
         fArray[i+1]=0;
+        fBinEntries[i]=0;
         ResetUsed(i);
     }
+
     fArray[0]         = 0;
     fArray[fNcells-1] = 0;
@@ -1623,65 +1649,68 @@
     const Float_t range = fGeomCam->GetMaxRadius()*1.05;
 
-    TArrow arr;
-    arr.PaintArrow(-range*.9, -range*.9, -range*.6, -range*.9, 0.025);
-    arr.PaintArrow(-range*.9, -range*.9, -range*.9, -range*.6, 0.025);
-
-    TString text;
-    text += (int)(range*.3);
-    text += "mm";
-
-    TText newtxt2;
-    newtxt2.SetTextSize(0.04);
-    newtxt2.PaintText(-range*.85, -range*.85, text);
-
-    text = "";
-    text += Form("%.2f", (float)((int)(range*.3*fGeomCam->GetConvMm2Deg()*10))/10);
-    text += "\\circ";
-    text = text.Strip(TString::kLeading);
-
-    TLatex latex;
-    latex.PaintLatex(-range*.85, -range*.75, 0, 0.04, text);
-
-    if (TestBit(kNoLegend))
-        return;
-
-    TPaveStats *stats = GetStatisticBox();
-
-    const Float_t hndc   = 0.92 - (stats ? stats->GetY1NDC() : 1);
-    const Float_t H      = (0.75-hndc)*range;
-    const Float_t offset = hndc*range;
-
-    const Float_t h = 2./kItemsLegend;
-    const Float_t w = range/sqrt((float)(fNcells-2));
-
-    TBox newbox;
-    TText newtxt;
-    newtxt.SetTextSize(0.03);
-    newtxt.SetTextAlign(12);
+    if (!TestBit(kNoScale))
+    {
+        TArrow arr;
+        arr.PaintArrow(-range*.9, -range*.9, -range*.6, -range*.9, 0.025);
+        arr.PaintArrow(-range*.9, -range*.9, -range*.9, -range*.6, 0.025);
+
+        TString text;
+        text += (int)(range*.3);
+        text += "mm";
+
+        TText newtxt2;
+        newtxt2.SetTextSize(0.04);
+        newtxt2.PaintText(-range*.85, -range*.85, text);
+
+        text = "";
+        text += Form("%.2f", (float)((int)(range*.3*fGeomCam->GetConvMm2Deg()*10))/10);
+        text += "\\circ";
+        text = text.Strip(TString::kLeading);
+
+        TLatex latex;
+        latex.PaintLatex(-range*.85, -range*.75, 0, 0.04, text);
+    }
+
+    if (!TestBit(kNoLegend))
+    {
+        TPaveStats *stats = GetStatisticBox();
+
+        const Float_t hndc   = 0.92 - (stats ? stats->GetY1NDC() : 1);
+        const Float_t H      = (0.75-hndc)*range;
+        const Float_t offset = hndc*range;
+
+        const Float_t h = 2./kItemsLegend;
+        const Float_t w = range/sqrt((float)(fNcells-2));
+
+        TBox newbox;
+        TText newtxt;
+        newtxt.SetTextSize(0.03);
+        newtxt.SetTextAlign(12);
 #if ROOT_VERSION_CODE > ROOT_VERSION(3,01,06)
-    newtxt.SetBit(/*kNoContextMenu|*/kCannotPick);
-    newbox.SetBit(/*kNoContextMenu|*/kCannotPick);
+        newtxt.SetBit(/*kNoContextMenu|*/kCannotPick);
+        newbox.SetBit(/*kNoContextMenu|*/kCannotPick);
 #endif
 
-    const Float_t step   = (islog && min>0 ? log10(max/min) : max-min) / kItemsLegend;
-    const Int_t   firsts = step*3 < 1e-8 ? 8 : (Int_t)floor(log10(step*3));
-    const TString opt    = Form("%%.%if", firsts>0 ? 0 : TMath::Abs(firsts));
-
-    for (Int_t i=0; i<kItemsLegend+1; i+=3)
-    {
-        Float_t val;
-        if (islog && min>0)
-            val = pow(10, step*i) * min;
-        else
-            val = min + step*i;
-
-        //const bool dispexp = max-min>1.5 && fabs(val)>0.1 && fabs(val)<1e6;
-        newtxt.PaintText(range+1.5*w, H*(i*h-1)-offset, Form(opt, val));
-    }
-
-    for (Int_t i=0; i<kItemsLegend; i++)
-    {
-        newbox.SetFillColor(gStyle->GetColorPalette(i));
-        newbox.PaintBox(range, H*(i*h-1)-offset, range+w, H*((i+1)*h-1)-offset);
+        const Float_t step   = (islog && min>0 ? log10(max/min) : max-min) / kItemsLegend;
+        const Int_t   firsts = step*3 < 1e-8 ? 8 : (Int_t)floor(log10(step*3));
+        const TString opt    = Form("%%.%if", firsts>0 ? 0 : TMath::Abs(firsts));
+
+        for (Int_t i=0; i<kItemsLegend+1; i+=3)
+        {
+            Float_t val;
+            if (islog && min>0)
+                val = pow(10, step*i) * min;
+            else
+                val = min + step*i;
+
+            //const bool dispexp = max-min>1.5 && fabs(val)>0.1 && fabs(val)<1e6;
+            newtxt.PaintText(range+1.5*w, H*(i*h-1)-offset, Form(opt, val));
+        }
+
+        for (Int_t i=0; i<kItemsLegend; i++)
+        {
+            newbox.SetFillColor(gStyle->GetColorPalette(i));
+            newbox.PaintBox(range, H*(i*h-1)-offset, range+w, H*((i+1)*h-1)-offset);
+        }
     }
 }
@@ -1881,5 +1910,5 @@
 UInt_t MHCamera::GetNumPixels() const
 {
-    return fGeomCam->GetNumPixels();
+    return fGeomCam ? fGeomCam->GetNumPixels() : 0;
 }
 
Index: trunk/MagicSoft/Mars/mhist/MHCamera.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHCamera.h	(revision 7341)
+++ trunk/MagicSoft/Mars/mhist/MHCamera.h	(revision 7342)
@@ -39,9 +39,11 @@
         kProfile            = BIT(18), // FIXME: When changing change max/min!
         kFreezed            = BIT(19),
-        kNoLegend           = BIT(20)/*,
+        kNoLegend           = BIT(20),
+        kNoScale            = BIT(21),
+        kNoUnused           = BIT(22)/*,
         kSqrtVariance       = BIT(21),
         kSinglePixelProfile = BIT(22)*/
     };
-private:
+protected:
     MGeomCam      *fGeomCam;     // pointer to camera geometry (y-axis)
     TArrayC        fUsed;        // array containing flags
Index: trunk/MagicSoft/Mars/mtools/MagicJam.cc
===================================================================
--- trunk/MagicSoft/Mars/mtools/MagicJam.cc	(revision 7342)
+++ trunk/MagicSoft/Mars/mtools/MagicJam.cc	(revision 7342)
@@ -0,0 +1,1025 @@
+/* ======================================================================== *\
+!
+! *
+! * This file is part of MARS, the MAGIC Analysis and Reconstruction
+! * Software. It is distributed to you in the hope that it can be a useful
+! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
+! * It is distributed WITHOUT ANY WARRANTY.
+! *
+! * Permission to use, copy, modify and distribute this software and its
+! * documentation for any purpose is hereby granted without fee,
+! * provided that the above copyright notice appear in all copies and
+! * that both that copyright notice and this permission notice appear
+! * in supporting documentation. It is provided "as is" without express
+! * or implied warranty.
+! *
+!
+!
+!   Author(s): Thomas Bretz, 9/2005 <mailto:tbretz@astro.uni-wuerzburg.de>
+!
+!   Copyright: MAGIC Software Development, 2005
+!
+!
+\* ======================================================================== */
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// MagicJam
+//
+// Jam is a multi player game. It is controlled by its context menu (click
+// with the right mouse button on one of the pixels in the game pad).
+//
+// Start the game with:
+//  MagicJam jam;
+//
+// Rules:
+//  MagicJam is a multiplayer game. The aim is to own the full game pad.
+// Ech pixel in the pad can contain as many entries as it has neighbors.
+// If it has more entries than neighbors it overflows into its neighbors.
+// All pixels into which such an overflow occures will be captured by
+// the current player. Player by player will be able to increase the
+// entry in one pixel by one. Increase the contents of an empty pixel to
+// one or by one in an owned pixel. The player who once will own the
+// all pixels will win.
+//
+// Editor:
+//  To edit or create a new game start the editor from the context menu
+// of MagicJam. The editor is also controlled from its context menu.
+// Use the curso keys to shift your game.
+// Warning: You MUST create a single-island game. Games which have two
+// islands might result in edless loops. (Currently there is no check!)
+//
+/////////////////////////////////////////////////////////////////////////////
+#include "MagicJam.h"
+
+#include <iostream>
+#include <fstream>
+
+#include <KeySymbols.h>
+
+#include <TBox.h>
+#include <TLine.h>
+#include <TText.h>
+#include <TStyle.h>
+#include <TSystem.h>
+#include <TRandom.h>
+#include <TNtuple.h>
+#include <TASImage.h>
+#include <TInterpreter.h>
+#include <TGFileDialog.h>
+
+#include "MHexagon.h"
+#include "MGeomCam.h"
+#include "MGeomPix.h"
+
+#include "MDirIter.h"
+
+ClassImp(MagicJamAbc);
+ClassImp(MagicJamEditor);
+ClassImp(MagicJam);
+
+using namespace std;
+
+// -------------------------------------------------------------------------
+//                     The editor for MagicJam
+// -------------------------------------------------------------------------
+
+// --------------------------------------------------------------------------
+//
+// Move the contents of the pad
+//
+void MagicJamEditor::Move(int dx, int dy)
+{
+    const TArrayC cpy(fUsed);
+
+    Int_t h = cpy.GetSize()/fWidth;
+
+    for (int i=0; i<cpy.GetSize(); i++)
+    {
+        Int_t x = i%fWidth;
+        Int_t y = i/fWidth;
+
+        x += dx   + fWidth;
+        y += dy*2 + h;
+
+        x %= fWidth;
+        y %= h;
+
+        fUsed[x+y*fWidth] = cpy[i];
+    }
+    gPad->GetPad(1)->Modified();
+    gPad->GetPad(1)->Update();
+    gPad->Modified();
+    gPad->Update();
+}
+
+// --------------------------------------------------------------------------
+//
+// Initialize the pad with size wx, hy
+//
+void MagicJamEditor::InitGeom(int wx, int hy)
+{
+    const Float_t dx = 0.5*(wx-1);
+    const Float_t dy = 0.5*(hy-1);
+
+    fWidth = wx;
+
+    MGeomCam cam(wx*hy, 1);
+
+    for (int x=0; x<wx; x++)
+        for (int y=0; y<hy; y++)
+        {
+            Float_t x0 = TMath::Odd(y) ? x-0.25 : x+0.25;
+
+            cam[x + y*fWidth].Set(x0-dx, (y-dy)*0.866, 1);
+        }
+
+    SetGeometry(cam);
+}
+
+// --------------------------------------------------------------------------
+//
+// Get index of pixel with position px, py
+//
+Int_t MagicJamEditor::GetPixelIndexFlt(Float_t px, Float_t py) const
+{
+    if (fNcells<=1)
+        return -1;
+
+    Int_t i;
+    for (i=0; i<fNcells-2; i++)
+    {
+        MHexagon hex((*fGeomCam)[i]);
+        if (hex.DistanceToPrimitive(px, py)>0)
+            continue;
+
+        return i;
+    }
+    return -1;
+}
+
+// --------------------------------------------------------------------------
+//
+// Open the MagicJam editor. Load a game with name name.
+//
+MagicJamEditor::MagicJamEditor(const char *name) : fImage(NULL)
+{
+    InitGeom(20, 20);
+
+    SetBit(kNoLegend);
+    SetBit(kNoScale);
+
+    Draw();
+
+    gPad->SetEditable(kFALSE);
+
+    if (name)
+        LoadGame(name);
+}
+
+// --------------------------------------------------------------------------
+//
+// Delete fImage
+//
+MagicJamEditor::~MagicJamEditor()
+{
+    if (fImage)
+        delete fImage;
+}
+
+// --------------------------------------------------------------------------
+//
+// Change width and height of pad. Preserve contents.
+//
+void MagicJamEditor::SetWidthHeight(Int_t dx, Int_t dy)
+{
+    TNtuple tup("", "", "x:y");
+    tup.SetDirectory(0);
+
+    for (UInt_t i=0; i<GetNumPixels(); i++)
+    {
+        if (IsUsed(i))
+            tup.Fill((*fGeomCam)[i].GetX(), (*fGeomCam)[i].GetY());
+    }
+    InitGeom(dx, dy);
+
+    fEntries=0;
+    for (int i=0; i<tup.GetEntries(); i++)
+    {
+        tup.GetEntry(i);
+        const Int_t idx = GetPixelIndexFlt(tup.GetArgs()[0], tup.GetArgs()[1]);
+        if (idx>=0)
+        {
+            SetUsed(idx);
+            fEntries++;
+        }
+    }
+}
+
+// --------------------------------------------------------------------------
+//
+// Save the current game
+//
+void MagicJamEditor::SaveGame(const char *name)
+{
+    ofstream fout(name);
+    if (!fout)
+    {
+        cout << "Cannot open file " << name << ": " << strerror(errno) << endl;
+        return;
+    }
+
+    for (UInt_t i=0; i<GetNumPixels(); i++)
+        if (IsUsed(i))
+            fout << i%fWidth << " " << i/fWidth << endl;
+
+    SetName(name);
+
+}
+
+// --------------------------------------------------------------------------
+//
+// Load a game
+//
+void MagicJamEditor::LoadGame(const char *name)
+{
+    InitGeom(1,1);
+    Reset();
+
+    ifstream fin(name);
+    if (!fin)
+    {
+        cout << "Cannot open file " << name << ": " << strerror(errno) << endl;
+        return;
+    }
+
+    Int_t maxx=-INT_MAX;
+    Int_t maxy=-INT_MAX;
+    Int_t minx= INT_MAX;
+    Int_t miny= INT_MAX;
+
+    TNtuple tup("", "", "x:y");
+    tup.SetDirectory(0);
+
+    while (1)
+    {
+        Int_t x,y;
+        fin >> x >> y;
+        if (!fin)
+            break;
+
+        tup.Fill(x, y);
+
+        maxx = TMath::Max(maxx, x);
+        maxy = TMath::Max(maxy, y);
+        minx = TMath::Min(minx, x);
+        miny = TMath::Min(miny, y);
+    }
+
+    if (tup.GetEntries()==0)
+    {
+        cout << "File " << name << " contains no entries!" << endl;
+        return;
+    }
+
+    if (TMath::Odd(miny))
+        miny--;
+
+    InitGeom((maxx-minx)+1, (maxy-miny)+1);
+
+    for (int i=0; i<tup.GetEntries(); i++)
+    {
+        tup.GetEntry(i);
+
+        const Int_t x = TMath::Nint(tup.GetArgs()[0]) - minx;
+        const Int_t y = TMath::Nint(tup.GetArgs()[1]) - miny;
+        SetUsed(x + y*fWidth);
+    }
+
+    fEntries=tup.GetEntries();;
+
+    SetName(name);
+}
+
+void MagicJamEditor::ShowImageAsBackground(const char *name)
+{
+    if (fImage)
+        delete fImage;
+
+    fImage = new TASImage(name);
+    if (!fImage->IsValid())
+    {
+        delete fImage;
+        fImage = NULL;
+        return;
+    }
+
+    fImage->SetEditable(kFALSE);
+
+    SetFillStyle(4000);
+}
+
+void MagicJamEditor::RemoveBackgroundImage()
+{
+    if (fImage)
+    {
+        delete fImage;
+        fImage=NULL;
+    }
+
+    SetFillStyle(1001);
+}
+
+// --------------------------------------------------------------------------
+//
+// Paint the game pad
+//
+void MagicJamEditor::Paint(Option_t *o)
+{
+    TString str = Form("Jam Editor pad %dx%d", fWidth, GetNumPixels()/fWidth);
+    SetTitle(str);
+
+    Float_t maxx = 0;
+    Float_t minx = 0;
+    Float_t maxy = 0;
+    Float_t miny = 0;
+
+    for (UInt_t i=0; i<GetNumPixels(); i++)
+    {
+        const Float_t x = (*fGeomCam)[i].GetX();
+        const Float_t y = (*fGeomCam)[i].GetY();
+
+        maxx = TMath::Max(maxx, x);
+        minx = TMath::Min(minx, x);
+        maxy = TMath::Max(maxy, y);
+        miny = TMath::Min(miny, y);
+    }
+
+    if (fImage)
+    {
+        SetRange();
+
+        Double_t x1, y1, x2, y2;
+        gPad->GetRange(x1, y1, x2, y2);
+
+        gPad->SetLeftMargin  (    (minx-x1)/(x2-x1));
+        gPad->SetBottomMargin(    (miny-y1)/(y2-y1));
+        gPad->SetRightMargin (1 - (maxx-x1)/(x2-x1));
+        gPad->SetTopMargin   (1 - (maxy-y1)/(y2-y1));
+
+        fImage->Paint();
+    }
+
+    gStyle->SetOptStat(11);
+    MHCamera::Paint(o);
+
+    TBox box;
+    box.SetLineColor(kBlack);
+    box.SetFillStyle(0);
+    box.PaintBox(minx-1, miny-1, maxx+1, maxy+1);
+
+    TLine l;
+    //l.SetLineStyle(kDashed);
+    l.SetLineColor(15);
+    l.PaintLine(0, miny, 0, maxy);
+    l.PaintLine(minx, 0, maxx, 0);
+}
+
+// --------------------------------------------------------------------------
+//
+// Call MHCamera Draw connect a signal to catch the keynoard events
+//
+void MagicJamEditor::Draw(Option_t *o)
+{
+    MHCamera::Draw();
+
+    // This seems to be necessary due to the pad-in-pad geometry
+    // otherwise I don't get the information about the keys pressed
+    gPad->GetCanvas()->Connect("ProcessedEvent(Int_t,Int_t,Int_t,TObject*)",
+                               "MagicJamEditor", this,
+                               "EventInfo(Int_t,Int_t,Int_t,TObject*)");
+}
+
+// --------------------------------------------------------------------------
+//
+// Process the keyboard events
+//
+void MagicJamEditor::EventInfo(Int_t event, Int_t px, Int_t py, TObject *o)
+{
+    if (event==kKeyPress)
+    {
+        switch (py)
+        {
+        case kKey_Left:
+            Move(-1, 0);
+            break;
+
+        case kKey_Right:
+            Move(1, 0);
+            break;
+
+        case kKey_Up:
+            Move(0, 1);
+            break;
+
+        case kKey_Down:
+            Move(0, -1);
+            break;
+
+        default:
+            return;
+        }
+
+        TVirtualPad *p = dynamic_cast<TVirtualPad*>(o);
+        if (p && p->GetPad(1))
+        {
+            p->GetPad(1)->Modified();
+            p->GetPad(1)->Update();
+        }
+    }
+}
+
+// --------------------------------------------------------------------------
+//
+// Execute mouse events
+//
+void MagicJamEditor::ExecuteEvent(Int_t event, Int_t px, Int_t py)
+{
+    const Int_t idx = GetPixelIndex(px, py);
+    if (idx<0)
+        return;
+
+    switch (event)
+    {
+    case kButton1Down:
+        if (IsUsed(idx))
+        {
+            ResetUsed(idx);
+            fEntries--;
+        }
+        else
+        {
+            SetUsed(idx);
+            fEntries++;
+        }
+        break;
+
+    case kButton1Motion:
+        if (!IsUsed(idx))
+        {
+            SetUsed(idx);
+            fEntries++;
+        }
+        break;
+
+    default:
+        return;
+    }
+
+    gPad->Modified();
+    gPad->Update();
+}
+
+
+// -------------------------------------------------------------------------
+//                        MagicJam -- the Game
+// -------------------------------------------------------------------------
+
+// --------------------------------------------------------------------------
+//
+// Fill 1 in a single pixel. If the pixel has more content than neighbors
+// it overflows into its neighbors. Called recursivly.
+//
+void MagicJam::FillPix(Int_t idx)
+{
+    if (CountPlayers()==1)
+        return;
+
+    const Int_t newval = fBinEntries[idx+1]+1;
+
+    const MGeomPix &gpix = (*fGeomCam)[idx];
+    const Int_t n = gpix.GetNumNeighbors();
+
+    SetBinContent(idx+1, fNumPlayer);
+    SetUsed(idx);
+
+    if (newval <= n)
+    {
+        fBinEntries[idx+1] = newval;
+        return;
+    }
+
+    fEntries -= n;
+    fBinEntries[idx+1] = 1;
+
+    for (int i=0; i<n; i++)
+        FillPix(gpix.GetNeighbor(i));
+
+    gPad->Modified();
+    gPad->Update();
+}
+
+// --------------------------------------------------------------------------
+//
+// Count tiles of player 
+//
+Int_t MagicJam::CountPlayer(Int_t player) const
+{
+    Int_t sum = 0;
+    for (int i=0; i<GetNbinsX(); i++)
+        if (IsUsed(i) && TMath::Nint(GetBinContent(i+1))==player)
+            sum += fBinEntries[i+1];
+    return sum;
+}
+
+// --------------------------------------------------------------------------
+//
+// Count number of players still able to move
+//
+Int_t MagicJam::CountPlayers() const
+{
+    if (GetEntries()<=fNumPlayers)
+        return 0;
+
+    Int_t cnt=0;
+    for (int i=0; i<fNumPlayers; i++)
+        if (CountPlayer(i)>0)
+            cnt++;
+
+    return cnt;
+}
+
+// --------------------------------------------------------------------------
+//
+// Start MagicJam. Loads the default game jam.txt and initializes a
+// two player game
+//
+MagicJam::MagicJam(const char *jam, MagicJam *game) : fNumPlayers(0), fGame(game)
+{
+    SetTitle("Magic Jam (game)");
+
+    SetBit(kNoLegend);
+    SetBit(kNoScale);
+    SetBit(kMustCleanup);
+
+    LoadGame(jam);
+
+    gInterpreter->DeleteGlobal(this);
+    gROOT->GetListOfCleanups()->Add(this);
+
+    if (fGame!=NULL)
+    {
+        SetBit(kNoContextMenu);
+        SetBit(kNoStats);
+        return;
+    }
+
+    SetNumPlayers(2);
+    SetMinMax(-0.5, 9.5);
+
+    Draw();
+    gPad->SetEditable(kFALSE);
+}
+
+// --------------------------------------------------------------------------
+//
+// Remove fGame if it was deleted
+//
+void MagicJam::RecursiveRemove(TObject *obj)
+{
+    if (fGame==obj)
+        fGame=0;
+}
+
+// --------------------------------------------------------------------------
+//
+// Set a new number of players. Restarts the game
+//
+void MagicJam::SetNumPlayers(Byte_t n)
+{
+    if (n<2 || n>9)
+        return;
+
+    fNumPlayers = n;
+    fNumPlayer  = 0;
+
+    Reset();
+}
+
+// --------------------------------------------------------------------------
+//
+// Loads a new geometry (game). Restarts the game.
+//
+void MagicJam::LoadGame(const char *name)
+{
+    /*
+    if (gPad)
+    {
+    static const char *gOpenTypes[] =
+    {
+        "Template files",  "*.txt",
+        "All files",    "*",
+        NULL,           NULL
+    };
+
+    static TString dir(".");
+
+    TGFileInfo fi; // fFileName and fIniDir deleted in ~TGFileInfo
+
+    fi.fFileTypes = (const char**)gOpenTypes;
+    fi.fIniDir    = StrDup(dir);
+
+    dlg = new TGFileDialog(0, 0, kFDOpen, &fi);
+
+    // Checks is meanwhile the game has been closed!
+    if (!gPad)
+        return;
+
+    cout << "done" << endl;
+
+    cout << gPad << endl;
+
+    if (!fi.fFilename || gPad==NULL)
+        return;
+
+    cout << "test" << endl;
+
+    dir  = fi.fIniDir;
+    name = fi.fFilename;
+    }
+    //if (!gROOT->GetListOfSpecials()->FindObject(this))
+    //    return;
+
+    cout << "Done." << endl;
+    */
+    //***
+
+
+
+    ifstream fin(name);
+    if (!fin)
+    {
+        cout << "Cannot open file " << name << ": " << strerror(errno) << endl;
+        return;
+    }
+
+    Int_t maxx=-INT_MAX;
+    Int_t maxy=-INT_MAX;
+    Int_t minx= INT_MAX;
+    Int_t miny= INT_MAX;
+
+    TNtuple tup("", "", "x:y");
+    tup.SetDirectory(0);
+
+    while (1)
+    {
+        Int_t x,y;
+        fin >> x >> y;
+        if (!fin)
+            break;
+
+        tup.Fill(x, y);
+
+        maxx = TMath::Max(maxx, x);
+        maxy = TMath::Max(maxy, y);
+        minx = TMath::Min(minx, x);
+        miny = TMath::Min(miny, y);
+    }
+
+    if (tup.GetEntries()==0)
+    {
+        cout << "File " << name << " contains no entries!" << endl;
+        return;
+    }
+
+    MGeomCam cam(tup.GetEntries());
+
+    for (int i=0; i<tup.GetEntries(); i++)
+    {
+        tup.GetEntry(i);
+
+        const Int_t x = TMath::Nint(tup.GetArgs()[0]);
+        const Int_t y = TMath::Nint(tup.GetArgs()[1]);
+
+        Float_t dx = -minx-0.5*(maxx-minx+1);
+        Float_t dy = -miny-0.5*(maxy-miny+1);
+
+        dx += TMath::Odd(y) ? x-0.25 : x+0.25;
+        dy += y;
+
+        cam[i].Set(dx, dy*0.866);
+    }
+
+    for (UInt_t i=0; i<cam.GetNumPixels(); i++)
+    {
+        Int_t nn[6] = { -1, -1, -1, -1, -1, -1 };
+        Int_t idx=0;
+
+        for (UInt_t j=0; j<cam.GetNumPixels(); j++)
+            if (i!=j && cam.GetDist(i,j)<1.5)
+                nn[idx++] = j;
+
+        cam[i].SetNeighbors(nn[0], nn[1], nn[2], nn[3], nn[4], nn[5]);
+    }
+
+    SetGeometry(cam);
+
+    SetName(name);
+    Reset();
+}
+
+// --------------------------------------------------------------------------
+//
+// Restart the game.
+//
+void MagicJam::Reset(Option_t *o)
+{
+    MHCamera::Reset("");
+
+    if (fNumPlayers==0)
+    {
+        SetAllUsed();
+        return;
+    }
+
+    const Int_t max = TMath::Max((Int_t)GetNumPixels()/25, 1);
+    for (Int_t i=0; i<fNumPlayers; i++)
+    {
+        for (Int_t x=0; x<max; x++)
+        {
+            const Int_t idx = gRandom->Integer(GetNumPixels()-1);
+
+            if (IsUsed(idx))
+            {
+                x--;
+                continue;
+            }
+
+            SetUsed(idx);
+            SetBinContent(idx+1, i);
+            fBinEntries[idx+1] = 1;
+        }
+    }
+}
+
+// --------------------------------------------------------------------------
+//
+// Star an editor to make your own game.
+//
+void MagicJam::StartEditor() const
+{
+    TCanvas *c=new TCanvas;
+
+    c->SetName("Editor");
+    c->SetTitle("MagicJam Editor");
+
+    MagicJamEditor *build=new MagicJamEditor;
+
+    build->SetBit(kCanDelete);
+}
+
+// --------------------------------------------------------------------------
+//
+// Open the current game in the editor.
+//
+void MagicJam::OpenInEditor() const
+{
+    TCanvas *c=new TCanvas;
+
+    c->SetName("Editor");
+    c->SetTitle("MagicJam Editor");
+
+    MagicJamEditor *build=new MagicJamEditor(GetName());
+
+    build->SetBit(kCanDelete);
+}
+
+// --------------------------------------------------------------------------
+//
+// Show the Jam games of this directory
+//
+void  MagicJam::ShowDirectory(const char *dir)
+{
+    MDirIter Next(dir, "*.jam");
+
+    TList list;
+
+    TString file;
+    while (1)
+    {
+        file=Next();
+        if (file.IsNull())
+            break;
+
+        MagicJam *jam = new MagicJam(file, this);
+        if (jam->GetNumPixels()==0)
+        {
+            delete jam;
+            continue;
+        }
+        list.Add(jam);
+    }
+
+    const Int_t n1 = TMath::Nint(TMath::Ceil(list.GetEntries()/3.));
+    const Int_t n2 = TMath::Nint(TMath::Ceil((float)list.GetEntries()/n1));
+
+    TCanvas *c = new TCanvas;
+    c->SetBorderMode(0);
+    c->SetFillColor(kWhite);
+    c->Divide(n1, n2, 0, 0);
+    c->SetBit(kNoContextMenu);
+    c->SetBit(kCannotPick);
+
+    Int_t i=0;
+
+    TObject *o=0;
+
+    TIter NextObj(&list);
+
+    while ((o=NextObj()))
+    {
+        list.Remove(o);
+
+        c->cd(++i);
+        gPad->SetFillColor(kWhite);
+        o->SetBit(kCanDelete);
+        o->Draw();
+        gPad->SetBit(kCannotPick);
+        gPad->GetPad(1)->SetBit(kCannotPick);
+    }
+
+    // Delete empty pads
+    for (; i<=n1*n2; i++)
+        delete c->GetPad(i);
+}
+
+// --------------------------------------------------------------------------
+//
+// Process mouse events
+//
+void MagicJam::ExecuteEvent(Int_t event, Int_t px, Int_t py)
+{
+    if (fNumPlayers==0) // We are in ShowDirectory-Mode
+    {
+        if (event!=kButton1Down)
+            return;
+
+        if (fGame)
+        {
+            // Do a simple search for the pad containing fGame
+            TIter Next(gROOT->GetListOfCanvases());
+            TCanvas *c=0;
+            while((c=(TCanvas*)Next()))
+            {
+                TVirtualPad *pad1 = c->GetPad(1);
+                if (!pad1)
+                    continue;
+
+                if (!pad1->GetListOfPrimitives()->FindObject(fGame))
+                    continue;
+
+                fGame->LoadGame(GetName());
+
+                pad1->Modified();
+                pad1->Update();
+                return;
+            }
+        }
+
+        // No pad found. Open new canvas for it
+        new TCanvas;
+        new MagicJam(GetName());
+
+        return;
+    }
+
+    if (CountPlayers()==1) // We already have a winner
+        return;
+
+    if (event==kButton1Down)
+    {
+        const Int_t idx = GetPixelIndex(px, py);
+        if (idx<0)
+            return;
+
+        if (IsUsed(idx) && TMath::Nint(GetBinContent(idx+1))!=fNumPlayer)
+        {
+            const Int_t col = gPad->GetFillColor();
+
+            gPad->SetFillColor(kRed);
+            gPad->Modified();
+            gPad->Update();
+
+            gSystem->Sleep(250);
+
+            gPad->SetFillColor(col);
+            gPad->Modified();
+            gPad->Update();
+            return;
+        }
+
+        FillPix(idx);
+
+        do
+        {
+            fNumPlayer++;
+            fNumPlayer %= fNumPlayers;
+        }
+        while (CountPlayers()>1 && CountPlayer(fNumPlayer)==0);
+
+        gPad->Modified();
+        gPad->Update();
+    }
+}
+
+// --------------------------------------------------------------------------
+//
+// Paint game pad
+//
+void MagicJam::Paint(Option_t *o)
+{
+    if (GetNumPixels()==0)
+        return;
+
+    gStyle->SetOptStat(11);
+
+    Int_t palette[50] =
+    {
+        4, 4, 4, 4, 4,  // light blue
+        3, 3, 3, 3, 3,  // light green
+        6, 6, 6, 6, 6,  // magenta
+        5, 5, 5, 5, 5,  // yellow
+        7, 7, 7, 7, 7,  // cyan
+        //8, 8, 8, 8, 8,  // dark green
+        //11, 11, 11, 11,11, // light gray
+        12, 12, 12, 12,12, // dark gray
+        1, 1, 1, 1, 1,  // black
+        46, 46, 46, 46, 46,
+        51, 51, 51, 51, 51,   // brown
+    };
+
+    gStyle->SetPalette(50, palette);
+    MHCamera::Paint(o);
+
+    TText txt;
+    txt.SetTextAlign(13);       // left/bottom
+    txt.SetTextSize(0.03);
+
+    const Double_t range = fGeomCam->GetMaxRadius();
+
+    Int_t max = 0;
+    Int_t num = 0;
+    Int_t pos = 0;
+    for (int i=0; i<fNumPlayers; i++)
+    {
+        const Int_t cnt = CountPlayer(i);
+
+        if (cnt>max)
+        {
+            max = cnt;
+            num = i;
+        }
+        if (cnt==0)
+            continue;
+
+        TString str = Form("Player #%d: %d %s", i+1, cnt, i==fNumPlayer?"<*>":"");
+
+        txt.SetTextColor(GetColor(i, fMinimum, fMaximum, kFALSE));
+        txt.PaintText(-range*0.95, range-pos*range*0.06, str);
+
+        pos++;
+    }
+
+    if (CountPlayers()==1)
+    {
+        TString str = "And the Winner... is... player #";
+        str += Form("%d (Score=%d)", num+1, max);
+        txt.SetTextColor(kRed);  // white
+        txt.SetTextAlign(22);    // centered/centered
+        txt.SetTextSize(0.05);   // white
+        txt.PaintText(0, 0, str);
+    }
+
+    if (fNumPlayers==0)
+    {
+        txt.SetTextSize(0.075);
+        txt.SetTextColor(kBlack);
+
+        txt.SetTextAlign(13); // left/top
+        txt.PaintTextNDC(0.02, 0.99, GetName());
+
+        //txt.SetTextAlign(11); // left/bottom
+        //txt.PaintTextNDC(0.01, 0.01, Form("%d", GetNumPixels()));
+        txt.PaintTextNDC(0.02, 0.91, Form("%d", GetNumPixels()));
+    }
+}
+
+// --------------------------------------------------------------------------
+//
+// Calls draw of the base class MHCamera with the necessary options
+//
+void MagicJam::Draw(Option_t *o)
+{
+    MHCamera::Draw(fNumPlayers>0 ? "pixelentries nopal" : "nopal");
+    gPad->SetBit(kCannotPick);
+}
Index: trunk/MagicSoft/Mars/mtools/MagicJam.h
===================================================================
--- trunk/MagicSoft/Mars/mtools/MagicJam.h	(revision 7342)
+++ trunk/MagicSoft/Mars/mtools/MagicJam.h	(revision 7342)
@@ -0,0 +1,124 @@
+#ifndef MARS_MagicJam
+#define MARS_Magicjam
+
+#ifndef MARS_MHCamera
+#include "MHCamera.h"
+#endif
+
+// --------------------------------------------------------------------
+
+class MagicJamAbc : public MHCamera
+{
+public:
+    // Remove this items from the context menu
+    void  SetLineAttributes() { }
+    void  SetFillAttributes() { }
+    void  SetMarkerAttributes() { }
+    void  SetName(const char *name) { MHCamera::SetName(name); }
+    void  SetTitle(const char *name) { MHCamera::SetTitle(name); }
+    TH1  *DrawCopy(const Option_t *o="") const { return MHCamera::DrawCopy(o); }
+    void  PrintInfo() const {  }
+    void  SetDrawOption(Option_t *option="") { MHCamera::SetDrawOption(option); }
+    Int_t Fit(const char *formula ,Option_t *option="" ,Option_t *goption="", Axis_t xmin=0, Axis_t xmax=0) { return 0; }
+    Int_t Fit(TF1 *f1 ,Option_t *option="" ,Option_t *goption="", Axis_t xmin=0, Axis_t xmax=0) { return 0; }
+    void  SetMaximum(Double_t maximum=-1111) { MHCamera::SetMaximum(maximum); }
+    void  SetMinimum(Double_t minimum=-1111) { MHCamera::SetMinimum(minimum); }
+    void  Add(const TH1 *h1, const TH1 *h2, Double_t c1=1, Double_t c2=1) { }
+    void  Add(TF1 *h1, Double_t c1, Option_t *) { }
+    void  Add(const TH1 *h1, Double_t c1=1) { }
+    void  Divide(TF1 *f1, Double_t c1=1) { }
+    void  Divide(const TH1 *h1) { }
+    void  Divide(const TH1 *h1, const TH1 *h2, Double_t c1=1, Double_t c2=1, Option_t *option="") { }
+    void  Multiply(TF1 *h1, Double_t c1=1) { }
+    void  Multiply(const TH1 *h1) { }
+    void  Multiply(const TH1 *h1, const TH1 *h2, Double_t c1=1, Double_t c2=1, Option_t *option="") { }
+    void  Smooth(int, int, int) { }
+    void  SetPrettyPalette() {}
+    void  SetDeepBlueSeaPalette() {}
+    void  SetInvDeepBlueSeaPalette() {}
+    void  SetFreezed(Bool_t f=kTRUE) { }
+    void  SetAbberation(Float_t f=0.0713) { }
+    void  SetAutoScale() { }
+    void  SetMinMax(Double_t min=-1111, Double_t max=-1111) { SetMinimum(min); SetMaximum(max); }
+
+    // Make the full pad sensible for the context menu
+    Int_t DistancetoPrimitive(Int_t px, Int_t py) { return 0; }
+
+    ClassDef(MagicJamAbc, 0) // Helper class for MagicJam
+};
+
+// --------------------------------------------------------------------
+class TASImage;
+
+class MagicJamEditor : public MagicJamAbc
+{
+    Int_t fWidth;
+
+    TASImage *fImage;
+
+    void Move(int dx, int dy);
+    void InitGeom(int wx, int hy);
+    Int_t GetPixelIndexFlt(Float_t px, Float_t py) const;
+
+public:
+    MagicJamEditor(const char *name=0);
+    ~MagicJamEditor();
+
+    // MagicJamEditor
+    void   SetAllUsed() { MHCamera::SetAllUsed(); } //*MENU*
+    void   Reset(Option_t *o="") { MHCamera::Reset(o); } //*MENU*
+    void   Invert() { for (UInt_t i=0; i<GetNumPixels(); i++) if (IsUsed(i)) ResetUsed(i); else SetUsed(i); } //*MENU*
+    void   SetWidthHeight(Int_t dx, Int_t dy); //*MENU*
+    Bool_t ShowUnused() const { return TestBit(kNoUnused); }
+    void   DoNotDisplayUnused(Bool_t b) { b ? SetBit(kNoUnused) : ResetBit(kNoUnused); } //*TOGGLE* *GETTER=ShowUnused
+
+    void   LoadGame(const char *name="default.jam");//*MENU* *ARGS={name=>fName}
+    void   SaveGame(const char *name="default.jam"); //*MENU* *ARGS={name=>fName}
+
+    void   ShowImageAsBackground(const char *name); //*MENU*
+    void   RemoveBackgroundImage(); //*MENU*
+
+    // TObject
+    void Paint(Option_t *o);
+    void Draw(Option_t *o="");
+    void EventInfo(Int_t event, Int_t px, Int_t py, TObject *);
+    void ExecuteEvent(Int_t event, Int_t px, Int_t py);
+
+    ClassDef(MagicJamEditor, 0) // Editor for the MAGIC Jam games
+};
+
+// --------------------------------------------------------------------
+
+class MagicJam : public MagicJamAbc
+{
+private:
+    Int_t fNumPlayers;
+    Int_t fNumPlayer;
+
+    MagicJam *fGame; //!
+
+    void FillPix(Int_t idx);
+    Int_t CountPlayer(Int_t player) const;
+    Int_t CountPlayers() const;
+
+public:
+    MagicJam(const char *jam="mtools/jam/default.jam", MagicJam *game=NULL);
+
+    // MagicJam
+    void  SetNumPlayers(Byte_t n=2); //*MENU*
+    void  LoadGame(const char *name="default.jam"); //*MENU* *ARGS={name=>fName}
+    void  Reset(Option_t *o=""); //*MENU*
+    void  StartEditor() const; //*MENU*
+    void  OpenInEditor() const; //*MENU*
+    void  ShowDirectory(const char *dir="mtools/jam"); //*MENU*
+
+    // TObject
+    void  ExecuteEvent(Int_t event, Int_t px, Int_t py);
+    void  Paint(Option_t *o);
+    void  Draw(Option_t *o=0);
+    void  RecursiveRemove(TObject *obj);
+
+    ClassDef(MagicJam, 0) // MAGIC-Jam (game)
+};
+
+#endif
Index: trunk/MagicSoft/Mars/mtools/Makefile
===================================================================
--- trunk/MagicSoft/Mars/mtools/Makefile	(revision 7341)
+++ trunk/MagicSoft/Mars/mtools/Makefile	(revision 7342)
@@ -20,5 +20,5 @@
 #
 INCLUDES = -I. -I../mbase -I../mgui -I../mgeom -I../mdata -I../mhbase \
-	   -I../mfileio -I../mfbase -I../manalysis
+	   -I../mfileio -I../mfbase -I../manalysis -I../mhist
 
 #manalysis: MChisqEval (MParameters)
@@ -34,4 +34,5 @@
 	   MagicSnake.cc \
            MagicShow.cc \
+           MagicJam.cc \
            MagicDomino.cc \
            MagicCivilization.cc \
Index: trunk/MagicSoft/Mars/mtools/ToolsLinkDef.h
===================================================================
--- trunk/MagicSoft/Mars/mtools/ToolsLinkDef.h	(revision 7341)
+++ trunk/MagicSoft/Mars/mtools/ToolsLinkDef.h	(revision 7342)
@@ -18,4 +18,7 @@
 #pragma link C++ class MagicSnake+;
 #pragma link C++ class MagicShow+;
+#pragma link C++ class MagicJamAbc+;
+#pragma link C++ class MagicJam+;
+#pragma link C++ class MagicJamEditor+;
 #pragma link C++ class MagicDomino+;
 #pragma link C++ class MagicCivilization+;
Index: trunk/MagicSoft/Mars/mtools/jam/bike.jam
===================================================================
--- trunk/MagicSoft/Mars/mtools/jam/bike.jam	(revision 7342)
+++ trunk/MagicSoft/Mars/mtools/jam/bike.jam	(revision 7342)
@@ -0,0 +1,443 @@
+8 14
+9 14
+10 14
+11 14
+12 14
+13 14
+36 14
+37 14
+38 14
+39 14
+40 14
+7 15
+8 15
+9 15
+10 15
+11 15
+12 15
+13 15
+14 15
+15 15
+35 15
+36 15
+37 15
+38 15
+39 15
+40 15
+41 15
+42 15
+5 16
+6 16
+7 16
+11 16
+12 16
+14 16
+15 16
+16 16
+34 16
+35 16
+41 16
+42 16
+43 16
+5 17
+6 17
+11 17
+12 17
+16 17
+17 17
+33 17
+34 17
+35 17
+43 17
+44 17
+45 17
+4 18
+5 18
+11 18
+16 18
+17 18
+23 18
+24 18
+25 18
+32 18
+33 18
+34 18
+35 18
+44 18
+45 18
+4 19
+5 19
+11 19
+12 19
+17 19
+18 19
+25 19
+32 19
+33 19
+35 19
+36 19
+45 19
+46 19
+3 20
+4 20
+10 20
+11 20
+17 20
+18 20
+25 20
+31 20
+32 20
+36 20
+43 20
+44 20
+45 20
+46 20
+3 21
+4 21
+10 21
+11 21
+12 21
+18 21
+19 21
+26 21
+28 21
+29 21
+32 21
+37 21
+38 21
+39 21
+40 21
+42 21
+43 21
+44 21
+45 21
+46 21
+47 21
+3 22
+4 22
+9 22
+10 22
+11 22
+12 22
+18 22
+25 22
+26 22
+28 22
+29 22
+31 22
+32 22
+37 22
+38 22
+39 22
+40 22
+41 22
+42 22
+43 22
+46 22
+3 23
+4 23
+9 23
+10 23
+11 23
+12 23
+13 23
+18 23
+19 23
+25 23
+27 23
+29 23
+32 23
+38 23
+39 23
+40 23
+41 23
+42 23
+46 23
+47 23
+3 24
+4 24
+7 24
+8 24
+9 24
+10 24
+11 24
+12 24
+13 24
+18 24
+24 24
+25 24
+28 24
+31 24
+32 24
+36 24
+37 24
+38 24
+39 24
+40 24
+45 24
+46 24
+4 25
+5 25
+6 25
+7 25
+11 25
+12 25
+14 25
+15 25
+17 25
+18 25
+24 25
+25 25
+26 25
+27 25
+28 25
+32 25
+34 25
+35 25
+36 25
+37 25
+38 25
+39 25
+40 25
+46 25
+3 26
+4 26
+5 26
+11 26
+14 26
+15 26
+16 26
+17 26
+23 26
+24 26
+25 26
+26 26
+27 26
+31 26
+32 26
+33 26
+34 26
+35 26
+38 26
+39 26
+45 26
+46 26
+4 27
+5 27
+12 27
+16 27
+17 27
+22 27
+23 27
+24 27
+25 27
+26 27
+27 27
+28 27
+30 27
+31 27
+32 27
+33 27
+34 27
+35 27
+38 27
+39 27
+45 27
+46 27
+4 28
+5 28
+6 28
+11 28
+12 28
+15 28
+16 28
+21 28
+22 28
+23 28
+24 28
+25 28
+26 28
+27 28
+28 28
+29 28
+30 28
+31 28
+32 28
+33 28
+34 28
+38 28
+39 28
+44 28
+45 28
+6 29
+7 29
+12 29
+13 29
+15 29
+16 29
+21 29
+22 29
+24 29
+25 29
+27 29
+28 29
+29 29
+30 29
+31 29
+32 29
+34 29
+35 29
+38 29
+39 29
+44 29
+45 29
+6 30
+7 30
+8 30
+9 30
+10 30
+11 30
+12 30
+13 30
+14 30
+20 30
+21 30
+24 30
+25 30
+27 30
+28 30
+29 30
+30 30
+34 30
+35 30
+36 30
+37 30
+38 30
+39 30
+42 30
+43 30
+8 31
+9 31
+10 31
+11 31
+12 31
+13 31
+20 31
+21 31
+25 31
+26 31
+36 31
+37 31
+38 31
+39 31
+40 31
+41 31
+42 31
+43 31
+12 32
+13 32
+18 32
+19 32
+20 32
+25 32
+26 32
+27 32
+38 32
+39 32
+40 32
+12 33
+13 33
+14 33
+15 33
+16 33
+18 33
+19 33
+20 33
+23 33
+24 33
+25 33
+26 33
+27 33
+28 33
+12 34
+13 34
+14 34
+15 34
+16 34
+17 34
+18 34
+21 34
+22 34
+23 34
+24 34
+25 34
+26 34
+27 34
+28 34
+29 34
+30 34
+13 35
+16 35
+17 35
+18 35
+19 35
+20 35
+21 35
+22 35
+28 35
+29 35
+30 35
+31 35
+12 36
+13 36
+16 36
+17 36
+18 36
+19 36
+29 36
+30 36
+13 37
+14 37
+17 37
+30 37
+31 37
+13 38
+14 38
+15 38
+16 38
+17 38
+31 38
+13 39
+14 39
+15 39
+16 39
+17 39
+32 39
+16 40
+17 40
+31 40
+16 41
+17 41
+32 41
+13 42
+14 42
+15 42
+30 42
+31 42
+32 42
+33 42
+11 43
+12 43
+13 43
+14 43
+30 43
+31 43
+32 43
+33 43
+34 43
+35 43
+10 44
+11 44
+12 44
+35 44
+11 45
Index: trunk/MagicSoft/Mars/mtools/jam/car.jam
===================================================================
--- trunk/MagicSoft/Mars/mtools/jam/car.jam	(revision 7342)
+++ trunk/MagicSoft/Mars/mtools/jam/car.jam	(revision 7342)
@@ -0,0 +1,86 @@
+4 1
+5 1
+15 1
+16 1
+3 2
+4 2
+5 2
+14 2
+15 2
+16 2
+0 3
+1 3
+2 3
+3 3
+6 3
+7 3
+8 3
+9 3
+10 3
+11 3
+12 3
+13 3
+14 3
+17 3
+18 3
+19 3
+0 4
+1 4
+2 4
+3 4
+4 4
+5 4
+6 4
+7 4
+8 4
+9 4
+10 4
+11 4
+12 4
+13 4
+14 4
+15 4
+16 4
+17 4
+18 4
+1 5
+2 5
+3 5
+4 5
+5 5
+9 5
+10 5
+14 5
+15 5
+16 5
+17 5
+18 5
+4 6
+8 6
+9 6
+13 6
+14 6
+15 6
+5 7
+6 7
+9 7
+10 7
+14 7
+15 7
+6 8
+7 8
+8 8
+9 8
+10 8
+11 8
+12 8
+13 8
+14 8
+8 9
+9 9
+10 9
+11 9
+12 9
+13 9
+12 10
+13 11
Index: trunk/MagicSoft/Mars/mtools/jam/crown.jam
===================================================================
--- trunk/MagicSoft/Mars/mtools/jam/crown.jam	(revision 7342)
+++ trunk/MagicSoft/Mars/mtools/jam/crown.jam	(revision 7342)
@@ -0,0 +1,180 @@
+9 16
+10 16
+11 16
+12 16
+13 16
+14 16
+15 16
+16 16
+17 16
+18 16
+19 16
+20 16
+21 16
+22 16
+23 16
+24 16
+25 16
+26 16
+27 16
+28 16
+29 16
+10 17
+11 17
+12 17
+13 17
+14 17
+15 17
+16 17
+17 17
+18 17
+19 17
+20 17
+21 17
+22 17
+23 17
+24 17
+25 17
+26 17
+27 17
+28 17
+29 17
+9 18
+10 18
+11 18
+12 18
+14 18
+15 18
+16 18
+17 18
+18 18
+20 18
+21 18
+22 18
+23 18
+24 18
+26 18
+27 18
+28 18
+29 18
+10 19
+11 19
+12 19
+13 19
+14 19
+15 19
+16 19
+17 19
+18 19
+21 19
+22 19
+23 19
+24 19
+25 19
+26 19
+27 19
+28 19
+29 19
+9 20
+10 20
+11 20
+12 20
+14 20
+15 20
+16 20
+17 20
+18 20
+20 20
+21 20
+22 20
+23 20
+24 20
+26 20
+27 20
+28 20
+29 20
+10 21
+12 21
+13 21
+14 21
+15 21
+16 21
+17 21
+18 21
+19 21
+20 21
+21 21
+22 21
+23 21
+24 21
+25 21
+26 21
+27 21
+29 21
+9 22
+10 22
+12 22
+13 22
+14 22
+16 22
+18 22
+19 22
+20 22
+22 22
+24 22
+25 22
+26 22
+28 22
+29 22
+10 23
+13 23
+14 23
+16 23
+17 23
+19 23
+20 23
+22 23
+23 23
+25 23
+26 23
+29 23
+13 24
+16 24
+19 24
+22 24
+25 24
+13 25
+14 25
+19 25
+20 25
+25 25
+26 25
+13 26
+19 26
+25 26
+13 27
+14 27
+19 27
+20 27
+25 27
+26 27
+12 28
+14 28
+18 28
+19 28
+20 28
+24 28
+26 28
+13 29
+14 29
+18 29
+19 29
+20 29
+21 29
+25 29
+26 29
+18 30
+19 30
+20 30
+19 31
+20 31
Index: trunk/MagicSoft/Mars/mtools/jam/default.jam
===================================================================
--- trunk/MagicSoft/Mars/mtools/jam/default.jam	(revision 7342)
+++ trunk/MagicSoft/Mars/mtools/jam/default.jam	(revision 7342)
@@ -0,0 +1,105 @@
+2 0
+3 0
+4 0
+2 1
+5 1
+1 2
+5 2
+2 3
+6 3
+0 4
+1 4
+2 4
+3 4
+4 4
+5 4
+6 4
+7 4
+8 4
+9 4
+10 4
+11 4
+12 4
+13 4
+14 4
+15 4
+16 4
+17 4
+18 4
+19 4
+3 5
+6 5
+1 6
+2 6
+3 6
+4 6
+5 6
+6 6
+7 6
+8 6
+9 6
+10 6
+11 6
+12 6
+13 6
+14 6
+15 6
+16 6
+17 6
+18 6
+19 6
+20 6
+4 7
+6 7
+4 8
+5 8
+6 8
+9 8
+10 8
+11 8
+12 8
+13 8
+16 8
+18 8
+5 9
+6 9
+9 9
+12 9
+14 9
+16 9
+17 9
+19 9
+5 10
+6 10
+7 10
+8 10
+12 10
+14 10
+16 10
+18 10
+6 11
+8 11
+9 11
+12 11
+14 11
+16 11
+17 11
+19 11
+6 12
+9 12
+10 12
+11 12
+12 12
+14 12
+15 12
+17 12
+18 12
+1 13
+6 13
+1 14
+2 14
+3 14
+6 14
+4 15
+5 15
+6 15
Index: trunk/MagicSoft/Mars/mtools/jam/earth.jam
===================================================================
--- trunk/MagicSoft/Mars/mtools/jam/earth.jam	(revision 7342)
+++ trunk/MagicSoft/Mars/mtools/jam/earth.jam	(revision 7342)
@@ -0,0 +1,498 @@
+16 0
+17 0
+17 1
+18 1
+57 1
+16 2
+17 2
+18 2
+19 2
+55 2
+56 2
+57 2
+17 3
+18 3
+19 3
+20 3
+21 3
+34 3
+35 3
+51 3
+52 3
+53 3
+54 3
+55 3
+56 3
+57 3
+58 3
+17 4
+18 4
+19 4
+20 4
+21 4
+33 4
+34 4
+35 4
+38 4
+51 4
+52 4
+53 4
+54 4
+55 4
+56 4
+57 4
+17 5
+18 5
+19 5
+20 5
+21 5
+22 5
+33 5
+34 5
+35 5
+36 5
+38 5
+39 5
+52 5
+53 5
+54 5
+55 5
+56 5
+57 5
+16 6
+17 6
+18 6
+19 6
+20 6
+21 6
+22 6
+32 6
+33 6
+34 6
+35 6
+36 6
+37 6
+38 6
+52 6
+53 6
+54 6
+55 6
+56 6
+16 7
+17 7
+18 7
+19 7
+20 7
+21 7
+22 7
+23 7
+33 7
+34 7
+35 7
+36 7
+37 7
+54 7
+55 7
+57 7
+58 7
+15 8
+16 8
+17 8
+18 8
+19 8
+20 8
+21 8
+22 8
+23 8
+32 8
+33 8
+34 8
+35 8
+36 8
+49 8
+50 8
+51 8
+52 8
+53 8
+55 8
+56 8
+57 8
+16 9
+17 9
+18 9
+19 9
+20 9
+21 9
+22 9
+32 9
+33 9
+34 9
+35 9
+36 9
+37 9
+49 9
+51 9
+54 9
+55 9
+15 10
+16 10
+17 10
+18 10
+19 10
+20 10
+32 10
+33 10
+34 10
+35 10
+36 10
+37 10
+38 10
+48 10
+50 10
+51 10
+15 11
+16 11
+17 11
+18 11
+19 11
+28 11
+29 11
+30 11
+31 11
+32 11
+33 11
+34 11
+35 11
+36 11
+37 11
+38 11
+39 11
+45 11
+48 11
+51 11
+52 11
+53 11
+14 12
+15 12
+16 12
+17 12
+27 12
+28 12
+29 12
+30 12
+31 12
+32 12
+33 12
+34 12
+35 12
+36 12
+37 12
+38 12
+44 12
+48 12
+49 12
+52 12
+12 13
+13 13
+14 13
+27 13
+28 13
+29 13
+30 13
+31 13
+32 13
+33 13
+34 13
+35 13
+36 13
+37 13
+39 13
+40 13
+44 13
+45 13
+47 13
+48 13
+49 13
+52 13
+10 14
+11 14
+13 14
+15 14
+16 14
+17 14
+27 14
+28 14
+29 14
+30 14
+31 14
+32 14
+33 14
+34 14
+35 14
+36 14
+38 14
+39 14
+40 14
+43 14
+44 14
+45 14
+46 14
+47 14
+48 14
+49 14
+50 14
+9 15
+10 15
+11 15
+12 15
+16 15
+28 15
+29 15
+30 15
+31 15
+32 15
+33 15
+34 15
+35 15
+36 15
+37 15
+38 15
+39 15
+41 15
+42 15
+43 15
+44 15
+45 15
+46 15
+47 15
+48 15
+49 15
+50 15
+51 15
+52 15
+8 16
+9 16
+10 16
+11 16
+12 16
+13 16
+14 16
+15 16
+28 16
+29 16
+30 16
+31 16
+32 16
+33 16
+37 16
+38 16
+39 16
+40 16
+41 16
+42 16
+43 16
+44 16
+45 16
+46 16
+47 16
+48 16
+49 16
+50 16
+51 16
+54 16
+8 17
+9 17
+10 17
+11 17
+12 17
+13 17
+14 17
+15 17
+16 17
+29 17
+36 17
+37 17
+38 17
+39 17
+40 17
+41 17
+42 17
+43 17
+44 17
+45 17
+46 17
+47 17
+48 17
+49 17
+50 17
+51 17
+52 17
+53 17
+54 17
+55 17
+56 17
+7 18
+8 18
+9 18
+10 18
+11 18
+12 18
+13 18
+14 18
+15 18
+16 18
+17 18
+29 18
+30 18
+31 18
+33 18
+34 18
+37 18
+38 18
+39 18
+40 18
+41 18
+42 18
+43 18
+44 18
+45 18
+46 18
+47 18
+48 18
+49 18
+50 18
+51 18
+52 18
+53 18
+55 18
+56 18
+7 19
+8 19
+9 19
+10 19
+11 19
+12 19
+13 19
+14 19
+15 19
+16 19
+17 19
+18 19
+19 19
+29 19
+31 19
+32 19
+33 19
+34 19
+35 19
+36 19
+37 19
+38 19
+39 19
+40 19
+41 19
+42 19
+43 19
+44 19
+45 19
+46 19
+47 19
+48 19
+49 19
+50 19
+51 19
+52 19
+53 19
+54 19
+55 19
+5 20
+6 20
+7 20
+8 20
+9 20
+10 20
+11 20
+12 20
+13 20
+16 20
+17 20
+18 20
+21 20
+32 20
+35 20
+36 20
+37 20
+38 20
+39 20
+40 20
+41 20
+42 20
+43 20
+44 20
+45 20
+46 20
+47 20
+48 20
+49 20
+50 20
+51 20
+52 20
+53 20
+54 20
+55 20
+56 20
+57 20
+5 21
+6 21
+7 21
+8 21
+9 21
+10 21
+11 21
+12 21
+13 21
+14 21
+15 21
+16 21
+17 21
+18 21
+19 21
+20 21
+21 21
+22 21
+23 21
+24 21
+25 21
+26 21
+27 21
+28 21
+29 21
+30 21
+31 21
+32 21
+33 21
+34 21
+35 21
+36 21
+37 21
+38 21
+39 21
+40 21
+41 21
+42 21
+43 21
+44 21
+45 21
+46 21
+47 21
+48 21
+49 21
+50 21
+51 21
+52 21
+53 21
+54 21
+55 21
+56 21
+57 21
+58 21
Index: trunk/MagicSoft/Mars/mtools/jam/flydog.jam
===================================================================
--- trunk/MagicSoft/Mars/mtools/jam/flydog.jam	(revision 7342)
+++ trunk/MagicSoft/Mars/mtools/jam/flydog.jam	(revision 7342)
@@ -0,0 +1,266 @@
+19 25
+20 25
+17 26
+18 26
+20 26
+17 27
+20 27
+16 28
+18 28
+19 28
+16 29
+19 29
+20 29
+21 29
+22 29
+23 29
+14 30
+15 30
+21 30
+23 30
+9 31
+10 31
+11 31
+12 31
+13 31
+14 31
+22 31
+23 31
+6 32
+7 32
+8 32
+12 32
+14 32
+15 32
+16 32
+17 32
+18 32
+19 32
+23 32
+24 32
+25 32
+26 32
+9 33
+10 33
+11 33
+12 33
+20 33
+21 33
+27 33
+5 34
+6 34
+7 34
+11 34
+21 34
+22 34
+27 34
+28 34
+29 34
+30 34
+5 35
+8 35
+9 35
+10 35
+11 35
+21 35
+23 35
+31 35
+32 35
+33 35
+34 35
+35 35
+36 35
+37 35
+38 35
+39 35
+40 35
+41 35
+42 35
+43 35
+44 35
+45 35
+46 35
+47 35
+5 36
+6 36
+11 36
+12 36
+13 36
+14 36
+15 36
+21 36
+23 36
+32 36
+47 36
+5 37
+7 37
+8 37
+15 37
+22 37
+24 37
+25 37
+32 37
+34 37
+35 37
+36 37
+37 37
+38 37
+39 37
+40 37
+41 37
+42 37
+43 37
+44 37
+45 37
+46 37
+47 37
+4 38
+8 38
+9 38
+10 38
+11 38
+12 38
+13 38
+14 38
+15 38
+16 38
+17 38
+18 38
+19 38
+20 38
+21 38
+22 38
+23 38
+24 38
+25 38
+26 38
+27 38
+28 38
+29 38
+30 38
+31 38
+33 38
+35 38
+4 39
+21 39
+22 39
+33 39
+36 39
+37 39
+38 39
+39 39
+40 39
+41 39
+42 39
+43 39
+44 39
+2 40
+3 40
+4 40
+5 40
+6 40
+7 40
+8 40
+9 40
+10 40
+19 40
+20 40
+23 40
+24 40
+25 40
+26 40
+27 40
+28 40
+29 40
+30 40
+31 40
+32 40
+39 40
+40 40
+41 40
+42 40
+43 40
+44 40
+45 40
+2 41
+11 41
+12 41
+13 41
+14 41
+15 41
+16 41
+17 41
+18 41
+19 41
+20 41
+21 41
+22 41
+23 41
+25 41
+26 41
+33 41
+45 41
+2 42
+17 42
+18 42
+19 42
+20 42
+21 42
+22 42
+23 42
+24 42
+28 42
+29 42
+30 42
+31 42
+32 42
+33 42
+41 42
+42 42
+43 42
+44 42
+3 43
+4 43
+5 43
+6 43
+7 43
+8 43
+9 43
+10 43
+11 43
+12 43
+13 43
+14 43
+15 43
+16 43
+17 43
+28 43
+34 43
+37 43
+38 43
+39 43
+40 43
+41 43
+27 44
+34 44
+36 44
+39 44
+27 45
+29 45
+30 45
+31 45
+32 45
+33 45
+37 45
+38 45
+39 45
+26 46
+27 46
+28 46
+33 46
+34 46
+38 46
+35 47
+36 47
+37 47
+38 47
Index: trunk/MagicSoft/Mars/mtools/jam/heart.jam
===================================================================
--- trunk/MagicSoft/Mars/mtools/jam/heart.jam	(revision 7342)
+++ trunk/MagicSoft/Mars/mtools/jam/heart.jam	(revision 7342)
@@ -0,0 +1,164 @@
+8 1
+7 2
+8 2
+7 3
+8 3
+9 3
+5 4
+6 4
+8 4
+9 4
+10 4
+6 5
+8 5
+9 5
+10 5
+4 6
+5 6
+8 6
+9 6
+10 6
+11 6
+4 7
+5 7
+8 7
+9 7
+10 7
+11 7
+12 7
+3 8
+4 8
+7 8
+8 8
+9 8
+10 8
+11 8
+12 8
+3 9
+4 9
+7 9
+8 9
+9 9
+10 9
+11 9
+12 9
+13 9
+2 10
+3 10
+7 10
+8 10
+9 10
+10 10
+11 10
+12 10
+13 10
+3 11
+7 11
+8 11
+9 11
+10 11
+11 11
+12 11
+13 11
+1 12
+2 12
+6 12
+7 12
+8 12
+9 12
+10 12
+11 12
+12 12
+13 12
+14 12
+2 13
+7 13
+8 13
+9 13
+10 13
+11 13
+12 13
+13 13
+14 13
+0 14
+1 14
+6 14
+7 14
+8 14
+9 14
+10 14
+11 14
+12 14
+13 14
+14 14
+15 14
+1 15
+6 15
+7 15
+8 15
+9 15
+10 15
+11 15
+12 15
+13 15
+14 15
+15 15
+0 16
+1 16
+3 16
+6 16
+7 16
+8 16
+9 16
+10 16
+13 16
+14 16
+15 16
+1 17
+4 17
+5 17
+6 17
+7 17
+8 17
+9 17
+10 17
+14 17
+15 17
+0 18
+1 18
+5 18
+6 18
+7 18
+8 18
+9 18
+14 18
+15 18
+1 19
+2 19
+6 19
+7 19
+8 19
+9 19
+10 19
+11 19
+13 19
+14 19
+15 19
+1 20
+2 20
+3 20
+4 20
+5 20
+6 20
+9 20
+10 20
+11 20
+12 20
+13 20
+14 20
+3 21
+4 21
+5 21
+11 21
+12 21
+13 21
Index: trunk/MagicSoft/Mars/mtools/jam/magiclogo.jam
===================================================================
--- trunk/MagicSoft/Mars/mtools/jam/magiclogo.jam	(revision 7342)
+++ trunk/MagicSoft/Mars/mtools/jam/magiclogo.jam	(revision 7342)
@@ -0,0 +1,245 @@
+2 22
+3 22
+4 22
+5 22
+6 22
+7 22
+8 22
+9 22
+10 22
+11 22
+12 22
+13 22
+14 22
+15 22
+16 22
+17 22
+18 22
+2 23
+3 23
+9 23
+10 23
+11 23
+12 23
+13 23
+14 23
+15 23
+16 23
+18 23
+19 23
+1 24
+2 24
+8 24
+9 24
+10 24
+11 24
+12 24
+13 24
+14 24
+15 24
+16 24
+18 24
+19 24
+20 24
+1 25
+2 25
+7 25
+8 25
+9 25
+10 25
+11 25
+12 25
+13 25
+14 25
+15 25
+16 25
+20 25
+21 25
+1 26
+6 26
+7 26
+8 26
+9 26
+10 26
+11 26
+12 26
+13 26
+14 26
+15 26
+20 26
+21 26
+1 27
+2 27
+5 27
+6 27
+7 27
+8 27
+9 27
+10 27
+11 27
+12 27
+13 27
+14 27
+15 27
+16 27
+21 27
+22 27
+0 28
+1 28
+4 28
+5 28
+6 28
+7 28
+8 28
+9 28
+10 28
+11 28
+12 28
+13 28
+14 28
+15 28
+20 28
+21 28
+1 29
+5 29
+6 29
+7 29
+8 29
+9 29
+10 29
+13 29
+14 29
+15 29
+21 29
+22 29
+0 30
+1 30
+4 30
+5 30
+6 30
+7 30
+8 30
+9 30
+11 30
+14 30
+21 30
+22 30
+1 31
+2 31
+4 31
+5 31
+6 31
+7 31
+8 31
+9 31
+11 31
+12 31
+13 31
+14 31
+21 31
+22 31
+1 32
+4 32
+5 32
+6 32
+7 32
+8 32
+9 32
+13 32
+21 32
+22 32
+1 33
+2 33
+4 33
+5 33
+6 33
+7 33
+8 33
+9 33
+10 33
+11 33
+14 33
+22 33
+23 33
+1 34
+2 34
+3 34
+4 34
+5 34
+6 34
+7 34
+8 34
+9 34
+10 34
+13 34
+14 34
+15 34
+16 34
+21 34
+22 34
+2 35
+3 35
+4 35
+5 35
+6 35
+7 35
+16 35
+22 35
+23 35
+2 36
+3 36
+16 36
+21 36
+22 36
+3 37
+4 37
+5 37
+16 37
+21 37
+22 37
+4 38
+5 38
+15 38
+16 38
+17 38
+18 38
+21 38
+22 38
+5 39
+6 39
+7 39
+18 39
+21 39
+22 39
+6 40
+7 40
+8 40
+17 40
+20 40
+21 40
+8 41
+9 41
+10 41
+11 41
+12 41
+18 41
+19 41
+20 41
+21 41
+9 42
+10 42
+11 42
+12 42
+13 42
+14 42
+15 42
+16 42
+17 42
+18 42
+19 42
+12 43
+13 43
+14 43
+15 43
+16 43
+17 43
Index: trunk/MagicSoft/Mars/mtools/jam/man.jam
===================================================================
--- trunk/MagicSoft/Mars/mtools/jam/man.jam	(revision 7342)
+++ trunk/MagicSoft/Mars/mtools/jam/man.jam	(revision 7342)
@@ -0,0 +1,201 @@
+23 3
+24 3
+25 3
+26 3
+27 3
+28 3
+29 3
+30 3
+31 3
+32 3
+33 3
+23 4
+32 4
+33 4
+23 5
+33 5
+34 5
+23 6
+25 6
+26 6
+27 6
+28 6
+29 6
+30 6
+31 6
+32 6
+33 6
+23 7
+26 7
+34 7
+35 7
+23 8
+25 8
+34 8
+35 8
+23 9
+26 9
+28 9
+29 9
+30 9
+31 9
+32 9
+33 9
+34 9
+35 9
+23 10
+25 10
+28 10
+23 11
+26 11
+28 11
+23 12
+25 12
+28 12
+23 13
+26 13
+28 13
+23 14
+25 14
+28 14
+23 15
+24 15
+25 15
+26 15
+27 15
+28 15
+29 15
+22 16
+29 16
+23 17
+30 17
+22 18
+30 18
+23 19
+30 19
+22 20
+30 20
+23 21
+30 21
+22 22
+30 22
+23 23
+30 23
+22 24
+29 24
+23 25
+26 25
+27 25
+28 25
+29 25
+30 25
+31 25
+32 25
+33 25
+22 26
+25 26
+33 26
+34 26
+23 27
+26 27
+27 27
+28 27
+29 27
+30 27
+31 27
+32 27
+35 27
+22 28
+27 28
+32 28
+33 28
+34 28
+23 29
+24 29
+25 29
+26 29
+27 29
+33 29
+34 29
+22 30
+27 30
+32 30
+33 30
+34 30
+23 31
+25 31
+26 31
+27 31
+34 31
+22 32
+24 32
+28 32
+29 32
+30 32
+31 32
+32 32
+34 32
+23 33
+25 33
+26 33
+27 33
+28 33
+33 33
+35 33
+22 34
+27 34
+33 34
+23 35
+28 35
+33 35
+22 36
+26 36
+27 36
+28 36
+29 36
+30 36
+31 36
+32 36
+23 37
+26 37
+28 37
+22 38
+26 38
+27 38
+23 39
+27 39
+22 40
+23 40
+24 40
+25 40
+26 40
+27 40
+23 41
+27 41
+22 42
+23 42
+24 42
+25 42
+26 42
+27 42
+23 43
+27 43
+22 44
+27 44
+22 45
+28 45
+21 46
+28 46
+22 47
+28 47
+21 48
+28 48
+22 49
+28 49
+22 50
+23 50
+26 50
+27 50
+24 51
+25 51
+26 51
Index: trunk/MagicSoft/Mars/mtools/jam/post.jam
===================================================================
--- trunk/MagicSoft/Mars/mtools/jam/post.jam	(revision 7342)
+++ trunk/MagicSoft/Mars/mtools/jam/post.jam	(revision 7342)
@@ -0,0 +1,192 @@
+7 2
+8 2
+10 2
+11 2
+17 2
+18 2
+20 2
+21 2
+8 3
+9 3
+11 3
+12 3
+17 3
+18 3
+20 3
+21 3
+8 4
+9 4
+11 4
+12 4
+16 4
+17 4
+19 4
+20 4
+10 5
+13 5
+16 5
+19 5
+9 6
+10 6
+11 6
+12 6
+13 6
+14 6
+15 6
+16 6
+17 6
+18 6
+19 6
+9 7
+10 7
+11 7
+12 7
+13 7
+14 7
+15 7
+16 7
+17 7
+18 7
+19 7
+20 7
+7 8
+8 8
+9 8
+10 8
+11 8
+17 8
+18 8
+19 8
+20 8
+21 8
+7 9
+8 9
+9 9
+10 9
+19 9
+20 9
+21 9
+22 9
+6 10
+7 10
+8 10
+9 10
+19 10
+20 10
+21 10
+22 10
+6 11
+7 11
+8 11
+9 11
+20 11
+21 11
+22 11
+23 11
+24 11
+5 12
+6 12
+7 12
+8 12
+20 12
+21 12
+22 12
+23 12
+24 12
+5 13
+6 13
+8 13
+20 13
+21 13
+22 13
+23 13
+24 13
+25 13
+4 14
+5 14
+7 14
+8 14
+20 14
+21 14
+22 14
+23 14
+24 14
+25 14
+4 15
+5 15
+8 15
+9 15
+20 15
+21 15
+23 15
+24 15
+25 15
+26 15
+3 16
+4 16
+5 16
+7 16
+8 16
+20 16
+21 16
+23 16
+24 16
+25 16
+4 17
+5 17
+8 17
+9 17
+20 17
+21 17
+23 17
+24 17
+25 17
+26 17
+3 18
+4 18
+5 18
+8 18
+9 18
+19 18
+20 18
+23 18
+24 18
+25 18
+26 18
+4 19
+5 19
+9 19
+10 19
+11 19
+18 19
+19 19
+20 19
+23 19
+24 19
+25 19
+26 19
+27 19
+9 20
+10 20
+11 20
+12 20
+16 20
+17 20
+18 20
+19 20
+23 20
+24 20
+25 20
+11 21
+12 21
+13 21
+14 21
+15 21
+16 21
+17 21
+18 21
+12 22
+13 22
+14 22
+15 22
+16 22
Index: trunk/MagicSoft/Mars/mtools/jam/running.jam
===================================================================
--- trunk/MagicSoft/Mars/mtools/jam/running.jam	(revision 7342)
+++ trunk/MagicSoft/Mars/mtools/jam/running.jam	(revision 7342)
@@ -0,0 +1,129 @@
+16 1
+17 1
+13 2
+14 2
+15 2
+16 2
+17 2
+14 3
+15 3
+0 4
+14 4
+15 4
+0 5
+1 5
+4 5
+5 5
+6 5
+7 5
+15 5
+0 6
+1 6
+2 6
+3 6
+4 6
+5 6
+6 6
+7 6
+14 6
+15 6
+1 7
+2 7
+3 7
+7 7
+8 7
+15 7
+1 8
+7 8
+8 8
+9 8
+10 8
+11 8
+12 8
+13 8
+14 8
+15 8
+8 9
+9 9
+10 9
+11 9
+12 9
+13 9
+14 9
+15 9
+8 10
+9 10
+9 11
+10 11
+8 12
+9 12
+1 13
+2 13
+9 13
+10 13
+11 13
+12 13
+13 13
+14 13
+15 13
+1 14
+2 14
+8 14
+9 14
+10 14
+11 14
+12 14
+13 14
+14 14
+15 14
+3 15
+4 15
+7 15
+8 15
+9 15
+10 15
+15 15
+16 15
+17 15
+18 15
+3 16
+4 16
+5 16
+6 16
+7 16
+9 16
+10 16
+16 16
+17 16
+5 17
+6 17
+9 17
+10 17
+11 17
+8 18
+9 18
+10 18
+11 18
+8 19
+12 19
+7 20
+12 20
+7 21
+8 21
+9 21
+10 21
+11 21
+12 21
+13 21
+14 21
+15 21
+16 21
+17 21
+7 22
+12 22
+8 23
+12 23
+8 24
+9 24
+10 24
+11 24
