Jump to content

rainbowhyphen

Premium Member
  • Posts

    4
  • Joined

  • Last visited

Everything posted by rainbowhyphen

  1. Hmm, never played Might and Magic, although my curiosity is now piqued. I was inspired by the Texas Hold'em minigame in Red Dead Redemption. Thought it was a nice little detail. As for him being in every inn, he is a traveler. Perhaps he could be on some rotating schedule, traveling from one inn to the next. Maybe I'll even give him a rug that he can roll out and set up a game anywhere with, should you run into him on the road. Then other random people wandering on the road could join in.
  2. Not a request exactly, but something I'm planning on building. Here's what I'm planning: Arzat is a Khajit historian of sorts who has traveled far and wide, documenting the card games of Tamriel. His travels have brought him to Skyrim, where he has learned the betting game called Holdem. You can find him in the Bee and Barb in Riften, dealing cards and taking bets at a table set for five. You can play by taking any seat and placing a bet. The game is identical to no-limit Texas Hold'em, but the cards are Skyrim-themed. Instead of spades, clubs, diamonds, and hearts, you have swords, shields, towers and dragons. Instead of jacks, queens, and kings, you have housecarls, thanes, and jarls. Arzat will be fully voice acted and will supply a book explaining the rules of the game, announce winning hands, etc. The game will be controlled through menus and feature custom animations and card models. What do you think? Is this something you'd be interested in?
  3. Hey, I know this is a bit old now, but it looks like there still isn't a poker mini game for Skyrim and I'm planning on building one. Texas Hold'em, though. Not dice poker. Kind of looking to gauge interest.
  4. The function is trivial: int function maxIndex(float[] numbers) ; Indicate an error for an empty array. if numbers.length < 1 return -1 endif ; Set up variables to track current maximum. int maxIndex = 0 float maxValue = numbers[0] ; Loop through all array elements. int i = 1 while i < numbers.length ; Update maximum whenever we find a larger value if numbers[i] > maxValue maxIndex = i maxValue = numbers[i] endif i += 1 endwhile ; maxIndex now contains the index of the max value in the input array. return maxIndex endfunction If you're not familiar with this algorithm, the idea is simple: Given an unsorted list of values, assume the first one is the largest value. This is called the candidate maximum. Starting with the second value, compare it with the current candidate. If the candidate is smaller, replace it with the new, larger value. When you get to the end of the list, the candidate is the maximum value.This particular function returns the position in the array rather than the value itself, since "the 4th skill in the list" is what we want to know, not "that skill that's at 58, you know the one." You'd want each position in the array to correspond to a particular skill. That way if you get 8 back, you can check that list and know 8 is One Handed or Destruction or Lockpicking or whatever. But if you want to get the top three, then rather than running max() three times and checking most of the skills multiple times, what you really want is a sort. And yes, you'll want to decide what you want to do for skills that have the same value. Edit: I went ahead and wrote a Papyrus implementation of quicksort, mostly out of boredom. Maybe it'll help? I haven't tested it yet, though, so it might not even compile. function fSwap(float[] a, int i, int k) float temp = a[i] a[i] = a[k] a[k] = temp endfunction function iSwap(int[] a, int i, int k) int temp = a[i] a[i] = a[k] a[k] = temp endfunction function quicksort(float[] numbers, int[] indexes, int start, int end) p = partition(numbers, indexes, start, end) quicksort(numbers, indexes, start, p - 1) quicksort(numbers, indexes, p + 1, end) endfunction int function partition(float[] numbers, int[] indexes, int start, int end) pivotIndex = start pivotValue = numbers[start] fSwap(numbers, pivotIndex, end) iSwap(indexes, pivotIndex, end) int storeIndex = start int i = start while i < end if numbers[i] < pivotValue fSwap(numbers, i, storeIndex) iSwap(indexes, i, storeIndex) storeIndex += 1 endif i += 1 endwhile fSwap(numbers, storeIndex, end) iSwap(indexes, storeIndex, end) return storeIndex endfunction int[] function indexSort(float[] numbers) int[] indexes = new int[numbers.length] float[] numCopy = new float[numbers.length] int i = 0 while i < indexes.length indexes[i] = i numCopy[i] = numbers[i] i += 1 endwhile quicksort(numCopy, indexes, 0, numbers.length) return indexes endfunction Note: the fSwap, iSwap, partition, quicksort, and indexSort functions are all required. The indexSort function is the one you want to actually call, and returns an array of integers containing the original order of the array, so if you put in [81, 4, 73] you'll get out [1, 2, 0]. That way if you had some other array in the same order like ["Lockpicking", "One Handed", "Speechcraft"], you could look up the skill.
×
×
  • Create New...