Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
MC
//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) { MoneyComingPlateManager manager = new MoneyComingPlateManager(); List<List<int>> plate = manager.ConvertStringToPlate("231C"); List<int> symbolPosition = manager.CheckLine(1); foreach (int index in symbolPosition) { Console.WriteLine(index); } } } public class MoneyComingPlateManager { private int columnCount = 4; private int rowCount = 1; private PlateSetting plateSetting; private string colorIdMain = "#12345678"; private string colorIdSpecial = "#7c6d9f1"; private string colorIdRespin = "#ebf1de"; private string colorIdMultipliers = "#e1d43f"; private List<int>[] lineInfo = new List<int>[1]; // Constructor 設定盤面資料 public MoneyComingPlateManager() { plateSetting.seperateCount = new List<int>(); plateSetting.direction = PlateDirection.Vertical; for (int i = 0 ; i < columnCount ; ++i) { plateSetting.seperateCount.Add(rowCount); // [ 1 ,1 ,1 ,1 ] } lineInfo[0] = new List<int>{ 0, 1, 2 }; } // 轉換盤面字串成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; } foreach (List<int> count in plate ) { foreach (int u in count ){ Console.WriteLine(u); } } return plate; } public List<int> CheckLine(int lineIndex) { List<int> temp = new List<int>(); for (int i = 0 ; i < 3; ++i) { temp.Add(lineInfo[lineIndex-1][i]); } return temp; } // 取得盤面設定 public PlateSetting GetPlateSetting() { return plateSetting; } // 取得色碼 --------------------------------------> 對應盤面定義 public string GetColorString(int colorId) { if (colorId == 1 ) { return colorIdMain; } else if (colorId == 2) { return colorIdSpecial; } else if (colorId == 3) { return colorIdRespin; } else if (colorId == 4) { return colorIdMultipliers; } return colorIdMain; } } }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
C# Overriding example using virtual and override keywords
Reed Solomon Demo
12
expression evaluator wich is easy to extend
test
Arreglo
Wait
BiologyQuestions
towers of hanoi
SevenSevenSeven
Please log in to post a comment.