# Eternity Async Tutoring

**URL:** https://discuss.criticalfallibilism.com/t/eternity-async-tutoring/1932
**Category:** Tutoring
**Created:** [April 17, 2024, 11:22pm UTC](https://discuss.criticalfallibilism.com/t/eternity-async-tutoring/1932 "2024-04-17T23:22:52Z")
**Posts on this page:** 1
**Showing post:** 929

<div class="post-metadata">

### Author: ![Eternity](https://discuss.criticalfallibilism.com/user_avatar/discuss.criticalfallibilism.com/eternity/32/5930_2.png) [@Eternity](https://discuss.criticalfallibilism.com/u/Eternity)
#### Post date: [June 3, 2025, 12:14am UTC](https://discuss.criticalfallibilism.com/t/eternity-async-tutoring/1932/929 "2025-06-03T00:14:49Z")

</div>

> [@Elliot](#):
>
> So let’s break the problem down into smaller parts.
> 
> Suppose you want to know whether the first card in the hand pairs with any other card in the hand? How could you figure that out using a loop or some other method where the number of lines of code doesn’t go up as the hand gets larger?

Ok went back and looked at advice given before. So far I’ve come up with this:

```auto
a = ["W","Q","R","R","W"]

a = a.shuffle

p = Array.new()

0.upto(3) do |x|

if a[0] == a[x+1]
  
  p << a.slice!(x+1)
  p << a.slice!(0)

end

end

```

Ok so far I got this and it seems to work for the first value in the array. I used slice because I think I should remove them from the array but still keep the values? but yeah this seems to work with comparing other values. Hmm. Also I think by slicing the values out as it goes along it avoids the issue I’ve had before where values would get re-used.

---

_[View the full topic](https://discuss.criticalfallibilism.com/t/eternity-async-tutoring/1932)._
