Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
MC
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
//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; } } }
Show compiler warnings
[
+
]
Show input
Compilation time: 0,59 sec, absolute running time: 0,11 sec, cpu time: 0,11 sec, average memory usage: 13 Mb, average nr of threads: 2, absolute service time: 0,73 sec
fork mode
|
history
|
discussion