Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
RomaSlot2
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public static class PlateDirection { public const int Vertical = 1; // 直 public const int Horizontal = 2; // 橫 } public struct PlateSetting { // 盤面編號方向 public int direction; // 幾個symbol一組 public List<int> seperateCount; } public class Program { public static void Main(string[] args) { RomaSlot2PlateManager manager = new RomaSlot2PlateManager(); List<List<int>> plate = manager.ConvertStringToPlate("028218208407013"); List<int> symbolPosition = manager.CheckLine(0, 3); List<int> bonusStr = manager.CheckBonusPlateStr("B,0,1"); foreach (int index in symbolPosition) { Console.WriteLine(index); } Console.WriteLine(""); foreach (int index in bonusStr) { Console.WriteLine(index); } } } public class RomaSlot2PlateManager { private int columnCount = 5; private int rowCount = 3; private PlateSetting plateSetting; private string colorIdMain = "##BFBFBF"; private string colorIdFree = "#FFC53B"; private string colorIdBonus = "#C46FFF"; private List<int>[] lineInfo = new List<int>[15]; // Constructor 設定盤面資料 public RomaSlot2PlateManager() { plateSetting.seperateCount = new List<int>(); plateSetting.direction = PlateDirection.Vertical; for (int i = 0 ; i < columnCount ; ++i) { plateSetting.seperateCount.Add(rowCount); } lineInfo[0] = new List<int>{ 1, 4, 7, 10, 13}; lineInfo[1] = new List<int>{ 2, 5, 8, 11, 14}; lineInfo[2] = new List<int>{ 0, 3, 6, 9, 12}; lineInfo[3] = new List<int>{ 2, 4, 6, 10, 14}; lineInfo[4] = new List<int>{ 0, 4, 8, 10, 12}; lineInfo[5] = new List<int>{ 2, 5, 7, 11, 14}; lineInfo[6] = new List<int>{ 0, 3, 7, 9, 12}; lineInfo[7] = new List<int>{ 1, 3, 6, 9, 13}; lineInfo[8] = new List<int>{ 1, 5, 8, 11, 13}; lineInfo[9] = new List<int>{ 1, 5, 7, 11, 13}; lineInfo[10] = new List<int>{ 1, 3, 7, 9, 13}; lineInfo[11] = new List<int>{ 2, 4, 8, 10, 14}; lineInfo[12] = new List<int>{ 0, 4, 6, 10, 12}; lineInfo[13] = new List<int>{ 1, 4, 8, 10, 13}; lineInfo[14] = new List<int>{ 1, 4, 6, 10, 13}; } // 轉換盤面字串成List<List<int>> public List<List<int>> ConvertStringToPlate(string plateStr) { List<List<int>> plate = new List<List<int>>(); if (plateSetting.seperateCount.Count < 1) { return plate; } char[] plateArray = plateStr.ToCharArray(); int currentCount = 0; foreach (int count in plateSetting.seperateCount) { List<int> tempList = new List<int>(); for( int i = currentCount ; i < currentCount+count; ++i ) { int intValue = int.Parse(plateArray[i].ToString(), System.Globalization.NumberStyles.HexNumber); tempList.Add(intValue); } plate.Add(tempList); currentCount += count; } return plate; } //取得線獎位置 public List<int> CheckLine(int lineIndex, int symbolCount) { List<int> temp = new List<int>(); for (int i = 0 ; i < symbolCount; ++i) { temp.Add(lineInfo[lineIndex][i]); } return temp; } // 取得盤面設定 public PlateSetting GetPlateSetting() { return plateSetting; } // 取得色碼 public string GetColorString(int colorId) { return colorIdMain; } public List<int> CheckBonusPlateStr(string plateStr) { List<int> tempList = new List<int>(); string[] tempStrArray = plateStr.Split(','); foreach (string str in tempStrArray) { char[] columnArray = str.ToCharArray(); for( int i = 0 ; i < columnArray.Length; ++i ) { int intValue = (int)columnArray[i]; if (intValue < 58) { intValue = (int)columnArray[i]-48; } else { intValue = (int)columnArray[i]-55; } tempList.Add(intValue); } } return tempList; } } }
run
|
edit
|
history
|
help
0
D13
tesyyyyy
Simple Enum Parsing
Linear search vs. Binary search
Roman Numbers, Sorting through IComparer
Roman to Arabic number conversion without semantic control
Task1
DNA FINAL
First code
Robot