From bb9f7c38540154b94bb00f30221a01c07bb77603 Mon Sep 17 00:00:00 2001 From: Sverre Rabbelier Date: Sat, 26 Jan 2008 19:49:00 +0100 Subject: [PATCH] Added swap functionality --- 4DMemory/Playground.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/4DMemory/Playground.cs b/4DMemory/Playground.cs index 8cde8f1..64515c1 100644 --- a/4DMemory/Playground.cs +++ b/4DMemory/Playground.cs @@ -63,6 +63,17 @@ namespace Memory } } } + + // Summary: + // Swaps two planes + public void SwapPlanes() + { + int maxvalue = m_cardsGrid.m_dimension - 1; + int firstpos = (int)Math.Round(maxvalue * m_random.NextDouble()); + int secondpos = (int)Math.Round(maxvalue * m_random.NextDouble()); + + m_cardsGrid.swap(firstpos, secondpos); + } // Summary: // Finds the next player and returns it -- 2.11.4.GIT