001 /////////////////////////////////////////////////////////////////////////////// 002 // Copyright (c) 2006, Frank S. Nestel, All Rights Reserved. 003 // 004 // This library is free software; you can redistribute it and/or 005 // modify it under the terms of the GNU Lesser General Public 006 // License as published by the Free Software Foundation; either 007 // version 2.1 of the License, or (at your option) any later version. 008 // 009 // This library is distributed in the hope that it will be useful, 010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 012 // GNU General Public License for more details. 013 // 014 // You should have received a copy of the GNU Lesser General Public 015 // License along with this program; if not, write to the Free Software 016 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 017 /////////////////////////////////////////////////////////////////////////////// 018 019 package de.spieleck.app.turn.splitting; 020 021 /** 022 * SplittingMode for Mü. 023 * <br /> 024 * Mü can be played with 4,5 or 6 players. 5 is optimal. 025 * 6 is probably better than for, since it can be played in 026 * a 5 + sitout fashion instead of really 6. But if there are 027 * to many 6-player tables, the splitter switches to replace 028 * 4 6 player tables to 1 4 player and 4 5 player tables. 029 * 030 * <p><a href="$URL: https://svn.sourceforge.net/svnroot/jtourney/src/de/spieleck/app/turn/splitting/Mue.java $">$URL: https://svn.sourceforge.net/svnroot/jtourney/src/de/spieleck/app/turn/splitting/Mue.java $</a></p> 031 * 032 * @author Frank S. Nestel 033 * @author $Author: nestefan $ 034 * @version $Revision: 2 $ $Date: 2006-03-20 14:33:27 +0100 (Mo, 20 Mrz 2006) $ $Author: nestefan $ 035 */ 036 public class Mue 037 extends BaseSplitter 038 { 039 public int optimal() 040 { 041 return 5; 042 } 043 044 public int[] split(int total) 045 { 046 if ( total < 4 ) 047 { 048 return null; 049 } 050 else if ( total == 7 ) 051 { 052 return new int[] { 0,2,0,0, 0,1 }; 053 } 054 else if ( total == 8 ) 055 { 056 return new int[] { 0,0,0,0, 2 }; 057 } 058 else if ( total == 13 ) 059 { 060 return new int[] { 0,0,0,0, 2,1 }; 061 } 062 else 063 { 064 int x6 = total % 5; 065 int x4 = 0; 066 if ( x6 == 4 ) 067 { 068 x4 = 1; 069 x6 = 0; 070 } 071 int x5 = (total - 6 * x6 - 4 * x4) / 5; 072 return new int[] { 0,0,0,0, x4,x5,x6 }; 073 } 074 } 075 076 }